public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [patch] handle unaligned arm abs relocs
@ 2011-12-13  0:20 Mike Frysinger
  2011-12-14 22:05 ` Carlos O'Donell
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Mike Frysinger @ 2011-12-13  0:20 UTC (permalink / raw)
  To: libc-ports

[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]

background can be found here:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51456

patch is below
-mike

2011-12-12  Mike Frysinger  <vapier@gentoo.org>

	* dl-machine.h (elf_machine_rel, R_ARM_ABS32): Declare "reloc_value".
	Replace reloc_addr addition with memcpy's.

diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 5ceeaa9..fe64800 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -413,6 +413,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel 
*reloc,
 	  break;
 	case R_ARM_ABS32:
 	  {
+	    Elf32_Addr reloc_value;
 # 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 +432,10 @@ 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.  */
+	    memcpy (&reloc_value, reloc_addr_arg, sizeof (reloc_value));
+	    reloc_value += value;
+	    memcpy (reloc_addr_arg, &reloc_value, sizeof (reloc_value));
 	    break;
 	  }
 	case R_ARM_TLS_DESC:

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-08-15  1:38 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-13  0:20 [patch] handle unaligned arm abs relocs Mike Frysinger
2011-12-14 22:05 ` Carlos O'Donell
2011-12-14 22:29   ` Mike Frysinger
2011-12-14 22:44     ` Carlos O'Donell
2011-12-15 17:48   ` Richard Henderson
2011-12-19 17:45 ` Joseph S. Myers
2011-12-19 18:27   ` Mike Frysinger
2011-12-19 19:57     ` Joseph S. Myers
2012-08-12  5:50 ` [PATCH v2] arm: handle unaligned ABS relocs Mike Frysinger
2012-08-12 13:01   ` Joseph S. Myers
2012-08-12 14:35     ` Mike Frysinger
2012-08-12 15:55       ` Joseph S. Myers
2012-08-12 18:51         ` Mike Frysinger
2012-08-12 13:26   ` Carlos O'Donell
2012-08-12 14:05     ` Andreas Schwab
2012-08-12 15:57     ` Joseph S. Myers
2012-08-14 21:49   ` Roland McGrath
2012-08-15  1:38     ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).