59 lines · plain
1REQUIRES: x862RUN: split-file %s %t.dir && cd %t.dir3 4RUN: llvm-mc -filetype=obj -triple=i386-windows a.s -o a.obj5 6RUN: llvm-mc -filetype=obj -triple=i386-windows b1.s -o b1.obj7RUN: llvm-mc -filetype=obj -triple=i386-windows b2.s -o b2.obj8 9### This is the line where our problem occurs. Here, we export the DllMain symbol which shouldn't happen normally.10RUN: lld-link b1.obj b2.obj -out:b.dll -dll -implib:b.lib -entry:DllMain -export:bar -export:DllMain -safeseh:no11 12RUN: llvm-mc -filetype=obj -triple=i386-windows c.s -o c.obj13RUN: lld-link -lib c.obj -out:c.lib14 15### Later, if b.lib is provided before other libs/objs that export DllMain statically, we previously were using the dllimported DllMain from b.lib, which is wrong.16RUN: lld-link a.obj b.lib c.lib -dll -out:out.dll -entry:DllMain -safeseh:no 2>&1 | FileCheck -check-prefix=WARN %s17RUN: lld-link a.obj b.lib c.lib -dll -out:out.dll -entry:DllMain -ignore:importeddllmain -safeseh:no 2>&1 | FileCheck -check-prefix=IGNORED --allow-empty %s18RUN: llvm-objdump --private-headers -d out.dll | FileCheck -check-prefix=DISASM %s19 20WARN: lld-link: warning: b.lib: skipping imported DllMain symbol [importeddllmain]21IGNORED-NOT: lld-link: warning: b.lib: skipping imported DllMain symbol [importeddllmain]22 23DISASM: The Import Tables:24DISASM: DLL Name: b.dll25DISASM-NOT: DllMain26DISASM: bar27DISASM: Disassembly of section .text:28DISASM: b0 01 movb $0x1, %al29DISASM-NEXT: c3 retl30 31#--- a.s32 .text33 .globl _foo34_foo:35 call *__imp__bar36 ret37 38#--- b1.s39 .text40 .globl _bar41_bar:42 ret43 44#--- b2.s45 .intel_syntax noprefix46 .text47 .globl _DllMain48_DllMain:49 xor al, al50 ret51 52#--- c.s53 .intel_syntax noprefix54 .text55 .globl _DllMain56_DllMain:57 mov al, 1 58 ret59