[LLVMdev] Global constructors "get lost" when transforming bitcode files

Jonas Wagner jonas.wagner at epfl.ch
Thu Jul 10 08:43:47 PDT 2014


Hi,

Are you setting DYLD_LIBRARY_PATH when running on OS X? The linker on
> OS X uses that to find libLTO.dylib.
>

This indeed solves the problem! Thanks for the hint. Although I had used
custom versions of Clang for a while, this is the first time I encountered
incompatibilities with the system linker, and so I wasn't aware of the need
to set DYLD_LIBRARY_PATH.

The llvm-dis/llvm-as operation should be a no-op, yet the global_ctors get
>> lost in the process. This happens also with other operations that affect
>> global_ctors, e.g., with "opt -insert-gcov-profiling".
>>
>

> This isn't strictly true.  Deserializing old bitcode will auto-upgrade it.
>  In this case, it will be auto-upgraded to the 3-field form of
> llvm.global_ctors.


I see. I wonder if this is what's happening. Clang and llvm-as are built
against the same version of LLVM, so Clang should not emit old bitcode. On
the other hand, the fact that the system linker understands Clang-generated
bitcode probably means it used the old format.

Best,
Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140710/fc111430/attachment.html>


More information about the llvm-dev mailing list