about summary refs log tree commit diff
path: root/elf/dl-open.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2018-06-06 16:02:02 +0200
committerFlorian Weimer <fweimer@redhat.com>2019-04-15 17:39:45 +0200
commit59c45eeb109a3e4567f2bebe3feb5330d99a392a (patch)
tree098d597006bdc88499f913eba751b586b1ba26a4 /elf/dl-open.c
parented8938f4f66e87cd805e0b1b94bab868e8ae0ea3 (diff)
downloadglibc-fw/bug21242.tar.gz
glibc-fw/bug21242.tar.xz
glibc-fw/bug21242.zip
ld.so: Introduce delayed relocation processing fw/bug21242
This makes it possible to use IFUNC resolvers which depend
on relocations themselves, as long as these reloctions do
not depend on IFUNCs.

So far, delayed relocation processing is only implemented for
x86-64.
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r--elf/dl-open.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 90c1180a8c..4e390d9abd 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -37,6 +37,7 @@
 #include <dl-dst.h>
 #include <dl-prop.h>
 
+#include <dl-delayed-reloc.h>
 
 /* We must be careful not to leave us in an inconsistent state.  Thus we
    catch any error and re-raise it after cleaning up.  */
@@ -327,6 +328,9 @@ dl_open_worker (void *a)
   while (l != NULL);
   _dl_sort_maps (maps, nmaps, NULL, false);
 
+  struct dl_delayed_reloc_global delayed_relocations;
+  _dl_delayed_reloc_init (&delayed_relocations);
+
   int relocation_in_progress = 0;
 
   for (unsigned int i = nmaps; i-- > 0; )
@@ -494,6 +498,7 @@ TLS generation counter wrapped!  Please report this."));
 	}
     }
 
+  _dl_delayed_reloc_apply ();
   _dl_relocate_apply_relro (new);
 
   /* Notify the debugger all new objects have been relocated.  */
@@ -611,6 +616,7 @@ no more namespaces available for dlmopen()"));
 	  if ((mode & __RTLD_AUDIT) == 0)
 	    GL(dl_tls_dtv_gaps) = true;
 
+	  _dl_delayed_reloc_clear ();
 	  _dl_close_worker (args.map, true);
 	}