Hide symbols from dependent libraries if HIDE_PRIVATE_SYMBOLS is ON. (#4041)
authorndl <ndl@endl.ch>
Mon, 7 Oct 2019 15:20:26 +0000 (17:20 +0200)
committerTianqi Chen <tqchen@users.noreply.github.com>
Mon, 7 Oct 2019 15:20:26 +0000 (08:20 -0700)
commita6cd6485c9d255a7191a6ae7acc63adf79345cf1
tree858e99ee777100133c490036344e6c595df52d48
parent8a9e65c7bcbdc502c57b45005dc294625a88f681
Hide symbols from dependent libraries if HIDE_PRIVATE_SYMBOLS is ON. (#4041)

In current implementation HIDE_PRIVATE_SYMBOLS hides symbols from TVM
itself but not from its dependent libraries. This is problematic when
other third-party libraries with the same symbols are linked to the
same executable.

One example is using TVM with Mesa OpenCL drivers: they depend on LLVM
and load its shared libraries with RTLD_GLOBAL flag, which results in
conflicts with LLVM symbols that TVM uses. Arguably this particular
issue belongs to Mesa (here's their tracking bug:
https://gitlab.freedesktop.org/mesa/mesa/issues/236) but in general
that's the right thing to do regardless of this particular bug.

Note that I'm not enabling this functionality for Darwin as in my
earlier tests their linker didn't seem to understand "--exclude-libs"
(but I don't have test platform ATM to double-check).
CMakeLists.txt