This is an archive of the discontinued LLVM Phabricator instance.

[CMake][compiler-rt] Don't load LLVM config in the runtimes build
ClosedPublic

Authored by phosek on Nov 11 2022, 2:52 PM.

Details

Reviewers
smeenai
mstorsjo
mgorny
Group Reviewers
Restricted Project
Restricted Project
Commits
rG9c2700dfa51a: [CMake][compiler-rt] Don't load LLVM config in the runtimes build
Summary

LLVM runtimes build already loads the LLVM config and sets all
appropriate variables, no need to do it again.

Diff Detail

Event Timeline

phosek created this revision.Nov 11 2022, 2:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 11 2022, 2:52 PM
Herald added subscribers: Enna1, dberris. · View Herald Transcript
phosek requested review of this revision.Nov 11 2022, 2:52 PM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptNov 11 2022, 2:52 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
Herald added subscribers: libcxx-commits, Restricted Project. · View Herald Transcript
mstorsjo added inline comments.Nov 12 2022, 12:36 AM
compiler-rt/CMakeLists.txt
82–84

Isn’t this condition unnecessary? This is in a block guarded with if (COMPILER_RT_STANDALONE_BUILD), and if that’s true, LLVM_RUNTIMES_BUILD won’t be set?

compiler-rt/lib/builtins/CMakeLists.txt
28–30

Ditto here?

phosek added inline comments.Nov 12 2022, 2:07 PM
compiler-rt/CMakeLists.txt
82–84

We currently set COMPILER_RT_STANDALONE_BUILD in the runtimes build, see https://github.com/llvm/llvm-project/blob/f53fde8e150553c194b3325fe2781775aa40ac3a/runtimes/CMakeLists.txt#L183. I'd like to eventually remove that, but we need to do a bunch of cleanup first.

mstorsjo accepted this revision.Nov 12 2022, 2:41 PM
mstorsjo added inline comments.
compiler-rt/CMakeLists.txt
82–84

Ah, I see.

Ok, in that case, this is a step in the right direction indeed. And I can see that it'll take a couple patches to untangle it - the compiler-rt cmake files are notoriously complex.

phosek added inline comments.Nov 12 2022, 3:37 PM
compiler-rt/CMakeLists.txt
82–84

Yeah, I'd like to improve the runtimes build support in compiler-rt with the eventual goal of deprecating the standalone build the same way we've done for libc++, but that's difficult if we have to make all changes in a way that doesn't break the standalone build. So I'm thinking about taking a different strategy which is to put the integration behind LLVM_RUNTIMES_BUILD until we're ready to deprecate the standalone build. It's not the cleanest solution, but hopefully it's just temporary.

mgorny accepted this revision.Nov 12 2022, 10:38 PM

Thanks for the explanation. This indeed makes sense then. Perhaps leave an explanatory comment/FIXME above it, so we know why it's like that in the future.

mstorsjo added inline comments.Nov 13 2022, 12:15 AM
compiler-rt/CMakeLists.txt
82–84

Sounds reasonable, as long as there’s a simple way to only build the builtins. IIRC llvm/runtimes builds those in a separate pass before building all other runtimes?

Currently in my bootstraps, I build the builtins in a super-standalone way by pointing cmake at compiler-rt/lib/builtins.

phosek added inline comments.Nov 15 2022, 12:59 AM
This revision was not accepted when it landed; it landed in state Needs Review.Nov 15 2022, 1:02 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.