Created attachment 2322 [details] Patch against lib/Target The attached patch adds a bogus *AsmPrinterForceLink definition to each of ARMAsmPrinter.cpp, AlphaAsmPrinter.cpp, CBackend.cpp, CPPBackend.cpp, IA64AsmPrinter.cpp, MSILWriter.cpp, MipsAsmPrinter.cpp, PIC16AsmPrinter.cpp, SPUAsmPrinter.cpp, SparcAsmPrinter.cpp and XCoreAsmPrinter.cpp. Or, in other words, the targets which don't already have such definitions. These definitions are already used by the CMake build on Windows, and could be used by the Makefile build system in the future.
Why do you need them?
I don't *need* them as such; it's a precursor to an optimisation for a dynamically linked LLVM. Regardless of that optimisation, however, this patch ensures consistency between all targets, and would — with a bit of hackery to the CMakeFiles — allow CMake to build all the LLVM backends. One of the ways to decrease the launch time of dynamically linked executables is to decrease the amount of libraries which must be searched for symbols. If all the target backends are combined into a single library, everything works fine when that library is linked to dynamically. Unfortunately, this causes static builds to fail on both platforms I test on, x86-linux and ppc-darwin, where they fail to link to any target backend whatsoever. Should you choose to accept this optimisation, these symbols will be passed in -u flags to the linker, causing it to load the requested target backends. I am aware that I will need to argue a bit more than that to convince you of the advantages of such a change, but those arguments will have to wait until later. I believe this small patch is one of the small, self-containing parts of my changes which has other benefits as well.
Anton, what are your thoughts on this?
One minor request: please consider this patch independently of whether archives should be used for the individual target libraries. It *allows* linking to targets when using archives, and is a necessary precursor for allowing the CMake build system to build these targets, but doesn't include any of these changes. As such, it just ensures consistency between targets. I took the liberty of adding Óscar Fuentes to the Cc list, as he might have input on this change too.
This bug is no longer relevant.