Author: rafael Date: Mon Sep 14 18:21:31 2015 New Revision: 247634 URL: http://llvm.org/viewvc/llvm-project?rev=247634&view=rev Log: [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! Added: cfe/trunk/test/Driver/solaris-opts.c Modified: cfe/trunk/lib/Driver/Tools.cpp Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=247634&r1=247633&r2=247634&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Mon Sep 14 18:21:31 2015 @@ -4572,8 +4572,9 @@ void Clang::ConstructJob(Compilation &C, if (!Args.hasFlag(options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, !IsWindowsCygnus && !IsWindowsGNU && - getToolChain().getArch() != llvm::Triple::hexagon && - getToolChain().getArch() != llvm::Triple::xcore) || + getToolChain().getTriple().getOS() != llvm::Triple::Solaris && + getToolChain().getArch() != llvm::Triple::hexagon && + getToolChain().getArch() != llvm::Triple::xcore) || KernelOrKext) CmdArgs.push_back("-fno-use-cxa-atexit"); @@ -6942,10 +6943,6 @@ void solaris::Linker::ConstructJob(Compi Args.MakeArgString(getToolChain().GetFilePath("values-Xa.o"))); CmdArgs.push_back( 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(); Added: cfe/trunk/test/Driver/solaris-opts.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/solaris-opts.c?rev=247634&view=auto ============================================================================== --- cfe/trunk/test/Driver/solaris-opts.c (added) +++ cfe/trunk/test/Driver/solaris-opts.c Mon Sep 14 18:21:31 2015 @@ -0,0 +1,4 @@ +// RUN: %clang %s --target=sparc-sun-solaris2.11 -### -o %t.o 2>&1 | FileCheck %s + +// CHECK: "-fno-use-cxa-atexit" + _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits