From 9d8533b7152daf792356c601516b57c6412d3e52 Mon Sep 17 00:00:00 2001 From: Michal Sekletar Date: Wed, 22 May 2024 17:15:07 +0200 Subject: [PATCH] libsystemd: link with '-z nodelete' We want to avoid reinitialization of our global variables with static storage duration in case we get dlopened multiple times by the same application. This will avoid potential resource leaks that could have happened otherwise (e.g. leaking journal socket fd). --- meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meson.build b/meson.build index 0d68f146fd..dfea903b60 100644 --- a/meson.build +++ b/meson.build @@ -2069,6 +2069,8 @@ libsystemd = shared_library( version : libsystemd_version, include_directories : libsystemd_includes, link_args : ['-shared', + # Make sure our library is never deleted from memory, so that our open logging fds don't leak on dlopen/dlclose cycles. + '-z', 'nodelete', '-Wl,--version-script=' + libsystemd_sym_path], link_with : [libbasic], link_whole : [libsystemd_static],