Loading debuginfod-client is expensive, especially when FIPS is enabled, as it goes through time intensive self-checks on load. Avoid dlopen() when no debuginfo url is set.
Signed-off-by: Dirk Müller <d...@dmllr.de> --- libdwfl/ChangeLog | 5 +++++ libdwfl/debuginfod-client.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 9c5c8517..1ec13f30 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2022-03-28 Dirk Müller <d...@dmllr.de> + + * debuginfod-client.c (__libdwfl_debuginfod_init): Skip dlopen + if debuginfod url is unset. + 2022-02-18 Mark Wielaard <m...@klomp.org> * image-header.c (__libdw_image_header): Assign header values for diff --git a/libdwfl/debuginfod-client.c b/libdwfl/debuginfod-client.c index 99b66b6e..af9d1363 100644 --- a/libdwfl/debuginfod-client.c +++ b/libdwfl/debuginfod-client.c @@ -101,7 +101,17 @@ __libdwfl_debuginfod_end (debuginfod_client *c) void __attribute__ ((constructor)) __libdwfl_debuginfod_init (void) { - void *debuginfod_so = dlopen(DEBUGINFOD_SONAME, RTLD_LAZY); + void *debuginfod_so; + + /* Is there any server we can query? If not, don't do any work, + just return with ENOSYS. Don't even access the cache. */ + char *urls_envvar = getenv(DEBUGINFOD_URLS_ENV_VAR); + if (urls_envvar == NULL || urls_envvar[0] == '\0') + { + return; + } + + debuginfod_so = dlopen(DEBUGINFOD_SONAME, RTLD_LAZY); if (debuginfod_so != NULL) { -- 2.35.1