This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add an option to make `libc` only build the `libc-hdrgen` tool
ClosedPublic

Authored by jhuber6 on May 22 2023, 2:02 PM.

Details

Summary

The libc-hdergen tool is required for cross-builds, however some cases
can cause issues when configuring this build. This patch adds an
ovveride option LIBC_HDRGEN_ONLY to allow us to retain the old
(incorrect) behaviour where libc would not build with any other
runtimes enabled.

Diff Detail

Event Timeline

jhuber6 created this revision.May 22 2023, 2:02 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 22 2023, 2:02 PM
jhuber6 requested review of this revision.May 22 2023, 2:02 PM
michaelrj added inline comments.May 22 2023, 2:22 PM
libc/CMakeLists.txt
32

nit: having some parentheses here would help clarify what the actual condition is.

tra added a comment.May 22 2023, 2:40 PM

Is libc-hdrgen the only target that's supposed to be built? I find it puzzling that LIBC_HDRGEN_ONLY enables/disables the same early return which is normally controlled by the runtime/project level knob. I mean -- it appears to enable way more than just libc-hdrgen.

Is libc-hdrgen the only target that's supposed to be built? I find it puzzling that LIBC_HDRGEN_ONLY enables/disables the same early return which is normally controlled by the runtime/project level knob. I mean -- it appears to enable way more than just libc-hdrgen.

When building with runtimes, we use the projects portion to just build the libc-hdrgen tool. So here the check is that if we have libc in the runtimes, but we're currently not doing a runtime build, then exit out early. This patch adds an extra way to assert that if we're building independently.

sivachandra added inline comments.May 22 2023, 4:56 PM
libc/CMakeLists.txt
32

This is OK but add an option which is OFF by default. Its not clear to me that this how we have to the libc build. We are stretching the limits of what is formally supported because of what happens to work.

jhuber6 updated this revision to Diff 524546.May 22 2023, 5:50 PM

Add option.

sivachandra accepted this revision.May 22 2023, 8:24 PM
This revision is now accepted and ready to land.May 22 2023, 8:24 PM