]> granicus.if.org Git - clang/commitdiff
Unconditionally use .init_array instead of .ctors on Solaris.
authorAaron Ballman <aaron@aaronballman.com>
Fri, 14 Jul 2017 17:49:52 +0000 (17:49 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Fri, 14 Jul 2017 17:49:52 +0000 (17:49 +0000)
Patch by Fedor Sergeev

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308038 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Gnu.cpp
lib/Driver/ToolChains/Solaris.cpp
lib/Driver/ToolChains/Solaris.h
test/Driver/constructors.c

index ad5f7df50d2ed89bc6418b0f47f41b877afde797..bc26ee1de46d2070868e529c118ad8ff64b01d69 100644 (file)
@@ -2471,7 +2471,8 @@ void Generic_ELF::addClangTargetOptions(const ArgList &DriverArgs,
        (!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))
index 78797c49d7b6fbb8ea70d452b1936b078158c59a..de98d11b2dc7beb6055beb90508232f71c7486b9 100644 (file)
@@ -126,7 +126,7 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
 
 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);
 
index edb44373b31dbf041d2d1f3e7adff2f549dba6af..787917afab6ea54c051e7aec5e26ad44b7ec0861 100644 (file)
@@ -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);
index cd14ed736a28cbc271296fb1dc6eb0f5c3f2c3b4..39a199a3c6ae851e87a61f22600bc2e5bbb07fc2 100644 (file)
 // 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