r308038 - Unconditionally use .init_array instead of .ctors on Solaris.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 14 10:49:52 PDT 2017


Author: aaronballman
Date: Fri Jul 14 10:49:52 2017
New Revision: 308038

URL: http://llvm.org/viewvc/llvm-project?rev=308038&view=rev
Log:
Unconditionally use .init_array instead of .ctors on Solaris.

Patch by Fedor Sergeev

Modified:
    cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
    cfe/trunk/lib/Driver/ToolChains/Solaris.cpp
    cfe/trunk/lib/Driver/ToolChains/Solaris.h
    cfe/trunk/test/Driver/constructors.c

Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=308038&r1=308037&r2=308038&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Fri Jul 14 10:49:52 2017
@@ -2471,7 +2471,8 @@ void Generic_ELF::addClangTargetOptions(
        (!V.isOlderThan(4, 7, 0) || getTriple().isAndroid())) ||
       getTriple().getOS() == llvm::Triple::NaCl ||
       (getTriple().getVendor() == llvm::Triple::MipsTechnologies &&
-       !getTriple().hasEnvironment());
+       !getTriple().hasEnvironment()) ||
+      getTriple().getOS() == llvm::Triple::Solaris;
 
   if (DriverArgs.hasFlag(options::OPT_fuse_init_array,
                          options::OPT_fno_use_init_array, UseInitArrayDefault))

Modified: cfe/trunk/lib/Driver/ToolChains/Solaris.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Solaris.cpp?rev=308038&r1=308037&r2=308038&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Solaris.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Solaris.cpp Fri Jul 14 10:49:52 2017
@@ -126,7 +126,7 @@ void solaris::Linker::ConstructJob(Compi
 
 Solaris::Solaris(const Driver &D, const llvm::Triple &Triple,
                  const ArgList &Args)
-    : Generic_GCC(D, Triple, Args) {
+    : Generic_ELF(D, Triple, Args) {
 
   GCCInstallation.init(Triple, Args);
 

Modified: cfe/trunk/lib/Driver/ToolChains/Solaris.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Solaris.h?rev=308038&r1=308037&r2=308038&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Solaris.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/Solaris.h Fri Jul 14 10:49:52 2017
@@ -50,7 +50,7 @@ public:
 
 namespace toolchains {
 
-class LLVM_LIBRARY_VISIBILITY Solaris : public Generic_GCC {
+class LLVM_LIBRARY_VISIBILITY Solaris : public Generic_ELF {
 public:
   Solaris(const Driver &D, const llvm::Triple &Triple,
           const llvm::opt::ArgList &Args);

Modified: cfe/trunk/test/Driver/constructors.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/constructors.c?rev=308038&r1=308037&r2=308038&view=diff
==============================================================================
--- cfe/trunk/test/Driver/constructors.c (original)
+++ cfe/trunk/test/Driver/constructors.c Fri Jul 14 10:49:52 2017
@@ -74,3 +74,11 @@
 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
 // RUN:     -target arm64-none-none-eabi \
 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1        \
+// RUN:     -target sparc-sun-solaris2.11 \
+// RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1        \
+// RUN:     -target i386-pc-solaris2.11 \
+// RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s




More information about the cfe-commits mailing list