Provide source level debug ability in *unix environment.

[Background]
The UnixPkg provide an simulator in *unix. To support source level debug, we need force all modules be built as ELF shard objects and dynamically load all of modules using dlopen(). For peicore, peim and dxecore, we provide a wrapper to provide PeCoffLoader interface 

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5382 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
eric_tian 2008-06-30 06:25:43 +00:00
parent ed0b86b183
commit 865c7e1722
3 changed files with 18 additions and 2 deletions

View File

@ -504,7 +504,8 @@ RELEASE_WINDDK3790x1830_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
*_ELFGCC_*_MAKE_FLAGS = -i
*_ELFGCC_IA32_CC_FLAGS = -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
*_ELFGCC_*_DLINK_FLAGS = -melf_i386 -nostdlib -n -q -Ttext 0x220 --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)
*_ELFGCC_*_DLINK_FLAGS = -melf_i386 -nostdlib --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)
#*_ELFGCC_*_DLINK_FLAGS = -melf_i386 -nostdlib -n -q -Ttext 0x220 --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)
*_ELFGCC_*_ASM_FLAGS = -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
*_ELFGCC_*_PP_FLAGS = -m32 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
*_ELFGCC_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include AutoGen.h

View File

@ -983,6 +983,21 @@ SecNt32PeCoffRelocateImage (
(unsigned long)ImageContext->ImageAddress,
(unsigned long)ImageContext->EntryPoint);
Handle = dlopen(ImageContext->PdbPointer, RTLD_NOW);
if (Handle) {
Entry = dlsym(Handle, "_ModuleEntryPoint");
} else {
printf("%s\n", dlerror());
}
if (Entry != NULL) {
ImageContext->EntryPoint = Entry;
printf("Change %s Entrypoint to :0x%08lx\n", ImageContext->PdbPointer, Entry);
} else {
printf("Could not find _ModuleEntryPoint Entry, Module may be built error\n");
}
SecUnixLoaderBreak ();
return Status;

View File

@ -492,5 +492,5 @@
}
[BuildOptions]
#DEBUG_*_IA32_DLINK_FLAGS = --shared
DEBUG_*_IA32_DLINK_FLAGS = --shared
*_*_IA32_CC_FLAGS = -idirafter/usr/include