From patchwork Wed Nov 20 07:21:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Victor Kamensky X-Patchwork-Id: 3210821 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 89453C045B for ; Wed, 20 Nov 2013 07:22:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC83B201B3 for ; Wed, 20 Nov 2013 07:22:40 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F8D92017B for ; Wed, 20 Nov 2013 07:22:39 +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 1Vj271-0003Yo-2v; Wed, 20 Nov 2013 07:22:11 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vj26q-0005Ix-O7; Wed, 20 Nov 2013 07:22:00 +0000 Received: from mail-pd0-f169.google.com ([209.85.192.169]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vj26g-0005HW-0k for linux-arm-kernel@lists.infradead.org; Wed, 20 Nov 2013 07:21:51 +0000 Received: by mail-pd0-f169.google.com with SMTP id v10so3682393pde.14 for ; Tue, 19 Nov 2013 23:21:28 -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:mime-version:content-type:content-transfer-encoding; bh=U19L3Gb6CoZsNa3ULoaIgDPhEyPHFpM3jG2/DfVko3w=; b=YA1if6Wol4yJTJ6WreSKWaiqn9RE9tw7apgHKIFuOitm956skWzq6LpvCIUnGN7KHr 5VdsAFM0M+Ftc+PY46/tHbgcy0uKGNgRSLrTm3BPhdp7O0emz96nu1d7e2sewabyDsdW n7/fOIjAtI/GkU/PJW5XhxcIdwU9rs+uOkD8xNnMRsvZV6b/vUyobHStooffSiK/bVWL PeD7DqF0DrVNMFe+FoUFAsbEjmefB8vZczISHbRJnwUoCVsyFidEx1NO5I5SbPquXzt7 cjb3U25zx6yagOWcel28ivl5r6l96RviZQ5L9/jTCFT+LaS56ocwntI7NQeSCsENnuyv MGFw== X-Gm-Message-State: ALoCoQlgArjy4LEFaH61+PDcC5rdpDh2Z4qo2gT18eY8cXvVyH6/wbJRdLvHMz/PZfzXhAgJ8TXm X-Received: by 10.66.154.197 with SMTP id vq5mr5776435pab.155.1384932088657; Tue, 19 Nov 2013 23:21:28 -0800 (PST) Received: from kamensky-w530.cisco.com.com (128-107-239-233.cisco.com. [128.107.239.233]) by mx.google.com with ESMTPSA id oj6sm40341886pab.9.2013.11.19.23.21.27 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2013 23:21:28 -0800 (PST) From: Victor Kamensky To: linux-arm-kernel@lists.infradead.org, Dave.Martin@arm.com, ben.dooks@codethink.co.uk, u.kleine-koenig@pengutronix.de Subject: [PATCH v4] ARM: signal: fix armv7-m build issue in sigreturn_codes.S Date: Tue, 19 Nov 2013 23:21:12 -0800 Message-Id: <1384932072-8103-2-git-send-email-victor.kamensky@linaro.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1384932072-8103-1-git-send-email-victor.kamensky@linaro.org> References: <1384932072-8103-1-git-send-email-victor.kamensky@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131120_022150_208192_AB106E1F X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) Cc: nicolas.pitre@linaro.org, linaro-kernel@lists.linaro.org, patches@linaro.org, taras.kondratiuk@linaro.org, Victor Kamensky , will.deacon@arm.com, rmk@arm.linux.org.uk 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: , 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 After "ARM: signal: sigreturn_codes should be endian neutral to work in BE8" commit, thumb only platforms, like armv7m, fails to compile sigreturn_codes.S. The reason is that for such arch values '.arm' directive and arm opcodes are not allowed. Fix conditionally enables arm opcodes only if no CONFIG_CPU_THUMBONLY defined and it uses .org instructions to keep sigreturn_codes layout. Suggested-by: Dave Martin Signed-off-by: Victor Kamensky Tested-by: Uwe Kleine-König Reviewed-by: Dave Martin --- arch/arm/kernel/sigreturn_codes.S | 40 ++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/arch/arm/kernel/sigreturn_codes.S b/arch/arm/kernel/sigreturn_codes.S index 3c5d0f2..b84d0cb 100644 --- a/arch/arm/kernel/sigreturn_codes.S +++ b/arch/arm/kernel/sigreturn_codes.S @@ -30,6 +30,27 @@ * snippets. */ +/* + * In CPU_THUMBONLY case kernel arm opcodes are not allowed. + * Note in this case codes skips those instructions but it uses .org + * directive to keep correct layout of sigreturn_codes array. + */ +#ifndef CONFIG_CPU_THUMBONLY +#define ARM_OK(code...) code +#else +#define ARM_OK(code...) +#endif + + .macro arm_slot n + .org sigreturn_codes + 12 * (\n) +ARM_OK( .arm ) + .endm + + .macro thumb_slot n + .org sigreturn_codes + 12 * (\n) + 8 + .thumb + .endm + #if __LINUX_ARM_ARCH__ <= 4 /* * Note we manually set minimally required arch that supports @@ -45,26 +66,27 @@ .global sigreturn_codes .type sigreturn_codes, #object - .arm + .align sigreturn_codes: /* ARM sigreturn syscall code snippet */ - mov r7, #(__NR_sigreturn - __NR_SYSCALL_BASE) - swi #(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE) + arm_slot 0 +ARM_OK( mov r7, #(__NR_sigreturn - __NR_SYSCALL_BASE) ) +ARM_OK( swi #(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE) ) /* Thumb sigreturn syscall code snippet */ - .thumb + thumb_slot 0 movs r7, #(__NR_sigreturn - __NR_SYSCALL_BASE) swi #0 /* ARM sigreturn_rt syscall code snippet */ - .arm - mov r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE) - swi #(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE) + arm_slot 1 +ARM_OK( mov r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE) ) +ARM_OK( swi #(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE) ) /* Thumb sigreturn_rt syscall code snippet */ - .thumb + thumb_slot 1 movs r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE) swi #0 @@ -74,7 +96,7 @@ sigreturn_codes: * it is thumb case or not, so we need additional * word after real last entry. */ - .arm + arm_slot 2 .space 4 .size sigreturn_codes, . - sigreturn_codes