(elf_machine_rel): Add the symbol's value plus the run-time displacement to the relocation for non-GOT symbols. Set the relocation to the GOT entry for GOT symbols.
This commit is contained in:
parent
8166c749b6
commit
a8e4ee5ab1
|
@ -158,7 +158,7 @@ do { \
|
||||||
i = (got[1] & ELF_MIPS_GNU_GOT1_MASK)? 2 : 1; \
|
i = (got[1] & ELF_MIPS_GNU_GOT1_MASK)? 2 : 1; \
|
||||||
n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val; \
|
n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val; \
|
||||||
\
|
\
|
||||||
/* Add the run-time display to all local got entries. */ \
|
/* Add the run-time displacement to all local got entries. */ \
|
||||||
while (i < n) \
|
while (i < n) \
|
||||||
got[i++] += map->l_addr; \
|
got[i++] += map->l_addr; \
|
||||||
\
|
\
|
||||||
|
@ -508,10 +508,40 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
|
||||||
switch (ELFW(R_TYPE) (reloc->r_info))
|
switch (ELFW(R_TYPE) (reloc->r_info))
|
||||||
{
|
{
|
||||||
case R_MIPS_REL32:
|
case R_MIPS_REL32:
|
||||||
|
{
|
||||||
|
int symidx = ELFW(R_SYM) (reloc->r_info);
|
||||||
|
|
||||||
|
if (symidx)
|
||||||
|
{
|
||||||
|
const ElfW(Word) gotsym
|
||||||
|
= (const ElfW(Word)) map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;
|
||||||
|
|
||||||
|
if (symidx < gotsym)
|
||||||
|
{
|
||||||
#ifndef RTLD_BOOTSTRAP
|
#ifndef RTLD_BOOTSTRAP
|
||||||
if (map != &_dl_rtld_map)
|
if (map != &_dl_rtld_map)
|
||||||
#endif
|
#endif
|
||||||
*reloc_addr += map->l_addr;
|
*reloc_addr += sym->st_value + map->l_addr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifndef RTLD_BOOTSTRAP
|
||||||
|
const ElfW(Addr) *got
|
||||||
|
= (const ElfW(Addr) *) D_PTR (map, l_info[DT_PLTGOT]);
|
||||||
|
const ElfW(Word) local_gotno
|
||||||
|
= (const ElfW(Word))
|
||||||
|
map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;
|
||||||
|
|
||||||
|
*reloc_addr += got[symidx + local_gotno - gotsym];
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#ifndef RTLD_BOOTSTRAP
|
||||||
|
if (map != &_dl_rtld_map)
|
||||||
|
#endif
|
||||||
|
*reloc_addr += map->l_addr;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case R_MIPS_NONE: /* Alright, Wilbur. */
|
case R_MIPS_NONE: /* Alright, Wilbur. */
|
||||||
break;
|
break;
|
||||||
|
@ -584,7 +614,8 @@ elf_machine_got_rel (struct link_map *map, int lazy)
|
||||||
generated by gnu ld. Skip these reserved entries from relocation. */
|
generated by gnu ld. Skip these reserved entries from relocation. */
|
||||||
i = (got[1] & ELF_MIPS_GNU_GOT1_MASK)? 2 : 1;
|
i = (got[1] & ELF_MIPS_GNU_GOT1_MASK)? 2 : 1;
|
||||||
|
|
||||||
/* Add the run-time display to all local got entries if needed. */
|
/* Add the run-time displacement to all local got entries if
|
||||||
|
needed. */
|
||||||
if (__builtin_expect (map->l_addr != 0, 0))
|
if (__builtin_expect (map->l_addr != 0, 0))
|
||||||
{
|
{
|
||||||
while (i < n)
|
while (i < n)
|
||||||
|
|
Loading…
Reference in New Issue