File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ ; REQUIRES: x86
2+ ; RUN: split-file %s %t.dir
3+ ; RUN: llc %t.dir/t1.ll -o %t.t1.obj --filetype=obj
4+ ; RUN: llc %t.dir/t2.ll -o %t.t2.obj --filetype=obj
5+ ; RUN: lld-link %t.t1.obj %t.t2.obj -entry:main -out:%t.exe
6+ ; RUN: llvm-readobj --section-headers %t.exe | FileCheck %s
7+
8+ ; Make sure that the data section contains just one copy of @a, not two.
9+ ; CHECK: Name: .data
10+ ; CHECK-NEXT: VirtualSize: 0x1000
11+
12+ ;--- t1.ll
13+ target triple = "x86_64-pc-windows-msvc"
14+ @a = common global [4096 x i8 ] zeroinitializer
15+
16+ define i32 @usea () {
17+ %ref_common = load i32 , ptr @a
18+ ret i32 %ref_common
19+ }
20+
21+ ;--- t2.ll
22+ target triple = "x86_64-pc-windows-msvc"
23+ @a = common global [4096 x i8 ] zeroinitializer
24+
25+ define i32 @useb () {
26+ %ref_common = load i32 , ptr @a
27+ ret i32 %ref_common
28+ }
29+
30+ declare i32 @usea ()
31+
32+ define dso_local i32 @main () local_unnamed_addr {
33+ entry:
34+ %a = tail call i32 @usea ()
35+ %b = tail call i32 @useb ()
36+ %add = add nsw i32 %a , %b
37+ ret i32 %add
38+ }
You can’t perform that action at this time.
0 commit comments