summaryrefslogtreecommitdiff
path: root/sysdeps/mips/dl-machine.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mips/dl-machine.h')
-rw-r--r--sysdeps/mips/dl-machine.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index 8c0b40e8de..91fc640388 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. MIPS version.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
@@ -190,7 +190,7 @@ elf_machine_load_address (void)
fiddles with global data. */
#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \
do { \
- struct link_map *map = &bootstrap_map; \
+ struct link_map *map = BOOTSTRAP_MAP; \
ElfW(Sym) *sym; \
ElfW(Addr) *got; \
int i, n; \
@@ -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++; \
@@ -453,6 +453,7 @@ dl_platform_init (void)
the corresponding PLT entry instead. */
static inline ElfW(Addr)
elf_machine_fixup_plt (struct link_map *map, lookup_t t,
+ const ElfW(Sym) *refsym, const ElfW(Sym) *sym,
const ElfW(Rel) *reloc,
ElfW(Addr) *reloc_addr, ElfW(Addr) value)
{
@@ -597,7 +598,7 @@ elf_machine_reloc (struct link_map *map, ElfW(Addr) r_info,
#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
{
@@ -662,7 +663,7 @@ elf_machine_reloc (struct link_map *map, ElfW(Addr) r_info,
"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;
@@ -676,7 +677,7 @@ elf_machine_reloc (struct link_map *map, ElfW(Addr) r_info,
/* 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
@@ -694,7 +695,8 @@ elf_machine_reloc (struct link_map *map, ElfW(Addr) r_info,
RTLD_PROGNAME, strtab + refsym->st_name);
}
memcpy (reloc_addr, (void *) value,
- MIN (sym->st_size, refsym->st_size));
+ sym->st_size < refsym->st_size
+ ? sym->st_size : refsym->st_size);
break;
}
@@ -796,7 +798,7 @@ elf_machine_got_rel (struct link_map *map, int lazy)
= 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)
@@ -840,7 +842,7 @@ elf_machine_got_rel (struct link_map *map, int lazy)
&& !(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. */