Message ID | 20140430162520.7d7eb209@octopus |
---|---|
State | Committed |
Headers |
Return-Path: <x14307373@homiemail-mx22.g.dreamhost.com> X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id B63F2360072 for <siddhesh@wilcox.dreamhost.com>; Wed, 30 Apr 2014 08:25:43 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14307373) id 606D55028A29; Wed, 30 Apr 2014 08:25:43 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx22.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx22.g.dreamhost.com (Postfix) with ESMTPS id 1DFE34F91F8B for <glibc@patchwork.siddhesh.in>; Wed, 30 Apr 2014 08:25:43 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id :mime-version:content-type; q=dns; s=default; b=yZWGopAxGkRLEj4i KIBJLRzR53E7dSiDPulmXHAucqWpfun/EugyGDdeetboqmL8nOb6jGgLWsccdDMi 2gvcYqI3fQbHvysATSBSS4jrPARcWY5zsB6dOLOIykMQ2FO58uKkTiFU5J5uS5d9 omxkMlBAhqh0z8o6wTtUtWtrG+8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id :mime-version:content-type; s=default; bh=RoEQubFGFqZdsQFALpHrDp QGicQ=; b=b99X2wzZZ6A6JRScSyXFblEvjeuG8+aaHerCrCR9o3TMNEQBKNoqsh CaYa9FkI6Q5l9h9c890C2JIYPbCfJzUaSvHPj2ggALJ2LmT+R5cXkTumqN1cPZAM 055xXyodkViCOh9aJod9R3P27EnowgHsmi/BNI0s5FMkS+GOh++II= Received: (qmail 3811 invoked by alias); 30 Apr 2014 15:25:39 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-glibc=patchwork.siddhesh.in@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 3802 invoked by uid 89); 30 Apr 2014 15:25:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FROM_12LTRDOM autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Wed, 30 Apr 2014 16:25:20 +0100 From: Julian Brown <julian@codesourcery.com> To: <libc-alpha@sourceware.org> CC: Jakub Jelinek <jakub@redhat.com>, <will.newton@linaro.org> Subject: [PATCH] ARM: Fix R_ARM_IRELATIVE RELA relocations Message-ID: <20140430162520.7d7eb209@octopus> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/q4IUQ75BKDAA.OFVTuVQ8xR" X-DH-Original-To: glibc@patchwork.siddhesh.in |
Commit Message
Julian Brown
April 30, 2014, 3:25 p.m. UTC
Hi, This patch fixes what I believe to be a bug in the handling of R_ARM_IRELATIVE RELA relocations. At present, these are handled the same as REL relocations: i.e. the addend is loaded from the relocation address. Most of the time this isn't a problem because RELA relocations aren't used on ARM (GNU/Linux at least) anyway, but it causes problems with prelink, which uses RELA on all targets for its conflict table. (Support for ifunc prelinking requires a prelink patch, not yet posted.) Anyway, this patch works, though I'm not 100% sure if it is correct: I notice that this code path received attention last year: https://sourceware.org/ml/libc-ports/2013-07/msg00000.html I'm not sure under what circumstances that patch would have had an effect, nor if my patch conflicts with that case. No regressions using Mentor's usual glibc cross-testing infrastructure. OK to apply? (Strangely, this appears to be my first glibc patch, so I'm not entirely certain if I have write access!) Thanks, Julian ChangeLog * sysdeps/arm/dl-machine.h (elf_machine_rela): Fix R_ARM_IRELATIVE handling.
Comments
On Wed, 30 Apr 2014, Julian Brown wrote: > Hi, > > This patch fixes what I believe to be a bug in the handling of > R_ARM_IRELATIVE RELA relocations. At present, these are handled the Please file a bug in glibc Bugzilla for this bug (glibc policy is that if fixing a bug that's user-visible in a release, it should first be filed in Bugzilla), then I'll commit the patch and close the bug.
On 30 April 2014 16:25, Julian Brown <julian@codesourcery.com> wrote: > Hi, > > This patch fixes what I believe to be a bug in the handling of > R_ARM_IRELATIVE RELA relocations. At present, these are handled the > same as REL relocations: i.e. the addend is loaded from the relocation > address. Most of the time this isn't a problem because RELA relocations > aren't used on ARM (GNU/Linux at least) anyway, but it causes problems > with prelink, which uses RELA on all targets for its conflict table. > (Support for ifunc prelinking requires a prelink patch, not yet posted.) > > Anyway, this patch works, though I'm not 100% sure if it is correct: I > notice that this code path received attention last year: > > https://sourceware.org/ml/libc-ports/2013-07/msg00000.html > > I'm not sure under what circumstances that patch would have had an > effect, nor if my patch conflicts with that case. I can't really explain what's happened there, I must have found that issue by reading the code rather than running it. Very odd. Your patch looks correct however.
On Wed, 30 Apr 2014 15:44:23 +0000 "Joseph S. Myers" <joseph@codesourcery.com> wrote: > On Wed, 30 Apr 2014, Julian Brown wrote: > > > Hi, > > > > This patch fixes what I believe to be a bug in the handling of > > R_ARM_IRELATIVE RELA relocations. At present, these are handled the > > Please file a bug in glibc Bugzilla for this bug (glibc policy is > that if fixing a bug that's user-visible in a release, it should > first be filed in Bugzilla), then I'll commit the patch and close the > bug. I created: https://sourceware.org/bugzilla/show_bug.cgi?id=16888 Thanks, Julian
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 02d1a5e..899b256 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -594,7 +594,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } break; case R_ARM_IRELATIVE: - value = map->l_addr + *reloc_addr; + value = map->l_addr + reloc->r_addend; value = ((Elf32_Addr (*) (int)) value) (GLRO(dl_hwcap)); *reloc_addr = value; break;