Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2936914pxy; Mon, 3 May 2021 11:14:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJYlHP1yXF9RaVc9qKtGnf5AaTkuKPJdVnFjHjSmyFR1em0XW1prCjq3V3W08SuiIACySo X-Received: by 2002:a63:e44f:: with SMTP id i15mr5065177pgk.147.1620065693497; Mon, 03 May 2021 11:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620065693; cv=none; d=google.com; s=arc-20160816; b=KE2TgD/oGNpaPwKgAF1wgPPhQtijaQCK7cPhzeispvQswetA1LC8OT6a6rP2Iafy7H zQ4JrCh55Z5xSLwhGSZURDmJUidECJoh023bNdZt0FMzj0Ev04w5HhXuF/g/XthhHX1u U54IRpFwqutyJBuvePqDKTJuJxy33wHdEnWId95RmM3De//IVsyBUW3a/+aDGk4pnoYd BJpFWQGEMP7o9bTflklgs764mTQh+ATNeRKlRvyJmSx9qd0JeUiTjoEbD4vYxFHE4tJE tEjRPTU28Dyaqc6Z15XFlvmMQDa3foJP2y53JP1TFvRPGCmz3Enx5fn0o+QGpebqqrcs a0qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=Yu8qvLbcCAvAnFk4XShMevVgYK+FRf9Q7zPytdY+pxs=; b=hOdmihUKw5/oVoJpOvZtp+3dj94QpLGnUs/oTBpeMILLc2mnzqAr1QeCsKFQ/5CkJV UiNdfVd23UB9yZCW99uz18AFK/IvbliDN43Ite4YHszuTJ4T3XKSIbgOviXRenrOuHKM 6cln35g4YZ4O3s+HTAkT28Zr+2A215fyLoSmQLpywhrsOM7dXN5D1mWW+PtyOtv6acIL DTwsF/Kypq88KfyDVYLs0fpez5gpDf5eKVoE+EeJ6J3gS6xe0iMOYHvVp8t9ya9nvdS0 AbJRG2dIFTwQdutMqmiRmziN/P0kh1IXYJCwuiYyJIBx1Owe2zUuOuvekE+iCq7aPR5u Y/Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ej0Ky9MI; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j20si62617pfj.243.2021.05.03.11.14.40; Mon, 03 May 2021 11:14:53 -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=@redhat.com header.s=mimecast20190719 header.b=ej0Ky9MI; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232764AbhECQ4X (ORCPT + 99 others); Mon, 3 May 2021 12:56:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41907 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234345AbhECQuG (ORCPT ); Mon, 3 May 2021 12:50:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620060552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yu8qvLbcCAvAnFk4XShMevVgYK+FRf9Q7zPytdY+pxs=; b=ej0Ky9MIlmNHxHQB9eq3HyhMduY9dCUOxkJ8Didgao2FUnVZP42Gz/OodckMRwbRUnJh/L 3m+VNYnfbf/WFR+ekVHw1AN4IxmaIRIX/foRO60QU9TBldCvFveEuxuD27gie7ewNxN2rS 45t7LO/rVL7FtIfJ9+zTF71/p0ENX/M= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-326-NdpJuQ0hNfG3HqZJdUHOYQ-1; Mon, 03 May 2021 12:49:00 -0400 X-MC-Unique: NdpJuQ0hNfG3HqZJdUHOYQ-1 Received: by mail-qv1-f69.google.com with SMTP id l5-20020a0ce0850000b02901c37c281207so5351340qvk.11 for ; Mon, 03 May 2021 09:49:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Yu8qvLbcCAvAnFk4XShMevVgYK+FRf9Q7zPytdY+pxs=; b=bNnDp6ab1f/3HqPl85Kf9Rap78pXS98YXYWoR3ooIVZGXqp3yF84TNRc0Tr0uUo8Vx roQiV93ikv6JZG9gThs7TFWIeyI+cbIaheUqV7NRU4pPZF3Mwhiz04V+AHwSkClrMSR6 qhl4ZU7jJb8YnPqSKz7c3umEJl0bKg/jAKcukbCevHLy2uG1X2jjeP7OV7ItsesuqLQX VTFyunK5s36IZQKDnXrS8DOPGDOgIYDVhBIMiVq/6RN9DkNNawXNxUT9ZDJacz7iVvZZ IAOnhUjLmO+3aVuEP8nrYEiglnZx0Jsdcic8w0yyndEsWDfN2dCBxvkIeEjk5BfdrFS5 fdsQ== X-Gm-Message-State: AOAM5337dCe8d2jGuStkKeRy9KyENgmhzlD+dXRTCunosdWyY4fS899N RbRSThCIPdviOdfKrmsRmjGi214QxTyCYSTVttd7HJmstsXugRGxwTlsixFRH+9IBrwgOGBai0w xT2abx4fV3AXwG1CZpPd9PLzO X-Received: by 2002:a05:620a:389:: with SMTP id q9mr11102365qkm.16.1620060540315; Mon, 03 May 2021 09:49:00 -0700 (PDT) X-Received: by 2002:a05:620a:389:: with SMTP id q9mr11102350qkm.16.1620060540143; Mon, 03 May 2021 09:49:00 -0700 (PDT) Received: from tstellar.remote.csb (97-120-191-206.ptld.qwest.net. [97.120.191.206]) by smtp.gmail.com with ESMTPSA id s25sm8447596qkj.34.2021.05.03.09.48.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 May 2021 09:48:59 -0700 (PDT) Subject: Re: Very slow clang kernel config .. To: Dan Aloni , Nick Desaulniers Cc: Linus Torvalds , Masahiro Yamada , Nathan Chancellor , Linux Kernel Mailing List , clang-built-linux , Fangrui Song , Serge Guelton , Sylvestre Ledru References: <20210502051909.pac2pycninc7fl53@gmail.com> From: Tom Stellard Message-ID: <6c4febd7-f826-9935-4163-138b1fed8278@redhat.com> Date: Mon, 3 May 2021 09:48:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210502051909.pac2pycninc7fl53@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/