-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][driver] Fix --print-libgcc-file-name on Darwin platforms
On Darwin, --print-libgcc-file-name was returning a nonsensical result. It would return the name of the library that would be used by the default toolchain implementation, but that was something that didn't exist on Darwin. Fixing this requires initializing the Darwin toolchain before processing `--print-libgcc-file-name`. Previously, the Darwin toolchain would only be initialized when building the jobs for this compilation, which is too late since `--print-libgcc-file-name` requires the toolchain to be initialized in order to provide the right results. rdar://90633749
- Loading branch information
Gabor Horvath
committed
Jul 12, 2024
1 parent
f50f7a7
commit 200d0b7
Showing
5 changed files
with
160 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,91 @@ | ||
// Test the output of -print-libgcc-file-name on Darwin. | ||
|
||
// | ||
// All platforms | ||
// | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: --target=x86_64-apple-macos \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-MACOS %s | ||
// CHECK-CLANGRT-MACOS: libclang_rt.osx.a | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: --target=arm64-apple-ios \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-IOS %s | ||
// CHECK-CLANGRT-IOS: libclang_rt.ios.a | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: --target=arm64-apple-watchos \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-WATCHOS %s | ||
// CHECK-CLANGRT-WATCHOS: libclang_rt.watchos.a | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: --target=arm64-apple-tvos \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-TVOS %s | ||
// CHECK-CLANGRT-TVOS: libclang_rt.tvos.a | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: --target=arm64-apple-driverkit \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-DRIVERKIT %s | ||
// CHECK-CLANGRT-DRIVERKIT: libclang_rt.driverkit.a | ||
|
||
// | ||
// Simulators | ||
// | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: --target=arm64-apple-ios-simulator \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-IOS-SIMULATOR %s | ||
// CHECK-CLANGRT-IOS-SIMULATOR: libclang_rt.iossim.a | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: --target=arm64-apple-watchos-simulator \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-WATCHOS-SIMULATOR %s | ||
// CHECK-CLANGRT-WATCHOS-SIMULATOR: libclang_rt.watchossim.a | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: --target=arm64-apple-tvos-simulator \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-TVOS-SIMULATOR %s | ||
// CHECK-CLANGRT-TVOS-SIMULATOR: libclang_rt.tvossim.a | ||
|
||
// Check the sanitizer and profile variants | ||
// While the driver also links in sanitizer-specific dylibs, the result of | ||
// -print-libgcc-file-name is the path of the basic compiler-rt library. | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: -fsanitize=address --target=x86_64-apple-macos \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-MACOS-SAN %s | ||
// CHECK-CLANGRT-MACOS-SAN: libclang_rt.osx.a | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: -fsanitize=address --target=arm64-apple-ios \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-IOS-SAN %s | ||
// CHECK-CLANGRT-IOS-SAN: libclang_rt.ios.a | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: -fsanitize=address --target=arm64-apple-watchos \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-WATCHOS-SAN %s | ||
// CHECK-CLANGRT-WATCHOS-SAN: libclang_rt.watchos.a | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: -fsanitize=address --target=arm64-apple-tvos \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-TVOS-SAN %s | ||
// CHECK-CLANGRT-TVOS-SAN: libclang_rt.tvos.a | ||
|
||
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \ | ||
// RUN: -fsanitize=address --target=arm64-apple-driverkit \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir 2>&1 \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-DRIVERKIT-SAN %s | ||
// CHECK-CLANGRT-DRIVERKIT-SAN: libclang_rt.driverkit.a |