This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Support platform building builtins without a full toolchain
ClosedPublic

Authored by beanz on Apr 29 2016, 1:34 PM.

Details

Summary

This patch adds support for building lib/builtins without a fully functioning toolchain. It allows you to bootstrap a cross-compiler, which previously couldn't be done with CMake.

This patch contains the following specific changes:

  • Split builtin-specific code out of config-ix.cmake into builtin-config-ix.cmake
  • Split some common CMake functionality needed by both builtins and sanitizers into base-config-ix.cmake
  • Made lib/builtins/CMakeLists.txt able to be a top-level CMake configuration

I have tested this on Darwin targeting embedded Darwin, and on FreeBSD x86_64 targeting FreeBSD AArch64.

This patch depends on http://reviews.llvm.org/D19692, and is the last part of http://reviews.llvm.org/D16653.

Diff Detail

Repository
rL LLVM

Event Timeline

beanz updated this revision to Diff 55657.Apr 29 2016, 1:34 PM
beanz retitled this revision from to [CMake] Support platform building builtins without a full toolchain.
beanz updated this object.
beanz added reviewers: samsonov, iains, jroelofs.
beanz added a subscriber: llvm-commits.
jroelofs added inline comments.May 1 2016, 11:59 AM
cmake/base-config-ix.cmake
24 ↗(On Diff #55657)

indentation is wrong here.

cmake/config-ix.cmake
218 ↗(On Diff #55657)

was bumping the min version here intentional?

lib/builtins/CMakeLists.txt
18 ↗(On Diff #55657)

why did this get deleted?

beanz added inline comments.May 2 2016, 11:15 AM
lib/builtins/CMakeLists.txt
18 ↗(On Diff #55657)

I meant to have this in a separate patch.

That file is actually only intended to be built into the libcompiler_rt.dylib that is shipped on Darwin. We actually don't currently support building that library from CMake at all, so we really shouldn't be including it in the sources anywhere. Including it in the static archives has no meaningful impact.

beanz updated this revision to Diff 55897.May 2 2016, 2:12 PM

Removing extra change to lib/builtins/CMakeLists.txt.

beanz updated this revision to Diff 55898.May 2 2016, 2:14 PM

Addressing @jroelofs other review feedback.

filcab added a subscriber: filcab.May 4 2016, 5:38 AM
filcab added inline comments.
cmake/config-ix.cmake
218 ↗(On Diff #55898)

Version bump (to a lower one) is still here, just making sure it's intentional.

lib/builtins/CMakeLists.txt
10 ↗(On Diff #55898)

No CXX in the builtins, AFAICT.

beanz updated this revision to Diff 56302.May 5 2016, 9:34 AM

Updates based on @filcab's feedback:

  • There is no cxx in the builtins
  • Watch builtins deploy to 2.0
This revision was automatically updated to reflect the committed changes.