[Clang] Move XCore specific options from Clang.cpp to XCore.cpp

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D118535
This commit is contained in:
Ben Shi 2022-01-29 12:42:06 +00:00
parent ee647d4c96
commit ac3894cf1e
3 changed files with 5 additions and 4 deletions

View File

@ -6266,7 +6266,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (!Args.hasFlag( if (!Args.hasFlag(
options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
!RawTriple.isOSAIX() && !RawTriple.isOSWindows() && !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
TC.getArch() != llvm::Triple::xcore &&
((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) || RawTriple.hasEnvironment())) ||
KernelOrKext) KernelOrKext)

View File

@ -130,6 +130,10 @@ void XCoreToolChain::addClangTargetOptions(const ArgList &DriverArgs,
ArgStringList &CC1Args, ArgStringList &CC1Args,
Action::OffloadKind) const { Action::OffloadKind) const {
CC1Args.push_back("-nostdsysteminc"); 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( void XCoreToolChain::AddClangCXXStdlibIncludeArgs(

View File

@ -4,9 +4,8 @@
// RUN: %clang -target xcore %s -g0 -### -o %t.o 2>&1 | FileCheck -check-prefix CHECK-G0 %s // RUN: %clang -target xcore %s -g0 -### -o %t.o 2>&1 | FileCheck -check-prefix CHECK-G0 %s
// CHECK: "-mframe-pointer=none" // CHECK: "-mframe-pointer=none"
// CHECK: "-nostdsysteminc" // CHECK: "-nostdsysteminc" "-fno-use-cxa-atexit"
// CHECK: "-fno-signed-char" // CHECK: "-fno-signed-char"
// CHECK: "-fno-use-cxa-atexit"
// CHECK-NOT: "-fcxx-exceptions" // CHECK-NOT: "-fcxx-exceptions"
// CHECK-NOT: "-fexceptions" // CHECK-NOT: "-fexceptions"
// CHECK-NOT: "-fcommon" // CHECK-NOT: "-fcommon"
@ -30,4 +29,3 @@
// CHECK-G0: xcc" // CHECK-G0: xcc"
// CHECK-G0-NOT: "-g" // CHECK-G0-NOT: "-g"
// CHECK-G0: xcc" // CHECK-G0: xcc"