From patchwork Fri Jan 10 17:58:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 3467451 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1189EC02DC for ; Fri, 10 Jan 2014 17:59:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 077ED2013A for ; Fri, 10 Jan 2014 17:59:17 +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 432B820149 for ; Fri, 10 Jan 2014 17:59:15 +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 1W1gMP-0004Sf-4Q; Fri, 10 Jan 2014 17:59:09 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1gMM-0007c5-85; Fri, 10 Jan 2014 17:59:06 +0000 Received: from mail-ea0-f173.google.com ([209.85.215.173]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1gMI-0007Zb-9O for linux-arm-kernel@lists.infradead.org; Fri, 10 Jan 2014 17:59:03 +0000 Received: by mail-ea0-f173.google.com with SMTP id o10so2205375eaj.32 for ; Fri, 10 Jan 2014 09:58:45 -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=K9bGKr8oOBu/T2vhjimjaWNidax8yKi+m9gPnccatlk=; b=Gm5nh0/TGUQvl0av6ka1anZx8CtWZ1avuxpuELohqO71OIWH0LRY7bpeUJrLPK0OYr HHTI6G2E7Zk38UZwLd6fM4frJgz8TnsedjUvK/tmNHzjiftyw8SDk1fEa9BEvM77kmt6 bNGMnF0HiJNFs4vrduntpt9aTVllOK4o6ilCgeIVb7/DUKp+lzvmIAAdYOglTHT5SIXP YKL89tC+TNhYuPJBbAsugByX4yiwHoMcUF31Zj9OyanesmHAl2gbBmjygPAz0o+zsYw/ BE+Z8CMxtaPdKfF1xam+dLPnVxyesDOP6jL91jN/ul0xf5m9fmqVVYdPFPyBMsxoluze 6mqA== X-Gm-Message-State: ALoCoQn6fbTkqUJCU/APBvNx2g85wjlMjfH0aYViyb9DnOnAGkJQ30/ogErRR2ez9+r19R1+UmcX X-Received: by 10.14.215.68 with SMTP id d44mr3054253eep.90.1389376723324; Fri, 10 Jan 2014 09:58:43 -0800 (PST) Received: from condor-x220.synapse.com ([195.238.93.36]) by mx.google.com with ESMTPSA id p45sm16407719eeg.1.2014.01.10.09.58.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Jan 2014 09:58:42 -0800 (PST) From: Taras Kondratiuk To: Russell King , Ben Dooks , Jon Medhurst , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 5/5] ARM: kprobes-test: Workaround GAS .align bug Date: Fri, 10 Jan 2014 19:58:26 +0200 Message-Id: <1389376706-30051-6-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389376706-30051-1-git-send-email-taras.kondratiuk@linaro.org> References: <1389376706-30051-1-git-send-email-taras.kondratiuk@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140110_125902_448823_C9E08685 X-CRM114-Status: GOOD ( 15.24 ) 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.3 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 0850c72..d2c2174 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" \