[clang] 45432ee - [ARM64EC] Add softintrin.lib as an implicit dependency to object files. (#89171)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 19 14:21:06 PDT 2024
Author: Eli Friedman
Date: 2024-04-19T14:21:03-07:00
New Revision: 45432eec0ae6a7f7452196eb099814d1a7dc2c0f
URL: https://github.com/llvm/llvm-project/commit/45432eec0ae6a7f7452196eb099814d1a7dc2c0f
DIFF: https://github.com/llvm/llvm-project/commit/45432eec0ae6a7f7452196eb099814d1a7dc2c0f.diff
LOG: [ARM64EC] Add softintrin.lib as an implicit dependency to object files. (#89171)
This copies MSVC behavior, and avoids weird link errors in certain
cases.
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/cl-options.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 456ea74caadb00..97b4aa1c9b1d0a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4733,7 +4733,7 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
Output.getFilename());
}
-static void ProcessVSRuntimeLibrary(const ArgList &Args,
+static void ProcessVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
ArgStringList &CmdArgs) {
unsigned RTOptionID = options::OPT__SLASH_MT;
@@ -4796,6 +4796,12 @@ static void ProcessVSRuntimeLibrary(const ArgList &Args,
// implemented in clang.
CmdArgs.push_back("--dependent-lib=oldnames");
}
+
+ // All Arm64EC object files implicitly add softintrin.lib. This is necessary
+ // even if the file doesn't actually refer to any of the routines because
+ // the CRT itself has incomplete dependency markings.
+ if (TC.getTriple().isWindowsArm64EC())
+ CmdArgs.push_back("--dependent-lib=softintrin");
}
void Clang::ConstructJob(Compilation &C, const JobAction &JA,
@@ -7051,7 +7057,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Triple.isWindowsMSVCEnvironment() && !D.IsCLMode() &&
Args.hasArg(options::OPT_fms_runtime_lib_EQ))
- ProcessVSRuntimeLibrary(Args, CmdArgs);
+ ProcessVSRuntimeLibrary(getToolChain(), Args, CmdArgs);
// Handle -fgcc-version, if present.
VersionTuple GNUCVer;
@@ -8178,7 +8184,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
ArgStringList &CmdArgs) const {
bool isNVPTX = getToolChain().getTriple().isNVPTX();
- ProcessVSRuntimeLibrary(Args, CmdArgs);
+ ProcessVSRuntimeLibrary(getToolChain(), Args, CmdArgs);
if (Arg *ShowIncludes =
Args.getLastArg(options::OPT__SLASH_showIncludes,
diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index 5b6dfe308a76ea..7731300ae9f525 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -790,6 +790,7 @@
// RUN: %clang_cl -vctoolsdir "" /arm64EC /c -### -- %s 2>&1 | FileCheck --check-prefix=ARM64EC %s
// ARM64EC-NOT: /arm64EC has been overridden by specified target
// ARM64EC: "-triple" "arm64ec-pc-windows-msvc19.33.0"
+// ARM64EC-SAME: "--dependent-lib=softintrin"
// RUN: %clang_cl -vctoolsdir "" /arm64EC /c -target x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck --check-prefix=ARM64EC_OVERRIDE %s
// ARM64EC_OVERRIDE: warning: /arm64EC has been overridden by specified target: x86_64-pc-windows-msvc; option ignored
More information about the cfe-commits
mailing list