summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2013-03-28 15:39:32 -0700
committerRoland McGrath <roland@hack.frob.com>2013-03-28 15:39:32 -0700
commitdc0a02638583d8e7f7e1cc72643d1b26ec6042fd (patch)
tree86ec6fdccabc839223424322719e2f9eebae13c3
parent3d3436ae68a907f656a07604eb7e10a50e1c8f85 (diff)
downloadglibc-dc0a02638583d8e7f7e1cc72643d1b26ec6042fd.tar.gz
Make _dl_phdr pointer to const.
-rw-r--r--ChangeLog6
-rw-r--r--csu/libc-tls.c2
-rw-r--r--elf/dl-support.c4
-rw-r--r--sysdeps/generic/ldsodefs.h2
-rw-r--r--sysdeps/mach/hurd/i386/init-first.c2
5 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 2689884951..de20ebb1c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2013-03-28 Roland McGrath <roland@hack.frob.com>
+ * elf/dl-support.c (_dl_phdr): Make pointer to const.
+ (_dl_aux_init): Use const in cast when setting it.
+ * sysdeps/mach/hurd/i386/init-first.c (init1): Remove superfluous cast.
+ * sysdeps/generic/ldsodefs.h [!SHARED] (_dl_phdr): Update decl.
+ * csu/libc-tls.c (__libc_setup_tls): Make PHDR pointer to const.
+
* sysdeps/generic/ldsodefs.h [!SHARED] (_dl_phdr, _dl_phnum):
Declare them here.
* elf/dl-iteratephdr.c [!SHARED] (_dl_phdr, _dl_phnum): Not here.
diff --git a/csu/libc-tls.c b/csu/libc-tls.c
index 2a195019cc..c37df67e6c 100644
--- a/csu/libc-tls.c
+++ b/csu/libc-tls.c
@@ -114,7 +114,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
size_t align = 0;
size_t max_align = tcbalign;
size_t tcb_offset;
- ElfW(Phdr) *phdr;
+ const ElfW(Phdr) *phdr;
/* Look through the TLS segment if there is any. */
if (_dl_phdr != NULL)
diff --git a/elf/dl-support.c b/elf/dl-support.c
index ad9b4c40b0..7a55b82e34 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -126,7 +126,7 @@ int _dl_debug_fd = STDERR_FILENO;
int _dl_correct_cache_id = _DL_CACHE_DEFAULT_ID;
ElfW(auxv_t) *_dl_auxv;
-ElfW(Phdr) *_dl_phdr;
+const ElfW(Phdr) *_dl_phdr;
size_t _dl_phnum;
uint64_t _dl_hwcap __attribute__ ((nocommon));
@@ -205,7 +205,7 @@ _dl_aux_init (ElfW(auxv_t) *av)
GLRO(dl_clktck) = av->a_un.a_val;
break;
case AT_PHDR:
- GL(dl_phdr) = (void *) av->a_un.a_val;
+ GL(dl_phdr) = (const void *) av->a_un.a_val;
break;
case AT_PHNUM:
GL(dl_phnum) = av->a_un.a_val;
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 89db552542..41684f3837 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -603,7 +603,7 @@ extern const struct rtld_global_ro _rtld_global_ro
#ifndef SHARED
/* dl-support.c defines these and initializes them early on. */
-extern ElfW(Phdr) *_dl_phdr;
+extern const ElfW(Phdr) *_dl_phdr;
extern size_t _dl_phnum;
#endif
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index 3cfddce15f..59253db539 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -122,7 +122,7 @@ init1 (int argc, char *arg0, ...)
the exec server. */
extern const void _start;
const ElfW(Ehdr) *const ehdr = &_start;
- _dl_phdr = (ElfW(Phdr) *) ((const void *) ehdr + ehdr->e_phoff);
+ _dl_phdr = (const void *) ehdr + ehdr->e_phoff;
_dl_phnum = ehdr->e_phnum;
assert (ehdr->e_phentsize == sizeof (ElfW(Phdr)));
#endif