xref: /llvm-project/llvm/test/CodeGen/X86/elf-associated.ll (revision 87f2e9448e82bbed4ac59bb61bea03256aa5f4de)
1; RUN: llc -data-sections=1 -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s
2; RUN: llc -data-sections=0 -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s
3
4@a = global i32 1
5@b = global i32 2, !associated !0
6!0 = !{ptr @a}
7; CHECK-DAG: .section .data.b,"awo",@progbits,a
8
9; Loop is OK. Also, normally -data-sections=0 would place @c and @d in the same section. !associated prevents that.
10@c = global i32 2, !associated !2
11@d = global i32 2, !associated !1
12!1 = !{ptr @c}
13!2 = !{ptr @d}
14; CHECK-DAG: .section .data.c,"awo",@progbits,d
15; CHECK-DAG: .section .data.d,"awo",@progbits,c
16
17; BSS is OK.
18@e = global i32 0
19@f = global i32 0, !associated !3
20@g = global i32 1, !associated !3
21!3 = !{ptr @e}
22; CHECK-DAG: .section .bss.f,"awo",@nobits,e
23; CHECK-DAG: .section .data.g,"awo",@progbits,e
24
25; Explicit sections.
26@h = global i32 1, section "aaa"
27@i = global i32 1, section "bbb", !associated !4
28@j = global i32 1, section "bbb", !associated !4
29@k = global i32 1, !associated !4
30!4 = !{ptr @h}
31; CHECK-DAG: .section	aaa,"aw",@progbits
32; CHECK-DAG: .section	bbb,"awo",@progbits,h,unique,1
33; CHECK-DAG: .section	bbb,"awo",@progbits,h,unique,2
34; CHECK-DAG: .section	.data.k,"awo",@progbits,h
35
36; Non-GlobalValue metadata.
37@l = global i32 1, section "ccc", !associated !5
38!5 = !{ptr null}
39; CHECK-DAG: .section	ccc,"awo",@progbits,0,unique,3
40
41; Aliases are OK.
42@n = alias i32, ptr inttoptr (i64 add (i64 ptrtoint (ptr @a to i64), i64 1297036692682702848) to ptr)
43@o = global i32 1, section "eee", !associated !7
44!7 = !{ptr @n}
45; CHECK-DAG: .section	eee,"awo",@progbits,n,unique,4
46