xref: /llvm-project/llvm/test/CodeGen/X86/stack-size-section-function-sections.ll (revision 7620f03ef7a662384d67b6bd1fad8582dfe9dd82)
1; RUN: llc < %s -mtriple=x86_64-linux -stack-size-section -function-sections | \
2; RUN:   FileCheck %s --check-prefix=UNIQ
3; RUN: llc < %s -mtriple=x86_64-linux -stack-size-section -function-sections -unique-section-names=0 | \
4; RUN:   FileCheck %s --check-prefix=NOUNIQ
5
6; Check we add SHF_LINK_ORDER for .stack_sizes and link it with the corresponding .text sections.
7; UNIQ:   .section        .text._Z3barv,"ax",@progbits{{$}}
8; UNIQ:   .section        .stack_sizes,"o",@progbits,.text._Z3barv{{$}}
9; UNIQ:   .section        .text._Z3foov,"ax",@progbits{{$}}
10; UNIQ:   .section        .stack_sizes,"o",@progbits,.text._Z3foov{{$}}
11; NOUNIQ: .section        .text,"ax",@progbits,unique,1
12; NOUNIQ: .section        .stack_sizes,"o",@progbits,.text,unique,1
13; NOUNIQ: .section        .text,"ax",@progbits,unique,2
14; NOUNIQ: .section        .stack_sizes,"o",@progbits,.text,unique,2
15
16; Check we add .stack_size section to a COMDAT group with the corresponding .text section if such a COMDAT exists.
17; UNIQ:   .section        .text._Z4fooTIiET_v,"axG",@progbits,_Z4fooTIiET_v,comdat{{$}}
18; UNIQ:   .section        .stack_sizes,"oG",@progbits,.text._Z4fooTIiET_v,_Z4fooTIiET_v,comdat{{$}}
19; NOUNIQ: .section        .text,"axG",@progbits,_Z4fooTIiET_v,comdat,unique,3
20; NOUNIQ: .section        .stack_sizes,"oG",@progbits,.text,_Z4fooTIiET_v,comdat,unique,3
21
22$_Z4fooTIiET_v = comdat any
23
24define dso_local i32 @_Z3barv() {
25  ret i32 0
26}
27
28define dso_local i32 @_Z3foov() {
29  %1 = call i32 @_Z4fooTIiET_v()
30  ret i32 %1
31}
32
33define linkonce_odr dso_local i32 @_Z4fooTIiET_v() comdat {
34  ret i32 0
35}
36