From patchwork Thu Dec 21 16:57:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10128055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1941A6019C for ; Thu, 21 Dec 2017 16:57:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09CA529D7B for ; Thu, 21 Dec 2017 16:57:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2D0A29D7D; Thu, 21 Dec 2017 16:57:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 722CF29D7B for ; Thu, 21 Dec 2017 16:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: References:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D00TwcwqpqJOWPWCX+Vpns7O++rtt6IqvD9NUMQVZ3E=; b=W7dcNAwXzFtryY bInf8lhn5vWHFpvNV+/3Qjf170V+JkQaiW4h0KZka3FSpHEx9IQKPxHF6HcGw5LcM/2Bwv+YHpUGT muE2XJjf1cYsbFSxwKA0Ge+/K3eATQxTG6NZUKaFwg/aTFlyzkMiAc7/lRkxHKrJ70Rmk7uIRT/rf /ETPQ1CZCOqxJ5uxORSxaQ8RtKInTHgmtRUTWoN+qbthM7oTJBhcQOcziWhfqm8bFo3+/Y4Oo2Ubg bx76ibP76WBanlAH2gpzEy/g4lA2iy+GMaR5zY7os9rdVXo6LPdQGC1HqucIj+Kh6Z1d9QHKyir2I 14zOgKkbU4VVnO4Qo8Vw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eS4A5-00010g-29; Thu, 21 Dec 2017 16:57:37 +0000 Received: from mail-it0-x243.google.com ([2607:f8b0:4001:c0b::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eS49x-0000wL-Bk for linux-arm-kernel@lists.infradead.org; Thu, 21 Dec 2017 16:57:34 +0000 Received: by mail-it0-x243.google.com with SMTP id b5so11386769itc.3 for ; Thu, 21 Dec 2017 08:57:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0D8UZBf/AMyinETFhte+VjQ5BCnZU1wpMkExGfrvZHg=; b=L3Cg2abSPpR0w3g01SGIQwZxgboPL64Nzwx4UNzsgkF3mTxEJCyjyDEvYD9epx86qC NZo7xwc2eVKbltuoKaneNEkSWygFWjsP1gAGsVGUouFXOrXJdmzS+slwH72gtZivsZ5w Oou5Nh2ppboxXRpw5E6FQ2J+wNI5WWvxb+pb4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0D8UZBf/AMyinETFhte+VjQ5BCnZU1wpMkExGfrvZHg=; b=hJOmumOPo7XiMjJlP5tUPDhylm68SG+ub8lfJLdhQDjh+KWds+OXpGm/6Zv4M/4XvD gzVOuw87QPwZom9Fw/gXS6cmzJC7d79Ma67r+M9SbDhlQblZgU5HB8zXCBWPMX2nR7sa VtfVfW/Aca1wVnd4TItbu/rLwAcSBAYJ9apt3w3RBy3p0G8xLTn2yp3W+ozC0z/hgG2g imaM+UEwXCg+pzz+998RcsvnbsmSA8lprxLmu2WqBMNn7VzSa+C5oeLnoftnreNDPDpY c/cxPA9n9SZOKBwf/XQSECpzgvaIT6+M11poGxheSxYYjwHPktaDXWwE3kjq8XUvmCsF C1MA== X-Gm-Message-State: AKGB3mLSQMjlvgAtzOUBSj0vyejAfh/VunSq6PbwPJV7cPUCwfcS348X bPJPD1nLprtkfMlcJ4yvNWapOYxUJh9RVjdbzLd4mA== X-Google-Smtp-Source: ACJfBospkyHHzWNJOn6Ex9dBmpqgaPa791C3nYQN2nEPOmtLTLy2mFhH61ZckmJzmVISVL2s6tTvcX0TeNLJDH6Nuqo= X-Received: by 10.36.157.129 with SMTP id f123mr14221657itd.39.1513875438279; Thu, 21 Dec 2017 08:57:18 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.87.84 with HTTP; Thu, 21 Dec 2017 08:57:17 -0800 (PST) In-Reply-To: <20171220130016.3156090-1-arnd@arndb.de> References: <20171220130016.3156090-1-arnd@arndb.de> From: Linus Walleij Date: Thu, 21 Dec 2017 17:57:17 +0100 Message-ID: Subject: Re: [PATCH, RFT] ARM: use --fix-v4bx to allow building ARMv4 with future gcc To: Arnd Bergmann X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171221_085729_533859_39046CCF X-CRM114-Status: GOOD ( 23.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Russell King , Linux ARM , "linux-kernel@vger.kernel.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Dec 20, 2017 at 2:00 PM, Arnd Bergmann wrote: > gcc-6.0 and later marks support for ARMv3 and ARMv4 as 'deprecated', > meaning that this is expected to be removed at some point in the future, > with gcc-8.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 'mov 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 mov 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 > --- > Please test by making the -march=armv4t switch unconditional > and see if that results in a working kernel I did this: arch-$(CONFIG_CPU_32v3) =-D__LINUX_ARM_ARCH__=3 -march=armv3 Built and booted on the Gemini platform. It crashes immediately and goes into the boot loader on thos FA-526 based platform. Yours, Linus Walleij diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 66e46aec0cd0..3944ecd6cd31 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -81,7 +81,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 $(call cc-option,-march=armv4,-march=armv4t) +arch-$(CONFIG_CPU_32v4) =-D__LINUX_ARM_ARCH__=4 -march=armv4t