This is an archive of the discontinued LLVM Phabricator instance.

[bootstrap build] Add libc-hdrgen as a build dep for libc bootstrap build.
ClosedPublic

Authored by sivachandra on Jan 10 2023, 11:32 PM.

Details

Summary

With this change, libc-hdrgen is built like a host build tool like clang and used
to build libc for the target.

Diff Detail

Event Timeline

sivachandra created this revision.Jan 10 2023, 11:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 11:32 PM
sivachandra requested review of this revision.Jan 10 2023, 11:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 11:32 PM
sivachandra edited the summary of this revision. (Show Details)Jan 10 2023, 11:36 PM
phosek added inline comments.Jan 12 2023, 12:19 AM
llvm/runtimes/CMakeLists.txt
362

This can have potentially negative side-effects. Take for example Fuchsia's CMake cache file where on Darwin we set the generic flags which are passed to the "default" build as well as prefixed flags which are passed to target build. With this change, the generic flags will be passed to the target build and interfere with the prefixed flags. Can we avoid this change for now?

phosek added inline comments.Jan 12 2023, 12:20 AM
llvm/runtimes/CMakeLists.txt
362

To add some additional context, I'm planning major changes to how the "default" and target builds are set up, and after those changes, this should be possible without any negative side-effects, but that's going to take a few more weeks.

sivachandra added inline comments.Jan 12 2023, 12:24 AM
llvm/runtimes/CMakeLists.txt
362

The other option is to detect the libc specific options and pass them as CMAKE_ARGS. For now, we only need to test for LLVM_LIBC_FULL_BUILD. If that is OK, then we can avoid depending on prefixes.

A friendly ping.

phosek added inline comments.Jan 30 2023, 10:31 PM
llvm/runtimes/CMakeLists.txt
362

That would be my preference, at least for now.

Use CMake args to pass options to the libc build.

sivachandra added inline comments.Jan 31 2023, 10:06 PM
llvm/runtimes/CMakeLists.txt
362

How does the latest diff look?

Friendly ping - how does the latest diff look?

phosek added inline comments.Feb 3 2023, 1:01 AM
llvm/runtimes/CMakeLists.txt
383–384

Nit: this is unnecessary (uninitialized variables in CMake evaluate to empty string).

392–393

This is slightly counterintuitive. I'd prefer introducing a special handling in llvm/CMakeLists.txt similarly to what we do for example for flang and mlir, see https://github.com/llvm/llvm-project/blob/830d116d776439093a16aad567cd3db2c4c3cd72/llvm/CMakeLists.txt#L143 and automatically including libc in LLVM_ENABLE_PROJECTS when libc is in LLVM_ENABLE_RUNTIMES.

Add "libc" to enabled projects if it is listed in enabled runtimes.

sivachandra added inline comments.Feb 3 2023, 4:48 PM
llvm/runtimes/CMakeLists.txt
392–393

I left this check here as a debug aid, but have also updated llvm/CMakeLists.txt according to your suggestion.

phosek accepted this revision.Feb 3 2023, 10:52 PM

LGTM

This revision is now accepted and ready to land.Feb 3 2023, 10:52 PM

Remove a spurious arg which was not removed when addressing the last round of comments.