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.