Please sign in to comment.
Cleanup library symbol visibility issues.
* On gcc-based systems, use __attribute__((visibility("hidden|default"))) (in export.h) to clearly mark which symbols must be visible as part of the public API (or that must be found by dlsym() in order for LLVM to correctly generate code to call them from shaders), versus symbols used only internally to the library that don't need to be visible to apps linking OSL libraries. Note that Windows already did this for DLLs. * For Unix-like systems, if the CMake variable HIDE_SYMBOLS is on (or 'make HIDE_SYMBOLS=1'), then use -fvisibility=hidden on the compile & link lines to control symbol visibility so that the default is to hide symbols not marked as part of the public APIs. (Note: Windows does this by default.) Even if HIDE_SYBOLS=1, the symbols are not hidden for DEBUG builds, so that all the symbols are available. * Add Makefile/CMake option LLVM_STATIC to use static LLVM libs rather than dynamic library. * On Linux, when LLVM_STATIC is used, also use linker option --version-script and a custom version-script for liboslexec.so in order to force LLVM's symbols to also remain hidden outside the OSL library. This is extremely helpful to apps that want to embed OSL but also embed LLVM for other reasons (and not necessarily the same version of LLVM) -- this makes sure the symbols don't crash when the program runs, leading to strange crashes.
- Loading branch information...
Showing with 146 additions and 90 deletions.
- +10 −0 Makefile
- +2 −0 site/spi/Makefile-bits
- +20 −4 src/CMakeLists.txt
- +15 −0 src/cmake/externalpackages.cmake
- +40 −41 src/include/export.h
- +3 −3 src/include/oslquery.h
- +0 −1 src/liboslcomp/ast.cpp
- +0 −2 src/liboslcomp/codegen.cpp
- +1 −3 src/liboslcomp/oslgram.y
- +1 −0 src/liboslcomp/osllex.l
- +0 −1 src/liboslcomp/symtab.cpp
- +0 −1 src/liboslcomp/typecheck.cpp
- +10 −4 src/liboslexec/CMakeLists.txt
- +4 −0 src/liboslexec/liboslexec.map
- +6 −3 src/liboslexec/loadshader.cpp
- +22 −26 src/liboslexec/oslexec_pvt.h
- +1 −1 src/liboslexec/osogram.y
- +11 −0 src/liboslexec/shadingsys.cpp
|@@ -0,0 +1,4 @@|
|+ global: *OSL*; osl_*;|
|+ local: *;|