This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Support single target builtins build on Darwin
ClosedPublic

Authored by phosek on Mar 14 2017, 3:28 PM.

Details

Summary

This change allows cross-compiling compiler-rt builtins for multiple targets as part of runtimes on Darwin. This functionality is already supported on other platforms.

Diff Detail

Repository
rL LLVM

Event Timeline

phosek created this revision.Mar 14 2017, 3:28 PM
beanz added inline comments.Mar 17 2017, 3:28 PM
cmake/modules/LLVMExternalProjectUtils.cmake
47

This part of the change can't be done without causing problems on Darwin. llvm-ar and llvm-ranlib don't correctly handle fat archives on Darwin, so if you have a Darwin target we really don't want this to be the case. That's why this isn't defaulted.

You really need to just override the TOOLCHAIN_TOOLS option at the call site. We also probably shouldn't have lld in the list, but it doesn't have any adverse side effects because we don't force its use.

runtimes/CMakeLists.txt
156

I believe this patch will misbehave if LLVM_BUILTIN_TARGETS is a Darwin target, so we probably need to put some sort of protection in to catch that.

phosek updated this revision to Diff 92417.Mar 20 2017, 7:18 PM
phosek marked 2 inline comments as done.
beanz edited edge metadata.Mar 21 2017, 10:50 AM

One minor style comment, otherwise looks good to me.

runtimes/CMakeLists.txt
185

This shouldn't need to be semi-colon separated. Space separated should work because TOOLCHAIN_TOOLS is a list parameter.

phosek updated this revision to Diff 92541.Mar 21 2017, 2:01 PM
phosek marked an inline comment as done.
beanz accepted this revision.Mar 21 2017, 3:26 PM

LGTM!

This revision is now accepted and ready to land.Mar 21 2017, 3:26 PM

Thanks, could you also please take at D30958?

This revision was automatically updated to reflect the committed changes.