[clang] ac3894c - [Clang] Move XCore specific options from Clang.cpp to XCore.cpp
Ben Shi via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 29 18:25:16 PST 2022
Author: Ben Shi
Date: 2022-01-30T02:24:35Z
New Revision: ac3894cf1e093baff747d63bd37844b9176bcbe0
URL: https://github.com/llvm/llvm-project/commit/ac3894cf1e093baff747d63bd37844b9176bcbe0
DIFF: https://github.com/llvm/llvm-project/commit/ac3894cf1e093baff747d63bd37844b9176bcbe0.diff
LOG: [Clang] Move XCore specific options from Clang.cpp to XCore.cpp
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D118535
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/XCore.cpp
clang/test/Driver/xcore-opts.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 7acb70e0a396..6e0040150bfd 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6266,7 +6266,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (!Args.hasFlag(
options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
!RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
- TC.getArch() != llvm::Triple::xcore &&
((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
KernelOrKext)
diff --git a/clang/lib/Driver/ToolChains/XCore.cpp b/clang/lib/Driver/ToolChains/XCore.cpp
index 7e74f6374050..29fa82aec0a9 100644
--- a/clang/lib/Driver/ToolChains/XCore.cpp
+++ b/clang/lib/Driver/ToolChains/XCore.cpp
@@ -130,6 +130,10 @@ void XCoreToolChain::addClangTargetOptions(const ArgList &DriverArgs,
ArgStringList &CC1Args,
Action::OffloadKind) const {
CC1Args.push_back("-nostdsysteminc");
+ // Set `-fno-use-cxa-atexit` to default.
+ if (!DriverArgs.hasFlag(options::OPT_fuse_cxa_atexit,
+ options::OPT_fno_use_cxa_atexit, false))
+ CC1Args.push_back("-fno-use-cxa-atexit");
}
void XCoreToolChain::AddClangCXXStdlibIncludeArgs(
diff --git a/clang/test/Driver/xcore-opts.c b/clang/test/Driver/xcore-opts.c
index 8885974ec84a..d4b400cbe933 100644
--- a/clang/test/Driver/xcore-opts.c
+++ b/clang/test/Driver/xcore-opts.c
@@ -4,9 +4,8 @@
// RUN: %clang -target xcore %s -g0 -### -o %t.o 2>&1 | FileCheck -check-prefix CHECK-G0 %s
// CHECK: "-mframe-pointer=none"
-// CHECK: "-nostdsysteminc"
+// CHECK: "-nostdsysteminc" "-fno-use-cxa-atexit"
// CHECK: "-fno-signed-char"
-// CHECK: "-fno-use-cxa-atexit"
// CHECK-NOT: "-fcxx-exceptions"
// CHECK-NOT: "-fexceptions"
// CHECK-NOT: "-fcommon"
@@ -30,4 +29,3 @@
// CHECK-G0: xcc"
// CHECK-G0-NOT: "-g"
// CHECK-G0: xcc"
-
More information about the cfe-commits
mailing list