aboutsummaryrefslogtreecommitdiff
path: root/lld/test/COFF/imports.test
blob: a3dbb86ec96cb6447a5af75365f9fb36fd291bb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# REQUIRES: x86
# Verify that the lld can handle .lib files and emit .idata sections.
#
# RUN: lld-link /out:%t.exe /entry:main /subsystem:console \
# RUN:   %p/Inputs/hello64.obj %p/Inputs/std64.lib
# RUN: llvm-objdump -d %t.exe | FileCheck -check-prefix=TEXT %s
# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORT %s

# RUN: lld-link /out:%t.exe /entry:main /subsystem:console \
# RUN:   %p/Inputs/hello64.obj %p/Inputs/std64.lib /include:ExitProcess
# RUN: llvm-objdump -d %t.exe | FileCheck -check-prefix=TEXT %s
# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORT %s

TEXT: Disassembly of section .text:
TEXT-EMPTY:
TEXT-NEXT: <.text>:
TEXT-NEXT: subq    $40, %rsp
TEXT-NEXT: movq    $0, %rcx
TEXT-NEXT: leaq    8180(%rip), %rdx
TEXT-NEXT: leaq    8167(%rip), %r8
TEXT-NEXT: movl    $0, %r9d
TEXT-NEXT: callq   60
TEXT-NEXT: movl    $0, %ecx
TEXT-NEXT: callq   18
TEXT-NEXT: callq   29
TEXT:      jmpq    *4098(%rip)
TEXT:      jmpq    *4090(%rip)
TEXT:      jmpq    *4082(%rip)

IMPORT:      Import {
IMPORT-NEXT:   Name: std64.dll
IMPORT-NEXT:   ImportLookupTableRVA: 0x2028
IMPORT-NEXT:   ImportAddressTableRVA: 0x2048
IMPORT-NEXT:   Symbol: ExitProcess (0)
IMPORT-NEXT:   Symbol:  (50)
IMPORT-NEXT:   Symbol: MessageBoxA (1)
IMPORT-NEXT: }

# RUN: lld-link /out:%t.exe /entry:main /subsystem:console /merge:.rdata=.text \
# RUN:   %p/Inputs/hello64.obj %p/Inputs/std64.lib /include:ExitProcess
# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=MERGE %s

MERGE:      Import {
MERGE-NEXT:   Name: std64.dll
MERGE-NEXT:   ImportLookupTableRVA: 0x1090
MERGE-NEXT:   ImportAddressTableRVA: 0x10B0
MERGE-NEXT:   Symbol: ExitProcess (0)
MERGE-NEXT:   Symbol:  (50)
MERGE-NEXT:   Symbol: MessageBoxA (1)
MERGE-NEXT: }