[PATCH] D71393: Default to -fuse-init-array

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 12 10:14:45 PST 2019


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

+1, the list of exceptions that will use .ctors is smaller than the list of platforms that default to init_array. And in general, I support anything that reduces the length of -cc1 command lines for standard compilation (for example, -mthread-model, which is basically always posix).

I think we have enough approver power to land it.



================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:2786-2799
   bool UseInitArrayDefault =
       getTriple().getArch() == llvm::Triple::aarch64 ||
       getTriple().getArch() == llvm::Triple::aarch64_be ||
       (getTriple().isOSFreeBSD() &&
        getTriple().getOSMajorVersion() >= 12) ||
       (getTriple().getOS() == llvm::Triple::Linux &&
        ((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) ||
----------------
I'd like to consider inverting the default. I suspect for a lot of the cases where this results in defaulting to ctors, we actually want to use init_array. However, that would be a functional change, and therefore out of scope.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71393/new/

https://reviews.llvm.org/D71393





More information about the cfe-commits mailing list