librdmacm/preload.c: fix duplicate LFS symbols definitions
85f9747 introduces the preload of fcntl64 and it fails to build on armhf:
Assembler messages:
Error: symbol `__fcntl_time64' is already defined
Error: symbol `sendfile64' is already defined
On armhf (and potentially other 32 bits systems), glibc directs fcntl64
and fcntl to the same symbol name. preload.c defines both fcntl and fcntl64
and these 2 implementations are in fact tight to the same symbol, that causes
the double symbol error.
So only provide the definition of both fcntl and fcntl64 if they are 2
separate symbols.
This fixes the issue both for sendfile64 and fcntl64.
Fixes: 85f9747 ("librdmacm: Add support for fcntl64")
Signed-off-by: Hector Cao <hector.cao@canonical.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fac3a43..520fffd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -467,9 +467,17 @@
return 0;
}
" RDMA_PRELOAD_LIBC_HAS_FCNTL64_SENDFILE64)
+CHECK_C_SOURCE_COMPILES("
+#include <fcntl.h>
+int fcntl(int, int, ...) { return 0; }
+int fcntl64(int, int, ...) { return 0; }
+int main(void) {
+ return 0;
+}
+" RDMA_PRELOAD_LIBC_SYMS_LFS_NOT_ALIAS)
set(CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_QUIET 0)
-if(RDMA_PRELOAD_LIBC_HAS_FCNTL64_SENDFILE64)
+if(RDMA_PRELOAD_LIBC_HAS_FCNTL64_SENDFILE64 AND RDMA_PRELOAD_LIBC_SYMS_LFS_NOT_ALIAS)
set(RDMA_PRELOAD_HAVE_LFS_WRAPPER_SYMS 1)
else()
set(RDMA_PRELOAD_HAVE_LFS_WRAPPER_SYMS 0)