diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2017-07-14 17:49:52 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2017-07-14 17:49:52 +0000 |
commit | 26658f174fdbf11f1c946fb03e6f9b617c8f9579 (patch) | |
tree | 12ebdf9346f537592dfd4b37ff55828ca5684b71 | |
parent | b7f2af9f4a2f07a8a38a7fe410bd96b9dbb4f848 (diff) |
Unconditionally use .init_array instead of .ctors on Solaris.
Patch by Fedor Sergeev
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308038 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Driver/ToolChains/Gnu.cpp | 3 | ||||
-rw-r--r-- | lib/Driver/ToolChains/Solaris.cpp | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/Solaris.h | 2 | ||||
-rw-r--r-- | test/Driver/constructors.c | 8 |
4 files changed, 12 insertions, 3 deletions
diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp index ad5f7df50d..bc26ee1de4 100644 --- a/lib/Driver/ToolChains/Gnu.cpp +++ b/lib/Driver/ToolChains/Gnu.cpp @@ -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)) diff --git a/lib/Driver/ToolChains/Solaris.cpp b/lib/Driver/ToolChains/Solaris.cpp index 78797c49d7..de98d11b2d 100644 --- a/lib/Driver/ToolChains/Solaris.cpp +++ b/lib/Driver/ToolChains/Solaris.cpp @@ -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); diff --git a/lib/Driver/ToolChains/Solaris.h b/lib/Driver/ToolChains/Solaris.h index edb44373b3..787917afab 100644 --- a/lib/Driver/ToolChains/Solaris.h +++ b/lib/Driver/ToolChains/Solaris.h @@ -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); diff --git a/test/Driver/constructors.c b/test/Driver/constructors.c index cd14ed736a..39a199a3c6 100644 --- a/test/Driver/constructors.c +++ b/test/Driver/constructors.c @@ -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 |