tree-wide: embed dlopen notes into individual executables

Previously, when a library was dynamically loaded via a helper function
inside libsystemd-shared.so, the resulting dlopen ELF note was not
propagated to the invoking executable's ELF metadata.

This commit explicitly annotates each executable with the relevant
dlopen ELF notes for any optional dependencies it might potentially
load. This ensures that package managers and build systems can properly
discover runtime dependencies that are triggered indirectly.
This commit is contained in:
Yu Watanabe
2026-07-10 16:35:19 +09:00
parent 3853a40f39
commit 4c0d8d9673
87 changed files with 432 additions and 4 deletions
@@ -8,6 +8,7 @@
#include "alloc-util.h"
#include "cryptsetup-token.h"
#include "cryptsetup-token-util.h"
#include "dlopen-note.h"
#include "luks2-fido2.h"
#include "memory-util.h"
#include "version.h"
@@ -17,7 +18,9 @@
#define TOKEN_VERSION_MINOR "0"
/* for libcryptsetup debug purpose */
_public_ const char *cryptsetup_token_version(void) {
_public_ const char* cryptsetup_token_version(void) {
LIBFIDO2_NOTE(suggested);
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")";
}
@@ -7,6 +7,7 @@
#include "alloc-util.h"
#include "cryptsetup-token.h"
#include "cryptsetup-token-util.h"
#include "dlopen-note.h"
#include "luks2-pkcs11.h"
#include "memory-util.h"
#include "pkcs11-util.h"
@@ -17,7 +18,10 @@
#define TOKEN_VERSION_MINOR "0"
/* for libcryptsetup debug purpose */
_public_ const char *cryptsetup_token_version(void) {
_public_ const char* cryptsetup_token_version(void) {
LIBCRYPTO_NOTE(suggested);
LIBP11KIT_NOTE(suggested);
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")";
}
@@ -5,6 +5,7 @@
#include "alloc-util.h"
#include "cryptsetup-token.h"
#include "cryptsetup-token-util.h"
#include "dlopen-note.h"
#include "hexdecoct.h"
#include "json-util.h"
#include "luks2-tpm2.h"
@@ -18,7 +19,9 @@
#define TOKEN_VERSION_MINOR "0"
/* for libcryptsetup debug purpose */
_public_ const char *cryptsetup_token_version(void) {
_public_ const char* cryptsetup_token_version(void) {
LIBCRYPTO_NOTE(suggested);
TPM2_NOTE(suggested);
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")";
}
+7
View File
@@ -18,6 +18,7 @@
#include "cryptsetup-pkcs11.h"
#include "cryptsetup-tpm2.h"
#include "cryptsetup-util.h"
#include "dlopen-note.h"
#include "efi-api.h"
#include "efi-loader.h"
#include "efivars.h"
@@ -2884,6 +2885,12 @@ static int verb_detach(int argc, char *argv[], uintptr_t _data, void *userdata)
static int run(int argc, char *argv[]) {
int r;
LIBBLKID_NOTE(recommended);
LIBFIDO2_NOTE(suggested);
LIBMOUNT_NOTE(recommended);
LIBP11KIT_NOTE(suggested);
TPM2_NOTE(suggested);
log_setup();
umask(0022);