This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RFC: Support DF_1_GLOBAL
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 16 Nov 2012 09:34:46 -0800
- Subject: RFC: Support DF_1_GLOBAL
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;