You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2019/04/22 12:35:30 UTC
[arrow] branch master updated: ARROW-2796: [C++] Simplify version
script used for linking
This is an automated email from the ASF dual-hosted git repository.
wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new d9f6753 ARROW-2796: [C++] Simplify version script used for linking
d9f6753 is described below
commit d9f675328edb1be9fc63a753cf05e3b4e9024707
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Mon Apr 22 12:35:13 2019 +0000
ARROW-2796: [C++] Simplify version script used for linking
Also use it for Arrow sublibraries: libarrow_flight.so, libarrow_python.so, libarrow_cuda.so.
Author: Antoine Pitrou <an...@python.org>
Closes #4142 from pitrou/ARROW-2796-simply-version-script and squashes the following commits:
c10f994e <Antoine Pitrou> ARROW-2796: Simplify version script used for linking
---
cpp/src/arrow/CMakeLists.txt | 3 +-
cpp/src/arrow/flight/CMakeLists.txt | 2 +
cpp/src/arrow/gpu/CMakeLists.txt | 2 +-
cpp/src/arrow/python/CMakeLists.txt | 2 +-
cpp/src/arrow/symbols.map | 73 ++++------------------
.../manylinux1/scripts/check_arrow_visibility.sh | 12 +++-
6 files changed, 26 insertions(+), 68 deletions(-)
diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt
index 6dac9ee..1049e27 100644
--- a/cpp/src/arrow/CMakeLists.txt
+++ b/cpp/src/arrow/CMakeLists.txt
@@ -241,8 +241,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})
diff --git a/cpp/src/arrow/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt
index c9c1e4d..8b9e4d0 100644
--- a/cpp/src/arrow/flight/CMakeLists.txt
+++ b/cpp/src/arrow/flight/CMakeLists.txt
@@ -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}
diff --git a/cpp/src/arrow/gpu/CMakeLists.txt b/cpp/src/arrow/gpu/CMakeLists.txt
index 334904d..caef952 100644
--- a/cpp/src/arrow/gpu/CMakeLists.txt
+++ b/cpp/src/arrow/gpu/CMakeLists.txt
@@ -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}
diff --git a/cpp/src/arrow/python/CMakeLists.txt b/cpp/src/arrow/python/CMakeLists.txt
index 6f61836..8df447b 100644
--- a/cpp/src/arrow/python/CMakeLists.txt
+++ b/cpp/src/arrow/python/CMakeLists.txt
@@ -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
diff --git a/cpp/src/arrow/symbols.map b/cpp/src/arrow/symbols.map
index 9b24ab4..0149f95 100644
--- a/cpp/src/arrow/symbols.map
+++ b/cpp/src/arrow/symbols.map
@@ -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::*;
- };
};
diff --git a/python/manylinux1/scripts/check_arrow_visibility.sh b/python/manylinux1/scripts/check_arrow_visibility.sh
index 477da65..ed464e0 100755
--- a/python/manylinux1/scripts/check_arrow_visibility.sh
+++ b/python/manylinux1/scripts/check_arrow_visibility.sh
@@ -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