mirror of
git://sourceware.org/git/glibc.git
synced 2025-01-24 12:25:35 +08:00
* elf/dynamic-link.h (elf_machine_rel, elf_machine_rela,
elf_machine_rel_relative, elf_machine_rela_relative): Don't assume reloc_addr is aligned. * sysdeps/alpha/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/arm/dl-machine.h (elf_machine_rel, elf_machine_rela, elf_machine_rel_relative, elf_machine_rela_relative): Adjust. * sysdeps/cris/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/hppa/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/i386/dl-machine.h (elf_machine_rel, elf_machine_rela, elf_machine_rel_relative, elf_machine_rela_relative): Adjust. * sysdeps/ia64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/m68k/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/mips/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela_relative, elf_machine_rela): Adjust. * sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/s390/s390-64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): * sysdeps/sh/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/x86_64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust.
This commit is contained in:
parent
775a8c02e1
commit
5027ae109a
@ -512,8 +512,9 @@ elf_machine_rela (struct link_map *map,
|
||||
const Elf64_Rela *reloc,
|
||||
const Elf64_Sym *sym,
|
||||
const struct r_found_version *version,
|
||||
Elf64_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
Elf64_Addr *const reloc_addr = reloc_addr_arg;
|
||||
unsigned long int const r_type = ELF64_R_TYPE (reloc->r_info);
|
||||
|
||||
#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC && !defined SHARED
|
||||
@ -538,15 +539,14 @@ elf_machine_rela (struct link_map *map,
|
||||
{
|
||||
/* XXX Make some timings. Maybe it's preferable to test for
|
||||
unaligned access and only do it the complex way if necessary. */
|
||||
void *reloc_addr_1 = reloc_addr;
|
||||
Elf64_Addr reloc_addr_val;
|
||||
|
||||
/* Load value without causing unaligned trap. */
|
||||
memcpy (&reloc_addr_val, reloc_addr_1, 8);
|
||||
memcpy (&reloc_addr_val, reloc_addr_arg, 8);
|
||||
reloc_addr_val += map->l_addr;
|
||||
|
||||
/* Store value without causing unaligned trap. */
|
||||
memcpy (reloc_addr_1, &reloc_addr_val, 8);
|
||||
memcpy (reloc_addr_arg, &reloc_addr_val, 8);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -598,10 +598,8 @@ elf_machine_rela (struct link_map *map,
|
||||
#ifndef RTLD_BOOTSTRAP
|
||||
else if (r_type == R_ALPHA_REFQUAD)
|
||||
{
|
||||
void *reloc_addr_1 = reloc_addr;
|
||||
|
||||
/* Store value without causing unaligned trap. */
|
||||
memcpy (reloc_addr_1, &sym_value, 8);
|
||||
memcpy (reloc_addr_arg, &sym_value, 8);
|
||||
}
|
||||
#endif
|
||||
#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
|
||||
@ -649,19 +647,18 @@ elf_machine_rela (struct link_map *map,
|
||||
|
||||
static inline void
|
||||
elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
|
||||
Elf64_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
/* XXX Make some timings. Maybe it's preverable to test for
|
||||
/* XXX Make some timings. Maybe it's preferable to test for
|
||||
unaligned access and only do it the complex way if necessary. */
|
||||
void *reloc_addr_1 = reloc_addr;
|
||||
Elf64_Addr reloc_addr_val;
|
||||
|
||||
/* Load value without causing unaligned trap. */
|
||||
memcpy (&reloc_addr_val, reloc_addr_1, 8);
|
||||
memcpy (&reloc_addr_val, reloc_addr_arg, 8);
|
||||
reloc_addr_val += l_addr;
|
||||
|
||||
/* Store value without causing unaligned trap. */
|
||||
memcpy (reloc_addr_1, &reloc_addr_val, 8);
|
||||
memcpy (reloc_addr_arg, &reloc_addr_val, 8);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* Machine-dependent ELF dynamic relocation inline functions. ARM version.
|
||||
Copyright (C) 1995,96,97,98,99,2000,2001,2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
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
|
||||
@ -419,8 +420,9 @@ fix_bad_pc24 (Elf32_Addr *const reloc_addr, Elf32_Addr value)
|
||||
static inline void
|
||||
elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
|
||||
const Elf32_Sym *sym, const struct r_found_version *version,
|
||||
Elf32_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
||||
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
|
||||
|
||||
#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
|
||||
@ -470,8 +472,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
|
||||
rtld_progname ?: "<program name unknown>",
|
||||
strtab + refsym->st_name);
|
||||
}
|
||||
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
|
||||
refsym->st_size));
|
||||
memcpy (reloc_addr_arg, (void *) value,
|
||||
MIN (sym->st_size, refsym->st_size));
|
||||
break;
|
||||
case R_ARM_GLOB_DAT:
|
||||
case R_ARM_JUMP_SLOT:
|
||||
@ -544,8 +546,9 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
|
||||
static inline void
|
||||
elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
const Elf32_Sym *sym, const struct r_found_version *version,
|
||||
Elf32_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
||||
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
|
||||
|
||||
if (__builtin_expect (r_type == R_ARM_RELATIVE, 0))
|
||||
@ -581,8 +584,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
rtld_progname ?: "<program name unknown>",
|
||||
strtab + refsym->st_name);
|
||||
}
|
||||
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
|
||||
refsym->st_size));
|
||||
memcpy (reloc_addr_arg, (void *) value,
|
||||
MIN (sym->st_size, refsym->st_size));
|
||||
break;
|
||||
# endif /* !RESOLVE_CONFLICT_FIND_MAP */
|
||||
case R_ARM_GLOB_DAT:
|
||||
@ -623,16 +626,18 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
|
||||
static inline void
|
||||
elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
|
||||
Elf32_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
||||
*reloc_addr += l_addr;
|
||||
}
|
||||
|
||||
# ifndef RTLD_BOOTSTRAP
|
||||
static inline void
|
||||
elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
|
||||
Elf32_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
||||
*reloc_addr = l_addr + reloc->r_addend;
|
||||
}
|
||||
# endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Machine-dependent ELF dynamic relocation inline functions. CRIS version.
|
||||
Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996-2001, 2002, 2003 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
|
||||
@ -280,8 +280,9 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
|
||||
static inline void
|
||||
elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
const Elf32_Sym *sym, const struct r_found_version *version,
|
||||
Elf32_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
||||
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
|
||||
|
||||
if (__builtin_expect (r_type == R_CRIS_RELATIVE, 0))
|
||||
@ -322,8 +323,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
rtld_progname ?: "<program name unknown>",
|
||||
strtab + refsym->st_name);
|
||||
}
|
||||
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
|
||||
refsym->st_size));
|
||||
memcpy (reloc_addr_arg, (void *) value,
|
||||
MIN (sym->st_size, refsym->st_size));
|
||||
break;
|
||||
|
||||
case R_CRIS_32:
|
||||
@ -364,8 +365,9 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
|
||||
static inline void
|
||||
elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
|
||||
Elf32_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
||||
*reloc_addr = l_addr + reloc->r_addend;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* Machine-dependent ELF dynamic relocation inline functions. PA-RISC version.
|
||||
Copyright (C) 1995-1997,1999,2000,2001,2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1997,1999,2000,2001,2002, 2003
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by David Huggins-Daines <dhd@debian.org>
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@ -481,8 +482,9 @@ asm ( \
|
||||
static inline void
|
||||
elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
const Elf32_Sym *sym, const struct r_found_version *version,
|
||||
Elf32_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
||||
const Elf32_Sym *const refsym = sym;
|
||||
unsigned long const r_type = ELF32_R_TYPE (reloc->r_info);
|
||||
struct link_map *sym_map;
|
||||
@ -531,9 +533,9 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
return;
|
||||
#endif
|
||||
/* .eh_frame can have unaligned relocs. */
|
||||
if ((unsigned long) reloc_addr & 3)
|
||||
if ((unsigned long) reloc_addr_arg & 3)
|
||||
{
|
||||
char *rel_addr = (char *) reloc_addr;
|
||||
char *rel_addr = (char *) reloc_addr_arg;
|
||||
rel_addr[0] = value >> 24;
|
||||
rel_addr[1] = value >> 16;
|
||||
rel_addr[2] = value >> 8;
|
||||
@ -614,7 +616,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
rtld_progname ?: "<program name unknown>",
|
||||
strtab + refsym->st_name);
|
||||
}
|
||||
memcpy (reloc_addr, (void *) value,
|
||||
memcpy (reloc_addr_arg, (void *) value,
|
||||
MIN (sym->st_size, refsym->st_size));
|
||||
return;
|
||||
|
||||
@ -637,8 +639,9 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
static inline void
|
||||
elf_machine_rela_relative (struct link_map *map, Elf32_Addr l_addr,
|
||||
const Elf32_Rela *reloc,
|
||||
Elf32_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
||||
unsigned long const r_type = ELF32_R_TYPE (reloc->r_info);
|
||||
Elf32_Addr value;
|
||||
|
||||
@ -651,9 +654,9 @@ elf_machine_rela_relative (struct link_map *map, Elf32_Addr l_addr,
|
||||
{
|
||||
case R_PARISC_DIR32:
|
||||
/* .eh_frame can have unaligned relocs. */
|
||||
if ((unsigned long) reloc_addr & 3)
|
||||
if ((unsigned long) reloc_addr_arg & 3)
|
||||
{
|
||||
char *rel_addr = (char *) reloc_addr;
|
||||
char *rel_addr = (char *) reloc_addr_arg;
|
||||
rel_addr[0] = value >> 24;
|
||||
rel_addr[1] = value >> 16;
|
||||
rel_addr[2] = value >> 8;
|
||||
|
@ -229,8 +229,9 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
|
||||
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,
|
||||
Elf32_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
||||
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
|
||||
|
||||
if (__builtin_expect (r_type == R_68K_RELATIVE, 0))
|
||||
@ -260,8 +261,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
rtld_progname ?: "<program name unknown>",
|
||||
strtab + refsym->st_name);
|
||||
}
|
||||
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
|
||||
refsym->st_size));
|
||||
memcpy (reloc_addr_arg, (void *) value,
|
||||
MIN (sym->st_size, refsym->st_size));
|
||||
break;
|
||||
case R_68K_GLOB_DAT:
|
||||
case R_68K_JMP_SLOT:
|
||||
@ -298,8 +299,9 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
|
||||
static inline void
|
||||
elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
|
||||
Elf32_Addr *const reloc_addr)
|
||||
void *const reloc_addr_arg)
|
||||
{
|
||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
||||
*reloc_addr = l_addr + reloc->r_addend;
|
||||
}
|
||||
|
||||
|
@ -534,10 +534,7 @@ static inline void
|
||||
#endif
|
||||
elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
|
||||
const ElfW(Sym) *sym, const struct r_found_version *version,
|
||||
/* We use void* because the location to be relocated
|
||||
is not required to be properly aligned for a
|
||||
ELFW(Addr). */
|
||||
void /* ElfW(Addr) */ *const reloc_addr)
|
||||
void *const reloc_addr)
|
||||
{
|
||||
const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
|
||||
|
||||
@ -640,7 +637,7 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
|
||||
|
||||
static inline void
|
||||
elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
|
||||
void /* ElfW(Addr) */ *const reloc_addr)
|
||||
void *const reloc_addr)
|
||||
{
|
||||
/* XXX Nothing to do. There is no relative relocation, right? */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user