Re: Trivial program size inflation

2023-07-02 Thread Mouse
> I'm sorta curious why linking against one of our small malloc > implementations still pulls in jemalloc: Using my shell on ftp.n.o (9.0_STABLE): cc -v says the ld line for cc -o null null.c -lgnumalloc is ld -plugin /usr/libexec/liblto_plugin.so -plugin-opt=/usr/libexec/lto-wrapper

Re: Trivial program size inflation

2023-07-02 Thread Simon Burge
Taylor R Campbell wrote: > A quicker way to address most of it is to just define your own malloc: > > $ cat null.o > #include > void *malloc(size_t n) { return NULL; } > void *realloc(void *p, size_t n) { return NULL; } > void *calloc(size_t n, size_t sz) { return NULL; } > void free(void *p) {}

Re: Trivial program size inflation

2023-07-02 Thread Taylor R Campbell
> Date: Sat, 1 Jul 2023 15:11:56 - (UTC) > From: mlel...@serpens.de (Michael van Elst) > > crt0 pulls in > - atexit > - environment > - static TLS > - stack guard > > which all more or less pull in jemalloc, stdio and string functions. > > You need to replace these with dummies (compile

Re: Trivial program size inflation

2023-07-02 Thread Joerg Sonnenberger
On Sun, Jul 02, 2023 at 06:52:55PM -0400, Mouse wrote: > > The CSU code has pretty much no idea on what the rest of the world is > > going to do. It does: [...] > > > There is no way with ELF to decide at link time which of those > > features are used by the program and therefore no way to

Re: Trivial program size inflation

2023-07-02 Thread Emmanuel Dreyfus
On Sun, Jul 02, 2023 at 11:16:12PM +0200, Joerg Sonnenberger wrote: > > At least in 9.3, dlopen() in a static binary does not work. Try using > > a NSS module from a statically lunked binary to check that. > > It does work in the sense that it always fails. It fails silently, there not even an

Re: Trivial program size inflation

2023-07-02 Thread Mouse
> The CSU code has pretty much no idea on what the rest of the world is > going to do. It does: [...] > There is no way with ELF to decide at link time which of those > features are used by the program and therefore no way to remove any > of them. I don't think that's true. If the program

Re: Trivial program size inflation

2023-07-02 Thread Joerg Sonnenberger
On Sun, Jul 02, 2023 at 05:04:10PM +0200, Martin Husemann wrote: > The other things that we *might* look into (if someone volunteers) is to > better modularize the CSU code, but it is not immediately clear how > that could/should be done. The CSU code has pretty much no idea on what the rest of

Re: Trivial program size inflation

2023-07-02 Thread Joerg Sonnenberger
On Sun, Jul 02, 2023 at 01:20:51AM +, Emmanuel Dreyfus wrote: > On Sat, Jul 01, 2023 at 02:25:03PM +, RVP wrote: > > Not to forget the code for C++ support. And, of course even static > > binaries may call dlopen() and friends. So that dl*() and the ELF bits > > right there. > > At least

Re: Trivial program size inflation

2023-07-02 Thread Michael van Elst
mo...@rodents-montreal.org (Mouse) writes: >> Way more interesting than useless tech demo sizes would size >> inflation of a real world minimal program, when linked statically. >Why? If I'm looking at overhead size, I am most interested in just the >overhead size, which is exactly what a no-op

Re: Trivial program size inflation

2023-07-02 Thread Mouse
> With most real world programs (hopefully) nearly 100% of what you see > as overhead now is actually needed - and it still may be bigger than > what we hope for due to suboptimal modularization. True. But this is not always as fixable as that wording implies. For example, a program that calls

Re: Trivial program size inflation

2023-07-02 Thread Martin Husemann
On Sun, Jul 02, 2023 at 01:49:57PM -0400, Mouse wrote: > Why? If I'm looking at overhead size, I am most interested in just the > overhead size, which is exactly what a no-op program gives. If I want > to look at the overhead of printf, or malloc, or something, I'd use a > program that just

Re: Trivial program size inflation

2023-07-02 Thread Mouse
> Note that a "do nothing" binary is a useless tech demo I chose it because, to a good approximation, the resulting size is nothing but overhead. It is useless as far as its own functionality goes; it is not useless in that it very clearly measures pure overhead. I actually started out on

Re: Trivial program size inflation

2023-07-02 Thread Martin Husemann
On Sun, Jul 02, 2023 at 12:34:25PM +0200, tlaro...@polynum.com wrote: > It is curious that you react this way in a thread where, you as others, > have had your jaw drop seeing the size of a literally do_nothing > executable. This was unseen precisely because few use static linking. I'm not sure

Re: Trivial program size inflation

2023-07-02 Thread Jason Thorpe
> On Jul 1, 2023, at 6:20 PM, Emmanuel Dreyfus wrote: > > On Sat, Jul 01, 2023 at 02:25:03PM +, RVP wrote: >> Not to forget the code for C++ support. And, of course even static >> binaries may call dlopen() and friends. So that dl*() and the ELF bits >> right there. > > At least in 9.3,

Re: style, sysexits(3), and man RETURN VALUES for sys programs

2023-07-02 Thread tlaronde
Le Sat, Jul 01, 2023 at 06:39:32PM -, Christos Zoulas a écrit : > In article <20230603120221.0766b60...@jupiter.mumble.net>, > Taylor R Campbell wrote: > >> Date: Sat, 3 Jun 2023 13:45:44 +0200 > >> From: tlaro...@polynum.com > >> > >> So I suggest to add a mention of sysexits(7) to style.

Re: Trivial program size inflation

2023-07-02 Thread tlaronde
Le Sat, Jul 01, 2023 at 12:04:25PM -0700, Jason Thorpe a écrit : > > > On Jul 1, 2023, at 8:20 AM, tlaro...@polynum.com wrote: > > > > This is also what I meant by "static seems to be considered deprecated". > > Honestly, I find the obsession with static linking hilariously quaint. > NetBSD

Re: Trivial program size inflation

2023-07-02 Thread RVP
On Sun, 2 Jul 2023, Emmanuel Dreyfus wrote: On Sat, Jul 01, 2023 at 02:25:03PM +, RVP wrote: Not to forget the code for C++ support. And, of course even static binaries may call dlopen() and friends. So that dl*() and the ELF bits right there. At least in 9.3, dlopen() in a static binary