diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/i386/dl-machine.h | 17 | ||||
-rw-r--r-- | sysdeps/m68k/dl-machine.h | 22 | ||||
-rw-r--r-- | sysdeps/powerpc/dl-machine.h | 16 | ||||
-rw-r--r-- | sysdeps/sparc/dl-machine.h | 15 |
4 files changed, 61 insertions, 9 deletions
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 7b3336588d..fa4f23f51a 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -22,6 +22,8 @@ #define ELF_MACHINE_NAME "i386" +#include <sys/param.h> + #include <assert.h> /* Return nonzero iff E_MACHINE is compatible with the running host. */ @@ -252,9 +254,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, } else { -#ifndef RTLD_BOOTSTRAP const Elf32_Sym *const refsym = sym; -#endif Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info)); if (sym) value += sym->st_value; @@ -262,7 +262,18 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, switch (ELF32_R_TYPE (reloc->r_info)) { case R_386_COPY: - memcpy (reloc_addr, (void *) value, sym->st_size); + if (sym->st_size != refsym->st_size) + { + const char *strtab; + + strtab = ((void *) map->l_addr + + map->l_info[DT_STRTAB]->d_un.d_ptr); + _dl_sysdep_error ("Symbol `", strtab + refsym->st_name, + "' has different size in shared object, " + "consider re-linking\n", NULL); + } + memcpy (reloc_addr, (void *) value, MIN (sym->st_size, + refsym->st_size)); break; case R_386_GLOB_DAT: case R_386_JMP_SLOT: diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index d79ef25d81..e6b8f9e362 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -22,6 +22,8 @@ #define ELF_MACHINE_NAME "m68k" +#include <sys/param.h> + #include <assert.h> /* Return nonzero iff E_MACHINE is compatible with the running host. */ @@ -54,14 +56,14 @@ static inline Elf32_Addr elf_machine_load_address (void) { Elf32_Addr addr; - asm ("here: lea here(%%pc), %0\n" - " sub.l %#here, %0" + asm (".Lhere: lea .Lhere(%%pc), %0\n" + " sub.l %#.Lhere, %0" : "=a" (addr)); return addr; } /* The `subl' insn above will contain an R_68K_RELATIVE relocation - entry intended to insert the run-time address of the label `here'. + entry intended to insert the run-time address of the label `.Lhere'. This will be the first relocation in the text of the dynamic linker; we skip it to avoid trying to modify read-only text in this early stage. */ @@ -215,6 +217,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, *reloc_addr = map->l_addr + reloc->r_addend; else { + const Elf32_Sym *const refsym = sym; Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info)); if (sym) value += sym->st_value; @@ -222,7 +225,18 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, switch (ELF32_R_TYPE (reloc->r_info)) { case R_68K_COPY: - memcpy (reloc_addr, (void *) value, sym->st_size); + if (sym->st_size != refsym->st_size) + { + const char *strtab; + + strtab = ((void *) map->l_addr + + map->l_info[DT_STRTAB]->d_un.d_ptr); + _dl_sysdep_error ("Symbol `", strtab + refsym->st_name, + "' has different size in shared object, " + "consider re-linking\n", NULL); + } + memcpy (reloc_addr, (void *) value, MIN (sym->st_size, + refsym->st_size)); break; case R_68K_GLOB_DAT: case R_68K_JMP_SLOT: diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h index ab22e46956..3ad5ca89c9 100644 --- a/sysdeps/powerpc/dl-machine.h +++ b/sysdeps/powerpc/dl-machine.h @@ -22,6 +22,8 @@ #include <assert.h> #include <string.h> #include <link.h> +#include <sys/param.h> + /* stuff for the PLT */ #define PLT_INITIAL_ENTRY_WORDS 18 @@ -149,6 +151,7 @@ static inline void elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, const Elf32_Sym *sym, const struct r_found_version *version) { + const Elf32_Sym *const refsym = sym; Elf32_Addr *const reloc_addr = (Elf32_Addr *)(map->l_addr + reloc->r_offset); Elf32_Word loadbase, finaladdr; const int rinfo = ELF32_R_TYPE (reloc->r_info); @@ -232,7 +235,18 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } else if (rinfo == R_PPC_COPY) { - memcpy (reloc_addr, (char *) finaladdr, sym->st_size); + if (sym->st_size != refsym->st_size) + { + const char *strtab; + + strtab = ((void *) map->l_addr + + map->l_info[DT_STRTAB]->d_un.d_ptr); + _dl_sysdep_error ("Symbol `", strtab + refsym->st_name, + "' has different size in shared object, " + "consider re-linking\n", NULL); + } + memcpy (reloc_addr, (char *) finaladdr, MIN (sym->st_size, + refsym->st_size)); } #endif else if (rinfo == R_PPC_REL32) diff --git a/sysdeps/sparc/dl-machine.h b/sysdeps/sparc/dl-machine.h index 1ab3762ea0..03458144b7 100644 --- a/sysdeps/sparc/dl-machine.h +++ b/sysdeps/sparc/dl-machine.h @@ -22,6 +22,7 @@ #include <assert.h> #include <string.h> #include <link.h> +#include <sys/param.h> /* Some SPARC opcodes we need to use for self-modifying code. */ @@ -113,6 +114,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } else { + const Elf32_Sym *const refsym = sym; Elf32_Addr value; if (sym->st_shndx != SHN_UNDEF && ELF32_ST_BIND (sym->st_info) == STB_LOCAL) @@ -128,7 +130,18 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, switch (ELF32_R_TYPE (reloc->r_info)) { case R_SPARC_COPY: - memcpy (reloc_addr, (void *) value, sym->st_size); + if (sym->st_size != refsym->st_size) + { + const char *strtab; + + strtab = ((void *) map->l_addr + + map->l_info[DT_STRTAB]->d_un.d_ptr); + _dl_sysdep_error ("Symbol `", strtab + refsym->st_name, + "' has different size in shared object, " + "consider re-linking\n", NULL); + } + memcpy (reloc_addr, (void *) value, MIN (sym->st_size, + refsym->st_size)); break; case R_SPARC_GLOB_DAT: case R_SPARC_32: |