Our clang++
build of executables with undefined behavior sanitizer works fine for executables when compiled as follows:
ccache clang++ -Qunused-arguments -fcolor-diagnostics -c -MMD -MP -std=c++11 --O1 -g3 -fPIC -fsanitize=address,undefined -fno-omit-frame-pointer -I /usr/lib/jvm/java-8-openjdk-amd64/include -I /usr/lib/jvm/java-8-openjdk-amd64/include/linux -o native/instrumen.o native/instrument.cpp
And linked to an executable as follows:
ccache clang++ -Qunused-arguments -fcolor-diagnostics -fsanitize=address,undefined -o cegis -Wl,--start-group native/instrument.o -Wl,--end-group
However, if we link it in a shared library as follows:
ccache clang++ -Qunused-arguments -fcolor-diagnostics -fsanitize=address,undefined -shared -o libsynth4j.so native/synth4j.o native/instrument.o ../lib/libinfo.a
We get the following error when trying to load the library from Java using JNI:
libsynth4j.so: undefined symbol: __ubsan_vptr_type_cache
Are there any additional considerations when creating shared libraries instead of executables using the clang undefined behaviour sanitizer? Our clang++ version is 3.7 running on Ubuntu Linux.