[LLVMdev] How to run LLVM3.6.1 on OS X (Yosemite, Xcode6.4) OR how to link bitcode generated by OS X clang with LLVM3.6.1

Tim Northover
Sun, 05 Jul 2015 16:01:45 -0000

> If anyone has suggestions on how to do one of the following - I would
greatly appreciate it.
> 1) Running clang built using LLVM3.6.1 (or higher) on OS X doesn’t work
because it doesn’t find system header files.
> I’ve added "-resource-dir
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.1.0”
to the command line and while versions of this path have worked in the past - it
doesn’t work anymore.

Resource-dir specifies the compiler's really, really internal support
bits. It definitely has to match the compiler being used rather than
the one provided with Xcode. What you probably want to play with
instead is -isysroot, though an OSS clang may or may not be able to
interpret those headers at any given point in time.

> I always thought that this was just a warning but now that I look at the
resulting bitcode file after linking I see that no inlining of the functions in
intrinsics_bitcode_boehm.o (this is a bitcode file and not a .o file as the
extension suggests) is taking place.

They look like reasonably harmless warnings to me too. The true test
of whether it's worked is going to be whether the output file runs
correctly though, rather than whether LLVM decided any particular
optimisation was profitable.

I assume you're running optimisation passes after linking the two
modules together? Perhaps try looking into the inliner to see why it's
decided not to do that one.

Cheers.

Tim.