summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2018-01-20 00:28:02 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2018-01-20 00:28:02 +0000
commit99f479abcf2c9b36daad04eb91cd0aafa659bb1d (patch)
tree331bb5b7a64e0b50fc139438a3ab4277080f188f /llvm/test/CodeGen
parent08bd14803cf6a89700db914b68affe98879f4049 (diff)
downloadbcm5719-llvm-99f479abcf2c9b36daad04eb91cd0aafa659bb1d.tar.gz
bcm5719-llvm-99f479abcf2c9b36daad04eb91cd0aafa659bb1d.zip
CodeGen: handle llvm.used properly for COFF
`llvm.used` contains a list of pointers to named values which the compiler, assembler, and linker are required to treat as if there is a reference that they cannot see. Ensure that the symbols are preserved by adding an explicit `-include` reference to the linker command. llvm-svn: 323017
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/coff-no-dead-strip.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/coff-no-dead-strip.ll b/llvm/test/CodeGen/X86/coff-no-dead-strip.ll
new file mode 100644
index 00000000000..adac90da885
--- /dev/null
+++ b/llvm/test/CodeGen/X86/coff-no-dead-strip.ll
@@ -0,0 +1,20 @@
+; RUN: llc -mtriple i686-windows-msvc -filetype asm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ULP
+; RUN: llc -mtriple x86_64-windows-msvc -filetype asm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-NOULP
+; RUN: llc -mtriple thumbv7-windows-msvc -filetype asm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-NOULP
+
+@i = global i32 0
+@j = weak global i32 0
+@k = internal global i32 0
+declare x86_vectorcallcc void @l()
+
+@llvm.used = appending global [4 x i8*] [i8* bitcast (i32* @i to i8*), i8* bitcast (i32* @j to i8*), i8* bitcast (i32* @k to i8*), i8* bitcast (void ()* @l to i8*)]
+
+; CHECK: .section .drectve
+; CHECK-ULP: .ascii " /INCLUDE:_i"
+; CHECK-ULP: .ascii " /INCLUDE:_j"
+; CHECK-ULP-NOT: .ascii " /INCLUDE:_k"
+; CHECK-NOULP: .ascii " /INCLUDE:i"
+; CHECK-NOULP: .ascii " /INCLUDE:j"
+; CHECK-NOULP-NOT: .ascii " /INCLUDE:k"
+; CHECK: .ascii " /INCLUDE:l@@0"
+
OpenPOWER on IntegriCloud