[PATCH] D35337: [Solaris] gcc runtime dropped support for .ctors, switch to .init_array

Fedor Sergeev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 12 16:41:52 PDT 2017


fedor.sergeev created this revision.

crtbegin.o from gcc toolchain as configured on latest Solaris
(with --enable-initfini-array) does not have support for .ctors.

Clang needs to switch to .init_array. Doing it unconditionally
is fine since older Solaris configurations do support .init_array.


https://reviews.llvm.org/D35337

Files:
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/ToolChains/Solaris.cpp
  lib/Driver/ToolChains/Solaris.h


Index: lib/Driver/ToolChains/Solaris.h
===================================================================
--- lib/Driver/ToolChains/Solaris.h
+++ lib/Driver/ToolChains/Solaris.h
@@ -50,7 +50,7 @@
 
 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: lib/Driver/ToolChains/Solaris.cpp
===================================================================
--- lib/Driver/ToolChains/Solaris.cpp
+++ lib/Driver/ToolChains/Solaris.cpp
@@ -126,7 +126,7 @@
 
 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: lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -2471,7 +2471,8 @@
        (!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))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35337.106345.patch
Type: text/x-patch
Size: 1541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170712/8b836f65/attachment.bin>


More information about the cfe-commits mailing list