Page MenuHomePhabricator

[CMake] Add LLVM runtimes directory
ClosedPublic

Authored by beanz on Jun 3 2016, 4:33 PM.

Details

Summary

There are a few LLVM projects that produce runtime libraries. Ideally
runtime libraries should be built differently than other projects,
specifically they should be built using the just-built toolchain.

There is support for building compiler-rt in this way from the clang
build. Moving this logic into the LLVM build is interesting because it
provides a simpler way to extend the just-built toolchain to include
LLD and the LLVM object file tools.

Once this functionality is better fleshed out and tested we’ll want to
encapsulate it in a module that can be used for clang standalone
builds, and we’ll want to make it the default way to build compiler-rt.

With this patch applied there is no immediate change in the build.
Moving compiler-rt out from llvm/projects into llvm/runtimes enables
the functionality.

This code has a few improvements over the method provided by
LLVM_BUILD_EXTERNAL_COMPILER_RT. Specifically the sub-ninja command is
always invoked, so changes to compiler-rt source files will get built
properly, so this patch can be used for iterative development with
just-built tools.

Diff Detail

Repository
rL LLVM

Event Timeline

beanz updated this revision to Diff 59640.Jun 3 2016, 4:33 PM
beanz retitled this revision from to [CMake] Add LLVM runtimes directory.
beanz updated this object.
beanz added reviewers: chandlerc, bogner.
beanz added a subscriber: llvm-commits.
beanz updated this revision to Diff 61451.Jun 21 2016, 2:37 PM

I kinda went a bit off into the woods after the llvm-dev thread, and I think I came back with something either interesting or insane... you decide.

This patch changed a few things about how I'm handling the runtimes subdirectory. First, it handles the compiler-rt builtin library dependency by building the builtins first as their own external project call. Second, it glumps all the other runtime libraries (including compiler-rt's sanitizers) into a single external project by using the runtimes/CMakeLists.txt file as the top-level CMake.

This is interesting for a few reasons. The biggest is a potential for reduced CMake-overhead when building runtime libraries. Additionally it will allow cross-project dependencies to be more easily modeled in CMake because the runtime libraries will be able to be aware of the targets coming from other runtime projects.

Thoughts?

beanz updated this revision to Diff 61724.Jun 23 2016, 2:34 PM
  • Added documentation to runtimes/CMakeLists.txt
  • Updated .gitignore to ignore subdirectories under runtimes
  • Removed a small hack from runtimes/CMakeLists.txt that related to libcxx - libcxx support for this path will be in a follow up
This revision was automatically updated to reflect the committed changes.