-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[clang][Darwin] Prefer the toolchain-provided libc++.dylib if there is one #170303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ldionne
wants to merge
4
commits into
llvm:main
Choose a base branch
from
ldionne:review/clang-link-against-built-libcxx-darwin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+144
−8
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
65709c9
[clang][Darwin] Prefer the toolchain-provided libc++.dylib if there i…
ldionne b5e52e5
Pass the specific library path instead, to avoid adding a new directo…
ldionne 854841e
Fix comment which incorrectly represents the value of the install/lib…
ldionne d1b7b48
Avoid default search paths when linking against libc++ from compiler-rt
ldionne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // UNSUPPORTED: system-windows | ||
|
|
||
| // Tests to check that we link against the toolchain-provided libc++ built library when it is provided. | ||
| // This is required to prefer the toolchain's libc++ over the system's libc++, which matches the behavior | ||
| // we have for header search paths. | ||
|
|
||
| // When libc++.dylib is NOT in the toolchain, we should use -lc++ and fall back to the libc++ | ||
| // in the sysroot. | ||
| // | ||
| // (1) Without -fexperimental-library. | ||
| // RUN: %clangxx -### %s 2>&1 \ | ||
| // RUN: --target=x86_64-apple-darwin \ | ||
| // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \ | ||
| // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain_no_libcxx \ | ||
| // RUN: --check-prefix=CHECK-1 %s | ||
| // CHECK-1: "/usr/bin/ld" | ||
| // CHECK-1: "-lc++" | ||
| // CHECK-1-NOT: "[[TOOLCHAIN]]/usr/lib" | ||
| // | ||
| // (2) With -fexperimental-library. | ||
| // RUN: %clangxx -### %s 2>&1 \ | ||
| // RUN: --target=x86_64-apple-darwin \ | ||
| // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \ | ||
| // RUN: -fexperimental-library \ | ||
| // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain_no_libcxx \ | ||
| // RUN: --check-prefix=CHECK-2 %s | ||
| // CHECK-2: "/usr/bin/ld" | ||
| // CHECK-2: "-lc++" "-lc++experimental" | ||
| // CHECK-2-NOT: "[[TOOLCHAIN]]/usr/lib" | ||
|
|
||
| // When we have libc++.dylib in the toolchain, it should be used over the one in the sysroot. | ||
| // There are a few cases worth testing. | ||
| // | ||
| // (1) Without -fexperimental-library. | ||
| // RUN: %clangxx -### %s 2>&1 \ | ||
| // RUN: --target=x86_64-apple-darwin \ | ||
| // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \ | ||
| // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \ | ||
| // RUN: --check-prefix=CHECK-3 %s | ||
| // CHECK-3: "/usr/bin/ld" | ||
| // CHECK-3: "[[TOOLCHAIN]]/usr/lib/libc++.dylib" | ||
| // CHECK-3-NOT: "-lc++" | ||
| // | ||
| // (2) With -fexperimental-library. | ||
| // RUN: %clangxx -### %s 2>&1 \ | ||
| // RUN: --target=x86_64-apple-darwin \ | ||
| // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \ | ||
| // RUN: -fexperimental-library \ | ||
| // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \ | ||
| // RUN: --check-prefix=CHECK-4 %s | ||
| // CHECK-4: "/usr/bin/ld" | ||
| // CHECK-4: "[[TOOLCHAIN]]/usr/lib/libc++.dylib" | ||
| // CHECK-4: "[[TOOLCHAIN]]/usr/lib/libc++experimental.a" | ||
| // CHECK-4-NOT: "-lc++" | ||
| // CHECK-4-NOT: "-lc++experimental" | ||
|
|
||
| // When we have libc++.a in the toolchain instead of libc++.dylib, it should be | ||
| // used over the one in the sysroot. | ||
| // | ||
| // (1) Without -fexperimental-library. | ||
| // RUN: %clangxx -### %s 2>&1 \ | ||
| // RUN: --target=x86_64-apple-darwin \ | ||
| // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_static/usr/bin \ | ||
| // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain_static \ | ||
| // RUN: --check-prefix=CHECK-5 %s | ||
| // CHECK-5: "/usr/bin/ld" | ||
| // CHECK-5: "[[TOOLCHAIN]]/usr/lib/libc++.a" | ||
| // CHECK-5-NOT: "-lc++" | ||
| // | ||
| // (2) With -fexperimental-library. | ||
| // RUN: %clangxx -### %s 2>&1 \ | ||
| // RUN: --target=x86_64-apple-darwin \ | ||
| // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_static/usr/bin \ | ||
| // RUN: -fexperimental-library \ | ||
| // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain_static \ | ||
| // RUN: --check-prefix=CHECK-6 %s | ||
| // CHECK-6: "/usr/bin/ld" | ||
| // CHECK-6: "[[TOOLCHAIN]]/usr/lib/libc++.a" | ||
| // CHECK-6: "[[TOOLCHAIN]]/usr/lib/libc++experimental.a" | ||
| // CHECK-6-NOT: "-lc++" | ||
| // CHECK-6-NOT: "-lc++experimental" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.