From edd2f0d87ed26f84823b417d188c1bb6778d0402 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 10 Nov 2026 06:09:31 -0800 Subject: [PATCH] rdma-core: Do not export LFS64 wrappers in librspreload when not built librspreload.map always exports fcntl64 and sendfile64, but preload.c only defines them when the libc provides them, which is not the case on musl, so lld fails with: error: version script assignment of 'global' to symbol 'fcntl64' failed: symbol not defined Drop them from the version script when RDMA_PRELOAD_WRAP_LFS64 is off. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj --- ...librspreload-version-script-entries-.patch | 45 +++++++++++++++++++ .../rdma-core/rdma-core_66.0.bb | 1 + 2 files changed, 46 insertions(+) create mode 100644 meta-networking/recipes-support/rdma-core/rdma-core/0003-librdmacm-Allow-librspreload-version-script-entries-.patch diff --git a/meta-networking/recipes-support/rdma-core/rdma-core/0003-librdmacm-Allow-librspreload-version-script-entries-.patch b/meta-networking/recipes-support/rdma-core/rdma-core/0003-librdmacm-Allow-librspreload-version-script-entries-.patch new file mode 100644 index 0000000000..845a6ce37e --- /dev/null +++ b/meta-networking/recipes-support/rdma-core/rdma-core/0003-librdmacm-Allow-librspreload-version-script-entries-.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 10 Nov 2026 06:06:10 -0800 +Subject: [PATCH] librdmacm: Allow librspreload version script entries the libc + lacks + +librspreload.map exports fcntl, fcntl64, sendfile and sendfile64, but +which of them preload.c ends up defining depends on the libc. On musl +there are no LFS64 symbols, so the fcntl64() and sendfile64() wrappers +are not built, while on glibc with _FILE_OFFSET_BITS=64 the fcntl() and +sendfile() wrappers are emitted as fcntl64 and sendfile64. Linkers that +check the version script, like lld, then fail, e.g. on musl: + + error: version script assignment of 'global' to symbol 'fcntl64' failed: symbol not defined + error: version script assignment of 'global' to symbol 'sendfile64' failed: symbol not defined + +Pass --undefined-version for the preload module when the linker +supports it, so whichever of these names are defined get exported. + +Upstream-Status: Submitted [https://github.com/linux-rdma/rdma-core/pull/1853] +Signed-off-by: Khem Raj +--- + buildlib/rdma_functions.cmake | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake +index 6e0c7d2e..95709537 100644 +--- a/buildlib/rdma_functions.cmake ++++ b/buildlib/rdma_functions.cmake +@@ -131,6 +131,15 @@ function(rdma_rspreload_module DEST VERSION_SCRIPT) + set_target_properties(${DEST} PROPERTIES LINK_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}) + set_target_properties(${DEST} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}") + rdma_set_library_map(${DEST} ${VERSION_SCRIPT}) ++ # Which of fcntl/fcntl64 and sendfile/sendfile64 get defined depends on the ++ # libc: musl has no LFS64 symbols, while glibc with _FILE_OFFSET_BITS=64 ++ # emits the plain wrappers under the 64 names. Let linkers that check the ++ # version script (lld) skip the names that do not exist. ++ RDMA_CHECK_C_LINKER_FLAG("-Wl,--undefined-version" SUPPORTS_UNDEFINED_VERSION) ++ if (SUPPORTS_UNDEFINED_VERSION) ++ set_property(TARGET ${DEST} APPEND_STRING PROPERTY ++ LINK_FLAGS " -Wl,--undefined-version") ++ endif() + endfunction() + + # Create a special provider with exported symbols in it The shared provider diff --git a/meta-networking/recipes-support/rdma-core/rdma-core_66.0.bb b/meta-networking/recipes-support/rdma-core/rdma-core_66.0.bb index a5e9ba9f12..2725d77cb2 100644 --- a/meta-networking/recipes-support/rdma-core/rdma-core_66.0.bb +++ b/meta-networking/recipes-support/rdma-core/rdma-core_66.0.bb @@ -8,6 +8,7 @@ RDEPENDS:${PN} = "bash perl" SRC_URI = "git://github.com/linux-rdma/rdma-core.git;branch=master;protocol=https;tag=v${PV} \ file://0001-cmake-Allow-SYSTEMCTL_BIN-to-be-overridden-from-envi.patch \ file://0002-mana-Link-with-libatomic-when-64-bit-atomics-need-it.patch \ + file://0003-librdmacm-Allow-librspreload-version-script-entries-.patch \ " SRCREV = "0fa90c60fbc274edb3495f30c1afd02b3f5fd38e"