<div dir="ltr">Hi,<div><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Are you setting DYLD_LIBRARY_PATH when running on OS X? The linker on<br>
OS X uses that to find libLTO.dylib.<br></blockquote><div><br></div><div>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.</div>
<div><br></div><div><div class="im"><blockquote class="gmail_quote" style="font-family:arial,sans-serif;font-size:13px;margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote">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".<br>
</blockquote></blockquote><div style="font-family:arial,sans-serif;font-size:13px"> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
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.</blockquote><div><br></div><div>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.</div>
<div><br></div><div>Best,</div><div>Jonas</div></div></div></div></div></div>