patches/glibc/2.3.6/180-allow-gcc-4.0-elf.patch
author Zoltan Devai <zdevai@gmail.com>
Wed Oct 28 12:03:38 2009 +0100 (2009-10-28)
branch1.5
changeset 1645 01d01185eb18
parent 402 197e1b49586e
permissions -rw-r--r--
libc/uClibc: fix building on system with recent glibc

While trying to build a toolchain with ct-ng 1.5.0,
arm-unknown-linux-uclibcgnueabi target,
I get the following error:

[INFO ] Installing C library headers
[EXTRA] Copying sources to build dir
[EXTRA] Applying configuration
[EXTRA] Building headers
[EXTRA] Installing headers
[ERROR] extra/scripts/unifdef.c:209: error: conflicting types for 'getline'
[ERROR] make[2]: *** [extra/scripts/unifdef] Error 1
[ERROR] Build failed in step 'Installing C library headers'

The following patch solves the problem.
(It's a backport of this uClibc commit:
http://git.uclibc.org/uClibc/commit/?id=49e81cada73616864b9b31df0aeb6961c30f5a6e
)

[--SNIP from another mail--]
AFAIK this is a problem since glibc 2.10.
(transplanted from 1ba79f2126df8bd89120899a58f2d0bcc2e9c771)
     1 From http://www.mail-archive.com/pld-cvs-commit@pld-linux.org/msg00229.html
     2 Fixes
     3   rtld.c: In function '_dl_start':
     4   dynamic-link.h:47: error: nested function 'elf_machine_rela_relative' declared but never defined
     5   dynamic-link.h:41: error: nested function 'elf_machine_rela' declared but never defined
     6 when compiling glibc-2.3.4 with gcc-4.0
     7 
     8 But see also
     9 http://sources.redhat.com/ml/libc-hacker/2005-02/msg00000.html
    10 and
    11 http://sources.redhat.com/ml/libc-hacker/2005-03/msg00008.html
    12 which seem to propose less radical fixes?
    13 
    14 Aha.  See also http://sources.redhat.com/bugzilla/show_bug.cgi?id=721
    15 
    16 --- glibc-2.3.6.orig/elf/dynamic-link.h	2005-03-12 18:12:37.000000000 -0800
    17 +++ glibc-2.3.6/elf/dynamic-link.h	2005-03-12 18:12:59.777820848 -0800
    18 @@ -19,47 +19,6 @@
    19  
    20  #include <elf.h>
    21  #include <assert.h>
    22 -
    23 -#ifdef RESOLVE
    24 -/* We pass reloc_addr as a pointer to void, as opposed to a pointer to
    25 -   ElfW(Addr), because not all architectures can assume that the
    26 -   relocated address is properly aligned, whereas the compiler is
    27 -   entitled to assume that a pointer to a type is properly aligned for
    28 -   the type.  Even if we cast the pointer back to some other type with
    29 -   less strict alignment requirements, the compiler might still
    30 -   remember that the pointer was originally more aligned, thereby
    31 -   optimizing away alignment tests or using word instructions for
    32 -   copying memory, breaking the very code written to handle the
    33 -   unaligned cases.  */
    34 -# if ! ELF_MACHINE_NO_REL
    35 -auto inline void __attribute__((always_inline))
    36 -elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
    37 -		 const ElfW(Sym) *sym, const struct r_found_version *version,
    38 -		 void *const reloc_addr);
    39 -auto inline void __attribute__((always_inline))
    40 -elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
    41 -			  void *const reloc_addr);
    42 -# endif
    43 -# if ! ELF_MACHINE_NO_RELA
    44 -auto inline void __attribute__((always_inline))
    45 -elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
    46 -		  const ElfW(Sym) *sym, const struct r_found_version *version,
    47 -		  void *const reloc_addr);
    48 -auto inline void __attribute__((always_inline))
    49 -elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
    50 -			   void *const reloc_addr);
    51 -# endif
    52 -# if ELF_MACHINE_NO_RELA || defined ELF_MACHINE_PLT_REL
    53 -auto inline void __attribute__((always_inline))
    54 -elf_machine_lazy_rel (struct link_map *map,
    55 -		      ElfW(Addr) l_addr, const ElfW(Rel) *reloc);
    56 -# else
    57 -auto inline void __attribute__((always_inline))
    58 -elf_machine_lazy_rel (struct link_map *map,
    59 -		      ElfW(Addr) l_addr, const ElfW(Rela) *reloc);
    60 -# endif
    61 -#endif
    62 -
    63  #include <dl-machine.h>
    64  
    65  #ifndef VERSYMIDX
    66 
    67 Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>