[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sort dynamic linking overhead
From: |
Bruno Haible |
Subject: |
Re: sort dynamic linking overhead |
Date: |
Tue, 27 Feb 2024 20:01:00 +0100 |
Paul Eggert wrote:
> Thanks for the patch. I was hoping that we didn't need to worry about
> older platforms needing -ldl. Oh well.
Distros with glibc < 2.34 include:
Debian 11
CentOS 8 stream
Fedora 34
openSUSE 15.5
Slackware 15
These are not obsolete, so far.
> The patch causes 'configure' to search for dlopen even when there's no
> crypto library. 'configure' could instead use AC_SEARCH_LIBS only if the
> AC_LINK_IFELSE fails (or simply put AC_LINK_ELSE in an 'for LIB_DL in ""
> -ldl' loop). But perhaps it's better to leave things be, in case we ever
> need dlopen for something else.
If we were to start optimizing configure.ac scripts like this, they would
quickly become hard to maintain, because here and there we would be
accessing a shell variable that has not been initialized (because the
initialization was in an 'if' branch). (There's a reason why AC_REQUIRE
has been invented...)
The configure tests which nag me the most are those which take one second
of time or more: the fcntl test, the sleep test, the strstr test, and a few
others. If someone is starting to optimize, here would be the starting point :)
> Also, if I understand things correctly, with this patch it's
> theoretically possible to pass -ldl to gcc even when 'sort' doesn't do
> dynamic linking, and we could complicate configure.ac further to omit
> -ldl in that case. But I doubt whether it's worth worrying about this.
Correct, but this applies only to glibc and Android systems, and on these
systems configure finds
checking for C compiler flag to ignore unused libraries... -Wl,--as-needed
So, if $(LIB_DL) is -ldl and this linker option gets used for 'sort', but
'sort' does not use dlopen(), the linker will eliminate it.
Bruno
Re: sort dynamic linking overhead, Pádraig Brady, 2024/02/26
Re: sort dynamic linking overhead, Bruno Haible, 2024/02/27