xref: /llvm-project/bolt/test/AArch64/text-data.c (revision d648aa1b8e937de1648524e1f1016b53b29ba2a4)
1 // This test checks that the data object located in text section
2 // is properly emitted in the new section.
3 
4 // RUN: %clang %cflags %s -o %t.exe -Wl,-q
5 // RUN: llvm-bolt %t.exe -o %t.bolt --lite=0 --use-old-text=0
6 // RUN: llvm-objdump -j .text -d --disassemble-symbols=arr %t.bolt | \
7 // RUN:   FileCheck %s
8 
9 // CHECK: {{.*}} <arr>:
10 
11 extern void exit(int);
12 
13 typedef void (*FooPtr)();
14 
exitOk()15 void exitOk() { exit(0); }
16 
17 __attribute__((section(".text"))) const FooPtr arr[] = {exitOk, 0};
18 
main()19 int main() {
20   arr[0]();
21   return -1;
22 }
23