Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,9 @@ 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(ARROW_SHARED_LINK_FLAGS
set(ARROW_VERSION_SCRIPT_FLAGS
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map")
set(ARROW_SHARED_LINK_FLAGS ${ARROW_VERSION_SCRIPT_FLAGS})
endif()

set(ARROW_ALL_SRCS ${ARROW_SRCS})
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/arrow/flight/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ add_arrow_lib(arrow_flight
DEPENDENCIES
flight_grpc_gen
metadata_fbs
SHARED_LINK_FLAGS
${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt
SHARED_LINK_LIBS
arrow_shared
${ARROW_FLIGHT_STATIC_LINK_LIBS}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/gpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ add_arrow_lib(arrow_cuda
DEPENDENCIES
metadata_fbs
SHARED_LINK_FLAGS
""
${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt
SHARED_LINK_LIBS
arrow_shared
${ARROW_CUDA_SHARED_LINK_LIBS}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ add_arrow_lib(arrow_python
DEPENDENCIES
${ARROW_PYTHON_DEPENDENCIES}
SHARED_LINK_FLAGS
""
${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt
SHARED_LINK_LIBS
${ARROW_PYTHON_SHARED_LINK_LIBS}
STATIC_LINK_LIBS
Expand Down
73 changes: 11 additions & 62 deletions cpp/src/arrow/symbols.map
Original file line number Diff line number Diff line change
Expand Up @@ -23,71 +23,20 @@
# 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
# (from e.g. STL or Flatbuffers) involving Arrow types.
*arrow::*;
};
# Also export C-level helpers
arrow_*;
pyarrow_*;

# Symbols marked as 'local' are not exported by the DSO and thus may not
# be used by client applications.
# be used by client applications. Everything except the above falls here.
# This ensures we hide symbols of static dependencies.
local:
# devtoolset / static-libstdc++ symbols
__cxa_*;
__once_proxy;
*;

# Static libraries that are linked in e.g. the manylinux1 build
# Brotli compression library
Brotli*;
# zlib
adler32*;
crc32*;
deflate*;
inflate*;
get_crc_table;
zcalloc;
zcfree;
zError;
zlibCompileFlags;
zlibVersion;
_tr_*;
# bz2
BZ2_*;
# lz4
LZ4_*;
LZ4F_*;
# zstandard
ZSTD_*;
ZSTDv*;
HUF_*;
HUFv*;
FSE_*;
FSEv*;
ZBUFFv*;
ZSTDMT*;
POOL_*;
HIST_*;
ERR_getErrorString;
# jemalloc
je_arrow_*;
# uriparser
uri*;
# ORC destructors
_ZThn8_N3orc*;
# Protobuf symbols that aren't hidden by the C++ section below
# (destructors, vtables, other stuff)
*N6google8protobuf*;

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::*;

# Statically linked C++ dependencies
boost::*;
double_conversion::*;
google::*;
# glog
*MakeCheckOpValueString*;
orc::*;
snappy::*;
};
};
12 changes: 9 additions & 3 deletions python/manylinux1/scripts/check_arrow_visibility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@
# specific language governing permissions and limitations
# under the License.

nm -D -C /arrow-dist/lib/libarrow.so > nm_arrow.log
grep ' T ' nm_arrow.log | grep -v arrow > visible_symbols.log
nm --demangle --dynamic /arrow-dist/lib/libarrow.so > nm_arrow.log

if [[ `cat visible_symbols.log | wc -l` -eq 2 ]]
# Filter out Arrow symbols and see if anything remains.
# '_init' and '_fini' symbols may or not be present, we don't care.
# (note we must ignore the grep exit status when no match is found)
grep ' T ' nm_arrow.log | grep -v -E '(arrow|\b_init\b|\b_fini\b)' | cat - > visible_symbols.log

if [[ -f visible_symbols.log && `cat visible_symbols.log | wc -l` -eq 0 ]]
then
exit 0
fi

echo "== Unexpected symbols exported by libarrow.so =="
cat visible_symbols.log
echo "================================================"

exit 1