From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755593AbdEEUgi (ORCPT ); Fri, 5 May 2017 16:36:38 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:32893 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754319AbdEEUgg (ORCPT ); Fri, 5 May 2017 16:36:36 -0400 MIME-Version: 1.0 In-Reply-To: References: <20170501224741.133938-1-mka@chromium.org> <20170505102555.ysjep3foplmhspux@hirez.programming.kicks-ass.net> <20170505175039.hf3jx4ljuyzzgxdn@gmail.com> <20170505184405.GB128305@google.com> From: Michael Davidson Date: Fri, 5 May 2017 13:36:34 -0700 Message-ID: Subject: Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for multiplication to work around Clang incompatibility To: Linus Torvalds Cc: Matthias Kaehlcke , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Peter Anvin , grundler@chromium.org, Linux Kernel Mailing List , Greg Hackmann , Kees Cook , "linux-tip-commits@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 5, 2017 at 12:30 PM, Linus Torvalds wrote: > On Fri, May 5, 2017 at 11:44 AM, Matthias Kaehlcke wrote: >> >> Indeed, I expect 4.12 (with this patch ...) to build with Clang for a >> x86 defconfig (with tons of warnings). ARM64 is very close. > > Does it actually *work*, rather than just build? > Yes, it does work. I have been using clang to build and run various 4.x based versions of Linux on both x86_64 and powerpc for over 6 months now. Assuming that you have a wrapper for clang that sets a few options and disables some warnings there really is very little else that is needed. powerpc currently only needs a single patch to the arch Makefile to add a cc-option check to a gcc specific flag. x86_64 needs the change that was under discussion here, but is still blocked by issues with building the 16 bit boot code. Supposedly this has now been fixed in clang, but I have not yet either seen or tried a version of the compiler with that fix. arm64 looks like it is also now very close. There are a few lingering places in the kernel which use variable length arrays in structs (eg the raid10 driver) which don't build with clang and that is about it. So, while I completely understand the resistance to adding arbitrary hacks to the kernel just to support another compiler it is important to also understand just how close things are to "just working". md