From bbefa63c99dd86a08c853c82fbe304481c20f7aa Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Sat, 22 Aug 2026 00:41:21 +0200 Subject: [PATCH 1/2] Link arrow_s3fs with -Bsymbolic-functions --- cpp/CMakeLists.txt | 2 ++ cpp/src/arrow/CMakeLists.txt | 4 ++++ cpp/src/arrow/filesystem/s3fs.cc | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index fd5eaf77f23b..79fe2fac48f9 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -367,6 +367,8 @@ else() check_linker_flag(CXX "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/arrow/symbols.map" CXX_LINKER_SUPPORTS_VERSION_SCRIPT) + check_linker_flag(CXX "-Wl,-Bsymbolic-functions" + CXX_LINKER_SUPPORTS_BSYMBOLIC_FUNCTIONS) endif() # diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index b9ff2ffa2c2d..908cd6bb58ae 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -1045,6 +1045,10 @@ if(ARROW_FILESYSTEM) add_library(arrow_s3fs MODULE filesystem/s3fs_module.cc filesystem/s3fs.cc) target_link_libraries(arrow_s3fs PRIVATE ${AWSSDK_LINK_LIBRARIES} arrow_shared) + if(CXX_LINKER_SUPPORTS_BSYMBOLIC_FUNCTIONS) + # Use this module's own S3 global state, not libarrow's copy of the same symbols + target_link_options(arrow_s3fs PRIVATE "-Wl,-Bsymbolic-functions") + endif() set_source_files_properties(filesystem/s3fs.cc filesystem/s3fs_module.cc PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) endif() diff --git a/cpp/src/arrow/filesystem/s3fs.cc b/cpp/src/arrow/filesystem/s3fs.cc index 1c6763a4aee9..91db2a3667fe 100644 --- a/cpp/src/arrow/filesystem/s3fs.cc +++ b/cpp/src/arrow/filesystem/s3fs.cc @@ -3668,7 +3668,7 @@ Result ResolveS3BucketRegion(const std::string& bucket) { return resolver->ResolveRegion(bucket); } -auto kS3FileSystemModule = ARROW_REGISTER_FILESYSTEM( +static auto kS3FileSystemModule = ARROW_REGISTER_FILESYSTEM( "s3", [](const arrow::util::Uri& uri, const FileSystemFactoryOptions& options, const io::IOContext& io_context, From 361fa5e4c8dee73d0ebf0d83e5b096afad1aa596 Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Tue, 25 Aug 2026 16:32:02 +0200 Subject: [PATCH 2/2] WORKAROUND until S3 is moved in GH-50194 --- compose.yaml | 4 ++++ cpp/CMakeLists.txt | 2 -- cpp/src/arrow/CMakeLists.txt | 4 ---- cpp/src/arrow/filesystem/s3fs.cc | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/compose.yaml b/compose.yaml index 6fa4e6fee5be..b594f83e27fa 100644 --- a/compose.yaml +++ b/compose.yaml @@ -292,6 +292,8 @@ services: ulimits: *ulimits environment: <<: [*common, *ccache, *sccache, *cpp] + # WORKAROUND: Remove after S3 is moved out of libarrow (GH-50194) + CXXFLAGS: "-fvisibility-inlines-hidden" ARROW_BUILD_BENCHMARKS: "ON" ARROW_BUILD_EXAMPLES: "ON" ARROW_BUILD_OPENMP_BENCHMARKS: "ON" @@ -327,6 +329,8 @@ services: shm_size: *shm-size environment: <<: [*common, *ccache, *sccache, *cpp] + # WORKAROUND: Remove after S3 is moved out of libarrow (GH-50194) + CXXFLAGS: "-fvisibility-inlines-hidden" # Shrink test runtime by enabling minimal optimizations ARROW_C_FLAGS_DEBUG: "-g1 -Og" ARROW_CXX_FLAGS_DEBUG: "-g1 -Og" diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 79fe2fac48f9..fd5eaf77f23b 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -367,8 +367,6 @@ else() check_linker_flag(CXX "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/arrow/symbols.map" CXX_LINKER_SUPPORTS_VERSION_SCRIPT) - check_linker_flag(CXX "-Wl,-Bsymbolic-functions" - CXX_LINKER_SUPPORTS_BSYMBOLIC_FUNCTIONS) endif() # diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index 908cd6bb58ae..b9ff2ffa2c2d 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -1045,10 +1045,6 @@ if(ARROW_FILESYSTEM) add_library(arrow_s3fs MODULE filesystem/s3fs_module.cc filesystem/s3fs.cc) target_link_libraries(arrow_s3fs PRIVATE ${AWSSDK_LINK_LIBRARIES} arrow_shared) - if(CXX_LINKER_SUPPORTS_BSYMBOLIC_FUNCTIONS) - # Use this module's own S3 global state, not libarrow's copy of the same symbols - target_link_options(arrow_s3fs PRIVATE "-Wl,-Bsymbolic-functions") - endif() set_source_files_properties(filesystem/s3fs.cc filesystem/s3fs_module.cc PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) endif() diff --git a/cpp/src/arrow/filesystem/s3fs.cc b/cpp/src/arrow/filesystem/s3fs.cc index 91db2a3667fe..1c6763a4aee9 100644 --- a/cpp/src/arrow/filesystem/s3fs.cc +++ b/cpp/src/arrow/filesystem/s3fs.cc @@ -3668,7 +3668,7 @@ Result ResolveS3BucketRegion(const std::string& bucket) { return resolver->ResolveRegion(bucket); } -static auto kS3FileSystemModule = ARROW_REGISTER_FILESYSTEM( +auto kS3FileSystemModule = ARROW_REGISTER_FILESYSTEM( "s3", [](const arrow::util::Uri& uri, const FileSystemFactoryOptions& options, const io::IOContext& io_context,