brintos

brintos / llvm-project-archived public Read only

0
0
Text · 804 B · 6f4f980 Raw
24 lines · c
1// Test checks that bolt properly finds end section label.2// Linker script contains gap after destructor array, so3// __init_array_end address would not be owned by any section.4 5// REQUIRES: system-linux6// RUN: %clang %cflags -no-pie %s -o %t.exe -Wl,-q \7// RUN:   -Wl,-T %S/Inputs/array_end.lld_script8// RUN: llvm-bolt %t.exe -o %t.bolt --print-disasm \9// RUN:  --print-only="callFini" | FileCheck %s10 11// CHECK: adr [[REG:x[0-28]+]], "__fini_array_end/1"12 13__attribute__((destructor)) void destr() {}14 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 23void _start() { callFini(); }24