aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/X86/constructor.ll
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-06-19 00:48:28 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-06-19 00:48:28 +0000
commitd6b43a317e71246380db55a50b799b062b53cdce (patch)
treea9065fa111ae4ea7feb770a27353bf0673c985fe /test/CodeGen/X86/constructor.ll
parentf6fc855a00b57786a7a9132095165575a5e45312 (diff)
downloadexternal_llvm-d6b43a317e71246380db55a50b799b062b53cdce.zip
external_llvm-d6b43a317e71246380db55a50b799b062b53cdce.tar.gz
external_llvm-d6b43a317e71246380db55a50b799b062b53cdce.tar.bz2
Move the support for using .init_array from ARM to the generic
TargetLoweringObjectFileELF. Use this to support it on X86. Unlike ARM, on X86 it is not easy to find out if .init_array should be used or not, so the decision is made via TargetOptions and defaults to off. Add a command line option to llc that enables it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/constructor.ll')
-rw-r--r--test/CodeGen/X86/constructor.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/CodeGen/X86/constructor.ll b/test/CodeGen/X86/constructor.ll
new file mode 100644
index 0000000..f6dec16
--- /dev/null
+++ b/test/CodeGen/X86/constructor.ll
@@ -0,0 +1,27 @@
+; RUN: llc < %s | FileCheck --check-prefix=CTOR %s
+; RUN: llc -use-init-array < %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() {
+entry:
+ ret void
+}
+
+define void @g() {
+entry:
+ ret void
+}
+
+; CTOR: .section .ctors.65520,"aw",@progbits
+; CTOR-NEXT: .align 8
+; CTOR-NEXT: .quad g
+; CTOR-NEXT: .section .ctors,"aw",@progbits
+; CTOR-NEXT: .align 8
+; CTOR-NEXT: .quad f
+
+; INIT-ARRAY: .section .init_array.15,"aw",@init_array
+; INIT-ARRAY-NEXT: .align 8
+; INIT-ARRAY-NEXT: .quad g
+; INIT-ARRAY-NEXT: .section .init_array,"aw",@init_array
+; INIT-ARRAY-NEXT: .align 8
+; INIT-ARRAY-NEXT: .quad f