From: Miguel Ojeda <email@example.com> To: David Laight <David.Laight@aculab.com> Cc: Adrian Bunk <firstname.lastname@example.org>, Linus Torvalds <email@example.com>, Tom Stellard <firstname.lastname@example.org>, Nick Desaulniers <email@example.com>, Masahiro Yamada <firstname.lastname@example.org>, Nathan Chancellor <email@example.com>, Linux Kernel Mailing List <firstname.lastname@example.org>, clang-built-linux <email@example.com>, Fangrui Song <firstname.lastname@example.org>, Serge Guelton <email@example.com>, Sylvestre Ledru <firstname.lastname@example.org> Subject: Re: Very slow clang kernel config .. Date: Wed, 5 May 2021 15:53:41 +0200 [thread overview] Message-ID: <CANiq72mq-SP5n_0cVr+eaP19xqJTP15V+JKUeqLiT910x=3NdA@mail.gmail.com> (raw) In-Reply-To: <5256ed6b6f7d423daeb36fcbfc837fbc@AcuMS.aculab.com> On Wed, May 5, 2021 at 1:06 PM David Laight <David.Laight@aculab.com> 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
next prev parent reply other threads:[~2021-05-05 13:53 UTC|newest] Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-29 21:53 Linus Torvalds 2021-04-30 0:19 ` Nick Desaulniers 2021-04-30 2:22 ` Nick Desaulniers 2021-05-01 0:19 ` Nick Desaulniers 2021-05-01 0:23 ` Nick Desaulniers 2021-05-01 0:25 ` Nick Desaulniers 2021-05-01 0:40 ` Nick Desaulniers 2021-05-01 1:22 ` Linus Torvalds 2021-05-01 1:48 ` Nick Desaulniers 2021-05-01 2:16 ` Fangrui Song 2021-05-01 3:32 ` Tom Stellard 2021-05-01 16:32 ` Linus Torvalds 2021-05-01 19:57 ` Serge Guelton 2021-05-01 22:39 ` Linus Torvalds 2021-05-01 23:55 ` Fangrui Song 2021-05-01 21:58 ` David Laight 2021-05-02 9:31 ` Adrian Bunk 2021-05-02 11:35 ` David Laight 2021-05-02 16:12 ` Linus Torvalds 2021-05-02 16:45 ` Adrian Bunk 2021-05-02 16:49 ` Linus Torvalds 2021-05-02 17:55 ` Adrian Bunk 2021-05-02 17:59 ` Linus Torvalds 2021-05-02 21:48 ` Adrian Bunk 2021-05-04 22:02 ` Miguel Ojeda 2021-05-05 0:58 ` Theodore Ts'o 2021-05-05 17:21 ` Miguel Ojeda 2021-05-04 21:32 ` Miguel Ojeda 2021-05-05 11:05 ` David Laight 2021-05-05 13:53 ` Miguel Ojeda [this message] 2021-05-05 14:13 ` David Laight 2021-05-05 16:06 ` Miguel Ojeda 2021-05-05 16:25 ` David Laight 2021-05-05 17:55 ` Miguel Ojeda 2021-05-03 1:03 ` Maciej W. Rozycki 2021-05-03 14:38 ` Theodore Ts'o 2021-05-03 14:54 ` Theodore Ts'o 2021-05-03 17:14 ` Maciej W. Rozycki 2021-05-03 16:09 ` David Laight 2021-05-04 23:04 ` Greg Stark 2021-05-05 0:55 ` Theodore Ts'o 2021-05-01 23:37 ` Mike Hommey 2021-05-02 5:19 ` Dan Aloni 2021-05-03 16:48 ` Tom Stellard 2021-05-03 19:00 ` Fangrui Song 2021-04-30 0:52 ` Nathan Chancellor 2021-04-30 2:21 ` Nick Desaulniers
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CANiq72mq-SP5n_0cVr+eaP19xqJTP15V+JKUeqLiT910x=3NdA@mail.gmail.com' \ --email@example.com \ --cc=David.Laight@aculab.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: Very slow clang kernel config ..' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).