Dear LLVMers, I'm currently working on creating an alternate libLTO.so that will run some whole-program analysis and transforms of mine during the final linking of an executable. The idea is for it to link all of the bitcode files together, run the regular LTO passes, and then run my passes. For Linux, I should be able to get the Gold linker to load my libLTO.so instead of the standard one, thereby allowing my passes to be run seamlessly when compiling large programs with complicated build systems. Can something similar be done on Mac OS X? Does the XCode linker dynamically load libLTO.dylib to perform link-time optimization? -- John T.
On Nov 12, 2009, at 11:43 AM, John Criswell wrote:> Dear LLVMers, > > I'm currently working on creating an alternate libLTO.so that will run > some whole-program analysis and transforms of mine during the final > linking of an executable. The idea is for it to link all of the > bitcode > files together, run the regular LTO passes, and then run my passes. > For > Linux, I should be able to get the Gold linker to load my libLTO.so > instead of the standard one, thereby allowing my passes to be run > seamlessly when compiling large programs with complicated build > systems. > > Can something similar be done on Mac OS X? Does the XCode linker > dynamically load libLTO.dylib to perform link-time optimization?Yes, it looks relative to itself to find it. If you link with / Developer/usr/bin/ld, it uses /Developer/usr/lib/libLTO.dylib. -Chris
On 12 Nov 2009, at 20:51, Chris Lattner wrote:> Yes, it looks relative to itself to find it. If you link with / > Developer/usr/bin/ld, it uses /Developer/usr/lib/libLTO.dylib.Alternatively, you could set the ‘DYLD_LIBRARY_PATH’ environment variable. The paths specified by it are searched *before* the both the path specified in the binary as well as the system fallback path. I often use it myself for newer versions of LLVM; the only caveat is that it won't work for e.g. ‘nm’, ‘ar’ and so on. Unlike ‘ld’ they load the library at runtime using a hardcoded path. For example: DYLD_LIBRARY_PATH=/opt/llvm/lib make -j2 Hope that helps, -- Dan Villiom Podlaski Christiansen danchr at gmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 1943 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091112/0eea394e/attachment.bin>