about summary refs log tree commit diff
path: root/ports/sysdeps
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-01-01 02:36:32 -0500
committerMike Frysinger <vapier@gentoo.org>2012-08-12 14:49:45 -0400
commit3447612d3ce9f6903c19526595c3acf0043daf80 (patch)
tree93151f5272cd963217086829d7825e2e63c59e04 /ports/sysdeps
parent121dce05fe25ed878088fa7351c840a303182c65 (diff)
downloadglibc-3447612d3ce9f6903c19526595c3acf0043daf80.tar.gz
glibc-3447612d3ce9f6903c19526595c3acf0043daf80.tar.xz
glibc-3447612d3ce9f6903c19526595c3acf0043daf80.zip
arm: handle unaligned ABS relocs
When relocating a misaligned R_ARM_ABS32, glibc currently crashes.

URL: https://bugs.gentoo.org/394237
URL: http://gcc.gnu.org/PR51456
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'ports/sysdeps')
-rw-r--r--ports/sysdeps/arm/dl-machine.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/ports/sysdeps/arm/dl-machine.h b/ports/sysdeps/arm/dl-machine.h
index fe39a5e682..ca66e83e0d 100644
--- a/ports/sysdeps/arm/dl-machine.h
+++ b/ports/sysdeps/arm/dl-machine.h
@@ -413,6 +413,10 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	  break;
 	case R_ARM_ABS32:
 	  {
+	    struct unaligned
+	      {
+		Elf32_Addr x;
+	      } __attribute__((packed, may_alias));
 # ifndef RTLD_BOOTSTRAP
 	   /* This is defined in rtld.c, but nowhere in the static
 	      libc.a; make the reference weak so static programs can
@@ -431,7 +435,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 		 used while loading those libraries.  */
 	      value -= map->l_addr + refsym->st_value;
 # endif
-	    *reloc_addr += value;
+	    /* Support relocations on mis-aligned offsets.  */
+	    ((struct unaligned *) reloc_addr)->x += value;
 	    break;
 	  }
 	case R_ARM_TLS_DESC: