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.8 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 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 5AF93C43470 for ; Wed, 5 May 2021 18:04:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 39B4C613C7 for ; Wed, 5 May 2021 18:04:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235742AbhEESFk (ORCPT ); Wed, 5 May 2021 14:05:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235911AbhEESEe (ORCPT ); Wed, 5 May 2021 14:04:34 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E296EC04682F for ; Wed, 5 May 2021 10:55:23 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id g38so3780849ybi.12 for ; Wed, 05 May 2021 10:55:23 -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=JRrWDm6hzoXBYkMYgzRKxH03l5/cMdlHpkGRxjVY6Vc=; b=eQKGx1guDvHwxN5vTy0GDXI58bnIFoJ0vFbeT43gm2kxemZAHNKxXjR+6J2fEvdWyS 0iJBNRookiebnuLF9MaEFtDfcmO1JhwGICRlMFglMOBbup0HVeQcQl/b7+aUUVu89+rL uEt0JPUFptZSyQvf16g3d9BRHJVqU2PGcD2eo5OpAZBL0RJdp696Xjs699Cb9AMUQLdf iwyQcx8oiQ6gCxsVMkSvZMI3Xj0qMaHE03MsOrQ0sBiGDQcg76Rawzf/IPv+MrUAkRB1 0Ox2xBfa4LIONi8LqCF3ubT4Bi8BOosO9QOewt1+22tt5hJf/2c3pl7URDok2BZEtGgv P2Cw== 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=JRrWDm6hzoXBYkMYgzRKxH03l5/cMdlHpkGRxjVY6Vc=; b=aMds1Wme7nGS2yrnGZ/+4jhPdOPtxah9ITesnnQsxcgVRFkc2TofW5tTejW2TGKGuw 80Yqmkf3QX5bqtuT70TrMSjnv5rWvATj2Uh78fo9k96tEVZmFGbm8TORCkzQRq/bfA/I GJTzNgRwF6HBJO0V/wZA915oNv8iQREnwHZEkL9izmKaN6NeGkxCQLWBrsbo8YfzEs3E 8zCHtPw1LADeBkkgga4xuwj/hy4mxsIU1Uu++1kiuKnl3O926CuML09FNVK/YIXpxfZZ TV4I+rIgEf7v5USdMErnCJ0cDPR5RDs5hmfxVDj2oERYWLZR3JEXFlNhFxtmC/KvUOhn vdRg== X-Gm-Message-State: AOAM531lMIFAGVvGkXo7sp5bi42vWuLtbRd8h3U3LC90GKDUpOqihTwi tc/EALaGO+6fMdDrx8z+iFHZY5vb/H5awtZpFEE= X-Google-Smtp-Source: ABdhPJwVMxbf8vlQIwVEJFRANO+gao9C76bvFSL0nqB9yuRBDcc47EIYjnT8+B25t/jdiKCU7AgSkcSJK7oJgcOVlko= X-Received: by 2002:a25:bc8b:: with SMTP id e11mr44494005ybk.115.1620237323235; Wed, 05 May 2021 10:55:23 -0700 (PDT) MIME-Version: 1.0 References: <1c5e05fa-a246-9456-ff4e-287960acb18c@redhat.com> <20210502093123.GC12293@localhost> <5256ed6b6f7d423daeb36fcbfc837fbc@AcuMS.aculab.com> <3ab89c4f8b1d455ba46781b392ef0b2d@AcuMS.aculab.com> <42fdc9f1b4b44136b4eeffa0957ebc3e@AcuMS.aculab.com> In-Reply-To: <42fdc9f1b4b44136b4eeffa0957ebc3e@AcuMS.aculab.com> From: Miguel Ojeda Date: Wed, 5 May 2021 19:55:12 +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 6:25 PM David Laight wrote: > > But it is the customer's customer who comes back to you saying > that something in your library is broken. > This is when you really don't what static linking - ever. In that case, you need to refer them to your (direct) customer. I understand where you are coming from (e.g. Microsoft also encourages developers to avoid static linking their CRT), but there is no good solution for that -- some of your direct customers will require you provide the version for static linking nevertheless, so your only approach would be gating access to the static version somehow. > Static linking is much worse because different parts of the 'system' > are provided by different people. > With a little care a C shared library can be implemented by different > companies while still meeting the same ABI. I assume you are talking about things like program plugins in the form of shared libraries (e.g. a different renderers in 3D suites, different chess engines, mods in a videogame, etc.). In that case, well, if you really need a customer of yours to swap libraries without rebuilding the host program, because you want other companies to provide plugins, then obviously static linking is not the way to go. But shared libraries are just one possible solution in that space anyway, there is also IPC of different kinds, bytecode VMs, interpreters, etc. > It this case it was done to give the software engineers some > experience of writing C++. > Technically it was a big mistake. > > Bad C++ is also infinitely worse that bad C. > Exception handling (which you might think of as a gain) > is very easy to get badly wrong. > Class member overloads make it impossible to work out where data is used. > Function overloads are sometimes nice - but unnecessary. Agreed! While, in general, this applies to any language, it is specially dangerous in languages with UB. And, among those, C++ is very complex, which in turn can produce very subtle UB issues. This was understood by Rust designers, and the language is an attempt to minimize UB while, at the same time, providing higher-level features than C. Cheers, Miguel