Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2971615pxy; Mon, 3 May 2021 12:01:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIZUfZLTGw6MBp1Sq8E67PEvq+UOETdVSlbw2xds13jBzwlWg+v4vySPeDwFRusOvsXvK3 X-Received: by 2002:a62:a515:0:b029:263:214f:27ff with SMTP id v21-20020a62a5150000b0290263214f27ffmr20343909pfm.4.1620068491889; Mon, 03 May 2021 12:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620068491; cv=none; d=google.com; s=arc-20160816; b=YeNFjjnXT7KdeVZhZwaDrHCTMtuolQBeYuMtPtB1zD9Zfa45cdhU09QywQdGxvPxwH DkJ9PpN6j3PUWj6aa4HvAKnq2ZFpkuKFg7OlCePfwdUjqkuqHpQriwk8WQiQTnc9288P WLQ3b9m57g3c1kb1IDYzXLY68LqKbatyJxT/yk8pngnA0cmJ4qwImjUdw/AsX8txOdTO 4UPFuyp/htUU+rHJCJOB2vqkNjx+OMDcGzKcVxllCWSLUi3y1xLB7tvO7g2sUE9RORqU g31ZCWmR0ou136qdhRTdiINivEXqn0KxXsdtppuoU5+s5k0+d7/FlQtJT6NuQ3YrC8LC 3eMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Q6rKBqfbWpNRJxPhhgqP74nxWxLm0jUmEd6rteF8gEQ=; b=iza7axe8WWVJTmir/kWQuUF3ZDINtZQlJi4P9JwrQdbWSVVrB0nfm7c1gNJ5c6eN/r magEy3EI40ykP0zMiBa5a8tO/YHdLFV4+pF397t/Gm5KmHTiWV7bFqYQ65Y5xk9G41cv cJ2wiLQBdG+B7Is84aU2FSkIp0q8AzeTd2yNg1o6LQ6wynuWegTByZoNY0eCWrMTnvFs UFQCuwvENGIfWf8vJ0/ZxCwOQcmNo3xn5kuqw4Eh8gCAweqK5/JdQowA0acMsIDecbS6 +0jYclGmGN7OtR0b7uGiIrpmZa2k2YnQWj07OPWM4jd/fwr8UsK6Z5rizrMCBtOYzpVH NuAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RsH4uqpO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si471364pgo.339.2021.05.03.12.01.14; Mon, 03 May 2021 12:01:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RsH4uqpO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229520AbhECTBQ (ORCPT + 99 others); Mon, 3 May 2021 15:01:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbhECTBQ (ORCPT ); Mon, 3 May 2021 15:01:16 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3170C06174A for ; Mon, 3 May 2021 12:00:22 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id q2so4871901pfh.13 for ; Mon, 03 May 2021 12:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Q6rKBqfbWpNRJxPhhgqP74nxWxLm0jUmEd6rteF8gEQ=; b=RsH4uqpOxk2qYwp8eioXSAIwuHlB86nRQUZMVBohHAkBRLZg2Ab2DbqKanWYdNb4fk rUs63WLNdxOrlujAtwD6e+eJ7p7fWBF4RLxXCGYedto785RmlC6hUNSS2IRbvzwiSIFh InGSf25NU/LyTZUNwOw0t7WAahx2JOP1pZ6v5F5qhAb6mK+9JpO2ZJE62WI1KSiOmnhO beeMA03NznJGXEvr3Kn9rs88IUXo4RpJQiADWXYIBzESl9GffQDhhr9E0/yUdaNT5lLK EcOcpJMPafyGWZSrHt9FpzsRuBMm5NBDNsw1EdK4hsOE80dolwAlqpBJF2VOCDLey2ra nngA== 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; bh=Q6rKBqfbWpNRJxPhhgqP74nxWxLm0jUmEd6rteF8gEQ=; b=lLet1mbE/Sy3OD3DO2mjY6AJGsPG4hIaIzKgDg7qdoa2VILvCZMuBrOGiBlWXIaO+z O0cYPhZobWnbW46CfLfEc4LLCel2KwDkywX5nmC4ug2EAavVqfjtyU2LUyt6J6jdppbc pxxkPEAiA3CPWFLu9JfJJN5qj/pMs9ed71lvshBeKjLHU6GM7JkWSsz95Y6i4Za22xAg DYJlidzXc837JOCKaL9wTHHBsqygKYk9cyegxEG7X2sd7iMmNq3Qmf30CXD5CK1YQTHa XwZ4r5yBaPLC2YoOIVVAibexfPr77KDEaWo9HJm1LNnM1hEosSGeNs7if4IWj07pty/R g6VA== X-Gm-Message-State: AOAM530NKuJx5J76Kx7pPOCmuTUa8lIBxLWaS4I45ciZpNjYiFMd9ks8 SCc54Kc3jPKXem1FvoWwO8sZFSPBzpiXtQ== X-Received: by 2002:a17:90a:1d44:: with SMTP id u4mr140512pju.46.1620068421951; Mon, 03 May 2021 12:00:21 -0700 (PDT) Received: from google.com ([2620:15c:2ce:200:b55f:a57:7a3c:5bf7]) by smtp.gmail.com with ESMTPSA id a185sm9629161pfd.70.2021.05.03.12.00.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:00:21 -0700 (PDT) Date: Mon, 3 May 2021 12:00:17 -0700 From: Fangrui Song To: Tom Stellard Cc: Dan Aloni , Nick Desaulniers , Linus Torvalds , Masahiro Yamada , Nathan Chancellor , Linux Kernel Mailing List , clang-built-linux , Serge Guelton , Sylvestre Ledru Subject: Re: Very slow clang kernel config .. Message-ID: <20210503190017.3r6mzy7xqx2bfwmk@google.com> References: <20210502051909.pac2pycninc7fl53@gmail.com> <6c4febd7-f826-9935-4163-138b1fed8278@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <6c4febd7-f826-9935-4163-138b1fed8278@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-05-03, Tom Stellard wrote: >On 5/1/21 10:19 PM, Dan Aloni wrote: >>On Fri, Apr 30, 2021 at 06:48:11PM -0700, Nick Desaulniers wrote: >>>On Fri, Apr 30, 2021 at 6:22 PM Linus Torvalds >>> wrote: >>>> 0.92% libLLVM-12.so llvm::StringMapImpl::LookupBucketFor >>> >>>^ wait a minute; notice how in your profile the `Shared Object` is >>>attributed to `libLLVM-12.so` while mine is `clang-13`? Clang can be >>>built as either having libllvm statically linked or dynamically; see >>>the cmake variables >>>LLVM_BUILD_LLVM_DYLIB:BOOL >>>LLVM_LINK_LLVM_DYLIB:BOOL >>>BUILD_SHARED_LIBS:BOOL >>>https://llvm.org/docs/CMake.html >>> >>>I think those are frowned upon; useful for cutting down on developers >>>iteration speed due to not having to relink llvm when developing >>>clang. But shipping that in production? I just checked and it doesn't >>>look like we do that for AOSP's build of LLVM. >> >>There's also `-DLLVM_ENABLE_LTO=Thin` that enables LTO for building LLVM >>and Clang themselves, considered they can be bootstrapped like this >>using a previous version of Clang. Combining that with a non-shared >>library build mode for both Clang and LLVM, the result is possibly the >>fastest and most optimized build that is achievable. Unfortunately I >>see distributions neglecting to enable this in packaging this as well. >> >>On a side note, I'm also a Fedora user and agree with Linus about this. >>I'd like to see an opt-in bypass of the shared library policy via >>something like `dnf install clang-optimized` that would install the >>fastest and most optimized Clang build regardless of RPM install size. >> > >I have experimented with creating a static version of clang in the past, >but never really found a solution I liked enough to upstream into Fedora. >e.g. This solution[1] that we're using to bootstrap clang in our internal >clang-as-the-default-cc Fedora buildroots that we use for testing. > >If someone could file a bug[2] against the clang package in Fedora (or RHEL even) >with some data or other information that shows the downsides of the shared >build of of clang, that would be really helpful. > >-Tom > >[1] https://src.fedoraproject.org/fork/tstellar/rpms/clang/c/dea2413c6822cc7aa7a08ebe73d10abf8216259f?branch=clang-minimal >[2] https://bugzilla.redhat.com/ > I have filed https://bugzilla.redhat.com/show_bug.cgi?id=1956484 with information from my previous reply https://lore.kernel.org/lkml/20210501235549.vugtjeb7dmd5xell@google.com/ -fpic (.so) -fno-semantic-interposition -Wl,-Bsymbolic-functions is very close to -fpic/-fpie (.a) in terms of performance. ( If Fedora is willing to use -fprofile-use (profile guided optimization) or ThinLTO, that's great as well, with the cost of much longer build time.)