Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:sp5-rebuild
glibc.14271
absolute-symbols.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File absolute-symbols.patch of Package glibc.14271
2018-04-04 Maciej W. Rozycki <macro@mips.com> [BZ #19818] * sysdeps/generic/ldsodefs.h (SYMBOL_ADDRESS): Handle SHN_ABS symbols. * elf/dl-addr.c (determine_info): Ignore SHN_ABS symbols. * elf/tst-absolute-sym.c: New file. * elf/tst-absolute-sym-lib.c: New file. * elf/tst-absolute-sym-lib.lds: New file. * elf/Makefile (tests): Add `tst-absolute-sym'. (modules-names): Add `tst-absolute-sym-lib'. (LDLIBS-tst-absolute-sym-lib.so): New variable. ($(objpfx)tst-absolute-sym-lib.so): New dependency. ($(objpfx)tst-absolute-sym): New dependency. 2018-04-04 Maciej W. Rozycki <macro@mips.com> [BZ #19818] * sysdeps/generic/ldsodefs.h (LOOKUP_VALUE_ADDRESS): Add `set' parameter. (SYMBOL_ADDRESS): New macro. [!ELF_FUNCTION_PTR_IS_SPECIAL] (DL_SYMBOL_ADDRESS): Use SYMBOL_ADDRESS for symbol address calculation. * elf/dl-runtime.c (_dl_fixup): Likewise. (_dl_profile_fixup): Likewise. * elf/dl-symaddr.c (_dl_symbol_address): Likewise. * elf/rtld.c (dl_main): Likewise. * sysdeps/aarch64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/alpha/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/arm/dl-machine.h (elf_machine_rel): Likewise. (elf_machine_rela): Likewise. * sysdeps/hppa/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Likewise. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. (elf_machine_rela): Likewise. * sysdeps/ia64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/m68k/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/microblaze/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/mips/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC): Likewise. (elf_machine_reloc): Likewise. (elf_machine_got_rel): Likewise. * sysdeps/mips/dl-trampoline.c (__dl_runtime_resolve): Likewise. * sysdeps/nios2/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/s390/s390-64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/sh/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/tile/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise. Index: glibc-2.26/elf/Makefile =================================================================== --- glibc-2.26.orig/elf/Makefile +++ glibc-2.26/elf/Makefile @@ -179,7 +179,8 @@ tests += restest1 preloadtest loadfail m tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \ tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \ - tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose + tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \ + tst-absolute-sym # reldep9 tests-internal += loadtest unload unload2 circleload1 \ neededtest neededtest2 neededtest3 neededtest4 \ @@ -263,7 +264,8 @@ modules-names = testobj1 testobj2 testob tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \ tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \ tst-latepthreadmod $(tst-tls-many-dynamic-modules) \ - tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin + tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin \ + tst-absolute-sym-lib ifeq (yes,$(have-mtls-dialect-gnu2)) tests += tst-gnu2-tls1 modules-names += tst-gnu2-tls1mod @@ -1410,3 +1412,7 @@ tst-env-setuid-ENV = MALLOC_CHECK_=2 MAL LD_HWCAP_MASK=0x1 tst-env-setuid-tunables-ENV = \ GLIBC_TUNABLES=glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096 + +LDLIBS-tst-absolute-sym-lib.so = tst-absolute-sym-lib.lds +$(objpfx)tst-absolute-sym-lib.so: $(LDLIBS-tst-absolute-sym-lib.so) +$(objpfx)tst-absolute-sym: $(objpfx)tst-absolute-sym-lib.so Index: glibc-2.26/elf/dl-addr.c =================================================================== --- glibc-2.26.orig/elf/dl-addr.c +++ glibc-2.26/elf/dl-addr.c @@ -60,6 +60,7 @@ determine_info (const ElfW(Addr) addr, s we can omit that test here. */ if ((symtab[symndx].st_shndx != SHN_UNDEF || symtab[symndx].st_value != 0) + && symtab[symndx].st_shndx != SHN_ABS && ELFW(ST_TYPE) (symtab[symndx].st_info) != STT_TLS && DL_ADDR_SYM_MATCH (match, &symtab[symndx], matchsym, addr) @@ -92,6 +93,7 @@ determine_info (const ElfW(Addr) addr, s && ELFW(ST_TYPE) (symtab->st_info) != STT_TLS && (symtab->st_shndx != SHN_UNDEF || symtab->st_value != 0) + && symtab->st_shndx != SHN_ABS && DL_ADDR_SYM_MATCH (match, symtab, matchsym, addr) && symtab->st_name < strtabsize) matchsym = (ElfW(Sym) *) symtab; Index: glibc-2.26/elf/dl-runtime.c =================================================================== --- glibc-2.26.orig/elf/dl-runtime.c +++ glibc-2.26/elf/dl-runtime.c @@ -124,14 +124,13 @@ _dl_fixup ( of the object that defines sym. Now add in the symbol offset. */ value = DL_FIXUP_MAKE_VALUE (result, - sym ? (LOOKUP_VALUE_ADDRESS (result) - + sym->st_value) : 0); + SYMBOL_ADDRESS (result, sym, false)); } else { /* We already found the symbol. The module (and therefore its load address) is also known. */ - value = DL_FIXUP_MAKE_VALUE (l, l->l_addr + sym->st_value); + value = DL_FIXUP_MAKE_VALUE (l, SYMBOL_ADDRESS (l, sym, true)); result = l; } @@ -241,9 +240,7 @@ _dl_profile_fixup ( of the object that defines sym. Now add in the symbol offset. */ value = DL_FIXUP_MAKE_VALUE (result, - defsym != NULL - ? LOOKUP_VALUE_ADDRESS (result) - + defsym->st_value : 0); + SYMBOL_ADDRESS (result, defsym, false)); if (defsym != NULL && __builtin_expect (ELFW(ST_TYPE) (defsym->st_info) @@ -254,7 +251,7 @@ _dl_profile_fixup ( { /* We already found the symbol. The module (and therefore its load address) is also known. */ - value = DL_FIXUP_MAKE_VALUE (l, l->l_addr + refsym->st_value); + value = DL_FIXUP_MAKE_VALUE (l, SYMBOL_ADDRESS (l, refsym, true)); if (__builtin_expect (ELFW(ST_TYPE) (refsym->st_info) == STT_GNU_IFUNC, 0)) Index: glibc-2.26/elf/dl-symaddr.c =================================================================== --- glibc-2.26.orig/elf/dl-symaddr.c +++ glibc-2.26/elf/dl-symaddr.c @@ -22,7 +22,7 @@ void * _dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref) { - ElfW(Addr) value = (map ? map->l_addr : 0) + ref->st_value; + ElfW(Addr) value = SYMBOL_ADDRESS (map, ref, false); /* Return the pointer to function descriptor. */ if (ELFW(ST_TYPE) (ref->st_info) == STT_FUNC) Index: glibc-2.26/elf/rtld.c =================================================================== --- glibc-2.26.orig/elf/rtld.c +++ glibc-2.26/elf/rtld.c @@ -1916,7 +1916,7 @@ ERROR: ld.so: object '%s' cannot be load NULL, ELF_RTYPE_CLASS_PLT, DL_LOOKUP_ADD_DEPENDENCY, NULL); - loadbase = LOOKUP_VALUE_ADDRESS (result); + loadbase = LOOKUP_VALUE_ADDRESS (result, false); _dl_printf ("%s found at 0x%0*Zd in object at 0x%0*Zd\n", _dl_argv[i], Index: glibc-2.26/elf/tst-absolute-sym-lib.c =================================================================== --- /dev/null +++ glibc-2.26/elf/tst-absolute-sym-lib.c @@ -0,0 +1,25 @@ +/* BZ #19818 absolute symbol calculation shared module. + Copyright (C) 2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +extern char absolute; + +void * +get_absolute (void) +{ + return &absolute; +} Index: glibc-2.26/elf/tst-absolute-sym-lib.lds =================================================================== --- /dev/null +++ glibc-2.26/elf/tst-absolute-sym-lib.lds @@ -0,0 +1,19 @@ +/* BZ #19818 absolute symbol calculation linker script. + Copyright (C) 2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +"absolute" = 0x55aa; Index: glibc-2.26/elf/tst-absolute-sym.c =================================================================== --- /dev/null +++ glibc-2.26/elf/tst-absolute-sym.c @@ -0,0 +1,38 @@ +/* BZ #19818 absolute symbol calculation main executable. + Copyright (C) 2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <support/check.h> +#include <support/support.h> +#include <support/test-driver.h> + +void *get_absolute (void); + +static int +do_test (void) +{ + void *ref = (void *) 0x55aa; + void *ptr; + + ptr = get_absolute (); + if (ptr != ref) + FAIL_EXIT1 ("Got %p, expected %p\n", ptr, ref); + + return 0; +} + +#include <support/test-driver.c> Index: glibc-2.26/sysdeps/aarch64/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/aarch64/dl-machine.h +++ glibc-2.26/sysdeps/aarch64/dl-machine.h @@ -258,7 +258,7 @@ elf_machine_rela (struct link_map *map, { const ElfW(Sym) *const refsym = sym; struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - ElfW(Addr) value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; + ElfW(Addr) value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL && __glibc_unlikely (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC) Index: glibc-2.26/sysdeps/alpha/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/alpha/dl-machine.h +++ glibc-2.26/sysdeps/alpha/dl-machine.h @@ -419,7 +419,7 @@ elf_machine_rela (struct link_map *map, if (sym_map) { sym_raw_value += sym->st_value; - sym_value = sym_raw_value + sym_map->l_addr; + sym_value += SYMBOL_ADDRESS (sym_map, sym, true); } if (r_type == R_ALPHA_GLOB_DAT) Index: glibc-2.26/sysdeps/arm/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/arm/dl-machine.h +++ glibc-2.26/sysdeps/arm/dl-machine.h @@ -389,7 +389,7 @@ elf_machine_rel (struct link_map *map, c { const Elf32_Sym *const refsym = sym; struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; + Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0) @@ -449,7 +449,7 @@ elf_machine_rel (struct link_map *map, c binding found in the user program or a loaded library rather than the dynamic linker's built-in definitions used while loading those libraries. */ - value -= map->l_addr + refsym->st_value; + value -= SYMBOL_ADDRESS (map, refsym, true); # endif /* Support relocations on mis-aligned offsets. */ ((struct unaligned *) reloc_addr)->x += value; @@ -551,7 +551,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Sym *const refsym = sym; # endif struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; + Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0) Index: glibc-2.26/sysdeps/generic/ldsodefs.h =================================================================== --- glibc-2.26.orig/sysdeps/generic/ldsodefs.h +++ glibc-2.26/sysdeps/generic/ldsodefs.h @@ -66,14 +66,21 @@ __BEGIN_DECLS /* Result of the lookup functions and how to retrieve the base address. */ typedef struct link_map *lookup_t; #define LOOKUP_VALUE(map) map -#define LOOKUP_VALUE_ADDRESS(map) ((map) ? (map)->l_addr : 0) +#define LOOKUP_VALUE_ADDRESS(map, set) ((set) || (map) ? (map)->l_addr : 0) + +/* Calculate the address of symbol REF using the base address from map MAP, + if non-NULL. Don't check for NULL map if MAP_SET is TRUE. */ +#define SYMBOL_ADDRESS(map, ref, map_set) \ + ((ref) == NULL ? 0 \ + : (__glibc_unlikely ((ref)->st_shndx == SHN_ABS) ? 0 \ + : LOOKUP_VALUE_ADDRESS (map, map_set)) + (ref)->st_value) /* On some architectures a pointer to a function is not just a pointer to the actual code of the function but rather an architecture specific descriptor. */ #ifndef ELF_FUNCTION_PTR_IS_SPECIAL # define DL_SYMBOL_ADDRESS(map, ref) \ - (void *) (LOOKUP_VALUE_ADDRESS (map) + ref->st_value) + (void *) SYMBOL_ADDRESS (map, ref, false) # define DL_LOOKUP_ADDRESS(addr) ((ElfW(Addr)) (addr)) # define DL_CALL_DT_INIT(map, start, argc, argv, env) \ ((init_t) (start)) (argc, argv, env) Index: glibc-2.26/sysdeps/hppa/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/hppa/dl-machine.h +++ glibc-2.26/sysdeps/hppa/dl-machine.h @@ -565,7 +565,7 @@ elf_machine_rela (struct link_map *map, if (sym_map) { - value = sym ? sym_map->l_addr + sym->st_value : 0; + value = SYMBOL_ADDRESS (sym_map, sym, true); value += reloc->r_addend; } else @@ -589,8 +589,8 @@ elf_machine_rela (struct link_map *map, case R_PARISC_DIR21L: { unsigned int insn = *(unsigned int *)reloc_addr; - value = sym_map->l_addr + sym->st_value - + ((reloc->r_addend + 0x1000) & -0x2000); + value = (SYMBOL_ADDRESS (sym_map, sym, true) + + ((reloc->r_addend + 0x1000) & -0x2000)); value = value >> 11; insn = (insn &~ 0x1fffff) | reassemble_21 (value); *(unsigned int *)reloc_addr = insn; @@ -600,8 +600,8 @@ elf_machine_rela (struct link_map *map, case R_PARISC_DIR14R: { unsigned int insn = *(unsigned int *)reloc_addr; - value = ((sym_map->l_addr + sym->st_value) & 0x7ff) - + (((reloc->r_addend & 0x1fff) ^ 0x1000) - 0x1000); + value = ((SYMBOL_ADDRESS (sym_map, sym, true) & 0x7ff) + + (((reloc->r_addend & 0x1fff) ^ 0x1000) - 0x1000)); insn = (insn &~ 0x3fff) | reassemble_14 (value); *(unsigned int *)reloc_addr = insn; } Index: glibc-2.26/sysdeps/hppa/dl-symaddr.c =================================================================== --- glibc-2.26.orig/sysdeps/hppa/dl-symaddr.c +++ glibc-2.26/sysdeps/hppa/dl-symaddr.c @@ -23,7 +23,7 @@ void * _dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref) { /* Find the "ip" from the "map" and symbol "ref" */ - Elf32_Addr value = (map ? map->l_addr : 0) + ref->st_value; + Elf32_Addr value = SYMBOL_ADDRESS (map, ref, false); /* On hppa, we have to return the pointer to function descriptor. This involves an "| 2" to inform $$dyncall that this is a plabel32 */ Index: glibc-2.26/sysdeps/i386/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/i386/dl-machine.h +++ glibc-2.26/sysdeps/i386/dl-machine.h @@ -315,7 +315,7 @@ elf_machine_rel (struct link_map *map, c const Elf32_Sym *const refsym = sym; # endif struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; + Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, @@ -496,7 +496,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Sym *const refsym = sym; # endif struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; + Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1) Index: glibc-2.26/sysdeps/ia64/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/ia64/dl-machine.h +++ glibc-2.26/sysdeps/ia64/dl-machine.h @@ -419,7 +419,7 @@ elf_machine_rela (struct link_map *map, /* RESOLVE_MAP() will return NULL if it fail to locate the symbol. */ if ((sym_map = RESOLVE_MAP (&sym, version, r_type))) { - value = sym_map->l_addr + sym->st_value + reloc->r_addend; + value = SYMBOL_ADDRESS (sym_map, sym, true) + reloc->r_addend; if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_DIR64LSB)) ;/* No adjustment. */ Index: glibc-2.26/sysdeps/m68k/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/m68k/dl-machine.h +++ glibc-2.26/sysdeps/m68k/dl-machine.h @@ -223,7 +223,7 @@ elf_machine_rela (struct link_map *map, { const Elf32_Sym *const refsym = sym; struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; + Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); switch (r_type) { Index: glibc-2.26/sysdeps/microblaze/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/microblaze/dl-machine.h +++ glibc-2.26/sysdeps/microblaze/dl-machine.h @@ -223,7 +223,7 @@ elf_machine_rela (struct link_map *map, { const Elf32_Sym *const refsym = sym; struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; + Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); value += reloc->r_addend; if (r_type == R_MICROBLAZE_GLOB_DAT || Index: glibc-2.26/sysdeps/mips/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/mips/dl-machine.h +++ glibc-2.26/sysdeps/mips/dl-machine.h @@ -220,7 +220,7 @@ do { \ while (i--) \ { \ if (sym->st_shndx == SHN_UNDEF || sym->st_shndx == SHN_COMMON) \ - *got = map->l_addr + sym->st_value; \ + *got = SYMBOL_ADDRESS (map, sym, true); \ else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC \ && *got != sym->st_value) \ *got += map->l_addr; \ @@ -230,7 +230,7 @@ do { \ *got += map->l_addr; \ } \ else \ - *got = map->l_addr + sym->st_value; \ + *got = SYMBOL_ADDRESS (map, sym, true); \ \ got++; \ sym++; \ @@ -598,7 +598,7 @@ elf_machine_reloc (struct link_map *map, #ifndef RTLD_BOOTSTRAP if (map != &GL(dl_rtld_map)) #endif - reloc_value += sym->st_value + map->l_addr; + reloc_value += SYMBOL_ADDRESS (map, sym, true); } else { @@ -663,7 +663,7 @@ elf_machine_reloc (struct link_map *map, "found jump slot relocation with non-zero addend"); sym_map = RESOLVE_MAP (&sym, version, r_type); - value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; + value = SYMBOL_ADDRESS (sym_map, sym, true); *addr_field = value; break; @@ -677,7 +677,7 @@ elf_machine_reloc (struct link_map *map, /* Calculate the address of the symbol. */ sym_map = RESOLVE_MAP (&sym, version, r_type); - value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; + value = SYMBOL_ADDRESS (sym_map, sym, true); if (__builtin_expect (sym == NULL, 0)) /* This can happen in trace mode if an object could not be @@ -797,7 +797,7 @@ elf_machine_got_rel (struct link_map *ma = vernum ? &map->l_versions[vernum[sym_index] & 0x7fff] : NULL; \ struct link_map *sym_map; \ sym_map = RESOLVE_MAP (&ref, version, reloc); \ - ref ? sym_map->l_addr + ref->st_value : 0; \ + SYMBOL_ADDRESS (sym_map, ref, true); \ }) if (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL) @@ -841,7 +841,7 @@ elf_machine_got_rel (struct link_map *ma && !(sym->st_other & STO_MIPS_PLT)) { if (lazy) - *got = sym->st_value + map->l_addr; + *got = SYMBOL_ADDRESS (map, sym, true); else /* This is a lazy-binding stub, so we don't need the canonical address. */ Index: glibc-2.26/sysdeps/mips/dl-trampoline.c =================================================================== --- glibc-2.26.orig/sysdeps/mips/dl-trampoline.c +++ glibc-2.26/sysdeps/mips/dl-trampoline.c @@ -192,12 +192,12 @@ __dl_runtime_resolve (ElfW(Word) sym_ind /* Currently value contains the base load address of the object that defines sym. Now add in the symbol offset. */ - value = (sym ? sym_map->l_addr + sym->st_value : 0); + value = SYMBOL_ADDRESS (sym_map, sym, true); } else /* We already found the symbol. The module (and therefore its load address) is also known. */ - value = l->l_addr + sym->st_value; + value = SYMBOL_ADDRESS (l, sym, true); /* Apply the relocation with that value. */ *(got + local_gotno + sym_index - gotsym) = value; Index: glibc-2.26/sysdeps/nios2/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/nios2/dl-machine.h +++ glibc-2.26/sysdeps/nios2/dl-machine.h @@ -250,7 +250,7 @@ elf_machine_rela (struct link_map *map, { const Elf32_Sym *const refsym = sym; struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; + Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); switch (r_type) { Index: glibc-2.26/sysdeps/powerpc/powerpc32/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/powerpc/powerpc32/dl-machine.h +++ glibc-2.26/sysdeps/powerpc/powerpc32/dl-machine.h @@ -314,7 +314,7 @@ elf_machine_rela (struct link_map *map, else { sym_map = RESOLVE_MAP (&sym, version, r_type); - value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; + value = SYMBOL_ADDRESS (sym_map, sym, true); } value += reloc->r_addend; #else Index: glibc-2.26/sysdeps/powerpc/powerpc64/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/powerpc/powerpc64/dl-machine.h +++ glibc-2.26/sysdeps/powerpc/powerpc64/dl-machine.h @@ -706,8 +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); - Elf64_Addr value = ((sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value) - + reloc->r_addend); + Elf64_Addr value = SYMBOL_ADDRESS (sym_map, sym, true) + reloc->r_addend; if (sym != NULL && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0) Index: glibc-2.26/sysdeps/s390/s390-32/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/s390/s390-32/dl-machine.h +++ glibc-2.26/sysdeps/s390/s390-32/dl-machine.h @@ -358,7 +358,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Sym *const refsym = sym; #endif struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; + Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0) Index: glibc-2.26/sysdeps/s390/s390-64/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/s390/s390-64/dl-machine.h +++ glibc-2.26/sysdeps/s390/s390-64/dl-machine.h @@ -305,7 +305,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Sym *const refsym = sym; #endif struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf64_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; + Elf64_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, Index: glibc-2.26/sysdeps/sh/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/sh/dl-machine.h +++ glibc-2.26/sysdeps/sh/dl-machine.h @@ -320,7 +320,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Sym *const refsym = sym; struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; + value = SYMBOL_ADDRESS (sym_map, sym, true); value += reloc->r_addend; switch (r_type) @@ -406,7 +406,7 @@ elf_machine_rela (struct link_map *map, binding found in the user program or a loaded library rather than the dynamic linker's built-in definitions used while loading those libraries. */ - value -= map->l_addr + refsym->st_value + reloc->r_addend; + value -= SYMBOL_ADDRESS (map, refsym, true) + reloc->r_addend; #endif COPY_UNALIGNED_WORD (&value, reloc_addr_arg, (int) reloc_addr_arg & 3); Index: glibc-2.26/sysdeps/sparc/sparc32/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/sparc/sparc32/dl-machine.h +++ glibc-2.26/sysdeps/sparc/sparc32/dl-machine.h @@ -381,7 +381,7 @@ elf_machine_rela (struct link_map *map, else { sym_map = RESOLVE_MAP (&sym, version, r_type); - value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; + value = SYMBOL_ADDRESS (sym_map, sym, true); } #else value = 0; Index: glibc-2.26/sysdeps/sparc/sparc64/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/sparc/sparc64/dl-machine.h +++ glibc-2.26/sysdeps/sparc/sparc64/dl-machine.h @@ -408,7 +408,7 @@ elf_machine_rela (struct link_map *map, else { sym_map = RESOLVE_MAP (&sym, version, r_type); - value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; + value = SYMBOL_ADDRESS (sym_map, sym, true); } #else value = 0; Index: glibc-2.26/sysdeps/tile/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/tile/dl-machine.h +++ glibc-2.26/sysdeps/tile/dl-machine.h @@ -559,7 +559,7 @@ elf_machine_rela (struct link_map *map, else if (ELFW_ST_TYPE (sym->st_info) == STT_SECTION) value = map->l_addr; /* like a RELATIVE reloc */ else - value = sym_map->l_addr + sym->st_value; + value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0) Index: glibc-2.26/sysdeps/x86_64/dl-machine.h =================================================================== --- glibc-2.26.orig/sysdeps/x86_64/dl-machine.h +++ glibc-2.26/sysdeps/x86_64/dl-machine.h @@ -306,8 +306,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Sym) *const refsym = sym; # endif struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - ElfW(Addr) value = (sym == NULL ? 0 - : (ElfW(Addr)) sym_map->l_addr + sym->st_value); + ElfW(Addr) value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC,
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor