From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756023AbdKCS3L (ORCPT ); Fri, 3 Nov 2017 14:29:11 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:48542 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752259AbdKCS3G (ORCPT ); Fri, 3 Nov 2017 14:29:06 -0400 Date: Fri, 3 Nov 2017 18:29:01 +0000 From: Mark Rutland To: Nick Desaulniers Cc: Sami Tolvanen , LKML , linux-arm-kernel@lists.infradead.org, Matthias Kaehlcke , Kees Cook , Greg Hackmann , George Burgess , Stephen Hines , Pirama Arumuga Nainar , Manoj Gupta Subject: Re: [PATCH 00/15] Add support for clang LTO Message-ID: <20171103182901.eajkzkef3to4p6rf@lakrids.cambridge.arm.com> References: <20171103171203.107569-1-samitolvanen@google.com> <20171103175156.f44o7kuxgzym3pbt@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 03, 2017 at 11:07:04AM -0700, Nick Desaulniers wrote: > On Fri, Nov 3, 2017 at 10:51 AM, Mark Rutland wrote: > > I had to create an aarch64-linux-gnu-clang wrapper, too. I'm not sure if > > there's build system help to avoid needing that? > > Gah! So a BIG difference with Clang vs GCC for cross compiling is > that Clang by default ships with all backends enabled, and uses a > `-target ` CFLAG to determine the arch to cross compile for, > while GCC is configured at compile time to support one back end, IIUC. Yup. I initally tried passing CC=clang\ --target=aarch64-linux-gnu ... but since that conflicts with CROSS_COMPILE, you then have to override AS, LD, OBJCOPY, etc, separately too. This is a little less than ideal. :/ > Clang _can_ be built with all other back ends disabled but one, but I > have a problem with this approach: distributions of Clang are rarely > configured this way (all backends enabled by default), and it seems we > just found this past week that Clang if configured with just one > backend, it will silently ignore -target flags for other backends and > generate code for the configured backend (this led to: > https://lkml.org/lkml/2017/11/2/892). I consider this a bug in Clang, > so I just filed: https://bugs.llvm.org/show_bug.cgi?id=35196 Ouch. Thanks for attacking that. > > CC arch/arm64/crypto/aes-ce-cipher.o > > fatal error: error in backend: Do not know how to split the result of this operator! > > Yep, we've seen this. It was the FINAL bug in Clang for compiling the > kernel for arm64. It was recently fixed upstream in llvm by > gbiv@google.com, but so recent that you'll need to either compiler > Clang from source from ToT or work around it like we have in Android > with: > https://android.googlesource.com/kernel/msm/+/9093342a0186dad05095b70f1806938310ace6e7 Sure. I can live with patch 7 for now, assuming there's nothing else lurking in the shadows. Thanks, Mark. From mboxrd@z Thu Jan 1 00:00:00 1970 From: mark.rutland@arm.com (Mark Rutland) Date: Fri, 3 Nov 2017 18:29:01 +0000 Subject: [PATCH 00/15] Add support for clang LTO In-Reply-To: References: <20171103171203.107569-1-samitolvanen@google.com> <20171103175156.f44o7kuxgzym3pbt@lakrids.cambridge.arm.com> Message-ID: <20171103182901.eajkzkef3to4p6rf@lakrids.cambridge.arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, Nov 03, 2017 at 11:07:04AM -0700, Nick Desaulniers wrote: > On Fri, Nov 3, 2017 at 10:51 AM, Mark Rutland wrote: > > I had to create an aarch64-linux-gnu-clang wrapper, too. I'm not sure if > > there's build system help to avoid needing that? > > Gah! So a BIG difference with Clang vs GCC for cross compiling is > that Clang by default ships with all backends enabled, and uses a > `-target ` CFLAG to determine the arch to cross compile for, > while GCC is configured at compile time to support one back end, IIUC. Yup. I initally tried passing CC=clang\ --target=aarch64-linux-gnu ... but since that conflicts with CROSS_COMPILE, you then have to override AS, LD, OBJCOPY, etc, separately too. This is a little less than ideal. :/ > Clang _can_ be built with all other back ends disabled but one, but I > have a problem with this approach: distributions of Clang are rarely > configured this way (all backends enabled by default), and it seems we > just found this past week that Clang if configured with just one > backend, it will silently ignore -target flags for other backends and > generate code for the configured backend (this led to: > https://lkml.org/lkml/2017/11/2/892). I consider this a bug in Clang, > so I just filed: https://bugs.llvm.org/show_bug.cgi?id=35196 Ouch. Thanks for attacking that. > > CC arch/arm64/crypto/aes-ce-cipher.o > > fatal error: error in backend: Do not know how to split the result of this operator! > > Yep, we've seen this. It was the FINAL bug in Clang for compiling the > kernel for arm64. It was recently fixed upstream in llvm by > gbiv at google.com, but so recent that you'll need to either compiler > Clang from source from ToT or work around it like we have in Android > with: > https://android.googlesource.com/kernel/msm/+/9093342a0186dad05095b70f1806938310ace6e7 Sure. I can live with patch 7 for now, assuming there's nothing else lurking in the shadows. Thanks, Mark.