lto.ll
4.11 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
; REQUIRES: x86
; RUN: llvm-as -o %T/main.lto.obj %s
; RUN: llvm-as -o %T/foo.lto.obj %S/Inputs/lto-dep.ll
; RUN: rm -f %T/foo.lto.lib
; RUN: llvm-ar cru %T/foo.lto.lib %T/foo.lto.obj
; RUN: llc -filetype=obj -o %T/main.obj %s
; RUN: llc -filetype=obj -o %T/foo.obj %S/Inputs/lto-dep.ll
; RUN: rm -f %T/foo.lib
; RUN: llvm-ar cru %T/foo.lib %T/foo.obj
; RUN: lld-link /out:%T/main.exe /entry:main /include:f2 /subsystem:console %T/main.lto.obj %T/foo.lto.obj
; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-11 %s
; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-11 %s
; RUN: lld-link /out:%T/main.exe /entry:main /include:f2 /subsystem:console %T/main.lto.obj %T/foo.lto.lib /verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-11 %s
; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-11 %s
; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.obj %T/foo.lto.obj
; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-01 %s
; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-01 %s
; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.obj %T/foo.lto.lib
; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-01 %s
; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-01 %s
; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.lto.obj %T/foo.obj
; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-10 %s
; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-10 %s
; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.lto.obj %T/foo.lib
; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-10 %s
; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-10 %s
; VERBOSE: foo.lto.lib({{.*}}foo.lto.obj)
; HEADERS-11: AddressOfEntryPoint: 0x1000
; TEXT-11: Disassembly of section .text:
; TEXT-11-EMPTY:
; TEXT-11-NEXT: <.text>:
; TEXT-11-NEXT: xorl %eax, %eax
; TEXT-11-NEXT: retq
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: int3
; TEXT-11-NEXT: movl $2, %eax
; TEXT-11-NEXT: retq
; HEADERS-01: AddressOfEntryPoint: 0x1000
; TEXT-01: Disassembly of section .text:
; TEXT-01-EMPTY:
; TEXT-01-NEXT: <.text>:
; TEXT-01-NEXT: subq $40, %rsp
; TEXT-01-NEXT: callq 0x140001020
; TEXT-01-NEXT: xorl %eax, %eax
; TEXT-01-NEXT: addq $40, %rsp
; TEXT-01-NEXT: retq
; TEXT-01-NEXT: retq
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: retq
; HEADERS-10: AddressOfEntryPoint: 0x1020
; TEXT-10: Disassembly of section .text:
; TEXT-10-EMPTY:
; TEXT-10-NEXT: <.text>:
; TEXT-10-NEXT: retq
; TEXT-10-NEXT: nopw %cs:(%rax,%rax)
; TEXT-10-NEXT: nopl (%rax,%rax)
; TEXT-10-NEXT: retq
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: subq $40, %rsp
; TEXT-10-NEXT: callq 0x140001000
; TEXT-10-NEXT: xorl %eax, %eax
; TEXT-10-NEXT: addq $40, %rsp
; TEXT-10-NEXT: retq
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
define i32 @main() {
call void @foo()
ret i32 0
}
declare void @foo()
$f1 = comdat any
define i32 @f1() comdat($f1) {
ret i32 1
}
$f2 = comdat any
define i32 @f2() comdat($f2) {
ret i32 2
}
define internal void @internal() {
ret void
}