summaryrefslogtreecommitdiff
path: root/test/Linker/ctors.ll
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-09-05 21:27:52 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-09-05 21:27:52 +0000
commite8b19acded1d944918a35c6196d8336916dde735 (patch)
treeec2c29d4d3eb83b51f0ee7ac2a1899ef867ad3ab /test/Linker/ctors.ll
parentea388503c47ba1af00b0ab2d4f5d8ae2fcbef727 (diff)
Fix pr20078.
When linking llvm.global_ctors with the optional third element we have to handle it specially and only copy the elements whose keys were also copied. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217281 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Linker/ctors.ll')
-rw-r--r--test/Linker/ctors.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Linker/ctors.ll b/test/Linker/ctors.ll
new file mode 100644
index 00000000000..67bf4563718
--- /dev/null
+++ b/test/Linker/ctors.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-link %s %p/Inputs/ctors.ll -S -o - | \
+; RUN: FileCheck --check-prefix=ALL --check-prefix=CHECK1 %s
+; RUN: llvm-link %p/Inputs/ctors.ll %s -S -o - | \
+; RUN: FileCheck --check-prefix=ALL --check-prefix=CHECK2 %s
+
+@v = weak global i8 0
+; CHECK1: @v = weak global i8 0
+; CHECK2: @v = weak global i8 1
+
+@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* @v }]
+; ALL: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* @v }]
+
+define weak void @f() {
+ ret void
+}