[lld] r293107 - COFF: add test for /INCLUDE directives specified in bitcode

Bob Haarman via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 15:07:40 PST 2017


Author: inglorion
Date: Wed Jan 25 17:07:40 2017
New Revision: 293107

URL: http://llvm.org/viewvc/llvm-project?rev=293107&view=rev
Log:
COFF: add test for /INCLUDE directives specified in bitcode

Summary: MSVC allows linker options to be specified in source code. One of these is the /INCLUDE directive, which specifies that a symbol must be added to the symbol table, even if it otherwise wouldn't be. Existing tests cover the case where the linker is given an object file with an /INCLUDE directive, but we also need to cover the case where /INCLUDE is specified in a bitcode file (as would happen when using LTO). This new test covers that case.

Reviewers: pcc, ruiu

Reviewed By: ruiu

Differential Revision: https://reviews.llvm.org/D29096


Added:
    lld/trunk/test/COFF/include-lto.ll

Added: lld/trunk/test/COFF/include-lto.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/include-lto.ll?rev=293107&view=auto
==============================================================================
--- lld/trunk/test/COFF/include-lto.ll (added)
+++ lld/trunk/test/COFF/include-lto.ll Wed Jan 25 17:07:40 2017
@@ -0,0 +1,24 @@
+; RUN: llvm-as -o %t.obj %s
+; RUN: lld-link /dll /out:%t.dll %t.obj
+; RUN: llvm-objdump -d %t.dll | FileCheck %s
+
+; Checks that code for foo is emitted, as required by the /INCLUDE directive.
+; CHECK: xorl %eax, %eax
+; CHECK-NEXT: retq
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+define void @_DllMainCRTStartup() {
+  ret void
+}
+
+define i32 @foo() {
+  ret i32 0
+}
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 6, !"Linker Options", !1}
+!1 = !{!2}
+!2 = !{!"/INCLUDE:foo"}




More information about the llvm-commits mailing list