delcypher created this revision. delcypher added reviewers: arphaman, dexonsmith, kubamracek, aralisza, yln. delcypher requested review of this revision. Herald added a project: clang.
When the Darwin target triple included the OS version number this would cause `ToolChain::getCompilerRTPath()` to return an incorrect path because the suffix was something like `darwin20.3.0` instead of `darwin`. This in turn caused - `-print-runtime-dir` to return a non-existant path. - `-print-file-name=<any compiler-rt library>` to not return a useful path. Two regression tests are included. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D101682 Files: clang/lib/Driver/ToolChain.cpp clang/test/Driver/darwin-print-file-name.c clang/test/Driver/darwin-print-runtime-dir.c Index: clang/test/Driver/darwin-print-runtime-dir.c =================================================================== --- /dev/null +++ clang/test/Driver/darwin-print-runtime-dir.c @@ -0,0 +1,6 @@ +// Regression test. Previously the output included the OS version number +// which was not correct. +// RUN: %clang -print-runtime-dir --target=x86_64-apple-darwin20.3.0 \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s +// PRINT-RUNTIME-DIR: lib{{/|\\}}darwin{{$}} \ No newline at end of file Index: clang/test/Driver/darwin-print-file-name.c =================================================================== --- /dev/null +++ clang/test/Driver/darwin-print-file-name.c @@ -0,0 +1,6 @@ +// Regression test. Previously Clang just returned the library name instead +// of the full path. +// RUN: %clang -print-file-name=libclang_rt.osx.a --target=x86_64-apple-darwin20.3.0 \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s +// PRINT-RUNTIME-DIR: lib{{/|\\}}darwin{{/|\\}}libclang_rt.osx.a \ No newline at end of file Index: clang/lib/Driver/ToolChain.cpp =================================================================== --- clang/lib/Driver/ToolChain.cpp +++ clang/lib/Driver/ToolChain.cpp @@ -398,6 +398,8 @@ return "sunos"; case llvm::Triple::AIX: return "aix"; + case llvm::Triple::Darwin: + return "darwin"; default: return getOS(); }
Index: clang/test/Driver/darwin-print-runtime-dir.c =================================================================== --- /dev/null +++ clang/test/Driver/darwin-print-runtime-dir.c @@ -0,0 +1,6 @@ +// Regression test. Previously the output included the OS version number +// which was not correct. +// RUN: %clang -print-runtime-dir --target=x86_64-apple-darwin20.3.0 \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s +// PRINT-RUNTIME-DIR: lib{{/|\\}}darwin{{$}} \ No newline at end of file Index: clang/test/Driver/darwin-print-file-name.c =================================================================== --- /dev/null +++ clang/test/Driver/darwin-print-file-name.c @@ -0,0 +1,6 @@ +// Regression test. Previously Clang just returned the library name instead +// of the full path. +// RUN: %clang -print-file-name=libclang_rt.osx.a --target=x86_64-apple-darwin20.3.0 \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s +// PRINT-RUNTIME-DIR: lib{{/|\\}}darwin{{/|\\}}libclang_rt.osx.a \ No newline at end of file Index: clang/lib/Driver/ToolChain.cpp =================================================================== --- clang/lib/Driver/ToolChain.cpp +++ clang/lib/Driver/ToolChain.cpp @@ -398,6 +398,8 @@ return "sunos"; case llvm::Triple::AIX: return "aix"; + case llvm::Triple::Darwin: + return "darwin"; default: return getOS(); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits