diff options
author | Fangrui Song <maskray@google.com> | 2021-10-07 11:55:02 -0700 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2021-10-07 11:55:02 -0700 |
commit | 490e6c62aa31a8aa5c4a059f6e646ede121edf0a (patch) | |
tree | 40bedb62d8b555792f91c82127b0f599da90ef39 /sysdeps | |
parent | 349b0441dab375099b1d7f6909c1742286a67da9 (diff) | |
download | glibc-490e6c62aa31a8aa5c4a059f6e646ede121edf0a.tar.gz glibc-490e6c62aa31a8aa5c4a059f6e646ede121edf0a.tar.xz glibc-490e6c62aa31a8aa5c4a059f6e646ede121edf0a.zip |
elf: Avoid nested functions in the loader [BZ #27220]
dynamic-link.h is included more than once in some elf/ files (rtld.c, dl-conflict.c, dl-reloc.c, dl-reloc-static-pie.c) and uses GCC nested functions. This harms readability and the nested functions usage is the biggest obstacle prevents Clang build (Clang doesn't support GCC nested functions). The key idea for unnesting is to add extra parameters (struct link_map *and struct r_scope_elm *[]) to RESOLVE_MAP, ELF_MACHINE_BEFORE_RTLD_RELOC, ELF_DYNAMIC_RELOCATE, elf_machine_rel[a], elf_machine_lazy_rel, and elf_machine_runtime_setup. (This is inspired by Stan Shebs' ppc64/x86-64 implementation in the google/grte/v5-2.27/master which uses mixed extra parameters and static variables.) Future simplification: * If mips elf_machine_runtime_setup no longer needs RESOLVE_GOTSYM, elf_machine_runtime_setup can drop the `scope` parameter. * If TLSDESC no longer need to be in elf_machine_lazy_rel, elf_machine_lazy_rel can drop the `scope` parameter. Tested on aarch64, i386, x86-64, powerpc64le, powerpc64, powerpc32, sparc64, sparcv9, s390x, s390, hppa, ia64, armhf, alpha, and mips64. In addition, tested build-many-glibcs.py with {arc,csky,microblaze,nios2}-linux-gnu and riscv64-linux-gnu-rv64imafdc-lp64d. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/aarch64/dl-machine.h | 22 | ||||
-rw-r--r-- | sysdeps/alpha/dl-machine.h | 16 | ||||
-rw-r--r-- | sysdeps/arc/dl-machine.h | 18 | ||||
-rw-r--r-- | sysdeps/arm/dl-machine.h | 34 | ||||
-rw-r--r-- | sysdeps/csky/dl-machine.h | 19 | ||||
-rw-r--r-- | sysdeps/hppa/dl-machine.h | 23 | ||||
-rw-r--r-- | sysdeps/i386/dl-machine.h | 40 | ||||
-rw-r--r-- | sysdeps/ia64/dl-machine.h | 22 | ||||
-rw-r--r-- | sysdeps/m68k/dl-machine.h | 19 | ||||
-rw-r--r-- | sysdeps/microblaze/dl-machine.h | 19 | ||||
-rw-r--r-- | sysdeps/mips/dl-machine.h | 58 | ||||
-rw-r--r-- | sysdeps/nios2/dl-machine.h | 21 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/dl-machine.h | 17 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/dl-machine.h | 19 | ||||
-rw-r--r-- | sysdeps/riscv/dl-machine.h | 23 | ||||
-rw-r--r-- | sysdeps/s390/s390-32/dl-machine.h | 19 | ||||
-rw-r--r-- | sysdeps/s390/s390-64/dl-machine.h | 19 | ||||
-rw-r--r-- | sysdeps/sh/dl-machine.h | 19 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/dl-machine.h | 18 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/dl-machine.h | 18 | ||||
-rw-r--r-- | sysdeps/x86_64/dl-machine.h | 25 |
21 files changed, 272 insertions, 216 deletions
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index 3e10cb462f..e30e81c902 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -59,7 +59,8 @@ elf_machine_dynamic (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((unused)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { if (l->l_info[DT_JMPREL] && lazy) { @@ -237,10 +238,11 @@ elf_machine_plt_value (struct link_map *map, #ifdef RESOLVE_MAP -auto inline void +static 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, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const ElfW(Rela) *reloc, const ElfW(Sym) *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { ElfW(Addr) *const reloc_addr = reloc_addr_arg; @@ -253,7 +255,8 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, else { const ElfW(Sym) *const refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); ElfW(Addr) value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL @@ -377,9 +380,9 @@ elf_machine_rela_relative (ElfW(Addr) l_addr, *reloc_addr = l_addr + reloc->r_addend; } -inline void +static inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], ElfW(Addr) l_addr, const ElfW(Rela) *reloc, int skip_ifunc) @@ -406,7 +409,7 @@ elf_machine_lazy_rel (struct link_map *map, (const void *)D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]); version = &map->l_versions[vernum[symndx] & 0x7fff]; } - elf_machine_rela (map, reloc, sym, version, reloc_addr, + elf_machine_rela (map, scope, reloc, sym, version, reloc_addr, skip_ifunc); return; } @@ -433,7 +436,8 @@ elf_machine_lazy_rel (struct link_map *map, /* Always initialize TLS descriptors completely, because lazy initialization requires synchronization at every TLS access. */ - elf_machine_rela (map, reloc, sym, version, reloc_addr, skip_ifunc); + elf_machine_rela (map, scope, reloc, sym, version, reloc_addr, + skip_ifunc); } else if (__glibc_unlikely (r_type == AARCH64_R(IRELATIVE))) { diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 9e327b7f17..491541326f 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -69,7 +69,8 @@ elf_machine_load_address (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int -elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *map, struct r_scope_elem *scope[], + int lazy, int profile) { extern char _dl_runtime_resolve_new[] attribute_hidden; extern char _dl_runtime_profile_new[] attribute_hidden; @@ -360,9 +361,9 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_rela (struct link_map *map, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], const Elf64_Rela *reloc, const Elf64_Sym *sym, const struct r_found_version *version, @@ -410,7 +411,8 @@ elf_machine_rela (struct link_map *map, return; else { - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); Elf64_Addr sym_value; Elf64_Addr sym_raw_value; @@ -488,7 +490,7 @@ elf_machine_rela (struct link_map *map, can be skipped. */ #define ELF_MACHINE_REL_RELATIVE 1 -auto inline void +static inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, void *const reloc_addr_arg) @@ -505,9 +507,9 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, memcpy (reloc_addr_arg, &reloc_addr_val, 8); } -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf64_Addr l_addr, const Elf64_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/arc/dl-machine.h b/sysdeps/arc/dl-machine.h index e6ce7f0ff6..4b64ffec25 100644 --- a/sysdeps/arc/dl-machine.h +++ b/sysdeps/arc/dl-machine.h @@ -122,7 +122,8 @@ elf_machine_load_address (void) static inline int __attribute__ ((always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { extern void _dl_runtime_resolve (void); @@ -228,10 +229,11 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t t, #ifdef RESOLVE_MAP -inline void +static 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, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const ElfW(Rela) *reloc, const ElfW(Sym) *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { ElfW(Addr) r_info = reloc->r_info; @@ -245,7 +247,8 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, else { const ElfW(Sym) *const refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); ElfW(Addr) value = SYMBOL_ADDRESS (sym_map, sym, true); switch (r_type) @@ -326,8 +329,9 @@ elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, ElfW(Addr) l_addr, - const ElfW(Rela) *reloc, int skip_ifunc) +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], + ElfW(Addr) l_addr, const ElfW(Rela) *reloc, + int skip_ifunc) { ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset); const unsigned int r_type = ELFW (R_TYPE) (reloc->r_info); diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index eb13cb8b57..68a0b4b476 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -57,7 +57,8 @@ elf_machine_dynamic (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((unused)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { Elf32_Addr *got; extern void _dl_runtime_resolve (Elf32_Word); @@ -276,7 +277,7 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc, #ifdef RESOLVE_MAP /* Handle a PC24 reloc, including the out-of-range case. */ -auto void +static void relocate_pc24 (struct link_map *map, Elf32_Addr value, Elf32_Addr *const reloc_addr, Elf32_Sword addend) { @@ -330,10 +331,11 @@ relocate_pc24 (struct link_map *map, Elf32_Addr value, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void +static 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, +elf_machine_rel (struct link_map *map, struct r_scope_elem *scope[], + const Elf32_Rel *reloc, const Elf32_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf32_Addr *const reloc_addr = reloc_addr_arg; @@ -364,7 +366,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, #endif { const Elf32_Sym *const refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL @@ -508,10 +511,11 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, } # ifndef RTLD_BOOTSTRAP -auto inline void +static 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, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const Elf32_Rela *reloc, const Elf32_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf32_Addr *const reloc_addr = reloc_addr_arg; @@ -526,7 +530,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, # ifndef RESOLVE_CONFLICT_FIND_MAP const Elf32_Sym *const refsym = sym; # endif - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type); Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL @@ -601,7 +605,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } # endif -auto inline void +static inline void __attribute__ ((always_inline)) elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc, void *const reloc_addr_arg) @@ -611,7 +615,7 @@ elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc, } # ifndef RTLD_BOOTSTRAP -auto inline void +static inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) @@ -621,9 +625,9 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, } # endif -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr l_addr, const Elf32_Rel *reloc, int skip_ifunc) { @@ -653,7 +657,7 @@ elf_machine_lazy_rel (struct link_map *map, /* Always initialize TLS descriptors completely, because lazy initialization requires synchronization at every TLS access. */ - elf_machine_rel (map, reloc, sym, version, reloc_addr, skip_ifunc); + elf_machine_rel (map, scope, reloc, sym, version, reloc_addr, skip_ifunc); } else _dl_reloc_bad_type (map, r_type, 1); diff --git a/sysdeps/csky/dl-machine.h b/sysdeps/csky/dl-machine.h index b08f06d74c..ec22f87577 100644 --- a/sysdeps/csky/dl-machine.h +++ b/sysdeps/csky/dl-machine.h @@ -58,7 +58,8 @@ elf_machine_load_address (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { Elf32_Addr *got; extern void _dl_runtime_resolve (Elf32_Word); @@ -215,9 +216,10 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void __attribute__ ((unused, always_inline)) -elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, - const Elf32_Sym *sym, const struct r_found_version *version, +static inline void __attribute__ ((unused, always_inline)) +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const Elf32_Rela *reloc, const Elf32_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf32_Addr *const reloc_addr = reloc_addr_arg; @@ -230,7 +232,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, else { const Elf32_Sym *const refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); ElfW(Addr) value = SYMBOL_ADDRESS (sym_map, sym, true); opcode16_addr = (unsigned short *)reloc_addr; @@ -331,7 +334,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } } -auto inline void __attribute__ ((unused, always_inline)) +static inline void __attribute__ ((unused, always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) { @@ -339,8 +342,8 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, *reloc_addr = l_addr + reloc->r_addend; } -auto inline void __attribute__ ((unused, always_inline)) -elf_machine_lazy_rel (struct link_map *map, +static inline void __attribute__ ((unused, always_inline)) +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr l_addr, const Elf32_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index ded9c193d6..e6a4575fce 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -68,8 +68,8 @@ __hppa_init_bootstrap_fdesc_table (struct link_map *map) map->l_mach.fptr_table = boot_table; } -#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \ - __hppa_init_bootstrap_fdesc_table (BOOTSTRAP_MAP); \ +#define ELF_MACHINE_BEFORE_RTLD_RELOC(map, dynamic_info) \ + __hppa_init_bootstrap_fdesc_table (map); \ _dl_fptr_init(); /* Return nonzero iff ELF header is compatible with the running host. */ @@ -162,7 +162,8 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { Elf32_Addr *got = NULL; Elf32_Addr l_addr, iplt, jmprel, end_jmprel, r_type, r_sym; @@ -548,8 +549,8 @@ dl_platform_init (void) ( (((as14) & 0x1fff) << 1) \ | (((as14) & 0x2000) >> 13)) -auto void __attribute__((always_inline)) -elf_machine_rela (struct link_map *map, +static void __attribute__((always_inline)) +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], const Elf32_Rela *reloc, const Elf32_Sym *sym, const struct r_found_version *version, @@ -578,11 +579,9 @@ elf_machine_rela (struct link_map *map, zeros, and an all zero Elf32_Sym has a binding of STB_LOCAL.) See RESOLVE_MAP definition in elf/dl-reloc.c */ # ifdef RTLD_BOOTSTRAP - /* RESOLVE_MAP in rtld.c doesn't have the local sym test. */ - sym_map = (ELF32_ST_BIND (sym->st_info) != STB_LOCAL - ? RESOLVE_MAP (&sym, version, r_type) : map); + sym_map = map; # else - sym_map = RESOLVE_MAP (&sym, version, r_type); + sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type); # endif if (sym_map) @@ -740,7 +739,7 @@ elf_machine_rela (struct link_map *map, /* hppa doesn't have an R_PARISC_RELATIVE reloc, but uses relocs with ELF32_R_SYM (info) == 0 for a similar purpose. */ -auto void __attribute__((always_inline)) +static void __attribute__((always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) @@ -793,8 +792,8 @@ elf_machine_rela_relative (Elf32_Addr l_addr, *reloc_addr = value; } -auto void __attribute__((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +static void __attribute__((always_inline)) +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr l_addr, const Elf32_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 0401888508..9f578e536a 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -54,7 +54,8 @@ elf_machine_dynamic (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((unused, always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { Elf32_Addr *got; extern void _dl_runtime_resolve (Elf32_Word) attribute_hidden; @@ -284,9 +285,10 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void +static inline void __attribute ((always_inline)) -elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, +elf_machine_rel (struct link_map *map, struct r_scope_elem *scope[], + const Elf32_Rel *reloc, const Elf32_Sym *sym, const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { @@ -320,7 +322,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, # ifndef RTLD_BOOTSTRAP const Elf32_Sym *const refsym = sym; # endif - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL @@ -491,10 +494,11 @@ and creates an unsatisfiable circular dependency.\n", } # ifndef RTLD_BOOTSTRAP -auto inline void +static 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, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const Elf32_Rela *reloc, const Elf32_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf32_Addr *const reloc_addr = reloc_addr_arg; @@ -507,7 +511,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, # ifndef RESOLVE_CONFLICT_FIND_MAP const Elf32_Sym *const refsym = sym; # endif - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL @@ -640,7 +645,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } # endif /* !RTLD_BOOTSTRAP */ -auto inline void +static inline void __attribute ((always_inline)) elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc, void *const reloc_addr_arg) @@ -651,7 +656,7 @@ elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc, } # ifndef RTLD_BOOTSTRAP -auto inline void +static inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) @@ -661,9 +666,9 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, } # endif /* !RTLD_BOOTSTRAP */ -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr l_addr, const Elf32_Rel *reloc, int skip_ifunc) { @@ -698,13 +703,13 @@ elf_machine_lazy_rel (struct link_map *map, const ElfW(Half) *const version = (const void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]); ElfW(Half) ndx = version[ELFW(R_SYM) (r->r_info)] & 0x7fff; - elf_machine_rel (map, r, &symtab[ELFW(R_SYM) (r->r_info)], + elf_machine_rel (map, scope, r, &symtab[ELFW(R_SYM) (r->r_info)], &map->l_versions[ndx], (void *) (l_addr + r->r_offset), skip_ifunc); } # ifndef RTLD_BOOTSTRAP else - elf_machine_rel (map, r, &symtab[ELFW(R_SYM) (r->r_info)], NULL, + elf_machine_rel (map, scope, r, &symtab[ELFW(R_SYM) (r->r_info)], NULL, (void *) (l_addr + r->r_offset), skip_ifunc); # endif } @@ -721,9 +726,9 @@ elf_machine_lazy_rel (struct link_map *map, # ifndef RTLD_BOOTSTRAP -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_lazy_rela (struct link_map *map, +elf_machine_lazy_rela (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr l_addr, const Elf32_Rela *reloc, int skip_ifunc) { @@ -747,7 +752,8 @@ elf_machine_lazy_rela (struct link_map *map, /* Always initialize TLS descriptors completely at load time, in case static TLS is allocated for it that requires locking. */ - elf_machine_rela (map, reloc, sym, version, reloc_addr, skip_ifunc); + elf_machine_rela (map, scope, reloc, sym, version, reloc_addr, + skip_ifunc); } else if (__glibc_unlikely (r_type == R_386_IRELATIVE)) { diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index 4403e7767a..2217d0b556 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -44,8 +44,8 @@ __ia64_init_bootstrap_fdesc_table (struct link_map *map) map->l_mach.fptr_table = boot_table; } -#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \ - __ia64_init_bootstrap_fdesc_table (BOOTSTRAP_MAP); +#define ELF_MACHINE_BEFORE_RTLD_RELOC(map, dynamic_info) \ + __ia64_init_bootstrap_fdesc_table (map); /* Return nonzero iff ELF header is compatible with the running host. */ static inline int __attribute__ ((unused)) @@ -98,7 +98,8 @@ elf_machine_load_address (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((unused, always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { extern void _dl_runtime_resolve (void); extern void _dl_runtime_profile (void); @@ -371,9 +372,9 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void +static inline void __attribute ((always_inline)) -elf_machine_rela (struct link_map *map, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], const Elf64_Rela *reloc, const Elf64_Sym *sym, const struct r_found_version *version, @@ -414,10 +415,11 @@ elf_machine_rela (struct link_map *map, return; else { - struct link_map *sym_map; + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); /* RESOLVE_MAP() will return NULL if it fail to locate the symbol. */ - if ((sym_map = RESOLVE_MAP (&sym, version, r_type))) + if (sym_map != NULL) { value = SYMBOL_ADDRESS (sym_map, sym, true) + reloc->r_addend; @@ -476,7 +478,7 @@ elf_machine_rela (struct link_map *map, can be skipped. */ #define ELF_MACHINE_REL_RELATIVE 1 -auto inline void +static inline void __attribute ((always_inline)) elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, void *const reloc_addr_arg) @@ -489,9 +491,9 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, } /* Perform a RELATIVE reloc on the .got entry that transfers to the .plt. */ -auto inline void +static inline void __attribute ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf64_Addr l_addr, const Elf64_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index 86a8c67e2a..5e34c4784e 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -68,7 +68,8 @@ elf_machine_load_address (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { Elf32_Addr *got; extern void _dl_runtime_resolve (Elf32_Word); @@ -215,9 +216,10 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void __attribute__ ((unused, always_inline)) -elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, - const Elf32_Sym *sym, const struct r_found_version *version, +static inline void __attribute__ ((unused, always_inline)) +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const Elf32_Rela *reloc, const Elf32_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf32_Addr *const reloc_addr = reloc_addr_arg; @@ -228,7 +230,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, else { const Elf32_Sym *const refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); switch (r_type) @@ -303,7 +306,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } } -auto inline void __attribute__ ((unused, always_inline)) +static inline void __attribute__ ((unused, always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) { @@ -311,8 +314,8 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, *reloc_addr = l_addr + reloc->r_addend; } -auto inline void __attribute__ ((unused, always_inline)) -elf_machine_lazy_rel (struct link_map *map, +static inline void __attribute__ ((unused, always_inline)) +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr l_addr, const Elf32_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/microblaze/dl-machine.h b/sysdeps/microblaze/dl-machine.h index e460f6f195..3fd4988e60 100644 --- a/sysdeps/microblaze/dl-machine.h +++ b/sysdeps/microblaze/dl-machine.h @@ -69,7 +69,8 @@ elf_machine_load_address (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { extern void _dl_runtime_resolve (Elf32_Word); extern void _dl_runtime_profile (Elf32_Word); @@ -207,9 +208,10 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, ((unsigned short *)(rel_addr))[3] = (val) & 0xffff; \ } while (0) -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, +static inline void __attribute__ ((always_inline)) +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const Elf32_Rela *reloc, const Elf32_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf32_Addr *const reloc_addr = reloc_addr_arg; @@ -222,7 +224,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, else { const Elf32_Sym *const refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); value += reloc->r_addend; @@ -277,7 +280,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } } -auto inline void +static inline void elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) { @@ -285,8 +288,8 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, PUT_REL_64 (reloc_addr, l_addr + reloc->r_addend); } -auto inline void -elf_machine_lazy_rel (struct link_map *map, +static inline void +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr l_addr, const Elf32_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index b74d427d64..f8d1298b60 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -187,9 +187,9 @@ elf_machine_load_address (void) /* We can't rely on elf_machine_got_rel because _dl_object_relocation_scope fiddles with global data. */ -#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \ +#define ELF_MACHINE_BEFORE_RTLD_RELOC(bootstrap_map, dynamic_info) \ do { \ - struct link_map *map = BOOTSTRAP_MAP; \ + struct link_map *map = bootstrap_map; \ ElfW(Sym) *sym; \ ElfW(Addr) *got; \ int i, n; \ @@ -474,11 +474,12 @@ elf_machine_plt_value (struct link_map *map, const ElfW(Rel) *reloc, by RELOC_ADDR. SYM is the relocation symbol specified by R_INFO and MAP is the object containing the reloc. */ -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_reloc (struct link_map *map, ElfW(Addr) r_info, - const ElfW(Sym) *sym, const struct r_found_version *version, - void *reloc_addr, ElfW(Addr) r_addend, int inplace_p) +elf_machine_reloc (struct link_map *map, struct r_scope_elem *scope[], + ElfW(Addr) r_info, const ElfW(Sym) *sym, + const struct r_found_version *version, void *reloc_addr, + ElfW(Addr) r_addend, int inplace_p) { const unsigned long int r_type = ELFW(R_TYPE) (r_info); ElfW(Addr) *addr_field = (ElfW(Addr) *) reloc_addr; @@ -506,7 +507,8 @@ elf_machine_reloc (struct link_map *map, ElfW(Addr) r_info, case R_MIPS_TLS_TPREL32: # endif { - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); switch (r_type) { @@ -646,7 +648,7 @@ elf_machine_reloc (struct link_map *map, ElfW(Addr) r_info, _dl_signal_error (0, map->l_name, NULL, "found jump slot relocation with non-zero addend"); - sym_map = RESOLVE_MAP (&sym, version, r_type); + sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type); value = SYMBOL_ADDRESS (sym_map, sym, true); *addr_field = value; @@ -660,7 +662,7 @@ elf_machine_reloc (struct link_map *map, ElfW(Addr) r_info, ElfW(Addr) value; /* Calculate the address of the symbol. */ - sym_map = RESOLVE_MAP (&sym, version, r_type); + sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type); value = SYMBOL_ADDRESS (sym_map, sym, true); if (__builtin_expect (sym == NULL, 0)) @@ -707,16 +709,17 @@ elf_machine_reloc (struct link_map *map, ElfW(Addr) r_info, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void +static 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, int skip_ifunc) +elf_machine_rel (struct link_map *map, struct r_scope_elem *scope[], + const ElfW(Rel) *reloc, const ElfW(Sym) *sym, + const struct r_found_version *version, void *const reloc_addr, + int skip_ifunc) { - elf_machine_reloc (map, reloc->r_info, sym, version, reloc_addr, 0, 1); + elf_machine_reloc (map, scope, reloc->r_info, sym, version, reloc_addr, 0, 1); } -auto inline void +static inline void __attribute__((always_inline)) elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc, void *const reloc_addr) @@ -724,9 +727,9 @@ elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc, /* XXX Nothing to do. There is no relative relocation, right? */ } -auto inline void +static inline void __attribute__((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], ElfW(Addr) l_addr, const ElfW(Rel) *reloc, int skip_ifunc) { @@ -747,17 +750,17 @@ elf_machine_lazy_rel (struct link_map *map, _dl_reloc_bad_type (map, r_type, 1); } -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], const ElfW(Rela) *reloc, const ElfW(Sym) *sym, const struct r_found_version *version, void *const reloc_addr, int skip_ifunc) { - elf_machine_reloc (map, reloc->r_info, sym, version, reloc_addr, + elf_machine_reloc (map, scope, reloc->r_info, sym, version, reloc_addr, reloc->r_addend, 0); } -auto inline void +static inline void __attribute__((always_inline)) elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, void *const reloc_addr) @@ -766,9 +769,9 @@ elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, #ifndef RTLD_BOOTSTRAP /* Relocate GOT. */ -auto inline void +static inline void __attribute__((always_inline)) -elf_machine_got_rel (struct link_map *map, int lazy) +elf_machine_got_rel (struct link_map *map, struct r_scope_elem *scope[], int lazy) { ElfW(Addr) *got; ElfW(Sym) *sym; @@ -781,7 +784,7 @@ elf_machine_got_rel (struct link_map *map, int lazy) const struct r_found_version *version __attribute__ ((unused)) \ = vernum ? &map->l_versions[vernum[sym_index] & 0x7fff] : NULL; \ struct link_map *sym_map; \ - sym_map = RESOLVE_MAP (&ref, version, reloc); \ + sym_map = RESOLVE_MAP (map, scope, &ref, version, reloc); \ SYMBOL_ADDRESS (sym_map, ref, true); \ }) @@ -867,9 +870,10 @@ elf_machine_got_rel (struct link_map *map, int lazy) /* Set up the loaded object described by L so its stub function will jump to the on-demand fixup code __dl_runtime_resolve. */ -auto inline int +static inline int __attribute__((always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { # ifndef RTLD_BOOTSTRAP ElfW(Addr) *got; @@ -899,7 +903,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) } /* Relocate global offset table. */ - elf_machine_got_rel (l, lazy); + elf_machine_got_rel (l, scope, lazy); /* If using PLTs, fill in the first two entries of .got.plt. */ if (l->l_info[DT_JMPREL] && lazy) diff --git a/sysdeps/nios2/dl-machine.h b/sysdeps/nios2/dl-machine.h index e000cd081f..4de602b13d 100644 --- a/sysdeps/nios2/dl-machine.h +++ b/sysdeps/nios2/dl-machine.h @@ -67,7 +67,8 @@ elf_machine_load_address (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { extern void _dl_runtime_resolve (Elf32_Word); @@ -234,10 +235,11 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, LOADADDR is the load address of the object; INFO is an array indexed by DT_* of the .dynamic section info. */ -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_arg, int skip_ifunc) +static inline void __attribute__ ((always_inline)) +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const ElfW(Rela) *reloc, const ElfW(Sym) *sym, + const struct r_found_version *version, + void *const reloc_addr_arg, int skip_ifunc) { Elf32_Addr *const reloc_addr = reloc_addr_arg; const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); @@ -249,7 +251,8 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, else { const Elf32_Sym *const refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); switch (r_type) @@ -314,7 +317,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, } } -auto inline void __attribute__((always_inline)) +static inline void __attribute__((always_inline)) elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, void *const reloc_addr_arg) { @@ -322,8 +325,8 @@ elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, *reloc_addr = l_addr + reloc->r_addend; } -auto inline void __attribute__((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +static inline void __attribute__((always_inline)) +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], ElfW(Addr) l_addr, const ElfW(Rela) *reloc, int skip_ifunc) { diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h index b93cf486b6..cda012dc1b 100644 --- a/sysdeps/powerpc/powerpc32/dl-machine.h +++ b/sysdeps/powerpc/powerpc32/dl-machine.h @@ -170,7 +170,7 @@ extern int __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile); static inline int -elf_machine_runtime_setup (struct link_map *map, +elf_machine_runtime_setup (struct link_map *map, struct r_scope_elem *scope[], int lazy, int profile) { if (map->l_info[DT_JMPREL] == 0) @@ -284,9 +284,10 @@ extern void _dl_reloc_overflow (struct link_map *map, LOADADDR is the load address of the object; INFO is an array indexed by DT_* of the .dynamic section info. */ -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, +static inline void __attribute__ ((always_inline)) +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const Elf32_Rela *reloc, const Elf32_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf32_Addr *const reloc_addr = reloc_addr_arg; @@ -315,7 +316,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } else { - sym_map = RESOLVE_MAP (&sym, version, r_type); + sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type); value = SYMBOL_ADDRESS (sym_map, sym, true); } value += reloc->r_addend; @@ -439,7 +440,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } } -auto inline void __attribute__ ((always_inline)) +static inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) { @@ -447,8 +448,8 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, *reloc_addr = l_addr + reloc->r_addend; } -auto inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +static inline void __attribute__ ((always_inline)) +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr l_addr, const Elf32_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h index b3f3352bcf..3f92fbb369 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.h +++ b/sysdeps/powerpc/powerpc64/dl-machine.h @@ -343,7 +343,8 @@ dl_platform_init (void) /* Set up the loaded object described by MAP so its unrelocated PLT entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((always_inline)) -elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *map, struct r_scope_elem *scope[], + int lazy, int profile) { if (map->l_info[DT_JMPREL]) { @@ -618,7 +619,7 @@ extern void attribute_hidden _dl_reloc_overflow (struct link_map *map, Elf64_Addr *const reloc_addr, const Elf64_Sym *refsym); -auto inline void __attribute__ ((always_inline)) +static inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, void *const reloc_addr_arg) { @@ -627,7 +628,7 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, } /* This computes the value used by TPREL* relocs. */ -auto inline Elf64_Addr __attribute__ ((always_inline, const)) +static inline Elf64_Addr __attribute__ ((always_inline, const)) elf_machine_tprel (struct link_map *map, struct link_map *sym_map, const Elf64_Sym *sym, @@ -646,7 +647,7 @@ elf_machine_tprel (struct link_map *map, } /* Call function at address VALUE (an OPD entry) to resolve ifunc relocs. */ -auto inline Elf64_Addr __attribute__ ((always_inline)) +static inline Elf64_Addr __attribute__ ((always_inline)) resolve_ifunc (Elf64_Addr value, const struct link_map *map, const struct link_map *sym_map) { @@ -676,8 +677,8 @@ resolve_ifunc (Elf64_Addr value, /* 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, +static inline void __attribute__ ((always_inline)) +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], const Elf64_Rela *reloc, const Elf64_Sym *sym, const struct r_found_version *version, @@ -705,7 +706,7 @@ elf_machine_rela (struct link_map *map, /* We need SYM_MAP even in the absence of TLS, for elf_machine_fixup_plt and STT_GNU_IFUNC. */ - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type); Elf64_Addr value = SYMBOL_ADDRESS (sym_map, sym, true) + reloc->r_addend; if (sym != NULL @@ -1035,8 +1036,8 @@ elf_machine_rela (struct link_map *map, MODIFIED_CODE_NOQUEUE (reloc_addr); } -auto inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +static inline void __attribute__ ((always_inline)) +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf64_Addr l_addr, const Elf64_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h index 5b0746175c..e7289d7ddc 100644 --- a/sysdeps/riscv/dl-machine.h +++ b/sysdeps/riscv/dl-machine.h @@ -161,17 +161,18 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t t, by RELOC_ADDR. SYM is the relocation symbol specified by R_INFO and MAP is the object containing the reloc. */ -auto inline void +static 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, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const ElfW(Rela) *reloc, const ElfW(Sym) *sym, + const struct r_found_version *version, void *const reloc_addr, int skip_ifunc) { ElfW(Addr) r_info = reloc->r_info; const unsigned long int r_type = ELFW (R_TYPE) (r_info); ElfW(Addr) *addr_field = (ElfW(Addr) *) reloc_addr; const ElfW(Sym) *const __attribute__ ((unused)) refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type); ElfW(Addr) value = 0; if (sym_map != NULL) value = SYMBOL_ADDRESS (sym_map, sym, true) + reloc->r_addend; @@ -279,7 +280,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, } } -auto inline void +static inline void __attribute__ ((always_inline)) elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, void *const reloc_addr) @@ -287,10 +288,11 @@ elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, *(ElfW(Addr) *) reloc_addr = l_addr + reloc->r_addend; } -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, ElfW(Addr) l_addr, - const ElfW(Rela) *reloc, int skip_ifunc) +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], + ElfW(Addr) l_addr, const ElfW(Rela) *reloc, + int skip_ifunc) { ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset); const unsigned int r_type = ELFW (R_TYPE) (reloc->r_info); @@ -320,9 +322,10 @@ elf_machine_lazy_rel (struct link_map *map, ElfW(Addr) l_addr, /* Set up the loaded object described by L so its stub function will jump to the on-demand fixup code __dl_runtime_resolve. */ -auto inline int +static inline int __attribute__ ((always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { #ifndef RTLD_BOOTSTRAP /* If using PLTs, fill in the first two entries of .got.plt. */ diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index 73cc007e34..cd16cc7e00 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -84,7 +84,8 @@ elf_machine_load_address (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((unused)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { extern void _dl_runtime_resolve (Elf32_Word); extern void _dl_runtime_profile (Elf32_Word); @@ -320,10 +321,11 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void +static 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, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const Elf32_Rela *reloc, const Elf32_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf32_Addr *const reloc_addr = reloc_addr_arg; @@ -356,7 +358,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, /* Only needed for R_390_COPY below. */ const Elf32_Sym *const refsym = sym; #endif - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL @@ -483,7 +486,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } } -auto inline void +static inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) @@ -492,9 +495,9 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, *reloc_addr = l_addr + reloc->r_addend; } -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr l_addr, const Elf32_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h index aa9d524bac..0330a8d7de 100644 --- a/sysdeps/s390/s390-64/dl-machine.h +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -74,7 +74,8 @@ elf_machine_load_address (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((unused)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { extern void _dl_runtime_resolve (Elf64_Word); extern void _dl_runtime_profile (Elf64_Word); @@ -267,10 +268,11 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, - const Elf64_Sym *sym, const struct r_found_version *version, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const Elf64_Rela *reloc, const Elf64_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf64_Addr *const reloc_addr = reloc_addr_arg; @@ -303,7 +305,8 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, /* Only needed for R_390_COPY below. */ const Elf64_Sym *const refsym = sym; #endif - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); Elf64_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL @@ -437,7 +440,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, } } -auto inline void +static inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, void *const reloc_addr_arg) @@ -446,9 +449,9 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, *reloc_addr = l_addr + reloc->r_addend; } -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf64_Addr l_addr, const Elf64_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index 122b417a17..0c22dfd848 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -69,7 +69,8 @@ elf_machine_load_address (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((unused, always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { Elf32_Addr *got; extern void _dl_runtime_resolve (Elf32_Word); @@ -259,10 +260,11 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void +static 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, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const Elf32_Rela *reloc, const Elf32_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf32_Addr *const reloc_addr = reloc_addr_arg; @@ -318,7 +320,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, else { const Elf32_Sym *const refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); value = SYMBOL_ADDRESS (sym_map, sym, true); value += reloc->r_addend; @@ -424,7 +427,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } } -auto inline void +static inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) @@ -443,9 +446,9 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, #undef COPY_UNALIGNED_WORD } -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr l_addr, const Elf32_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 0269e458ea..6361cfae9e 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -97,7 +97,8 @@ elf_machine_load_address (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { Elf32_Addr *plt; extern void _dl_runtime_resolve (Elf32_Word); @@ -327,10 +328,11 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void +static 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, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const Elf32_Rela *reloc, const Elf32_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf32_Addr *const reloc_addr = reloc_addr_arg; @@ -381,7 +383,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } else { - sym_map = RESOLVE_MAP (&sym, version, r_type); + sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type); value = SYMBOL_ADDRESS (sym_map, sym, true); } #else @@ -536,7 +538,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } } -auto inline void +static inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) @@ -545,9 +547,9 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, *reloc_addr += l_addr + reloc->r_addend; } -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr l_addr, const Elf32_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index bbd4566d8a..3fd18c6e5e 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -126,7 +126,8 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { if (l->l_info[DT_JMPREL] && lazy) { @@ -354,10 +355,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, - const Elf64_Sym *sym, const struct r_found_version *version, +elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], + const Elf64_Rela *reloc, const Elf64_Sym *sym, + const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { Elf64_Addr *const reloc_addr = reloc_addr_arg; @@ -408,7 +410,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, } else { - sym_map = RESOLVE_MAP (&sym, version, r_type); + sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type); value = SYMBOL_ADDRESS (sym_map, sym, true); } #else @@ -646,7 +648,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, } } -auto inline void +static inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, void *const reloc_addr_arg) @@ -655,9 +657,9 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, *reloc_addr = l_addr + reloc->r_addend; } -auto inline void +static inline void __attribute__ ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf64_Addr l_addr, const Elf64_Rela *reloc, int skip_ifunc) { diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index b3ed4dd467..9c0182d597 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -54,7 +54,8 @@ elf_machine_dynamic (void) entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int __attribute__ ((unused, always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int profile) { Elf64_Addr *got; extern void _dl_runtime_resolve_fxsave (ElfW(Word)) attribute_hidden; @@ -250,12 +251,11 @@ elf_machine_plt_value (struct link_map *map, const ElfW(Rela) *reloc, /* 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 ElfW(Rela) *reloc, - const ElfW(Sym) *sym, const struct r_found_version *version, - void *const reloc_addr_arg, int skip_ifunc) -{ +static inline void __attribute__((always_inline)) +elf_machine_rela(struct link_map *map, struct r_scope_elem *scope[], + const ElfW(Rela) *reloc, const ElfW(Sym) *sym, + const struct r_found_version *version, + void *const reloc_addr_arg, int skip_ifunc) { ElfW(Addr) *const reloc_addr = reloc_addr_arg; const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info); @@ -292,7 +292,8 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, # ifndef RTLD_BOOTSTRAP const ElfW(Sym) *const refsym = sym; # endif - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); + struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, + r_type); ElfW(Addr) value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL @@ -517,7 +518,7 @@ and creates an unsatisfiable circular dependency.\n", } } -auto inline void +static inline void __attribute ((always_inline)) elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, void *const reloc_addr_arg) @@ -536,9 +537,9 @@ elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, } } -auto inline void +static inline void __attribute ((always_inline)) -elf_machine_lazy_rel (struct link_map *map, +elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], ElfW(Addr) l_addr, const ElfW(Rela) *reloc, int skip_ifunc) { @@ -572,7 +573,7 @@ elf_machine_lazy_rel (struct link_map *map, /* Always initialize TLS descriptors completely at load time, in case static TLS is allocated for it that requires locking. */ - elf_machine_rela (map, reloc, sym, version, reloc_addr, skip_ifunc); + elf_machine_rela (map, scope, reloc, sym, version, reloc_addr, skip_ifunc); } else if (__glibc_unlikely (r_type == R_X86_64_IRELATIVE)) { |