about summary refs log tree commit diff
path: root/sysdeps/i386/dl-machine.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/dl-machine.h')
-rw-r--r--sysdeps/i386/dl-machine.h17
1 files changed, 14 insertions, 3 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: