From patchwork Thu Mar 17 10:38:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102552 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp380067lbc; Thu, 17 Mar 2016 03:42:24 -0700 (PDT) X-Received: by 10.66.244.233 with SMTP id xj9mr13863761pac.19.1458211344314; Thu, 17 Mar 2016 03:42:24 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id m21si11795626pfi.12.2016.03.17.03.42.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Mar 2016 03:42:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1agVKs-0002wt-2l; Thu, 17 Mar 2016 10:39:22 +0000 Received: from mout.kundenserver.de ([212.227.126.187]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1agVKo-0002vY-PC for linux-arm-kernel@lists.infradead.org; Thu, 17 Mar 2016 10:39:20 +0000 Received: from wuerfel.localnet ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0MVHuk-1aIySD0T8Q-00YlFd; Thu, 17 Mar 2016 11:38:35 +0100 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: use --fix-v4bx to allow building ARMv4 with future gcc Date: Thu, 17 Mar 2016 11:38:30 +0100 Message-ID: <12678426.5oeMNXL25J@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:D4XLyIQ5lv8QbM727xTmZRA4Po8x2w0Jx/7RCc60nXxW7sY+Qya fsN42hzpW3Ywa3RgXiO9IBIsdpwkkycBXNE1BexyT8S3dalLZ/6B4D57qpv2wqZk5qJWTPg EQikRhNVLzEj2baMFszXY8NOJcmok6j31hS24ral7AdwipjE9N+J9v/0+KgMwiJPmFgzxFn aTFP81cXjedXi16tbnB+g== X-UI-Out-Filterresults: notjunk:1; V01:K0:o4gLz5RxGWQ=:MBDGFsvOc3pCi2aBumpa6l E1QD9BLkHHP3ywa2+/6R6W2U/BnQWxP8zoNaFeDdrxSW/Gd4DsypELQwsUPl42nmR9c3TBRTS zWZkONzDX16X1S5tOGAhxlM8iWdCK7iJTDgNMA7Rz7BNeDbfLEtkjzP+XPhBSX1AH9YvDd7nc B3bRX8RecI/0PzAEwFMk3/Pipbymbd3hHI32GoyWCH8ye2RmsY81IDUBuYdJ2qMPaKl+xyM1i Kv2/liJ2+XRhAWQZSbRW81jjPKjGI7bFeZ46XccbCXJEL05Vi6zaaFwhJcGtnzz5YoHFHmR7S hgHdvPVDEAvegtuXMRziHHE2rQxS/0oUarKwBZ+OiEOs8S3kZhWXDr/HAuJTFh/TLQCQVIGNU xhY+UqbQHpx4/uUQ/FoqlRjPR46yaHTT4Bvne/OAUoY9k3R+8F4nvwRq9t8h7pya8tsceJd6J cKRsMF0L1nL93qF6Fo2louZvzpPfOGdzlTbf+JDDSHJDyOsQFhIQhMMzRa02my89bt5dhqxHP VdVuCDzfs7681pDOJw3WFLzlT49xmS2u1Z8bU6NXTxIw++yBXfX29IHHIQ+lgn+khquFJz7gv cAtj83us4HQJ3GzfCBnJSmybMdHMvp8PeNFxw+Yi6U27dRr+y7qn5OYK1dGikro0noZkYHsJQ PB7gHee7nnBbNk573XPEx4ske2PGqIE0PkFcACTHkP6Y9Ze2vNCG44EpiGneciQzlB6+90C5u bzl7RpNg3lOOjwA+ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160317_033919_220960_2207E4F5 X-CRM114-Status: GOOD ( 17.92 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.227.126.187 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.126.187 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Baruch Siach , Russell King - ARM Linux , Linus Walleij , Ramana Radhakrishnan , Roman Yeryomin , Hans Ulli Kroll , Jonas Jensen , Dmitry Eremin-Solenikov , Jonas Gorski , openwrt-devel@lists.openwrt.org, Robin Murphy , Dave Martin , "linux-arm-kernel@lists.infradead.org" , John Crispin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org gcc-6.0 marks support for ARMv3 and ARMv4 as 'deprecated', meaning that this is expected to be removed at some point in the future, with gcc-7.0 as the earliest. When building the kernel, the difference between ARMv4 and ARMv4T is relatively small because the kernel never runs THUMB instructions on ARMv4T and does not need any support for interworking. For any future compiler that does not support -march=armv4, we now fall back to -march=armv4t as the architecture level selection, but keep using -march=armv4 by default as long as that is supported by the compiler. Similarly, the -mtune=strongarm110 and -mtune=strongarm1100 options will go away at the same time as -march=armv4, so this adds a check to see if the compiler supports them, falling back to no -mtune option otherwise. Compiling with -march=armv4t leads the compiler to using 'bx reg' instructions instead of 'ld pc,reg'. This is not supported on ARMv4 based CPUs, but the linker can work around this by rewriting those instructions to the ARMv4 version if we pass --fix-v4bx to the linker. This should work with binutils-2.15 (released May 2004) or higher, and we can probably assume that anyone using gcc-7.x will have a much more recent binutils version as well. However, in order to still allow users of old toolchains to link the kernel, we only pass the option to linkers that support it, based on a $(ld-option ...) call. I'm intentionally passing the flag to all linker versions here regardless of whether it's needed or not, so we can more easily spot any regressions if something goes wrong. For consistency, I'm passing the --fix-v4bx flag for both the vmlinux final link and the individual loadable modules. The module loader code already interprets the R_ARM_V4BX relocations in loadable modules and converts bx instructions into ldr even when running on ARMv4T or ARMv5 processors. This is now redundant when we pass --fix-v4bx to the linker for building modules, but I see no harm in leaving the current implementation and doing both. Signed-off-by: Arnd Bergmann _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 9fb3fee0e908..3c312d37a83a 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -19,6 +19,11 @@ LDFLAGS_vmlinux += --be8 LDFLAGS_MODULE += --be8 endif +ifeq ($(CONFIG_CPU_32v4),y) +LDFLAGS_vmlinux += $(call ld-option,--fix-v4bx) +LDFLAGS_MODULE += $(call ld-option,--fix-v4bx) +endif + ifeq ($(CONFIG_ARM_MODULE_PLTS),y) LDFLAGS_MODULE += -T $(srctree)/arch/arm/kernel/module.lds endif @@ -75,7 +80,7 @@ arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k, endif arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t) arch-$(CONFIG_CPU_32v4T) =-D__LINUX_ARM_ARCH__=4 -march=armv4t -arch-$(CONFIG_CPU_32v4) =-D__LINUX_ARM_ARCH__=4 -march=armv4 +arch-$(CONFIG_CPU_32v4) =-D__LINUX_ARM_ARCH__=4 $(call cc-option,-march=armv4,-march=armv4t) arch-$(CONFIG_CPU_32v3) =-D__LINUX_ARM_ARCH__=3 -march=armv3 # Evaluate arch cc-option calls now @@ -93,8 +98,8 @@ tune-$(CONFIG_CPU_ARM922T) =-mtune=arm9tdmi tune-$(CONFIG_CPU_ARM925T) =-mtune=arm9tdmi tune-$(CONFIG_CPU_ARM926T) =-mtune=arm9tdmi tune-$(CONFIG_CPU_FA526) =-mtune=arm9tdmi -tune-$(CONFIG_CPU_SA110) =-mtune=strongarm110 -tune-$(CONFIG_CPU_SA1100) =-mtune=strongarm1100 +tune-$(CONFIG_CPU_SA110) =$(call cc-option,-mtune=strongarm110) +tune-$(CONFIG_CPU_SA1100) =$(call cc-option,-mtune=strongarm1100) tune-$(CONFIG_CPU_XSCALE) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale tune-$(CONFIG_CPU_XSC3) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale tune-$(CONFIG_CPU_FEROCEON) =$(call cc-option,-mtune=marvell-f,-mtune=xscale)