Submitted By: Matthew Burgess Date: 2005-08-28 Initial Package Version: 2.3.5 Upstream Status: From Upstream and Debian Origin: Ryan Oliver, courtesy of upstream CVS and Dan Kegel's crosstool (http://kegel.com/crosstool/) Description: Fixes a compilation problem with gcc-4.0.x that results in: rtld.c: In function '_dl_start': dynamic-link.h:47: error: nested function 'elf_machine_rela_relative' declared but never defined dynamic-link.h:41: error: nested function 'elf_machine_rela' declared but never defined Updated by Jim Gifford from Debian patch to fix Sparc 64 Bit build diff -Naur glibc-2.3.5.orig/elf/dynamic-link.h glibc-2.3.5/elf/dynamic-link.h --- glibc-2.3.5.orig/elf/dynamic-link.h 2004-09-24 17:09:03.000000000 +0000 +++ glibc-2.3.5/elf/dynamic-link.h 2005-08-28 17:31:19.000000000 +0000 @@ -1,5 +1,5 @@ /* Inline functions for dynamic linking. - Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2003, 2004, 2005 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 @@ -31,26 +31,30 @@ optimizing away alignment tests or using word instructions for copying memory, breaking the very code written to handle the unaligned cases. */ -auto void __attribute__((always_inline)) +# if ! ELF_MACHINE_NO_REL +auto inline void __attribute__((always_inline)) elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc, const ElfW(Sym) *sym, const struct r_found_version *version, void *const reloc_addr); -auto void __attribute__((always_inline)) +auto inline void __attribute__((always_inline)) +elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc, + void *const reloc_addr); +# endif +# if ! ELF_MACHINE_NO_RELA +auto inline void __attribute__((always_inline)) elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, const ElfW(Sym) *sym, const struct r_found_version *version, void *const reloc_addr); -auto void __attribute__((always_inline)) -elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc, - void *const reloc_addr); -auto void __attribute__((always_inline)) +auto inline void __attribute__((always_inline)) elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, void *const reloc_addr); +# endif # if ELF_MACHINE_NO_RELA || defined ELF_MACHINE_PLT_REL -auto void __attribute__((always_inline)) +auto inline void __attribute__((always_inline)) elf_machine_lazy_rel (struct link_map *map, ElfW(Addr) l_addr, const ElfW(Rel) *reloc); # else -auto void __attribute__((always_inline)) +auto inline void __attribute__((always_inline)) elf_machine_lazy_rel (struct link_map *map, ElfW(Addr) l_addr, const ElfW(Rela) *reloc); # endif diff -Naur glibc-2.3.5.orig/sysdeps/alpha/dl-machine.h glibc-2.3.5/sysdeps/alpha/dl-machine.h --- glibc-2.3.5.orig/sysdeps/alpha/dl-machine.h 2004-10-15 07:06:11.000000000 +0000 +++ glibc-2.3.5/sysdeps/alpha/dl-machine.h 2005-08-28 17:31:19.000000000 +0000 @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. Alpha version. - Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson . @@ -508,6 +508,7 @@ /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ auto inline void +__attribute__ ((always_inline)) elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, const Elf64_Sym *sym, @@ -646,6 +647,7 @@ #define ELF_MACHINE_REL_RELATIVE 1 auto inline void +__attribute__ ((always_inline)) elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, void *const reloc_addr_arg) { @@ -662,6 +664,7 @@ } auto inline void +__attribute__ ((always_inline)) elf_machine_lazy_rel (struct link_map *map, Elf64_Addr l_addr, const Elf64_Rela *reloc) { diff -Naur glibc-2.3.5.orig/sysdeps/arm/dl-machine.h glibc-2.3.5/sysdeps/arm/dl-machine.h --- glibc-2.3.5.orig/sysdeps/arm/dl-machine.h 2004-12-04 21:20:17.000000000 +0000 +++ glibc-2.3.5/sysdeps/arm/dl-machine.h 2005-08-28 17:31:19.000000000 +0000 @@ -350,16 +350,15 @@ #endif /* !dl_machine_h */ -#ifdef RESOLVE - /* ARM never uses Elf32_Rela relocations for the dynamic linker. Prelinked libraries may use Elf32_Rela though. */ -# ifdef RTLD_BOOTSTRAP -# define ELF_MACHINE_NO_RELA 1 -# endif +#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP + +#ifdef RESOLVE /* Deal with an out-of-range PC24 reloc. */ -static Elf32_Addr +auto inline Elf32_Addr +__attribute__ ((always_inline)) fix_bad_pc24 (Elf32_Addr *const reloc_addr, Elf32_Addr value) { static void *fix_page; @@ -392,7 +391,8 @@ /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -static inline void +auto inline void +__attribute__ ((always_inline)) elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, const Elf32_Sym *sym, const struct r_found_version *version, void *const reloc_addr_arg) @@ -517,7 +517,8 @@ } # ifndef RTLD_BOOTSTRAP -static inline void +auto inline void +__attribute__ ((always_inline)) elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, const Elf32_Sym *sym, const struct r_found_version *version, void *const reloc_addr_arg) @@ -597,7 +598,8 @@ } # endif -static inline void +auto inline void +__attribute__ ((always_inline)) elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc, void *const reloc_addr_arg) { @@ -606,7 +608,8 @@ } # ifndef RTLD_BOOTSTRAP -static inline void +auto inline void +__attribute__ ((always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) { @@ -615,7 +618,8 @@ } # endif -static inline void +auto inline void +__attribute__ ((always_inline)) elf_machine_lazy_rel (struct link_map *map, Elf32_Addr l_addr, const Elf32_Rel *reloc) { diff -Naur glibc-2.3.5.orig/sysdeps/generic/dl-machine.h glibc-2.3.5/sysdeps/generic/dl-machine.h --- glibc-2.3.5.orig/sysdeps/generic/dl-machine.h 2001-09-08 17:16:43.000000000 +0000 +++ glibc-2.3.5/sysdeps/generic/dl-machine.h 2005-08-28 17:31:19.000000000 +0000 @@ -1,5 +1,6 @@ /* Machine-dependent ELF dynamic relocation inline functions. Stub version. - Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2005 + 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 @@ -64,7 +65,8 @@ LOADADDR is the load address of the object; INFO is an array indexed by DT_* of the .dynamic section info. */ -static inline void +auto inline void +__attribute__ ((always_inline)) elf_machine_rel (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM], const Elf32_Rel *reloc, const Elf32_Sym *sym, Elf32_Addr (*resolve) (const Elf32_Sym **ref, @@ -87,7 +89,8 @@ } -static inline Elf32_Addr +auto inline Elf32_Addr +__attribute__ ((always_inline)) elf_machine_rela (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM], const Elf32_Rel *reloc, const Elf32_Sym *sym, Elf32_Addr (*resolve) (const Elf32_Sym **ref, diff -Naur glibc-2.3.5.orig/sysdeps/i386/dl-machine.h glibc-2.3.5/sysdeps/i386/dl-machine.h --- glibc-2.3.5.orig/sysdeps/i386/dl-machine.h 2005-02-16 10:58:03.000000000 +0000 +++ glibc-2.3.5/sysdeps/i386/dl-machine.h 2005-08-28 17:31:19.000000000 +0000 @@ -387,13 +387,11 @@ #endif /* !dl_machine_h */ -#ifdef RESOLVE - /* The i386 never uses Elf32_Rela relocations for the dynamic linker. Prelinked libraries may use Elf32_Rela though. */ -#ifdef RTLD_BOOTSTRAP -# define ELF_MACHINE_NO_RELA 1 -#endif +#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP + +#ifdef RESOLVE /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ diff -Naur glibc-2.3.5.orig/sysdeps/mips/dl-machine.h glibc-2.3.5/sysdeps/mips/dl-machine.h --- glibc-2.3.5.orig/sysdeps/mips/dl-machine.h 2004-11-24 04:36:09.000000000 +0000 +++ glibc-2.3.5/sysdeps/mips/dl-machine.h 2005-08-28 17:31:19.000000000 +0000 @@ -528,7 +528,7 @@ /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -static inline void +auto inline void #ifdef RTLD_BOOTSTRAP __attribute__ ((always_inline)) #endif @@ -635,14 +635,16 @@ } } -static inline void +auto inline void +__attribute__((always_inline)) elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc, void *const reloc_addr) { /* XXX Nothing to do. There is no relative relocation, right? */ } -static inline void +auto inline void +__attribute__((always_inline)) elf_machine_lazy_rel (struct link_map *map, ElfW(Addr) l_addr, const ElfW(Rel) *reloc) { @@ -651,7 +653,8 @@ #ifndef RTLD_BOOTSTRAP /* Relocate GOT. */ -static inline void +auto inline void +__attribute__((always_inline)) elf_machine_got_rel (struct link_map *map, int lazy) { ElfW(Addr) *got; @@ -738,7 +741,8 @@ /* Set up the loaded object described by L so its stub function will jump to the on-demand fixup code __dl_runtime_resolve. */ -static inline int +auto inline int +__attribute__((always_inline)) elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { # ifndef RTLD_BOOTSTRAP diff -Naur glibc-2.3.5.orig/sysdeps/powerpc/powerpc32/dl-machine.h glibc-2.3.5/sysdeps/powerpc/powerpc32/dl-machine.h --- glibc-2.3.5.orig/sysdeps/powerpc/powerpc32/dl-machine.h 2003-07-31 06:33:52.000000000 +0000 +++ glibc-2.3.5/sysdeps/powerpc/powerpc32/dl-machine.h 2005-08-28 17:31:19.000000000 +0000 @@ -353,7 +353,7 @@ LOADADDR is the load address of the object; INFO is an array indexed by DT_* of the .dynamic section info. */ -inline void +auto inline void __attribute__ ((always_inline)) elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, const Elf32_Sym *sym, const struct r_found_version *version, void *const reloc_addr_arg) @@ -455,7 +455,7 @@ } } -static inline void +auto inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) { @@ -463,7 +463,7 @@ *reloc_addr = l_addr + reloc->r_addend; } -static inline void +auto inline void __attribute__ ((always_inline)) elf_machine_lazy_rel (struct link_map *map, Elf32_Addr l_addr, const Elf32_Rela *reloc) { diff -Naur glibc-2.3.5.orig/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.3.5/sysdeps/powerpc/powerpc64/dl-machine.h --- glibc-2.3.5.orig/sysdeps/powerpc/powerpc64/dl-machine.h 2004-09-08 06:57:14.000000000 +0000 +++ glibc-2.3.5/sysdeps/powerpc/powerpc64/dl-machine.h 2005-08-28 17:31:19.000000000 +0000 @@ -567,7 +567,7 @@ const Elf64_Sym *refsym) attribute_hidden; -static inline void +auto inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, void *const reloc_addr_arg) { @@ -577,7 +577,7 @@ #if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) /* This computes the value used by TPREL* relocs. */ -static Elf64_Addr __attribute__ ((const)) +auto inline Elf64_Addr __attribute__ ((always_inline, const)) elf_machine_tprel (struct link_map *map, struct link_map *sym_map, const Elf64_Sym *sym, @@ -598,7 +598,7 @@ /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -static inline void +auto inline void __attribute__ ((always_inline)) elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, const Elf64_Sym *sym, @@ -883,11 +883,12 @@ MODIFIED_CODE_NOQUEUE (reloc_addr); } -static inline void +auto inline void __attribute__ ((always_inline)) elf_machine_lazy_rel (struct link_map *map, Elf64_Addr l_addr, const Elf64_Rela *reloc) { /* elf_machine_runtime_setup handles this. */ } + #endif /* RESOLVE */ diff -Naur glibc-2.3.5.orig/sysdeps/sparc/sparc32/dl-machine.h glibc-2.3.5/sysdeps/sparc/sparc32/dl-machine.h --- glibc-2.3.5.orig/sysdeps/sparc/sparc32/dl-machine.h 2004-05-17 18:20:30.000000000 +0000 +++ glibc-2.3.5/sysdeps/sparc/sparc32/dl-machine.h 2005-08-28 17:32:10.000000000 +0000 @@ -411,7 +411,14 @@ /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -static inline void +#if __GNUC__ >= 4 + auto inline void +#else + static inline void +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, const Elf32_Sym *sym, const struct r_found_version *version, void *const reloc_addr_arg) @@ -593,7 +600,14 @@ } } -static inline void +#if __GNUC__ >= 4 + auto inline void +#else + static inline void +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) { @@ -601,7 +615,14 @@ *reloc_addr += l_addr + reloc->r_addend; } -static inline void +#if __GNUC__ >= 4 + auto inline void +#else + static inline void +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_lazy_rel (struct link_map *map, Elf32_Addr l_addr, const Elf32_Rela *reloc) { diff -Naur glibc-2.3.5.orig/sysdeps/sparc/sparc64/dl-machine.h glibc-2.3.5/sysdeps/sparc/sparc64/dl-machine.h --- glibc-2.3.5.orig/sysdeps/sparc/sparc64/dl-machine.h 2004-03-05 10:27:55.000000000 +0000 +++ glibc-2.3.5/sysdeps/sparc/sparc64/dl-machine.h 2005-08-28 17:32:10.000000000 +0000 @@ -34,7 +34,18 @@ #define ELF64_R_TYPE_DATA(info) ((info) >> 8) /* Return nonzero iff ELF header is compatible with the running host. */ -static inline int +#if __GNUC__ >= 4 +# ifdef RESOLVE + auto inline int +# else + static inline int +# endif +#else + static inline int +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_matches_host (const Elf64_Ehdr *ehdr) { return ehdr->e_machine == EM_SPARCV9; @@ -55,7 +66,18 @@ /* Return the link-time address of _DYNAMIC. Conveniently, this is the first element of the GOT. This must be inlined in a function which uses global data. */ -static inline Elf64_Addr +#if __GNUC__ >= 4 +# ifdef RESOLVE + auto inline Elf64_Addr +# else + static inline Elf64_Addr +# endif +#else + static inline Elf64_Addr +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_dynamic (void) { register Elf64_Addr *elf_pic_register __asm__("%l7"); @@ -66,7 +88,18 @@ } /* Return the run-time load address of the shared object. */ -static inline Elf64_Addr +#if __GNUC__ >= 4 +# ifdef RESOLVE + auto inline Elf64_Addr +# else + static inline Elf64_Addr +# endif +#else + static inline Elf64_Addr +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_load_address (void) { register Elf32_Addr *pc __asm ("%o7"); @@ -88,7 +121,18 @@ /* We have 4 cases to handle. And we code different code sequences for each one. I love V9 code models... */ -static inline void +#if __GNUC__ >= 4 +# ifdef RESOLVE + auto inline void +# else + static inline void +# endif +#else + static inline void +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif sparc64_fixup_plt (struct link_map *map, const Elf64_Rela *reloc, Elf64_Addr *reloc_addr, Elf64_Addr value, Elf64_Addr high, int t) @@ -212,7 +256,18 @@ } } -static inline Elf64_Addr +#if __GNUC__ >= 4 +# ifdef RESOLVE + auto inline Elf64_Addr +# else + static inline Elf64_Addr +# endif +#else + static inline Elf64_Addr +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_fixup_plt (struct link_map *map, lookup_t t, const Elf64_Rela *reloc, Elf64_Addr *reloc_addr, Elf64_Addr value) @@ -223,7 +278,18 @@ } /* Return the final value of a plt relocation. */ -static inline Elf64_Addr +#if __GNUC__ >= 4 +# ifdef RESOLVE + auto inline Elf64_Addr +# else + static inline Elf64_Addr +# endif +#else + static inline Elf64_Addr +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, Elf64_Addr value) { @@ -238,7 +304,14 @@ /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -static inline void +#if __GNUC__ >= 4 + auto inline void +#else + static inline void +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, const Elf64_Sym *sym, const struct r_found_version *version, void *const reloc_addr_arg) @@ -430,7 +503,14 @@ } } -static inline void +#if __GNUC__ >= 4 + auto inline void +#else + static inline void +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, void *const reloc_addr_arg) { @@ -438,7 +518,14 @@ *reloc_addr = l_addr + reloc->r_addend; } -static inline void +#if __GNUC__ >= 4 + auto inline void +#else + static inline void +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_lazy_rel (struct link_map *map, Elf64_Addr l_addr, const Elf64_Rela *reloc) { @@ -476,7 +563,18 @@ /* Set up the loaded object described by L so its unrelocated PLT entries will jump to the on-demand fixup code in dl-runtime.c. */ -static inline int +#if __GNUC__ >= 4 +# ifdef RESOLVE + auto inline int +# else + static inline int +# endif +#else + static inline int +#endif +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + __attribute ((always_inline)) +#endif elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { if (l->l_info[DT_JMPREL] && lazy)