Vladislav Khmelevsky fed958c6cc [BOLT] AArch64: Emit text objects
BOLT treats aarch64 objects located in text as empty functions with
contant islands. Emit them with at least 8-byte alignment to the new
text section.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

Differential Revision: https://reviews.llvm.org/D122097
2022-03-31 22:28:50 +03:00

23 lines
520 B
C

// This test checks that the data object located in text section
// is properly emitted in the new section.
// RUN: %clang %cflags %s -o %t.exe -Wl,-q
// RUN: llvm-bolt %t.exe -o %t.bolt -lite=0 -use-old-text=0
// RUN: llvm-objdump -j .text -d --disassemble-symbols=arr %t.bolt | \
// RUN: FileCheck %s
// CHECK: {{.*}} <arr>:
#include <stdlib.h>
typedef void (*FooPtr)();
void exitOk() { exit(0); }
__attribute__((section(".text"))) const FooPtr arr[] = {exitOk, NULL};
int main() {
arr[0]();
return -1;
}