Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / AArch64 / array_end.c
blob6f4f9800c3903123cd40ce53edc38cb5bddb6ae9
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.
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
11 // CHECK: adr [[REG:x[0-28]+]], "__fini_array_end/1"
13 __attribute__((destructor)) void destr() {}
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])();
23 void _start() { callFini(); }