This is an archive of the discontinued LLVM Phabricator instance.

[CMake][libc] Don't put archive in build/lib/<target triple> by default
ClosedPublic

Authored by aidengrossman on Jun 5 2023, 1:00 PM.

Details

Summary

ea8f4b98419750c8cc7c60ea43b570adf47b3f78 broke some build configurations
because it was enabled by default and some people are using a just built
libc/clang/LLVM to work on other projects where having a just built LLVM
libc in one of Clang's default include directories can make things
unusable.

Diff Detail

Event Timeline

aidengrossman created this revision.Jun 5 2023, 1:00 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 5 2023, 1:00 PM
aidengrossman requested review of this revision.Jun 5 2023, 1:00 PM
goldstein.w.n accepted this revision.Jun 5 2023, 1:03 PM

LGTM, but wait on a proper maintainer before pushing.
Thanks!

This revision is now accepted and ready to land.Jun 5 2023, 1:03 PM

This is OK but can you point us to what broke?

@goldstein.w.n reported this failure with full build mode after this patch:

$> echo "int main() {}" > tmp.c &&  ./bin/clang tmp.c -o tmp
/bin/ld: /lib/x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x21): undefined reference to `__libc_start_main'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

As far as I understand it, the previous patch also moved the full build libc.a and libm.a into the build/lib/<target triple> directory, so clang would try and link against the full built LLVM libc there by default instead of the system libc, causing build failures. It didn't break the overlay mode because llvmlibc.a needs to be explicitly linked against.

In addition it seems to make more sense to keep this gated behind a flag even just for the overlay mode as LLVM libc matures further.

sivachandra accepted this revision.Jun 5 2023, 5:11 PM