[Solaris] Default to -fno-cxa-finalize.

There is no __cxa_finalize symbol available on recent Solaris OS
versions, so we need this flag to make non trivial C++ programs run.

Also stop looking for cxa_finalize.o, since it won't be there.

Patch by Xan López!

llvm-svn: 247634
This commit is contained in:
Rafael Espindola 2015-09-14 23:21:31 +00:00
parent 8ef7a5b4b7
commit fe71f3887c
2 changed files with 7 additions and 6 deletions

View File

@ -4572,8 +4572,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (!Args.hasFlag(options::OPT_fuse_cxa_atexit, if (!Args.hasFlag(options::OPT_fuse_cxa_atexit,
options::OPT_fno_use_cxa_atexit, options::OPT_fno_use_cxa_atexit,
!IsWindowsCygnus && !IsWindowsGNU && !IsWindowsCygnus && !IsWindowsGNU &&
getToolChain().getArch() != llvm::Triple::hexagon && getToolChain().getTriple().getOS() != llvm::Triple::Solaris &&
getToolChain().getArch() != llvm::Triple::xcore) || getToolChain().getArch() != llvm::Triple::hexagon &&
getToolChain().getArch() != llvm::Triple::xcore) ||
KernelOrKext) KernelOrKext)
CmdArgs.push_back("-fno-use-cxa-atexit"); CmdArgs.push_back("-fno-use-cxa-atexit");
@ -6942,10 +6943,6 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
Args.MakeArgString(getToolChain().GetFilePath("values-Xa.o"))); Args.MakeArgString(getToolChain().GetFilePath("values-Xa.o")));
CmdArgs.push_back( CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o"))); Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
if (getToolChain().getDriver().CCCIsCXX())
CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("cxa_finalize.o")));
} }
const ToolChain::path_list &Paths = getToolChain().getFilePaths(); const ToolChain::path_list &Paths = getToolChain().getFilePaths();

View File

@ -0,0 +1,4 @@
// RUN: %clang %s --target=sparc-sun-solaris2.11 -### -o %t.o 2>&1 | FileCheck %s
// CHECK: "-fno-use-cxa-atexit"