From patchwork Fri Apr 4 09:59:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 27799 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2A18C20369 for ; Fri, 4 Apr 2014 09:59:55 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id lh14sf8401906vcb.6 for ; Fri, 04 Apr 2014 02:59:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:subject:date :message-id:x-original-sender:x-original-authentication-results; bh=Wh7juvu2iY5J8C90Or0m5ujaMLcOYQRumcE6ah2B5Vs=; b=AvIr3Ut4g2GUuNk93i1PIlNw1h78yusaSHVrVhh4c8qcCCcscZBJxp+sWY538JmVHz MYN9HCSXBAuzhRca0/5QKY/WBYi+CmRtXl33EhwtbPrX3UfeAsYLI3iaEYDxoydXXJ2K PGnmwY2WOX3GW3jGCSmLq+5qNvL13uqBoI70LbDH9hmyRgN49+deD5CScdNAnc8BDOzE SovFzcNTno2Dy9uA+qyxIOutQk3cXGh6q7nVjXdPgOWt3wSk0LlGST66eUa458+kmrEJ CrsRFOq/zKIbHNwXEMPtiiHAyISLC+jY4klKl2/kyqk38aYuy1TsPq9/MyvUmhzeqEOm kV6g== X-Gm-Message-State: ALoCoQl7JXQY21qJDJ3yVf02+R/bhD1TBrYLHxUnww7RFrQ+eFceMxSpolCvJmaId/d2vHl4hp3E X-Received: by 10.224.30.4 with SMTP id s4mr7333250qac.5.1396605594823; Fri, 04 Apr 2014 02:59:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.39.133 with SMTP id v5ls938700qgv.23.gmail; Fri, 04 Apr 2014 02:59:54 -0700 (PDT) X-Received: by 10.52.164.237 with SMTP id yt13mr10534204vdb.18.1396605594765; Fri, 04 Apr 2014 02:59:54 -0700 (PDT) Received: from mail-ve0-x232.google.com (mail-ve0-x232.google.com [2607:f8b0:400c:c01::232]) by mx.google.com with ESMTPS id v2si698061vet.142.2014.04.04.02.59.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Apr 2014 02:59:54 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::232; Received: by mail-ve0-f178.google.com with SMTP id jw12so1233473veb.23 for ; Fri, 04 Apr 2014 02:59:54 -0700 (PDT) X-Received: by 10.221.40.10 with SMTP id to10mr898033vcb.22.1396605594640; Fri, 04 Apr 2014 02:59:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp100463vcv; Fri, 4 Apr 2014 02:59:54 -0700 (PDT) X-Received: by 10.66.190.138 with SMTP id gq10mr13960313pac.108.1396605593716; Fri, 04 Apr 2014 02:59:53 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id ic8si4406920pad.13.2014.04.04.02.59.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Apr 2014 02:59:53 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-return-83363-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 4136 invoked by alias); 4 Apr 2014 09:59:37 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Subscribe: List-Archive: List-Post: , List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 4119 invoked by uid 89); 4 Apr 2014 09:59:37 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-we0-f170.google.com Received: from mail-we0-f170.google.com (HELO mail-we0-f170.google.com) (74.125.82.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 04 Apr 2014 09:59:35 +0000 Received: by mail-we0-f170.google.com with SMTP id w61so3187733wes.15 for ; Fri, 04 Apr 2014 02:59:32 -0700 (PDT) X-Received: by 10.180.13.8 with SMTP id d8mr1050685wic.13.1396605571758; Fri, 04 Apr 2014 02:59:31 -0700 (PDT) Received: from localhost.localdomain (cpc6-seac21-2-0-cust453.7-2.cable.virginm.net. [82.1.113.198]) by mx.google.com with ESMTPSA id gx9sm3655577wib.13.2014.04.04.02.59.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Apr 2014 02:59:30 -0700 (PDT) From: Will Newton To: binutils@sourceware.org Subject: [PATCH] gas/arm: Force output of a data mapping symbol for literal pools Date: Fri, 4 Apr 2014 10:59:26 +0100 Message-Id: <1396605566-7328-1-git-send-email-will.newton@linaro.org> X-IsSubscribed: yes X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 If there is a a trailing align statement in a code section we may output data padding with a data mapping followed by a code alignment with a code mapping. The literal pool may then be output with a code mapping symbol which will cause it to be endian swapped in a big-endian configuration. When outputting a literal pool make sure that a data mapping symbol is output in all cases. gas/ChangeLog: 2014-04-04 Will Newton * config/tc-arm.c (s_ltorg): Call make_mapping_symbol directly instead of mapping_state. gas/testsuite/ChangeLog: 2014-04-04 Will Newton * gas/arm/mapmisc.d: Check literal pool mapping with a trailing .align statement. * gas/arm/mapmisc.s: Likewise. --- gas/config/tc-arm.c | 5 +++-- gas/testsuite/gas/arm/mapmisc.d | 10 ++++++++++ gas/testsuite/gas/arm/mapmisc.s | 6 ++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 69299c7..88136f4 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -3328,8 +3328,6 @@ s_ltorg (int ignored ATTRIBUTE_UNUSED) || pool->next_free_entry == 0) return; - mapping_state (MAP_DATA); - /* Align pool as you have word accesses. Only make a frag if we have to. */ if (!need_pass_2) @@ -3337,6 +3335,9 @@ s_ltorg (int ignored ATTRIBUTE_UNUSED) record_alignment (now_seg, 2); + seg_info (now_seg)->tc_segment_info_data.mapstate = MAP_DATA; + make_mapping_symbol (MAP_DATA, (valueT) frag_now_fix (), frag_now); + sprintf (sym_name, "$$lit_\002%x", pool->id); symbol_locate (pool->symbol, sym_name, now_seg, diff --git a/gas/testsuite/gas/arm/mapmisc.d b/gas/testsuite/gas/arm/mapmisc.d index f5b7039..0e1d046 100644 --- a/gas/testsuite/gas/arm/mapmisc.d +++ b/gas/testsuite/gas/arm/mapmisc.d @@ -47,6 +47,10 @@ SYMBOL TABLE: 0+a0 l .text 00000000 \$d 0+a4 l .text 00000000 \$a 0+a8 l .text 00000000 \$a +0+b0 l .text 00000000 string +0+b0 l .text 00000000 \$d +0+b4 l .text 00000000 \$d +0+b3 l .text 00000000 \$d 0+00 l d .ARM.attributes 00000000 .ARM.attributes @@ -95,3 +99,9 @@ Disassembly of section .text: a0: 7778797a .word 0x7778797a a4: e1a00000 nop ; \(mov r0, r0\) a8: e1a00000 nop ; \(mov r0, r0\) + ac: e51f0000 ldr r0, \[pc, #-0\] ; b4 +000000b0 : + b0: 6261 .short 0x6261 + b2: 63 .byte 0x63 + b3: 00 .byte 0x00 + b4: 000000b0 .word 0x000000b0 diff --git a/gas/testsuite/gas/arm/mapmisc.s b/gas/testsuite/gas/arm/mapmisc.s index 1625515..c203e74 100644 --- a/gas/testsuite/gas/arm/mapmisc.s +++ b/gas/testsuite/gas/arm/mapmisc.s @@ -38,3 +38,9 @@ foo: nop .fill 0, 0, 0 nop +# This test should always be at the end. Check that a trailing align does +# not cause the literal pool to be emitted with a code mapping symbol. + ldr r0,=string +string: + .ascii "abc" + .align 2