RFC: Support DF_1_GLOBAL

H.J. Lu hjl.tools@gmail.com
Fri Nov 16 17:34:00 GMT 2012


Hi,

This simple change adds DF_1_GLOBAL support. Do we want to support
this feature?  If yes, I will submit a linker patch to implement
-z global and add a testcase for glibc.


H.J.
----
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 9c39a34..2e3e7ec 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -240,6 +240,11 @@ dl_open_worker (void *a)
     /* This happens only if we load a DSO for 'sprof'.  */
     return;
 
+  /* Make the symbols defined in the object available for symbol resolution
+     of subsequently loaded objects if it is marked with DF_1_GLOBAL.  */
+  if (__builtin_expect (new->l_flags_1 & DF_1_GLOBAL, 0))
+    mode |= RTLD_GLOBAL;
+
   /* This object is directly loaded.  */
   ++new->l_direct_opencount;
 



More information about the Libc-alpha mailing list