This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/4] Don't take the address of a void object.


GCC 4.5 warns about "extern void _end; &end;".
Use char[] instead, as that also doesn't fall foul
of a target's .sdata optimizations.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 ChangeLog                           |    7 +++++++
 csu/gmon-start.c                    |    4 ++--
 elf/dl-sysdep.c                     |    6 +++---
 sysdeps/unix/sysv/linux/dl-sysdep.c |    8 ++++----
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8117882..72cbef6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-26  Richard Henderson  <rth@redhat.com>
+
+	* csu/gmon-start.c (ENTRY_POINT, etext): Declare as char[], not void.
+	* elf/dl-sysdep.c (_end): Likewise.
+	* sysdeps/unix/sysv/dl-sysdep.c (frob_brk): Likewise with locally
+	declared _end, and associated variables.
+
 2010-03-26  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/posix/getaddrinfo.c (gaih_inet): Don't assume success always
diff --git a/csu/gmon-start.c b/csu/gmon-start.c
index d11c9b9..7d585e1 100644
--- a/csu/gmon-start.c
+++ b/csu/gmon-start.c
@@ -31,9 +31,9 @@
 #ifdef ENTRY_POINT_DECL
 ENTRY_POINT_DECL(extern)
 #else
-extern void ENTRY_POINT;
+extern char ENTRY_POINT[];
 #endif
-extern void etext;
+extern char etext[];
 
 #ifndef TEXT_START
 # ifdef ENTRY_POINT_DECL
diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index 5507e57..160503d 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -47,7 +47,7 @@
 #endif
 
 extern char **_environ attribute_hidden;
-extern void _end attribute_hidden;
+extern char _end[] attribute_hidden;
 
 /* Protect SUID program against misuse of file descriptors.  */
 extern void __libc_check_standard_fds (void);
@@ -226,14 +226,14 @@ _dl_sysdep_start (void **start_argptr,
   if (GLRO(dl_platform) != NULL)
     GLRO(dl_platformlen) = strlen (GLRO(dl_platform));
 
-  if (__sbrk (0) == &_end)
+  if (__sbrk (0) == _end)
     /* The dynamic linker was run as a program, and so the initial break
        starts just after our bss, at &_end.  The malloc in dl-minimal.c
        will consume the rest of this page, so tell the kernel to move the
        break up that far.  When the user program examines its break, it
        will see this new value and not clobber our data.  */
     __sbrk (GLRO(dl_pagesize)
-	    - ((&_end - (void *) 0) & (GLRO(dl_pagesize) - 1)));
+	    - ((_end - (char *) 0) & (GLRO(dl_pagesize) - 1)));
 
   /* If this is a SUID program we make sure that FDs 0, 1, and 2 are
      allocated.  If necessary we are doing it ourself.  If it is not
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
index 08ae9aa..34e8808 100644
--- a/sysdeps/unix/sysv/linux/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
@@ -47,12 +47,12 @@ frob_brk (void)
      Later Linux kernels have changed this behavior so that the initial
      break value is rounded up to the page boundary before we start.  */
 
-  extern void *__curbrk attribute_hidden;
-  extern void _end attribute_hidden;
-  void *const endpage = (void *) 0 + (((__curbrk - (void *) 0)
+  extern char *__curbrk attribute_hidden;
+  extern char _end[] attribute_hidden;
+  char *const endpage = (void *) 0 + (((__curbrk - (char *) 0)
 				       + GLRO(dl_pagesize) - 1)
 				      & -GLRO(dl_pagesize));
-  if (__builtin_expect (__curbrk >= &_end && __curbrk < endpage, 0))
+  if (__builtin_expect (__curbrk >= _end && __curbrk < endpage, 0))
     __brk (endpage);
 #endif
 }
-- 
1.6.6.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]