diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2003-07-31 06:33:53 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2003-07-31 06:33:53 +0000 |
commit | 87d254a7bf02b60e6cd0699ddca6105b3ea232c9 (patch) | |
tree | 8a8121db8c86680e1a9d34acdc844f73f8962bcf /sysdeps | |
parent | e4a6507c4c50580521b80970bfae00df472a549c (diff) | |
download | glibc-87d254a7bf02b60e6cd0699ddca6105b3ea232c9.zip glibc-87d254a7bf02b60e6cd0699ddca6105b3ea232c9.tar.gz glibc-87d254a7bf02b60e6cd0699ddca6105b3ea232c9.tar.bz2 |
* 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.
2003-07-31 Alexandre Oliva <aoliva@redhat.com>
* 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.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/alpha/dl-machine.h | 21 | ||||
-rw-r--r-- | sysdeps/arm/dl-machine.h | 23 | ||||
-rw-r--r-- | sysdeps/cris/dl-machine.h | 12 | ||||
-rw-r--r-- | sysdeps/hppa/dl-machine.h | 19 | ||||
-rw-r--r-- | sysdeps/i386/dl-machine.h | 20 | ||||
-rw-r--r-- | sysdeps/ia64/dl-machine.h | 6 | ||||
-rw-r--r-- | sysdeps/m68k/dl-machine.h | 10 | ||||
-rw-r--r-- | sysdeps/mips/dl-machine.h | 7 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/dl-machine.h | 6 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/dl-machine.h | 37 | ||||
-rw-r--r-- | sysdeps/s390/s390-32/dl-machine.h | 12 | ||||
-rw-r--r-- | sysdeps/s390/s390-64/dl-machine.h | 12 | ||||
-rw-r--r-- | sysdeps/sh/dl-machine.h | 32 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/dl-machine.h | 22 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/dl-machine.h | 47 | ||||
-rw-r--r-- | sysdeps/x86_64/dl-machine.h | 12 |
16 files changed, 166 insertions, 132 deletions
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 0101ba4..b3c1eac 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -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 diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 074762e..9c11f0b 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -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 diff --git a/sysdeps/cris/dl-machine.h b/sysdeps/cris/dl-machine.h index 0fa13a7..7354c49 100644 --- a/sysdeps/cris/dl-machine.h +++ b/sysdeps/cris/dl-machine.h @@ -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; } diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index 9cc10c4..cd180e7 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -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; diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index b0c3c7f..34019b8 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -391,8 +391,9 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc, 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 @@ -519,8 +520,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; default: _dl_reloc_bad_type (map, r_type, 0); @@ -534,8 +535,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 (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE) @@ -618,8 +620,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 */ default: @@ -634,8 +636,9 @@ 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; assert (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE); *reloc_addr += l_addr; } @@ -643,8 +646,9 @@ elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc, #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 /* !RTLD_BOOTSTRAP */ diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index 7aaf084..3edaca1 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -507,8 +507,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; const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info); Elf64_Addr value; @@ -607,8 +608,9 @@ 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) { + Elf64_Addr *const reloc_addr = reloc_addr_arg; /* ??? Ignore MSB and Instruction format for now. */ assert (ELF64_R_TYPE (reloc->r_info) == R_IA64_REL64LSB); diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index a09f611..5ae53a4 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -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; } diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index f644441..a402b39 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -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? */ } diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h index 0260ac8..a8c1e3e 100644 --- a/sysdeps/powerpc/powerpc32/dl-machine.h +++ b/sysdeps/powerpc/powerpc32/dl-machine.h @@ -356,8 +356,9 @@ extern void _dl_reloc_overflow (struct link_map *map, 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; Elf32_Addr value; const int r_type = ELF32_R_TYPE (reloc->r_info); @@ -456,8 +457,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; } diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h index 7f0353f..843737e 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.h +++ b/sysdeps/powerpc/powerpc64/dl-machine.h @@ -565,8 +565,9 @@ extern void _dl_reloc_overflow (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) { + Elf64_Addr *const reloc_addr = reloc_addr_arg; *reloc_addr = l_addr + reloc->r_addend; } @@ -598,8 +599,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; const int r_type = ELF64_R_TYPE (reloc->r_info); #ifndef RTLD_BOOTSTRAP const Elf64_Sym *const refsym = sym; @@ -766,27 +768,28 @@ elf_machine_rela (struct link_map *map, _dl_argv[0] ?: "<program name unknown>", strtab + refsym->st_name); } - memcpy (reloc_addr, (char *) value, MIN (sym->st_size, refsym->st_size)); + memcpy (reloc_addr_arg, (char *) value, + MIN (sym->st_size, refsym->st_size)); return; case R_PPC64_UADDR64: /* We are big-endian. */ - ((char *) reloc_addr)[0] = (value >> 56) & 0xff; - ((char *) reloc_addr)[1] = (value >> 48) & 0xff; - ((char *) reloc_addr)[2] = (value >> 40) & 0xff; - ((char *) reloc_addr)[3] = (value >> 32) & 0xff; - ((char *) reloc_addr)[4] = (value >> 24) & 0xff; - ((char *) reloc_addr)[5] = (value >> 16) & 0xff; - ((char *) reloc_addr)[6] = (value >> 8) & 0xff; - ((char *) reloc_addr)[7] = (value >> 0) & 0xff; + ((char *) reloc_addr_arg)[0] = (value >> 56) & 0xff; + ((char *) reloc_addr_arg)[1] = (value >> 48) & 0xff; + ((char *) reloc_addr_arg)[2] = (value >> 40) & 0xff; + ((char *) reloc_addr_arg)[3] = (value >> 32) & 0xff; + ((char *) reloc_addr_arg)[4] = (value >> 24) & 0xff; + ((char *) reloc_addr_arg)[5] = (value >> 16) & 0xff; + ((char *) reloc_addr_arg)[6] = (value >> 8) & 0xff; + ((char *) reloc_addr_arg)[7] = (value >> 0) & 0xff; return; case R_PPC64_UADDR32: /* We are big-endian. */ - ((char *) reloc_addr)[0] = (value >> 24) & 0xff; - ((char *) reloc_addr)[1] = (value >> 16) & 0xff; - ((char *) reloc_addr)[2] = (value >> 8) & 0xff; - ((char *) reloc_addr)[3] = (value >> 0) & 0xff; + ((char *) reloc_addr_arg)[0] = (value >> 24) & 0xff; + ((char *) reloc_addr_arg)[1] = (value >> 16) & 0xff; + ((char *) reloc_addr_arg)[2] = (value >> 8) & 0xff; + ((char *) reloc_addr_arg)[3] = (value >> 0) & 0xff; return; case R_PPC64_ADDR32: @@ -811,8 +814,8 @@ elf_machine_rela (struct link_map *map, if (dont_expect ((value + 0x8000) >= 0x10000)) _dl_reloc_overflow (map, "R_PPC64_UADDR16", reloc_addr, refsym); /* We are big-endian. */ - ((char *) reloc_addr)[0] = (value >> 8) & 0xff; - ((char *) reloc_addr)[1] = (value >> 0) & 0xff; + ((char *) reloc_addr_arg)[0] = (value >> 8) & 0xff; + ((char *) reloc_addr_arg)[1] = (value >> 0) & 0xff; break; case R_PPC64_ADDR16_DS: diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index 017077a..5c60a35 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -376,9 +376,10 @@ 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) + const Elf32_Sym *sym, const struct r_found_version *version, + 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 @@ -486,8 +487,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 case R_390_32: @@ -529,8 +530,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; } diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h index 35df120..b40c7c3 100644 --- a/sysdeps/s390/s390-64/dl-machine.h +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -344,9 +344,10 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, static inline void 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) + const Elf64_Sym *sym, const struct r_found_version *version, + void *const reloc_addr_arg) { + Elf64_Addr *const reloc_addr = reloc_addr_arg; const unsigned int r_type = ELF64_R_TYPE (reloc->r_info); #if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC @@ -454,8 +455,8 @@ elf_machine_rela (struct link_map *map, const Elf64_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 case R_390_64: @@ -509,8 +510,9 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, 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) { + Elf64_Addr *const reloc_addr = reloc_addr_arg; *reloc_addr = l_addr + reloc->r_addend; } diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index 6607d9b..5403c3c 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -456,15 +456,16 @@ 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) + const Elf32_Sym *sym, const struct r_found_version *version, + void *const reloc_addr_arg) { + Elf32_Addr *const reloc_addr = reloc_addr_arg; const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); Elf32_Addr value; -#define COPY_UNALIGNED_WORD(sw, tw, align) \ +#define COPY_UNALIGNED_WORD(swp, twp, align) \ { \ - void *__s = &(sw), *__t = &(tw); \ + void *__s = (swp), *__t = (twp); \ switch ((align)) \ { \ case 0: \ @@ -493,10 +494,12 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, value = map->l_addr + reloc->r_addend; else { - COPY_UNALIGNED_WORD (*reloc_addr, value, (int) reloc_addr & 3); + COPY_UNALIGNED_WORD (reloc_addr_arg, &value, + (int) reloc_addr_arg & 3); value += map->l_addr; } - COPY_UNALIGNED_WORD (value, *reloc_addr, (int) reloc_addr & 3); + COPY_UNALIGNED_WORD (&value, reloc_addr_arg, + (int) reloc_addr_arg & 3); } } #ifndef RTLD_BOOTSTRAP @@ -538,8 +541,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_SH_GLOB_DAT: case R_SH_JMP_SLOT: @@ -606,12 +609,14 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, used while loading those libraries. */ value -= map->l_addr + refsym->st_value + reloc->r_addend; #endif - COPY_UNALIGNED_WORD (value, *reloc_addr, (int) reloc_addr & 3); + COPY_UNALIGNED_WORD (&value, reloc_addr_arg, + (int) reloc_addr_arg & 3); break; } case R_SH_REL32: value = (value - (Elf32_Addr) reloc_addr); - COPY_UNALIGNED_WORD (value, *reloc_addr, (int) reloc_addr & 3); + COPY_UNALIGNED_WORD (&value, reloc_addr_arg, + (int) reloc_addr_arg & 3); break; default: _dl_reloc_bad_type (map, r_type, 0); @@ -622,18 +627,19 @@ 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; Elf32_Addr value; if (reloc->r_addend) value = l_addr + reloc->r_addend; else { - COPY_UNALIGNED_WORD (*reloc_addr, value, (int) reloc_addr & 3); + COPY_UNALIGNED_WORD (reloc_addr_arg, &value, (int) reloc_addr_arg & 3); value += l_addr; } - COPY_UNALIGNED_WORD (value, *reloc_addr, (int) reloc_addr & 3); + COPY_UNALIGNED_WORD (&value, reloc_addr_arg, (int) reloc_addr_arg & 3); #undef COPY_UNALIGNED_WORD } diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 8c821b9..45bb0bf 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -435,8 +435,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 !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC @@ -510,8 +511,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 case R_SPARC_GLOB_DAT: @@ -587,14 +588,14 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, *reloc_addr = (*reloc_addr & 0xffc00000) | (value >> 10); break; case R_SPARC_UA16: - ((unsigned char *) reloc_addr) [0] = value >> 8; - ((unsigned char *) reloc_addr) [1] = value; + ((unsigned char *) reloc_addr_arg) [0] = value >> 8; + ((unsigned char *) reloc_addr_arg) [1] = value; break; case R_SPARC_UA32: - ((unsigned char *) reloc_addr) [0] = value >> 24; - ((unsigned char *) reloc_addr) [1] = value >> 16; - ((unsigned char *) reloc_addr) [2] = value >> 8; - ((unsigned char *) reloc_addr) [3] = value; + ((unsigned char *) reloc_addr_arg) [0] = value >> 24; + ((unsigned char *) reloc_addr_arg) [1] = value >> 16; + ((unsigned char *) reloc_addr_arg) [2] = value >> 8; + ((unsigned char *) reloc_addr_arg) [3] = value; break; #endif case R_SPARC_NONE: /* Alright, Wilbur. */ @@ -610,8 +611,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; } diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index 802364b..5d87b4c 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -1,5 +1,6 @@ /* Machine-dependent ELF dynamic relocation inline functions. Sparc64 version. - Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 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 @@ -240,8 +241,9 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, static inline void 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; const unsigned long int r_type = ELF64_R_TYPE_ID (reloc->r_info); #if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC @@ -292,8 +294,8 @@ elf_machine_rela (struct link_map *map, const Elf64_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 case R_SPARC_64: @@ -392,31 +394,31 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, break; #ifndef RTLD_BOOTSTRAP case R_SPARC_UA16: - ((unsigned char *) reloc_addr) [0] = value >> 8; - ((unsigned char *) reloc_addr) [1] = value; + ((unsigned char *) reloc_addr_arg) [0] = value >> 8; + ((unsigned char *) reloc_addr_arg) [1] = value; break; case R_SPARC_UA32: - ((unsigned char *) reloc_addr) [0] = value >> 24; - ((unsigned char *) reloc_addr) [1] = value >> 16; - ((unsigned char *) reloc_addr) [2] = value >> 8; - ((unsigned char *) reloc_addr) [3] = value; + ((unsigned char *) reloc_addr_arg) [0] = value >> 24; + ((unsigned char *) reloc_addr_arg) [1] = value >> 16; + ((unsigned char *) reloc_addr_arg) [2] = value >> 8; + ((unsigned char *) reloc_addr_arg) [3] = value; break; case R_SPARC_UA64: - if (! ((long) reloc_addr & 3)) + if (! ((long) reloc_addr_arg & 3)) { /* Common in .eh_frame */ - ((unsigned int *) reloc_addr) [0] = value >> 32; - ((unsigned int *) reloc_addr) [1] = value; + ((unsigned int *) reloc_addr_arg) [0] = value >> 32; + ((unsigned int *) reloc_addr_arg) [1] = value; break; } - ((unsigned char *) reloc_addr) [0] = value >> 56; - ((unsigned char *) reloc_addr) [1] = value >> 48; - ((unsigned char *) reloc_addr) [2] = value >> 40; - ((unsigned char *) reloc_addr) [3] = value >> 32; - ((unsigned char *) reloc_addr) [4] = value >> 24; - ((unsigned char *) reloc_addr) [5] = value >> 16; - ((unsigned char *) reloc_addr) [6] = value >> 8; - ((unsigned char *) reloc_addr) [7] = value; + ((unsigned char *) reloc_addr_arg) [0] = value >> 56; + ((unsigned char *) reloc_addr_arg) [1] = value >> 48; + ((unsigned char *) reloc_addr_arg) [2] = value >> 40; + ((unsigned char *) reloc_addr_arg) [3] = value >> 32; + ((unsigned char *) reloc_addr_arg) [4] = value >> 24; + ((unsigned char *) reloc_addr_arg) [5] = value >> 16; + ((unsigned char *) reloc_addr_arg) [6] = value >> 8; + ((unsigned char *) reloc_addr_arg) [7] = value; break; #endif #if !defined RTLD_BOOTSTRAP || defined _NDEBUG @@ -430,8 +432,9 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, 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) { + Elf64_Addr *const reloc_addr = reloc_addr_arg; *reloc_addr = l_addr + reloc->r_addend; } diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index a5035fc..aebdebf 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -361,9 +361,10 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, static inline void 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) + const Elf64_Sym *sym, const struct r_found_version *version, + void *const reloc_addr_arg) { + Elf64_Addr *const reloc_addr = reloc_addr_arg; const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info); #if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC @@ -510,8 +511,8 @@ elf_machine_rela (struct link_map *map, const Elf64_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 default: @@ -525,8 +526,9 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, 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) { + Elf64_Addr *const reloc_addr = reloc_addr_arg; assert (ELF64_R_TYPE (reloc->r_info) == R_X86_64_RELATIVE); *reloc_addr = l_addr + reloc->r_addend; } |