From patchwork Sun Nov 4 13:52:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 150109 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1537969ljp; Sun, 4 Nov 2018 05:53:02 -0800 (PST) X-Google-Smtp-Source: AJdET5d5W0mSl7M9j7s3+badebCTYjg1O16sC/EtT7GKZp15PTiPQtZRw0Bckdt79W6qV4l4Hab8 X-Received: by 2002:a17:902:a984:: with SMTP id bh4-v6mr18717865plb.163.1541339582322; Sun, 04 Nov 2018 05:53:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541339582; cv=none; d=google.com; s=arc-20160816; b=l9stzI8ZN7t2TwBnC8y//+a/R4HUdnkr3ogyviz3VqsIMlWFFjc3X4mkedm/fZhOf7 XCJ/Uxz6rP3J6cafTG2p5wGVIvl6I44bWDfHBJpA8EFuoRtqCwnCdnrr+EKY4JFGKRGY JukYLLMD9+/w37GF9LHZ4IDiVT1Ppm4pAM+urr2wrptiImIUo5DrPt3oTQIWROjW81PV pM5XJYtnHEOOL3vDkoXE8GFexBb8Yns1ers0trITgziGQXeqypQ3XB2tyrDwZ5Ux92aJ +r74GupxWCMheEYEYrm5xuuUKizhsrF09cJdzrK66uEgsTtc+3oClLR5yhTqBsrANlOT 0Gaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=OdEhdih2dT7SIu71gjD0N49HJBaSMJinANYL/jICyn8=; b=G6lz0oDyrAe9zRkqwbHZMyW3EJFTK64nG/FcKPNW1LZqQS7+2invXYIGMVgKvdOzNQ EW5XwfUugVms9x0yEuk5CTGJd9CekN80Vlw3ScnWFHzdDiHFdzELYlF0HquiSmBvICal O8FdCd3pfxU28cGQKFLe4v0Jq/N0fIvW5jFyI6hgXGBMcbuSS2pcXkXbmRUcpQ1VyVgv rS/9gT+k/uGbAa7L4QCvQcnMJmweVQ7OfPQRcvpMGumuk4wlA7JXrW5ACjPppWCxCHqL pKaOazl7AKq7D7mOi6f3kK1AhDcQY6DMEWvakeWQMjYidvJ/kLEg26qKiHbabm5lp+HC puDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nuPl8KgN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8-v6si1456980pgj.409.2018.11.04.05.53.02; Sun, 04 Nov 2018 05:53:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nuPl8KgN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730795AbeKDXIE (ORCPT + 32 others); Sun, 4 Nov 2018 18:08:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:46360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730678AbeKDXIB (ORCPT ); Sun, 4 Nov 2018 18:08:01 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7F3332085A; Sun, 4 Nov 2018 13:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541339577; bh=tEJtpAqTMjlEQ/L67FZ9RIUlP5Om9vqXkw2axuGYhyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nuPl8KgNhG3siUxuZzX7a2khqAQNxkQJ7uAZCOZ/jHLtGlCz663zfTKQcNLGtrAx3 9nQHpgZ6nKEdH+hxLTphaPz+9+S17C2zpH9O0K/9hE0cQ4xXllTzvtEvT+wOYcUQv4 Y9dEiCqg98kD7jMH49FLAKYxSMeo5uFNyIVI+/18= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Joel Stanley , Michael Ellerman , Sasha Levin Subject: [PATCH AUTOSEL 4.18 14/45] powerpc/Makefile: Fix PPC_BOOK3S_64 ASFLAGS Date: Sun, 4 Nov 2018 08:52:09 -0500 Message-Id: <20181104135240.88431-14-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181104135240.88431-1-sashal@kernel.org> References: <20181104135240.88431-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joel Stanley [ Upstream commit 960e30029863db95ec79a71009272d4661db5991 ] Ever since commit 15a3204d24a3 ("powerpc/64s: Set assembler machine type to POWER4") we force -mpower4 to be passed to the assembler irrespective of the CFLAGS used (for Book3s 64). When building a powerpc64 kernel with clang, clang will not add -many to the assembler flags, so any instructions that the compiler has generated that are not available on power4 will cause an error: /usr/bin/as -a64 -mppc64 -mlittle-endian -mpower8 \ -I ./arch/powerpc/include -I ./arch/powerpc/include/generated \ -I ./include -I ./arch/powerpc/include/uapi \ -I ./arch/powerpc/include/generated/uapi -I ./include/uapi \ -I ./include/generated/uapi -I arch/powerpc -I arch/powerpc \ -maltivec -mpower4 -o init/do_mounts.o /tmp/do_mounts-3b0a3d.s /tmp/do_mounts-51ce54.s:748: Error: unrecognized opcode: `isel' GCC does include -many, so the GCC driven gas call will succeed: as -v -I ./arch/powerpc/include -I ./arch/powerpc/include/generated -I ./include -I ./arch/powerpc/include/uapi -I ./arch/powerpc/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi -I arch/powerpc -I arch/powerpc -a64 -mpower8 -many -mlittle -maltivec -mpower4 -o init/do_mounts.o Note that isel is power7 and above for IBM CPUs. GCC only generates it for Power9 and above, but the above test was run against the clang generated assembly. Peter Bergner explains: When using -many -mpower4, gas will first try and find a matching power4 mnemonic and failing that, it will then allow any valid mnemonic that gas knows about. GCC's use of -many predates me though. IIRC, Alan looked at trying to remove it, but I forget why he didn't. Could be either a gcc or gas issue at the time. I'm not sure whether issue still exists or not. He and I have modified how gas works internally a fair amount since he tried removing gcc use of -many. I will also note that when using -many, gas will choose the first mnemonic that matches in the mnemonic table and we have (mostly) sorted the table so that server mnemonics show up earlier in the table than other mnemonics, so they'll be seen/chosen first. By explicitly setting -many we can build with Clang and GCC while retaining the -mpower4 option. Signed-off-by: Joel Stanley Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index fb96206de317..2510ff9381d0 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -244,7 +244,11 @@ cpu-as-$(CONFIG_4xx) += -Wa,-m405 cpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec) cpu-as-$(CONFIG_E200) += -Wa,-me200 cpu-as-$(CONFIG_E500) += -Wa,-me500 -cpu-as-$(CONFIG_PPC_BOOK3S_64) += -Wa,-mpower4 + +# When using '-many -mpower4' gas will first try and find a matching power4 +# mnemonic and failing that it will allow any valid mnemonic that GAS knows +# about. GCC will pass -many to GAS when assembling, clang does not. +cpu-as-$(CONFIG_PPC_BOOK3S_64) += -Wa,-mpower4 -Wa,-many cpu-as-$(CONFIG_PPC_E500MC) += $(call as-option,-Wa$(comma)-me500mc) KBUILD_AFLAGS += $(cpu-as-y)