summaryrefslogtreecommitdiff
path: root/UnixPkg
diff options
context:
space:
mode:
Diffstat (limited to 'UnixPkg')
-rw-r--r--UnixPkg/Sec/SecMain.c15
-rw-r--r--UnixPkg/UnixPkg.dsc2
2 files changed, 16 insertions, 1 deletions
diff --git a/UnixPkg/Sec/SecMain.c b/UnixPkg/Sec/SecMain.c
index a6da20b135..bfa44e7a17 100644
--- a/UnixPkg/Sec/SecMain.c
+++ b/UnixPkg/Sec/SecMain.c
@@ -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;
diff --git a/UnixPkg/UnixPkg.dsc b/UnixPkg/UnixPkg.dsc
index 2ff9efca2b..7db8d82fc1 100644
--- a/UnixPkg/UnixPkg.dsc
+++ b/UnixPkg/UnixPkg.dsc
@@ -492,5 +492,5 @@
}
[BuildOptions]
- #DEBUG_*_IA32_DLINK_FLAGS = --shared
+ DEBUG_*_IA32_DLINK_FLAGS = --shared
*_*_IA32_CC_FLAGS = -idirafter/usr/include