brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · fa8579b Raw
58 lines · plain
1REQUIRES: x862RUN: split-file %s %t.dir && cd %t.dir3 4RUN: llvm-mc -filetype=obj -triple=x86_64-windows a.s -o a.obj5 6RUN: llvm-mc -filetype=obj -triple=x86_64-windows b1.s -o b1.obj7RUN: llvm-mc -filetype=obj -triple=x86_64-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:DllMain11 12RUN: llvm-mc -filetype=obj -triple=x86_64-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 2>&1 | FileCheck -check-prefix=WARN %s17RUN: lld-link a.obj b.lib c.lib -dll -out:out.dll -entry:DllMain -ignore:importeddllmain 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-EMPTY:29DISASM:      b8 01 00 00 00               movl    $0x1, %eax30DISASM-NEXT: c3                           retq31 32#--- a.s33        .text34        .globl foo35foo:36        call *__imp_bar(%rip)37        ret38 39#--- b1.s40        .text41        .globl bar42bar:43        ret44 45#--- b2.s46        .text47        .globl DllMain48DllMain:49        xor %eax, %eax50        ret51 52#--- c.s53        .text54        .globl DllMain55DllMain:56        movl $1, %eax57        ret58