Skip to content

Commit

Permalink
[Clang] Move XCore specific options from Clang.cpp to XCore.cpp
Browse files Browse the repository at this point in the history
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D118535
  • Loading branch information
benshi001 committed Jan 30, 2022
1 parent ee647d4 commit ac3894c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion clang/lib/Driver/ToolChains/Clang.cpp
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Driver/ToolChains/XCore.cpp
Expand Up @@ -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(
Expand Down
4 changes: 1 addition & 3 deletions clang/test/Driver/xcore-opts.c
Expand Up @@ -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"
Expand All @@ -30,4 +29,3 @@
// CHECK-G0: xcc"
// CHECK-G0-NOT: "-g"
// CHECK-G0: xcc"

0 comments on commit ac3894c

Please sign in to comment.