• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; REQUIRES: x86
2; RUN: llvm-as -o %T/main.lto.obj %s
3; RUN: llvm-as -o %T/foo.lto.obj %S/Inputs/lto-dep.ll
4; RUN: rm -f %T/foo.lto.lib
5; RUN: llvm-ar cru %T/foo.lto.lib %T/foo.lto.obj
6
7; RUN: llc -filetype=obj -o %T/main.obj %s
8; RUN: llc -filetype=obj -o %T/foo.obj %S/Inputs/lto-dep.ll
9; RUN: rm -f %T/foo.lib
10; RUN: llvm-ar cru %T/foo.lib %T/foo.obj
11
12; RUN: lld-link /out:%T/main.exe /entry:main /include:f2 /subsystem:console %T/main.lto.obj %T/foo.lto.obj
13; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-11 %s
14; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-11 %s
15; 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
16; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-11 %s
17; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-11 %s
18
19; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.obj %T/foo.lto.obj
20; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-01 %s
21; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-01 %s
22; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.obj %T/foo.lto.lib
23; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-01 %s
24; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-01 %s
25
26; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.lto.obj %T/foo.obj
27; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-10 %s
28; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-10 %s
29; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.lto.obj %T/foo.lib
30; RUN: llvm-readobj --file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-10 %s
31; RUN: llvm-objdump -d %T/main.exe | FileCheck --check-prefix=TEXT-10 %s
32
33; VERBOSE: foo.lto.lib({{.*}}foo.lto.obj)
34
35; HEADERS-11: AddressOfEntryPoint: 0x1000
36; TEXT-11: Disassembly of section .text:
37; TEXT-11-EMPTY:
38; TEXT-11-NEXT: <.text>:
39; TEXT-11-NEXT: xorl	%eax, %eax
40; TEXT-11-NEXT: retq
41; TEXT-11-NEXT: int3
42; TEXT-11-NEXT: int3
43; TEXT-11-NEXT: int3
44; TEXT-11-NEXT: int3
45; TEXT-11-NEXT: int3
46; TEXT-11-NEXT: int3
47; TEXT-11-NEXT: int3
48; TEXT-11-NEXT: int3
49; TEXT-11-NEXT: int3
50; TEXT-11-NEXT: int3
51; TEXT-11-NEXT: int3
52; TEXT-11-NEXT: int3
53; TEXT-11-NEXT: int3
54; TEXT-11-NEXT: movl	$2, %eax
55; TEXT-11-NEXT: retq
56
57; HEADERS-01: AddressOfEntryPoint: 0x1000
58; TEXT-01: Disassembly of section .text:
59; TEXT-01-EMPTY:
60; TEXT-01-NEXT: <.text>:
61; TEXT-01-NEXT: subq	$40, %rsp
62; TEXT-01-NEXT: callq	0x140001020
63; TEXT-01-NEXT: xorl	%eax, %eax
64; TEXT-01-NEXT: addq	$40, %rsp
65; TEXT-01-NEXT: retq
66; TEXT-01-NEXT: retq
67; TEXT-01-NEXT: int3
68; TEXT-01-NEXT: int3
69; TEXT-01-NEXT: int3
70; TEXT-01-NEXT: int3
71; TEXT-01-NEXT: int3
72; TEXT-01-NEXT: int3
73; TEXT-01-NEXT: int3
74; TEXT-01-NEXT: int3
75; TEXT-01-NEXT: int3
76; TEXT-01-NEXT: int3
77; TEXT-01-NEXT: int3
78; TEXT-01-NEXT: int3
79; TEXT-01-NEXT: int3
80; TEXT-01-NEXT: int3
81; TEXT-01-NEXT: int3
82; TEXT-01-NEXT: retq
83
84; HEADERS-10: AddressOfEntryPoint: 0x1020
85; TEXT-10: Disassembly of section .text:
86; TEXT-10-EMPTY:
87; TEXT-10-NEXT: <.text>:
88; TEXT-10-NEXT: retq
89; TEXT-10-NEXT: nopw %cs:(%rax,%rax)
90; TEXT-10-NEXT: nopl (%rax,%rax)
91; TEXT-10-NEXT: retq
92; TEXT-10-NEXT: int3
93; TEXT-10-NEXT: int3
94; TEXT-10-NEXT: int3
95; TEXT-10-NEXT: int3
96; TEXT-10-NEXT: int3
97; TEXT-10-NEXT: int3
98; TEXT-10-NEXT: int3
99; TEXT-10-NEXT: int3
100; TEXT-10-NEXT: int3
101; TEXT-10-NEXT: int3
102; TEXT-10-NEXT: int3
103; TEXT-10-NEXT: int3
104; TEXT-10-NEXT: int3
105; TEXT-10-NEXT: int3
106; TEXT-10-NEXT: int3
107; TEXT-10-NEXT: subq	$40, %rsp
108; TEXT-10-NEXT: callq	0x140001000
109; TEXT-10-NEXT: xorl	%eax, %eax
110; TEXT-10-NEXT: addq	$40, %rsp
111; TEXT-10-NEXT: retq
112
113target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
114target triple = "x86_64-pc-windows-msvc"
115
116define i32 @main() {
117  call void @foo()
118  ret i32 0
119}
120
121declare void @foo()
122
123$f1 = comdat any
124define i32 @f1() comdat($f1) {
125  ret i32 1
126}
127
128$f2 = comdat any
129define i32 @f2() comdat($f2) {
130  ret i32 2
131}
132
133define internal void @internal() {
134  ret void
135}
136