Skip to content

Commit d20d0da

Browse files
committed
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>
1 parent 1c73934 commit d20d0da

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,17 @@ int main(void) {
467467
return 0;
468468
}
469469
" RDMA_PRELOAD_LIBC_HAS_FCNTL64_SENDFILE64)
470+
CHECK_C_SOURCE_COMPILES("
471+
#include <fcntl.h>
472+
int fcntl(int, int, ...) { return 0; }
473+
int fcntl64(int, int, ...) { return 0; }
474+
int main(void) {
475+
return 0;
476+
}
477+
" RDMA_PRELOAD_LIBC_SYMS_LFS_NOT_ALIAS)
470478
set(CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
471479
set(CMAKE_REQUIRED_QUIET 0)
472-
if(RDMA_PRELOAD_LIBC_HAS_FCNTL64_SENDFILE64)
480+
if(RDMA_PRELOAD_LIBC_HAS_FCNTL64_SENDFILE64 AND RDMA_PRELOAD_LIBC_SYMS_LFS_NOT_ALIAS)
473481
set(RDMA_PRELOAD_HAVE_LFS_WRAPPER_SYMS 1)
474482
else()
475483
set(RDMA_PRELOAD_HAVE_LFS_WRAPPER_SYMS 0)

0 commit comments

Comments
 (0)