about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/elfs/elfloader.c8
-rwxr-xr-xsrc/elfs/elfloader_private.h1
-rwxr-xr-xsrc/elfs/elfparser.c4
3 files changed, 13 insertions, 0 deletions
diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c
index 05ff19e1..5582ebef 100755
--- a/src/elfs/elfloader.c
+++ b/src/elfs/elfloader.c
@@ -844,6 +844,10 @@ int RelocateElfRELA(lib_t *maplib, lib_t *local_maplib, int bindnow, elfheader_t
 void checkHookedSymbols(lib_t *maplib, elfheader_t* h); // in mallochook.c
 int RelocateElf(lib_t *maplib, lib_t *local_maplib, int bindnow, elfheader_t* head)
 {
+    if((head->flags&DF_BIND_NOW) && !bindnow) {
+        bindnow = 1;
+        printf_log(LOG_DEBUG, "Forcing %s to Bind Now\n", head->name);
+    }
     if(head->rel) {
         int cnt = head->relsz / head->relent;
         DumpRelTable(head, cnt, (Elf64_Rel *)(head->rel + head->delta), "Rel");
@@ -865,6 +869,10 @@ int RelocateElf(lib_t *maplib, lib_t *local_maplib, int bindnow, elfheader_t* he
 int RelocateElfPlt(lib_t *maplib, lib_t *local_maplib, int bindnow, elfheader_t* head)
 {
     int need_resolver = 0;
+    if((head->flags&DF_BIND_NOW) && !bindnow) {
+        bindnow = 1;
+        printf_log(LOG_DEBUG, "Forcing %s to Bind Now\n", head->name);
+    }
     if(head->pltrel) {
         int cnt = head->pltsz / head->pltent;
         if(head->pltrel==DT_REL) {
diff --git a/src/elfs/elfloader_private.h b/src/elfs/elfloader_private.h
index c4637535..c3d387ef 100755
--- a/src/elfs/elfloader_private.h
+++ b/src/elfs/elfloader_private.h
@@ -34,6 +34,7 @@ struct elfheader_s {
     Elf64_Verdef*   VerDef;
     int         szVerDef;
     int         e_type;
+    uint32_t    flags;
 
     intptr_t    delta;  // should be 0
 
diff --git a/src/elfs/elfparser.c b/src/elfs/elfparser.c
index 1fd3ca01..7b83e07e 100755
--- a/src/elfs/elfparser.c
+++ b/src/elfs/elfparser.c
@@ -278,6 +278,10 @@ elfheader_t* ParseElfHeader(FILE* f, const char* name, int exec)
                     h->VerDef = (Elf64_Verdef*)ptr;
                     printf_dump(LOG_DEBUG, "The DT_VERDEF is at address %p\n", h->VerDef);
                     break;
+                case DT_FLAGS:
+                    h->flags = val;
+                    printf_dump(LOG_DEBUG, "The DT_FLAGS is 0x%x\n", h->flags);
+                    break;
                 }
             }
             if(h->rel) {