[patch] Replace -use-init-array with -use-ctors

Reid Kleckner rnk at google.com
Fri Aug 29 14:32:33 PDT 2014

Looks like Clang picks the default in this way:

void Generic_ELF::addClangTargetOptions(const ArgList &DriverArgs,
                                        ArgStringList &CC1Args) const {
  const Generic_GCC::GCCVersion &V = GCCInstallation.getVersion();
  bool UseInitArrayDefault =
      getTriple().getArch() == llvm::Triple::aarch64 ||
      getTriple().getArch() == llvm::Triple::aarch64_be ||
      (getTriple().getOS() == llvm::Triple::Linux &&
       (!V.isOlderThan(4, 7, 0) ||
        getTriple().getEnvironment() == llvm::Triple::Android));

  if (DriverArgs.hasFlag(options::OPT_fuse_init_array,

I thought gcc changed way earlier than 4.7.

Anyway, this looks good to me. llc can have the modern default on other ELF

Does anyone know if the BSDs ever switched over to .init_array from .ctors?

On Thu, Aug 28, 2014 at 5:37 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> We have been using .init-array for most systems for quiet some time,
> but tools like llc are still defaulting to .ctors because the old
> option was never changed.
> This patch makes llc default to .init-array and changes the option to
> be -use-ctors.
> Cheers,
> Rafael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140829/af10388f/attachment.html>

More information about the llvm-commits mailing list