Skip to content

Commit 2f230ce

Browse files
committed
Only strip -unknown environment component
1 parent 6ed30e6 commit 2f230ce

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

clang/lib/Driver/ToolChain.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -935,10 +935,10 @@ ToolChain::getTargetSubDirPath(StringRef BaseDir) const {
935935
if (auto Path = getPathForTriple(T))
936936
return *Path;
937937

938-
// On AIX, the environment component is not used in the target sub dir name.
939-
if (T.isOSAIX() && T.hasEnvironment()) {
940-
llvm::Triple AIXTriple(T.getArchName(), T.getVendorName(),
941-
llvm::Triple::getOSTypeName(T.getOS()));
938+
if (T.isOSAIX() && T.getEnvironment() == Triple::UnknownEnvironment) {
939+
// Strip unknown environment from the triple.
940+
const llvm::Triple AIXTriple(llvm::Triple(T.getArchName(), T.getVendorName(),
941+
llvm::Triple::getOSTypeName(T.getOS())));
942942
if (auto Path = getPathForTriple(AIXTriple))
943943
return *Path;
944944
}

clang/test/Driver/aix-print-runtime-dir.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818

1919
// RUN: %clang -print-runtime-dir --target=powerpc-ibm-aix-unknown \
2020
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir\
21-
// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR32-PER-TARGET %s
21+
// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR-UNKNOWN-ENV %s
2222

2323
// PRINT-RUNTIME-DIR: lib{{/|\\}}aix{{$}}
2424
// PRINT-RUNTIME-DIR32-PER-TARGET: lib{{/|\\}}powerpc-ibm-aix{{$}}
2525
// PRINT-RUNTIME-DIR64-PER-TARGET: lib{{/|\\}}powerpc64-ibm-aix{{$}}
26+
// PRINT-RUNTIME-DIR-UNKNOWN-ENV: lib{{/|\\}}powerpc-ibm-aix

0 commit comments

Comments
 (0)