From 92ad15a8f1d3e65f20fda3265c04ff26a642a2d0 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 15 Mar 2010 11:44:58 -0700 Subject: Implement handling of libc ABI in ELF header. --- csu/version.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'csu') diff --git a/csu/version.c b/csu/version.c index db913be800..8e32f312a9 100644 --- a/csu/version.c +++ b/csu/version.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1992-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,6 +18,7 @@ #include "version.h" #include +#include #include static const char __libc_release[] = RELEASE; @@ -25,12 +26,15 @@ static const char __libc_version[] = VERSION; static const char banner[] = "GNU C Library "RELEASE" release version "VERSION", by Roland McGrath et al.\n\ -Copyright (C) 2009 Free Software Foundation, Inc.\n\ +Copyright (C) 2010 Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions.\n\ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\ PARTICULAR PURPOSE.\n\ Compiled by GNU CC version "__VERSION__".\n" #include "version-info.h" +#ifdef LIBC_ABIS_STRING +LIBC_ABIS_STRING +#endif #ifdef GLIBC_OLDEST_ABI "The oldest ABI supported: " GLIBC_OLDEST_ABI ".\n" #endif -- cgit v1.2.3 From b1c1949e60e7c61bcd9f40f712d07494596491b2 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 26 Mar 2010 09:16:21 -0700 Subject: 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 --- 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(-) (limited to 'csu') diff --git a/ChangeLog b/ChangeLog index 8117882671..72cbef6681 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-03-26 Richard Henderson + + * 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 * sysdeps/posix/getaddrinfo.c (gaih_inet): Don't assume success always diff --git a/csu/gmon-start.c b/csu/gmon-start.c index d11c9b9532..7d585e135f 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 5507e57b96..160503dac5 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 08ae9aa86d..34e8808928 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 } -- cgit v1.2.3 From 9e37946dba22b53c5108eef777e867f93c894502 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 4 Apr 2010 01:02:09 -0700 Subject: Fix retrieving of kernel header version. --- ChangeLog | 6 ++++++ csu/Makefile | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'csu') diff --git a/ChangeLog b/ChangeLog index 99aa68027c..7db74b326c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-04-04 Ulrich Drepper + + [BZ #11287] + * csu/Makefile ($(objpfx)version-info.h): Handle newer kernel headers + which don't define UTS_RELEASE. + 2010-04-04 H.J. Lu Ulrich Drepper diff --git a/csu/Makefile b/csu/Makefile index 0e2ae07cf7..69e07c71cf 100644 --- a/csu/Makefile +++ b/csu/Makefile @@ -1,5 +1,5 @@ # Makefile for csu code for GNU C library. -# Copyright (C) 1995-2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 1995-2004, 2005, 2006, 2010 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -209,8 +209,19 @@ $(objpfx)version-info.h: $(common-objpfx)config.make $(all-Banner-files) linux*) version=`(printf '%s\n%s\n' \ '#include ' \ UTS_RELEASE \ - | $(CC) $(CPPFLAGS) -E -P - -DNOT_IN_libc=1 | \ + | $(CC) $(CPPFLAGS) -O -E -P - -DNOT_IN_libc=1 | \ sed -e 's/"\([^"]*\)".*/\1/p' -e d) 2>/dev/null`;\ + if [ -z "$$version" ]; then \ + version=`(printf '%s\n%s\n' \ + '#include ' \ + LINUX_VERSION_CODE \ + | $(CC) $(CPPFLAGS) -O -E -P - -DNOT_IN_libc=1 \ + | sed -n -e '/^[123456789].*/p' \ + | awk '{v=$$1; \ + printf("%d.%d.%d\n", \ + v/65535, v/256%256, v%256)}') \ + 2>/dev/null`; \ + fi; \ if [ -z "$$version" ]; then \ if [ -r /proc/version ]; then \ version=`sed 's/.*Linux version \([^ ]*\) .*/>>\1<