patches/glibc/2.3.6/180-allow-gcc-4.0-elf.patch
author Johannes Stezenbach <js@sig21.net>
Thu Jul 29 19:47:16 2010 +0200 (2010-07-29)
changeset 2045 fdaa6c7f6dea
parent 402 197e1b49586e
permissions -rw-r--r--
cc/gcc: add option to compile against static libstdc++, for gcc-4.4 and newer

Idea and know-how taken from CodeSourcery build script.

Normal build:
$ ldd arm-unknown-linux-uclibcgnueabi-gcc
linux-gate.so.1 => (0xb77f3000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb76e8000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb75a1000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb757a000)
/lib/ld-linux.so.2 (0xb77f4000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb755c000)

CC_STATIC_LIBSTDCXX=y:
$ ldd arm-unknown-linux-uclibcgnueabi-gcc
linux-gate.so.1 => (0xb7843000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb76e6000)
/lib/ld-linux.so.2 (0xb7844000)

I made CC_STATIC_LIBSTDCXX default=y since I think
it is always desirable.

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