1; RUN: llc < %s -mtriple=x86_64-linux -stack-size-section -function-sections | FileCheck %s
2
3; Check we add SHF_LINK_ORDER for .stack_sizes and link it with the corresponding .text sections.
4; CHECK: .section        .text._Z3barv,"ax",@progbits
5; CHECK: .section        .stack_sizes,"o",@progbits,.text._Z3barv{{$}}
6; CHECK: .section        .text._Z3foov,"ax",@progbits
7; CHECK: .section        .stack_sizes,"o",@progbits,.text._Z3foov{{$}}
8
9; Check we add .stack_size section to a COMDAT group with the corresponding .text section if such a COMDAT exists.
10; CHECK: .section        .text._Z4fooTIiET_v,"axG",@progbits,_Z4fooTIiET_v,comdat
11; CHECK: .section        .stack_sizes,"Go",@progbits,_Z4fooTIiET_v,comdat,.text._Z4fooTIiET_v{{$}}
12
13$_Z4fooTIiET_v = comdat any
14
15define dso_local i32 @_Z3barv() {
16  ret i32 0
17}
18
19define dso_local i32 @_Z3foov() {
20  %1 = call i32 @_Z4fooTIiET_v()
21  ret i32 %1
22}
23
24define linkonce_odr dso_local i32 @_Z4fooTIiET_v() comdat {
25  ret i32 0
26}
27