1# REQUIRES: x86
2# Verify that the lld can handle .lib files and emit .idata sections.
3#
4# RUN: lld-link /out:%t.exe /entry:main /subsystem:console \
5# RUN:   %p/Inputs/hello64.obj %p/Inputs/std64.lib
6# RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=TEXT %s
7# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORT %s
8
9# RUN: lld-link /out:%t.exe /entry:main /subsystem:console \
10# RUN:   %p/Inputs/hello64.obj %p/Inputs/std64.lib /include:ExitProcess
11# RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=TEXT %s
12# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORT %s
13
14TEXT: Disassembly of section .text:
15TEXT-EMPTY:
16TEXT-NEXT: <.text>:
17TEXT-NEXT: subq    $40, %rsp
18TEXT-NEXT: movq    $0, %rcx
19TEXT-NEXT: leaq    8180(%rip), %rdx
20TEXT-NEXT: leaq    8167(%rip), %r8
21TEXT-NEXT: movl    $0, %r9d
22TEXT-NEXT: callq   0x140001060
23TEXT-NEXT: movl    $0, %ecx
24TEXT-NEXT: callq   0x140001040
25TEXT-NEXT: callq   0x140001050
26TEXT:      jmpq    *4098(%rip)
27TEXT:      jmpq    *4090(%rip)
28TEXT:      jmpq    *4082(%rip)
29
30IMPORT:      Import {
31IMPORT-NEXT:   Name: std64.dll
32IMPORT-NEXT:   ImportLookupTableRVA: 0x2028
33IMPORT-NEXT:   ImportAddressTableRVA: 0x2048
34IMPORT-NEXT:   Symbol: ExitProcess (0)
35IMPORT-NEXT:   Symbol:  (50)
36IMPORT-NEXT:   Symbol: MessageBoxA (1)
37IMPORT-NEXT: }
38
39# RUN: lld-link /out:%t.exe /entry:main /subsystem:console /merge:.rdata=.text \
40# RUN:   %p/Inputs/hello64.obj %p/Inputs/std64.lib /include:ExitProcess
41# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=MERGE %s
42
43MERGE:      Import {
44MERGE-NEXT:   Name: std64.dll
45MERGE-NEXT:   ImportLookupTableRVA: 0x1090
46MERGE-NEXT:   ImportAddressTableRVA: 0x10B0
47MERGE-NEXT:   Symbol: ExitProcess (0)
48MERGE-NEXT:   Symbol:  (50)
49MERGE-NEXT:   Symbol: MessageBoxA (1)
50MERGE-NEXT: }
51