From 1e556a80ffbc7c4ecb99848e14995119337c9362 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 2 Sep 2014 13:54:53 +0000 Subject: [PATCH] Replace -use-init-array with -use-ctors. 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. Clang is not affected by this. It has its own fancier logic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216905 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/CommandFlags.h | 6 +++--- test/CodeGen/AArch64/init-array.ll | 4 ++-- test/CodeGen/Mips/init-array.ll | 2 +- test/CodeGen/X86/2011-08-29-InitOrder.ll | 2 +- test/CodeGen/X86/constructor.ll | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/llvm/CodeGen/CommandFlags.h b/include/llvm/CodeGen/CommandFlags.h index 28069c3f40a..95579f84825 100644 --- a/include/llvm/CodeGen/CommandFlags.h +++ b/include/llvm/CodeGen/CommandFlags.h @@ -190,8 +190,8 @@ EnablePIE("enable-pie", cl::init(false)); cl::opt -UseInitArray("use-init-array", - cl::desc("Use .init_array instead of .ctors."), +UseCtors("use-ctors", + cl::desc("Use .ctors instead of .init_array."), cl::init(false)); cl::opt StopAfter("stop-after", @@ -248,7 +248,7 @@ static inline TargetOptions InitTargetOptionsFromCodeGenFlags() { Options.StackAlignmentOverride = OverrideStackAlignment; Options.TrapFuncName = TrapFuncName; Options.PositionIndependentExecutable = EnablePIE; - Options.UseInitArray = UseInitArray; + Options.UseInitArray = !UseCtors; Options.DataSections = DataSections; Options.FunctionSections = FunctionSections; diff --git a/test/CodeGen/AArch64/init-array.ll b/test/CodeGen/AArch64/init-array.ll index f47b490baeb..a275e7ecc57 100644 --- a/test/CodeGen/AArch64/init-array.ll +++ b/test/CodeGen/AArch64/init-array.ll @@ -1,5 +1,5 @@ -; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -use-init-array -o - %s | FileCheck %s -; RUN: llc -mtriple=aarch64-none-none-eabi -verify-machineinstrs -use-init-array -o - %s | FileCheck %s +; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s +; RUN: llc -mtriple=aarch64-none-none-eabi -verify-machineinstrs -o - %s | FileCheck %s define internal void @_GLOBAL__I_a() section ".text.startup" { ret void diff --git a/test/CodeGen/Mips/init-array.ll b/test/CodeGen/Mips/init-array.ll index f96ce264728..1ca182dae7a 100644 --- a/test/CodeGen/Mips/init-array.ll +++ b/test/CodeGen/Mips/init-array.ll @@ -1,4 +1,4 @@ -; RUN: llc -mtriple mipsel-unknown-linux -use-init-array < %s | FileCheck %s +; RUN: llc -mtriple mipsel-unknown-linux < %s | FileCheck %s target triple = "mipsel-unknown-linux" diff --git a/test/CodeGen/X86/2011-08-29-InitOrder.ll b/test/CodeGen/X86/2011-08-29-InitOrder.ll index a95dcb58070..b278ad67415 100644 --- a/test/CodeGen/X86/2011-08-29-InitOrder.ll +++ b/test/CodeGen/X86/2011-08-29-InitOrder.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=i386-linux-gnu | FileCheck %s --check-prefix=CHECK-DEFAULT +; RUN: llc < %s -mtriple=i386-linux-gnu -use-ctors | FileCheck %s --check-prefix=CHECK-DEFAULT ; RUN: llc < %s -mtriple=i386-apple-darwin | FileCheck %s --check-prefix=CHECK-DARWIN ; PR5329 diff --git a/test/CodeGen/X86/constructor.ll b/test/CodeGen/X86/constructor.ll index b57889643e0..23860be4a3b 100644 --- a/test/CodeGen/X86/constructor.ll +++ b/test/CodeGen/X86/constructor.ll @@ -1,5 +1,5 @@ -; RUN: llc -mtriple x86_64-pc-linux < %s | FileCheck --check-prefix=CTOR %s -; RUN: llc -mtriple x86_64-pc-linux -use-init-array < %s | FileCheck --check-prefix=INIT-ARRAY %s +; RUN: llc -mtriple x86_64-pc-linux -use-ctors < %s | FileCheck --check-prefix=CTOR %s +; RUN: llc -mtriple x86_64-pc-linux < %s | FileCheck --check-prefix=INIT-ARRAY %s @llvm.global_ctors = appending global [2 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @f }, { i32, void ()* } { i32 15, void ()* @g }] define void @f() { -- 2.34.1