[PATCH] D118535: [clang] Move XCore specific options from Clang.cpp to XCore.cpp
Ben Shi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 29 04:50:38 PST 2022
benshi001 created this revision.
benshi001 added reviewers: MaskRay, rsmith.
benshi001 requested review of this revision.
Herald added subscribers: cfe-commits, jacquesguan.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118535
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/XCore.cpp
clang/test/Driver/xcore-opts.c
Index: clang/test/Driver/xcore-opts.c
===================================================================
--- clang/test/Driver/xcore-opts.c
+++ 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"
-
Index: clang/lib/Driver/ToolChains/XCore.cpp
===================================================================
--- clang/lib/Driver/ToolChains/XCore.cpp
+++ clang/lib/Driver/ToolChains/XCore.cpp
@@ -130,6 +130,10 @@
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(
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6266,7 +6266,6 @@
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118535.404255.patch
Type: text/x-patch
Size: 1886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220129/1a40de66/attachment-0001.bin>
More information about the cfe-commits
mailing list