Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp4029271ima; Tue, 23 Oct 2018 15:45:25 -0700 (PDT) X-Google-Smtp-Source: AJdET5fUrIgIHGW+FT+qC4ZdY8aSAHbQ/B0zh11tX83rwqZC1wgGYCfEU+r9dCymK7s1oENLm2TE X-Received: by 2002:a62:76d8:: with SMTP id r207-v6mr167601pfc.216.1540334725396; Tue, 23 Oct 2018 15:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540334725; cv=none; d=google.com; s=arc-20160816; b=f1Pmk433zrEJXJ+O1Lf/4lV+TcehHJWUwSOygYkEbhlKFc3qW+DelZeLKx7QD8ym4r 0Xw1Yiv0mywO3HHYlfO/k4Hszw2EsieRNZqim+JjIy0oV3OFHuzTZ7QCBunJhl2+IBAA ysVctuUAPx7me2TyHsPXP2D93VYwNE9jbJlzJBOu/fGHrIT9EKkMscrguqeTMk+nfKUe t5Y3LWzG4NkUoyZai8L+95EIL+OJ1NtoEiqjDKvRxyPcUq5VQJrT7zG+ehzfDrAYTRvw /qmd9kV3ap0xeyo/w0M1Q0mncOsArtI3c97ELie2H332k1q2LMpdNGRzAcqkrVpuQovk xFIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JN1ntBK7pOKR2EidxWRrYtL2nFqpv4y1p4ZBZeaLSEg=; b=FD1lD6aKVolEp59rLRaDJh7I4Hi4AcUbSiMwZEoL3cI8owH/H8meVBhgJmrlFp3AvD NtSwCbTLsv684Gpzv+POXIG6U/N6piM+ioiSdmLsZKRBafW9RDkuMsW73ve008EbBMZM Brgee7qrsyh6y5qp+Z8ry18CAoZCG7VbgImU+Rf6WtrAAWmF0AOVxwoiHKI1guIJ+di5 cuWEYTCZqO4dvYLyM3Af3im+mJa0QSxhVIPeCEk1Cj9ZX+FW8b9wEnVY3UnbxOCmIRCl 58ZiKHXq5M243yG4aa5nEo0wJwRxrQN8IChJqIBZSDdlT//459xPdbRwpay7lFj1FiXR IXSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rswUT8KV; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j5-v6si2481541plk.145.2018.10.23.15.45.09; Tue, 23 Oct 2018 15:45:25 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=rswUT8KV; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728896AbeJXHKG (ORCPT + 99 others); Wed, 24 Oct 2018 03:10:06 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:32999 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbeJXHKF (ORCPT ); Wed, 24 Oct 2018 03:10:05 -0400 Received: by mail-wr1-f67.google.com with SMTP id u1-v6so3428832wrn.0 for ; Tue, 23 Oct 2018 15:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JN1ntBK7pOKR2EidxWRrYtL2nFqpv4y1p4ZBZeaLSEg=; b=rswUT8KVTCz6MjHeeEVe9nSwviM4b15DxczHdcizNsg5vH+L3ojhHGR0x/NgghOtt4 EsNOaZgQ8ZNOcng3ufWZG2S+YUL8/52Sb5Ch21jRXlX7PR+zM5wt6CNXG/xinUOjWt71 UeWgntIinn6frNRMvmUBi0DP0+4TMs5uFgqRwP4+HCseSXZqH8r7vJEMljTyaMie6940 rtqdjpzxKHwV3IzyKWZenpbicR5XxNqiqkPHRxXlgqepawIHOM/s2Yg+h4IiW9VOSLCf dGwljfPz6/a5DwjNmAF9cQTgZZXdx3xim4uNTsNDxWhmib3hoFTlfX4VtuGntp9cQV6E qb8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JN1ntBK7pOKR2EidxWRrYtL2nFqpv4y1p4ZBZeaLSEg=; b=KXpKaQHTYc3AUZYLv5CFoiQLUqnGd7XHabAeBylBDkbQmDFRkww50UjVYdQ5LCLP+c mzRWfGO30CxLgOUycmYc1s4MmL+42CZrsN36LgyFgwo+MU6crCS+R5SXpTcNgNgJ/SgK NA1wbucgr/ijG2LgJpVYf+XlJqQgxyeXA2/bn2xmzc7doG5KiCXj0Wpzw26YIulx2z1P SCJw4DHyhWnrkpKJovsg6FsIb7eoA+KqpvVgsuDg15ccD6BpV0Dd6UCJyVbVjxdESnxw EQ3HI2UiLz6+uAIBryLnHkCy9UEPCuNO94IbagaZX8FLqBffHv0zbiX/3crQ7Sf/HX+W 4kYQ== X-Gm-Message-State: AGRZ1gL1aOHEqAb7DD2CGOVfWzIiFWF6aCkwd1xUUHl4uHxPUOVl//b8 c4Pcio/Ycth0HeJ47Zlx4Jc= X-Received: by 2002:adf:9b84:: with SMTP id d4-v6mr163708wrc.240.1540334678461; Tue, 23 Oct 2018 15:44:38 -0700 (PDT) Received: from flashbox ([2a01:4f8:10b:24a5::2]) by smtp.gmail.com with ESMTPSA id y141-v6sm755474wme.10.2018.10.23.15.44.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Oct 2018 15:44:37 -0700 (PDT) Date: Tue, 23 Oct 2018 15:44:35 -0700 From: Nathan Chancellor To: Nick Desaulniers Cc: hpa@zytor.com, namit@vmware.com, Thomas Gleixner , mingo@redhat.com, bp@alien8.de, x86@kernel.org, LKML , Kees Cook , Masahiro Yamada Subject: Re: [PATCH RFC] x86: Don't include '-Wa,-' when building with Clang Message-ID: <20181023224435.GA7163@flashbox> References: <20181023003725.21463-1-natechancellor@gmail.com> <96ffedd2-a19d-95de-45fd-3a83025dd48a@zytor.com> <20181023215811.GA10771@flashbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 23, 2018 at 03:08:53PM -0700, Nick Desaulniers wrote: > On Tue, Oct 23, 2018 at 2:58 PM Nathan Chancellor > wrote: > > > > On Tue, Oct 23, 2018 at 01:01:22PM -0700, H. Peter Anvin wrote: > > > On 10/23/18 11:40, Nick Desaulniers wrote: > > > > On Mon, Oct 22, 2018 at 10:11 PM Nadav Amit wrote: > > > >> > > > >> at 5:37 PM, Nathan Chancellor wrote: > > > >> > > > >> Commit 77b0bf55bc67 ("kbuild/Makefile: Prepare for using macros in > > > >> inline assembly code to work around asm() related GCC inlining bugs") > > > >> added this flag to KBUILD_CFLAGS, where it works perfectly fine with > > > >> GCC. However, when building with Clang, all of the object files compile > > > >> fine but the build hangs indefinitely at init/main.o, right before the > > > >> linking stage. Don't include this flag when building with Clang. > > > >> > > > >> The kernel builds and boots to a shell in QEMU with both GCC and Clang > > > >> with this patch applied. > > > >> > > > >> Link: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FClangBuiltLinux%2Flinux%2Fissues%2F213&data=02%7C01%7Cnamit%40vmware.com%7C871daebc2ca44947d28d08d638811fb5%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C636758524579997650&sdata=shuxW81QRrO3TSqbgf462wgZYdLeAKeQEdGRxmnUX30%3D&reserved=0 > > > >> Signed-off-by: Nathan Chancellor > > > >> --- > > > >> > > > >> The reason this patch is labeled RFC is while I can verify that this > > > >> fixes the issue, I'm not entirely sure why the '-Wa,-' works for GCC > > > >> and not Clang. I looked into what the flag means and I couldn't really > > > >> find anything so I just assume it's taking input from stdin? The issue > > > >> could stem from how GCC forks gas versus how Clang does it. If this > > > >> isn't of concern and the maintainers are happy with this patch as is, > > > >> feel free to take it. > > > >> > > > > > > Perhaps someone could actually, you know, time the build and see how > > > much -pipe actually matters, if at all? > > > > > > -hpa > > > > > > > Thank you for the suggestion! With the attached diff for removing > > '-pipe' and 'make -j1' with defconfig (just to make sure any variance > > would stand out), here are my results: > > > > -pipe (GCC): > > > > real 15m55.202s > > user 14m17.748s > > sys 1m47.496s > > > > No -pipe (GCC): > > > > real 16m4.430s > > user 14m16.277s > > sys 1m46.604s > > > > -pipe (Clang): > > > > real 21m26.016s > > user 19m21.722s > > sys 2m2.606s > > > > No -pipe (Clang): > > > > real 21m27.822s > > user 19m22.092s > > sys 2m4.151s > > Looks like Clang eats `-pipe`: > https://github.com/llvm-mirror/clang/blob/391667a023f79287f9c40868f34f08c161555556/lib/Driver/Driver.cpp#L962 > commit r110007 has the log: > Driver: Start ripping out support for -pipe, which is worthless > and complicates > too many other things. > In that case, we can either keep this change (I'll resend with the explanation that Clang doesn't respect -pipe) or we can just rip out -pipe for GCC too. Here are three separate results for GCC with my normal jobs flag: -pipe (GCC): real 3m40.813s real 3m44.449s real 3m39.648s No -pipe (GCC): real 3m38.492s real 3m38.335s real 3m38.975s Practically no variance. Thanks, Nathan > > > > Certainly seems like -pipe doesn't make a ton of difference. If this is > > a better fix, I am happy to draft up a proper commit message and send > > it out for review. > > > > ================================================== > > > > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > > index 73f4831283ac..672c689c1faa 100644 > > --- a/arch/x86/Makefile > > +++ b/arch/x86/Makefile > > @@ -213,8 +213,6 @@ ifdef CONFIG_X86_64 > > KBUILD_LDFLAGS += $(call ld-option, -z max-page-size=0x200000) > > endif > > > > -# Speed up the build > > -KBUILD_CFLAGS += -pipe > > # Workaround for a gcc prelease that unfortunately was shipped in a suse release > > KBUILD_CFLAGS += -Wno-sign-compare > > # > > @@ -239,7 +237,7 @@ archheaders: > > archmacros: > > $(Q)$(MAKE) $(build)=arch/x86/kernel arch/x86/kernel/macros.s > > > > -ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s -Wa,- > > +ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s > > export ASM_MACRO_FLAGS > > KBUILD_CFLAGS += $(ASM_MACRO_FLAGS) > > > > > -- > Thanks, > ~Nick Desaulniers