Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp495470pxy; Wed, 5 May 2021 07:13:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfe+4z9jpUvHL6K4iSYmaxRUy/RrDMIwSOY4R05OV/H1B5TOahBZgMXVNcUExrsKLnypcQ X-Received: by 2002:a63:ed17:: with SMTP id d23mr14040545pgi.107.1620224026115; Wed, 05 May 2021 07:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620224026; cv=none; d=google.com; s=arc-20160816; b=JXw7hcl7yDAXblKlf5tgELEx4UYVlqvSt4s4ExBOBx7iLo0vsMA1QezzhJfUq1urKd it6mv/ZwEv3GmK4E91PTB5DeggGCEPKkANrxpJ14eWW51hgfG9UEgtfxdEx4LFIOAkj/ PvR0tnuC7nxbHxSbeun0vN4kd67LRhgcO2XdGicEk5fo4ZNrQWk39fXsQoizjIHoIYOA /balOYCuLEItilMB+D90WV10qbsVqgy+RiBH9ktzDMppL9GBt6kWszF2tT1h8sKLIupZ UKr6WzRk6dheTSTon2SaqfA1r4uJKllV8Po/pZ6sXHydFEqjVFh0njlKH748Q8SC3prR d+/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=clf2wb3Wvwg3HyTYmDIH3OCqRQ4Qu8WPQlaPdGBfodo=; b=nMTAoDfjrN7mf3EHwfsopNn0/5iFMr4WjDxzVgEQ3FgTNFtrbNXXjGzyun70unu3r1 e6LzClUN4jDvdIhm43oPj+SOl7ziLn3lv1x3W9y7LkDqt6oG781dYlhEbBbvpj1JYA8q fkgYMuLKvBi5rv7OCKdpuFFMaBIBJI0x6nRh+CpmFRB6SnLOItdNz6nzPRb4uxyijeow Lom6TE7hHKqcugAM1dqPv/kVPNEOclTm2gYSWW0S7uUhUuOKG8Nh5Zz75Kqs3a86nHfc y5Ot31w4sBM7mshMOxEWvbQ4BUvhvboQZ18wmx2EPRXmP3cidGkBo3XfDWau2LcgXwv4 3yTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JfKZNrdn; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k12si2589899plt.7.2021.05.05.07.13.33; Wed, 05 May 2021 07:13:46 -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=@gmail.com header.s=20161025 header.b=JfKZNrdn; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233332AbhEENyu (ORCPT + 99 others); Wed, 5 May 2021 09:54:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbhEENyt (ORCPT ); Wed, 5 May 2021 09:54:49 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C878C06174A for ; Wed, 5 May 2021 06:53:53 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id i4so2771909ybe.2 for ; Wed, 05 May 2021 06:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=clf2wb3Wvwg3HyTYmDIH3OCqRQ4Qu8WPQlaPdGBfodo=; b=JfKZNrdnuYgfNHUmgOCqOdIjMbuF/sBBzVGGzX9kLfLkWIIlloDiT5ky31jsg8DOtv DExpo1mE8Hml4L5w8N4MDActP/1g1nsoz/wfRWOrZqplALxFetR+3Uj+WU54aQvCmmCE xJk0IslbRFBKAWycow9Lzcz2Od3O80GUi3I22djW+tYjRUi1viMAhR939lwD36tfBST5 xwIg+ai2ILqc59Dh9FbJFgI3IvKiCv1e5KTXo8qDvj3MQu75FuGY/f5zuCbXV3v2EXGt XXkuXAV+LmoKyj0kUNtdOYepJYQkS0iOxRG2bm7F5UCFJgrm3Uz00yNr6Gwkt8ke6EvE l/0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=clf2wb3Wvwg3HyTYmDIH3OCqRQ4Qu8WPQlaPdGBfodo=; b=l7TFT80s4i0BJzHNKbBNSqHcwS60LHKqL5UEYbFydTS2MxibqSzEW1ycvaAuxKxZSL V/dx5WDsmmZw3OcbffL14bJJt/GVkwQ9DApA3HNzrDpMuX2v7K3+IHI/QJKDwifsh0Nm hSqUutR+912H2SHZ+aPXcSjnJlj4h9UQHW+gufxzwIhyvrOe32BRSectB8lFwvhP+Lwh kVdFlkDXdQFNMygrrQYrveJ1QlmcEBKfGbDeHyDwcBR8yC2WZWHMlEgCdoN8fr1eb727 ljE/5eC2dvBJdTCzjoVlHrvFSWzOVaNaDwkrvpcjkuOKV2BDyt3opioWT6bZdIJ2VJou xzuQ== X-Gm-Message-State: AOAM530OumavQAReKQgiXhILZwUR1iATzrZsOm11JP01Q5PAZ99LRDFH 0FFk1rJmC+EEJSZO1ExTqtZodiZztp89jHJRyTpwLZsCFN5kWA== X-Received: by 2002:a25:880f:: with SMTP id c15mr40989755ybl.247.1620222832436; Wed, 05 May 2021 06:53:52 -0700 (PDT) MIME-Version: 1.0 References: <1c5e05fa-a246-9456-ff4e-287960acb18c@redhat.com> <20210502093123.GC12293@localhost> <5256ed6b6f7d423daeb36fcbfc837fbc@AcuMS.aculab.com> In-Reply-To: <5256ed6b6f7d423daeb36fcbfc837fbc@AcuMS.aculab.com> From: Miguel Ojeda Date: Wed, 5 May 2021 15:53:41 +0200 Message-ID: Subject: Re: Very slow clang kernel config .. To: David Laight Cc: Adrian Bunk , Linus Torvalds , Tom Stellard , Nick Desaulniers , Masahiro Yamada , Nathan Chancellor , Linux Kernel Mailing List , clang-built-linux , Fangrui Song , Serge Guelton , Sylvestre Ledru Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 5, 2021 at 1:06 PM David Laight wrote: > > The problem isn't the packages that come with the distribution. My question was in the context of Adrian's emails who were mentioning issues for Linux distribution etc. > The problem is 3rd party programs supplied as binaries. > They have 2 big requirements: > 1) The same binary will run on all distributions (newer than some cutoff). This is fine with the "everything statically linked" model. > 2) Any serious bug fixes in system libraries get picked up when the > distribution updates the library. For 3rd party software, this is usually done through an auto-update mechanism of some kind. And since the vendor typically provides everything, including dependencies (even libc in some cases!), they can afford to statically link the world. That model, of course, has issues -- the vendor may go out of business, may be slow with security updates, etc. But this is all orthogonal to Rust -- I replied mainly because it was mentioned that Rust brought new issues to the table, which isn't true. > There is also the possibility that the implementation of some > function differs between distributions. > So you absolutely need to use the version from the installed system > not whatever was in some static library on the actual build machine. > > Both of these need stable ABI and shared libraries. Not really. If you go for the "statically linked" model for your application, you only need to care about the syscall layer (or equivalent higher-level layers in e.g. Windows/macOS). If you trust vendors a bit, you can instead go for "statically linked except for major system libraries" (like libc or libm in Linux). This is what Rust does by default for the glibc x86_64 target. Given that nowadays statically linking is convenient, affordable and improves performance, it seems like the right decision. > Remember, as far as userspace is concerned, foo.h is the definition > for 'foo' and foo.so is the current implementation. > (yes, I know a little bit of info is taken from foo.so on the build > system - but that ought to be absolutely minimal.) No, that is only the C model for shared libraries. C++ has had templates for decades now and no "C++ ABI" so far covers them. Thus, if you want to provide templates as a library, they cannot be "pre-compiled" and so the implementation is kept in the header. This actually turned out to be quite convenient and nowadays many libraries are developed as "header-only", in fact. Moreover, recently the C++ standard introduced new features that simplify taking this approach, e.g. C++17 `inline` variables. Rust has the same issue with generics, but improves the situation a bit: there is no need to reparse everything, every time, from scratch, for each translation unit that uses a library with templates (which is quite an issue for C++, with big projects going out of their way to reduce the trees of includes). Cheers, Miguel