1// Verify that PLT optimization in BOLT preserves exception-handling info.
2
3// REQUIRES: system-linux
4
5// RUN: %clang %cflags -fpic -shared -xc /dev/null -o %t.so
6// Link against a DSO to ensure PLT entries.
7// RUN: %clangxx %cxxflags -O1 -Wl,-q,-znow %s %t.so -o %t.exe
8// RUN: llvm-bolt %t.exe -o %t.bolt.exe --plt=all --print-only=.*main.* \
9// RUN: --print-finalized 2>&1 | FileCheck %s
10
11// CHECK-LABEL: Binary Function
12// CHECK: adrp {{.*}}__cxa_throw
13// CHECK-NEXT: ldr {{.*}}__cxa_throw
14// CHECK-NEXT: blr x17 {{.*}} handler: {{.*}} PLTCall:
15
16int main() {
17 try {
18 throw new int;
19 } catch (...) {
20 return 0;
21 }
22 return 1;
23}
24

source code of bolt/test/AArch64/exceptions-plt.cpp