Skip to content

Conversation

@ldionne
Copy link
Member

@ldionne ldionne commented Dec 5, 2025

When libc++ is bootstrapped with clang, the resulting clang uses the just-built libc++ headers from /bin/../include/c++/v1. However, before this patch, clang would still use the system-provided libc++.dylib (usually in the Apple SDK) because it would fail to add the corresponding linker flag to find the just-built libc++. After this patch, Clang will instead link against the toolchain provided libc++.dylib in <install>/lib if it exists, which results in programs being compiled and linked against corresponding libc++ headers and dylib.

This is a re-application of #170303 which was temporarily reverted due to build breakages. This also contains minor fixes to the tests to make the more portable across platforms.

Fixes #77653
rdar://107060541

…s one

When libc++ is bootstrapped with clang, the resulting clang uses the
just-built libc++ headers from <install>/bin/../include/c++/v1. However,
before this patch, clang would still use the system-provided libc++.dylib
(usually in the Apple SDK) because it would fail to add the corresponding
linker flag to find the just-built libc++. After this patch, Clang will
instead link against the toolchain provided `libc++.dylib` in
`<install>/lib` if it exists, which results in programs being compiled
and linked against corresponding libc++ headers and dylib.

This is a re-application of llvm#170303 which was temporarily reverted
due to build breakages. This also contains minor fixes to the tests
to make the more portable across platforms.

Fixes llvm#77653
rdar://107060541
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[D148266] [clang][driver] Linking to just-built libc++.dylib when bootstrapping libc++ with clang

1 participant