imageworks/OpenShadingLanguage — pull request #138 by lgritz (2012-05-18 17:21:04+00:00)
Title: Review: Cleanup library symbol visibility issues.

* On gcc-based systems, use __attribute__((visibility("hidden|default")))
(in export.h) and -fvisibility=hidden on the compile & link lines to
control symbol visibility so that only symbols that are part of the
public APIs are visible in the resulting library. (But also must
include functions that need to be found by dlsym() in order for LLVM
to correctly generate code to call them from shaders.)
* 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.
* (SPI only - make it compile this way by default)