From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9936 invoked by alias); 12 Aug 2012 05:50:33 -0000 Received: (qmail 9928 invoked by uid 22791); 12 Aug 2012 05:50:32 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,TW_FN,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 12 Aug 2012 05:50:19 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id B21FC1B4001; Sun, 12 Aug 2012 05:50:17 +0000 (UTC) From: Mike Frysinger To: libc-ports@sourceware.org Cc: Richard Henderson , "Joseph S. Myers" Subject: [PATCH v2] arm: handle unaligned ABS relocs Date: Sun, 12 Aug 2012 05:50:00 -0000 Message-Id: <1344750618-13673-1-git-send-email-vapier@gentoo.org> In-Reply-To: <201112121920.17908.vapier@gentoo.org> References: <201112121920.17908.vapier@gentoo.org> X-IsSubscribed: yes Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00098.txt.bz2 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 2012-08-12 Mike Frysinger * sysdeps/arm/dl-machine.h (elf_machine_rel) [R_ARM_ABS32]: Declare a new unaligned struct. Cast reloc_addr to that when updating the value it points to. --- ports/sysdeps/arm/dl-machine.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ports/sysdeps/arm/dl-machine.h b/ports/sysdeps/arm/dl-machine.h index fe39a5e..ca66e83 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: -- 1.7.9.7