This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 1/5] Use protected visibility for _rtld_global and _rtld_global_ro
- From: Peter Collingbourne <pcc at google dot com>
- To: libc-alpha at sourceware dot org
- Cc: Peter Collingbourne <pcc at google dot com>
- Date: Mon, 13 May 2013 08:36:08 -0700
- Subject: [PATCH 1/5] Use protected visibility for _rtld_global and _rtld_global_ro
- References: <1368459372-2415-1-git-send-email-pcc at google dot com>
_rtld_local was created back in 2002 (see commit 0d01dac), and the
protected attribute removed on _rtld_global, for an undocumented
reason, but probably because there wasn't much compiler support for
visibility back then. Now that we're using a visibility attribute
directly on _rtld_local, it should be safe to add one for _rtld_global
and _rtld_global_ro.
2013-05-13 Peter Collingbourne <pcc@google.com>
* elf/rtld.c (_rtld_global): Add protected attribute.
(_rtld_global_ro): Likewise.
---
elf/rtld.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/elf/rtld.c b/elf/rtld.c
index 23238ad..c62ee1b 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -121,7 +121,7 @@ INTVARDEF(_dl_starting_up)
/* This is the structure which defines all variables global to ld.so
(except those which cannot be added for some reason). */
-struct rtld_global _rtld_global =
+struct rtld_global _rtld_global __attribute__ ((visibility ("protected"))) =
{
/* Generally the default presumption without further information is an
* executable stack but this is not true for all platforms. */
@@ -149,7 +149,8 @@ extern struct rtld_global _rtld_local
/* This variable is similar to _rtld_local, but all values are
read-only after relocation. */
-struct rtld_global_ro _rtld_global_ro attribute_relro =
+struct rtld_global_ro _rtld_global_ro attribute_relro
+ __attribute__ ((visibility ("protected"))) =
{
/* Get architecture specific initializer. */
#include <dl-procinfo.c>
--
1.8.2.1