[LLVMdev] Shared libraries, msan and -z,defs

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jan 21 05:59:47 PST 2015


I recently tried to enabled building llvm libraries with -Wl,-z,defs.
The intention was to detect missing dependencies on ELF, so that we
don't
get into a situation where a .so builds, but the equivalent .dylib or
.dll fails.

This failed when building with msan because of undefined references to
functions like __msan_memcpy.

Unfortunately, I don't think elf linkers have a way of informing them
that a given symbol will be provided at runtime. It is possible to
pass a dummy executable build with msan, but that gets recorded in
DT_NEEDED.

My understanding is that the msan library provides two things: an
initialization code that has to run really early and auxiliary
functions like __msan_memcpy.

Would it be possible to split libclang_rt.msan-x86_64.a such that the
utility functions are available on a .so (or at least a -fPIC .a)?
That library could be linked with every .so. The early init logic
would still only be linked with executables.

Cheers,
Rafael



More information about the llvm-dev mailing list