From patchwork Mon Dec 23 16:19:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 3397151 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CA6A19F169 for ; Mon, 23 Dec 2013 16:22:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 691602057D for ; Mon, 23 Dec 2013 16:22:39 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D373A2058C for ; Mon, 23 Dec 2013 16:22:37 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vv8G0-0005kF-8i; Mon, 23 Dec 2013 16:21:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vv8Fe-0002U6-Sd; Mon, 23 Dec 2013 16:21:06 +0000 Received: from mail-ea0-f175.google.com ([209.85.215.175]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vv8Ev-0002Ma-1i for linux-arm-kernel@lists.infradead.org; Mon, 23 Dec 2013 16:20:24 +0000 Received: by mail-ea0-f175.google.com with SMTP id z10so2437240ead.34 for ; Mon, 23 Dec 2013 08:19:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oInMehbGwo+w85zHbgDLJUvuxqLSrMyN5uPtHY5xNN0=; b=bDaaHCaZb7LiFCsSjZAWoXbhFZwcXOOqkuiZbSvC4RPcbirBDPUlOwPrTlGm4Gi4IG mzMumE5toFBDHIVowWxjJrAQONDuLUkKRC9UTgz9+KI/zhjGTKW8JQs7HWcy+FFukiZg UWl/94W5yNaB3GS8r4GeokmUa8i4OBEvuvc8CHvg4GDX1NpK0phC2cF6rrTdNJieErnq D5fZsRkgHIC0EF4jPyoZRI3gsTWMoLvOlW5u3kVlm1FZ4sj92Kw7B8hwNHZDNdYTp3dB Ps/Nv47OqHPfHRBDLs2g9TRmh6Idw///aCpOaansb2xbSViwqd6a2Yi5QqHvFVpIQbD1 vJrw== X-Gm-Message-State: ALoCoQnOK2JwRVEc6dqmkzJws7pez3L5JV0lWD4dvxZJljDdxwwbN8JjQ+r3IDIjw++RGmp4Bxc1 X-Received: by 10.15.54.72 with SMTP id s48mr22261611eew.3.1387815599241; Mon, 23 Dec 2013 08:19:59 -0800 (PST) Received: from condor-x220.synapse.com ([195.238.93.36]) by mx.google.com with ESMTPSA id 1sm46940687eeg.4.2013.12.23.08.19.57 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Dec 2013 08:19:58 -0800 (PST) From: Taras Kondratiuk To: Jon Medhurst , Russell King , Ben Dooks , linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/5] ARM: kprobes-test: Workaround GAS .align bug Date: Mon, 23 Dec 2013 18:19:39 +0200 Message-Id: <1387815579-15677-6-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1387815579-15677-1-git-send-email-taras.kondratiuk@linaro.org> References: <1387815579-15677-1-git-send-email-taras.kondratiuk@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131223_112021_419621_254BC03D X-CRM114-Status: GOOD ( 14.83 ) X-Spam-Score: -2.6 (--) Cc: Taras Kondratiuk , linaro-networking@linaro.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP By default if no fill symbol is given to .align directive in a code section it fills gap with NOPs. If previous fragment is not instruction-aligned, additional pre-alignment is done by zero bytes before NOPs. These zero bytes are marked as data by special symbol $d in symbol table. Unfortunately GAS assumes that there is only code in the code section so it "puts back" code symbol $a at the end of this pre-alignment. So if there is some data after alignment it will be interpreted as code and will be swapped back to LE for BE8 system during a final linking. If explicit fill value is given to .align, the NOP-padding code is skipped and symbol table does not get messed-up. So the workaround for this issue: Use explicit fill value if data should be aligned in the code section. Acked-by: Jon Medhurst Signed-off-by: Taras Kondratiuk --- arch/arm/kernel/kprobes-test.c | 2 +- arch/arm/kernel/kprobes-test.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c index 96e3dbc..162828e 100644 --- a/arch/arm/kernel/kprobes-test.c +++ b/arch/arm/kernel/kprobes-test.c @@ -113,7 +113,7 @@ * @ start of inline data... * .ascii "mov r0, r7" @ text title for test case * .byte 0 - * .align 2 + * .align 2, 0 * * @ TEST_ARG_REG * .byte ARG_TYPE_REG diff --git a/arch/arm/kernel/kprobes-test.h b/arch/arm/kernel/kprobes-test.h index e28a869..eecc90a 100644 --- a/arch/arm/kernel/kprobes-test.h +++ b/arch/arm/kernel/kprobes-test.h @@ -115,7 +115,7 @@ struct test_arg_end { /* multiple strings to be concatenated. */ \ ".ascii "#title" \n\t" \ ".byte 0 \n\t" \ - ".align 2 \n\t" + ".align 2, 0 \n\t" #define TEST_ARG_REG(reg, val) \ ".byte "__stringify(ARG_TYPE_REG)" \n\t" \