xref: /llvm-project/llvm/test/CodeGen/X86/elf-separate-named-sections.ll (revision 8bcb0737056163686e967821bea7f9e87c57cdfc)
1; Test that global values with explicit sections are placed into unique sections.
2
3; RUN: llc < %s | FileCheck %s
4; RUN: llc -separate-named-sections < %s | FileCheck %s --check-prefix=SEPARATE
5target triple="x86_64-unknown-unknown-elf"
6
7define i32 @f() section "custom_text" {
8    entry:
9    ret i32 0
10}
11
12define i32 @g() section "custom_text" {
13    entry:
14    ret i32 0
15}
16
17; CHECK: .section custom_text,"ax",@progbits{{$}}
18; CHECK: f:
19; CHECK: g:
20
21; SEPARATE: .section custom_text,"ax",@progbits,unique,1{{$}}
22; SEPARATE: f:
23; SEPARATE: .section custom_text,"ax",@progbits,unique,2{{$}}
24; SEPARATE: g:
25
26@i = global i32 0, section "custom_data", align 8
27@j = global i32 0, section "custom_data", align 8
28
29; CHECK: .section custom_data,"aw",@progbits{{$}}
30; CHECK: i:
31; CHECK: j:
32
33; SEPARATE: .section custom_data,"aw",@progbits,unique,3{{$}}
34; SEPARATE: i:
35; SEPARATE: .section custom_data,"aw",@progbits,unique,4{{$}}
36; SEPARATE: j:
37