1; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=labels | FileCheck %s 2; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-address-map | FileCheck %s 3 4$_Z4fooTIiET_v = comdat any 5 6define dso_local i32 @_Z3barv() { 7 ret i32 0 8} 9;; Check we add SHF_LINK_ORDER for .llvm_bb_addr_map and link it with the corresponding .text sections. 10; CHECK: .section .text._Z3barv,"ax",@progbits 11; CHECK-LABEL: _Z3barv: 12; CHECK-NEXT: [[BAR_BEGIN:.Lfunc_begin[0-9]+]]: 13; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text._Z3barv{{$}} 14; CHECK-NEXT: .byte 2 # version 15; CHECK-NEXT: .byte 0 # feature 16; CHECK-NEXT: .quad [[BAR_BEGIN]] # function address 17 18 19define dso_local i32 @_Z3foov() { 20 %1 = call i32 @_Z4fooTIiET_v() 21 ret i32 %1 22} 23; CHECK: .section .text._Z3foov,"ax",@progbits 24; CHECK-LABEL: _Z3foov: 25; CHECK-NEXT: [[FOO_BEGIN:.Lfunc_begin[0-9]+]]: 26; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text._Z3foov{{$}} 27; CHECK-NEXT: .byte 2 # version 28; CHECK-NEXT: .byte 0 # feature 29; CHECK-NEXT: .quad [[FOO_BEGIN]] # function address 30 31 32define linkonce_odr dso_local i32 @_Z4fooTIiET_v() comdat { 33 ret i32 0 34} 35;; Check we add .llvm_bb_addr_map section to a COMDAT group with the corresponding .text section if such a COMDAT exists. 36; CHECK: .section .text._Z4fooTIiET_v,"axG",@progbits,_Z4fooTIiET_v,comdat 37; CHECK-LABEL: _Z4fooTIiET_v: 38; CHECK-NEXT: [[FOOCOMDAT_BEGIN:.Lfunc_begin[0-9]+]]: 39; CHECK: .section .llvm_bb_addr_map,"oG",@llvm_bb_addr_map,.text._Z4fooTIiET_v,_Z4fooTIiET_v,comdat{{$}} 40; CHECK-NEXT: .byte 2 # version 41; CHECK-NEXT: .byte 0 # feature 42; CHECK-NEXT: .quad [[FOOCOMDAT_BEGIN]] # function address 43