Author: Jake Egan Date: 2024-09-01T23:37:43-04:00 New Revision: 27e244f51435f8f0933969782a6faddfcbe809a6
URL: https://github.com/llvm/llvm-project/commit/27e244f51435f8f0933969782a6faddfcbe809a6 DIFF: https://github.com/llvm/llvm-project/commit/27e244f51435f8f0933969782a6faddfcbe809a6.diff LOG: [clang][AIX] Fix -print-runtime-dir on AIX (#104806) Currently the option prints a path to a nonexistent directory with the full triple, `lib/powerpc64-ibm-aix7.2.0.0`. It should only be `lib/aix`. Added: clang/test/Driver/aix-print-runtime-dir.c Modified: clang/lib/Driver/ToolChain.cpp Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 76901875c66959..64f23d43e87ee8 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -843,8 +843,8 @@ std::optional<std::string> ToolChain::getRuntimePath() const { llvm::sys::path::append(P, "lib"); if (auto Ret = getTargetSubDirPath(P)) return Ret; - // Darwin does not use per-target runtime directory. - if (Triple.isOSDarwin()) + // Darwin and AIX does not use per-target runtime directory. + if (Triple.isOSDarwin() || Triple.isOSAIX()) return {}; llvm::sys::path::append(P, Triple.str()); return std::string(P); diff --git a/clang/test/Driver/aix-print-runtime-dir.c b/clang/test/Driver/aix-print-runtime-dir.c new file mode 100644 index 00000000000000..0d68ad6fee005e --- /dev/null +++ b/clang/test/Driver/aix-print-runtime-dir.c @@ -0,0 +1,11 @@ +// Test output of -print-runtime-dir on AIX + +// RUN: %clang -print-runtime-dir --target=powerpc-ibm-aix \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s + +// RUN: %clang -print-runtime-dir --target=powerpc64-ibm-aix \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s + +// PRINT-RUNTIME-DIR: lib{{/|\\}}aix{{$}} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits