[cfe-dev] Clang as a compiler-only tool
David Chisnall
David.Chisnall at cl.cam.ac.uk
Tue Nov 27 08:24:07 PST 2012
On 27 Nov 2012, at 15:48, Rafael EspĂndola wrote:
> Another possibility that might work is to build a shared library that
> exports only the symbols that plugins can use (just lib/AST maybe?)
> and have both clang and plugins link with it.
To use LLVM plugins I have to do a build with shared libraries, or you get a problem two handlers for command line options get registered (or, rather, the same one twice). I tried doing builds of LLVM and FreeBSD using the shared and statically linked versions of clang and found that there was a 5-10% slowdown for the shared version on x86-64, which didn't seem too bad. Not ideal, but a smaller change than going from -O2 to -O3 and a much smaller slowdown than enabling LTO.
The problem with only exporting the symbols that you think a plugin would use is that it's very hard to determine exactly what those would be. For example, it sounds like a lot of people want to write plugins that modify IR generation, so they'd need access to all of the clang IRGen and a load of the LLVM stuff as well.
David
More information about the cfe-dev
mailing list