Skip to content

Commit 120423a

Browse files
committed
Handle triple environment component for target runtime directory on AIX
1 parent 224ec83 commit 120423a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

clang/lib/Driver/ToolChain.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,13 @@ 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(), llvm::Triple::getOSTypeName(T.getOS()));
941+
if (auto Path = getPathForTriple(AIXTriple))
942+
return *Path;
943+
}
944+
938945
if (T.isOSzOS() &&
939946
(!T.getOSVersion().empty() || !T.getEnvironmentVersion().empty())) {
940947
// Build the triple without version information

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir\
1717
// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR64-PER-TARGET %s
1818

19+
// RUN: %clang -print-runtime-dir --target=powerpc-ibm-aix-unknown \
20+
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir\
21+
// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR32-PER-TARGET %s
22+
1923
// PRINT-RUNTIME-DIR: lib{{/|\\}}aix{{$}}
2024
// PRINT-RUNTIME-DIR32-PER-TARGET: lib{{/|\\}}powerpc-ibm-aix{{$}}
2125
// PRINT-RUNTIME-DIR64-PER-TARGET: lib{{/|\\}}powerpc64-ibm-aix{{$}}

0 commit comments

Comments
 (0)