From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C48BEC43460 for ; Wed, 5 May 2021 13:53:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90C666101C for ; Wed, 5 May 2021 13:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233379AbhEENyw (ORCPT ); Wed, 5 May 2021 09:54:52 -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-Google-Smtp-Source: ABdhPJwt59zPhG3C7dBLxMIsKHiFesWF0LokA9gB7+aHvgW6h2cIYRqmUd2pqlVd/hmi748H50J3AuRXQjAbW8P7vCE= 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