diff --git a/cpp/src/arrow/symbols.map b/cpp/src/arrow/symbols.map index 0149f9515d636..a8825250d0561 100644 --- a/cpp/src/arrow/symbols.map +++ b/cpp/src/arrow/symbols.map @@ -18,11 +18,6 @@ { global: extern "C++" { - # Export pthread_once-related symbols so that two SO files - # (e.g. libarrow.so and libplasma.so) don't use separate copies of - # those symbols. - # See https://github.com/apache/arrow/pull/1953#issuecomment-386057063 - std::__once*; # The leading asterisk is required for symbols such as # "typeinfo for arrow::SomeClass". # Unfortunately this will also catch template specializations diff --git a/cpp/src/parquet/CMakeLists.txt b/cpp/src/parquet/CMakeLists.txt index 3615246ef4c1c..679851020bf07 100644 --- a/cpp/src/parquet/CMakeLists.txt +++ b/cpp/src/parquet/CMakeLists.txt @@ -209,8 +209,8 @@ if(NOT APPLE AND NOT MSVC) # Localize thirdparty symbols using a linker version script. This hides them # from the client application. The OS X linker does not support the # version-script option. - set(SHARED_LINK_FLAGS - "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/parquet/symbols.map") + set(PARQUET_SHARED_LINK_FLAGS + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map") endif() # Because of PARQUET-1420 (Thrift-generated symbols not exported in DLL), diff --git a/cpp/src/parquet/symbols.map b/cpp/src/parquet/symbols.map index e00751e35c320..4bf032dd5846c 100644 --- a/cpp/src/parquet/symbols.map +++ b/cpp/src/parquet/symbols.map @@ -21,6 +21,7 @@ local: # devtoolset / static-libstdc++ symbols __cxa_*; + __once_proxy; extern "C++" { # boost @@ -34,5 +35,6 @@ # a system with an older libstdc++ which doesn't include the necessary # c++11 symbols. std::*; + *std::__once_call*; }; }; diff --git a/cpp/src/plasma/CMakeLists.txt b/cpp/src/plasma/CMakeLists.txt index 729fba7e944a4..fa3b15795ee4a 100644 --- a/cpp/src/plasma/CMakeLists.txt +++ b/cpp/src/plasma/CMakeLists.txt @@ -80,6 +80,14 @@ if(ARROW_CUDA) add_definitions(-DPLASMA_CUDA) endif() +if(NOT APPLE AND NOT MSVC) + # Localize thirdparty symbols using a linker version script. This hides them + # from the client application. The OS X linker does not support the + # version-script option. + set(PLASMA_SHARED_LINK_FLAGS + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map") +endif() + add_arrow_lib(plasma SOURCES ${PLASMA_SRCS} @@ -87,6 +95,8 @@ add_arrow_lib(plasma PLASMA_LIBRARIES DEPENDENCIES gen_plasma_fbs + SHARED_LINK_FLAGS + ${PLASMA_SHARED_LINK_FLAGS} SHARED_LINK_LIBS ${PLASMA_LINK_LIBS} STATIC_LINK_LIBS diff --git a/cpp/src/plasma/symbols.map b/cpp/src/plasma/symbols.map new file mode 100644 index 0000000000000..32c86daa44039 --- /dev/null +++ b/cpp/src/plasma/symbols.map @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +{ + # Symbols marked as 'local' are not exported by the DSO and thus may not + # be used by client applications. + local: + # devtoolset / static-libstdc++ symbols + __cxa_*; + __once_proxy; + + extern "C++" { + # devtoolset or -static-libstdc++ - the Red Hat devtoolset statically + # links c++11 symbols into binaries so that the result may be executed on + # a system with an older libstdc++ which doesn't include the necessary + # c++11 symbols. + std::*; + *std::__once_call*; + }; +};