1 // Test checks that bolt properly finds end section label. 2 // Linker script contains gap after destructor array, so 3 // __init_array_end address would not be owned by any section. 4 5 // REQUIRES: system-linux 6 // RUN: %clang %cflags -no-pie %s -o %t.exe -Wl,-q \ 7 // RUN: -Wl,-T %S/Inputs/array_end.lld_script 8 // RUN: llvm-bolt %t.exe -o %t.bolt --print-disasm \ 9 // RUN: --print-only="callFini" | FileCheck %s 10 11 // CHECK: adr [[REG:x[0-28]+]], "__fini_array_end/1" 12 destr()13__attribute__((destructor)) void destr() {} 14 callFini()15__attribute__((noinline)) void callFini() { 16 extern void (*__fini_array_start[])(); 17 extern void (*__fini_array_end[])(); 18 unsigned long Count = __fini_array_end - __fini_array_start; 19 for (unsigned long I = 0; I < Count; ++I) 20 (*__fini_array_start[I])(); 21 } 22 _start()23void _start() { callFini(); } 24