llvm-project/lld/test/ELF/arm-exidx-add-missing.s
Tobias Hieta 87383e408d [ELF][ARM] Increase default max-page-size from 4096 to 6536
See http://lists.llvm.org/pipermail/llvm-dev/2020-April/140549.html

For the record, GNU ld changed to 64k max page size in 2014
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=7572ca8989ead4c3425a1500bc241eaaeffa2c89
"[RFC] ld/ARM: Increase maximum page size to 64kB"

Android driver forced 4k page size in AArch64 (D55029) and ARM (D77746).

A binary linked with max-page-size=4096 does not run on a system with a
higher page size configured. There are some systems out there that do
this and it leads to the binary getting `Killed!` by the kernel.

In the non-linker-script cases, when linked with -z noseparate-code
(default), the max-page-size increase should not cause any size
difference. There may be some VMA usage differences, though.

Reviewed By: psmith, MaskRay

Differential Revision: https://reviews.llvm.org/D77330
2020-04-18 08:19:45 -07:00

67 lines
2.2 KiB
ArmAsm

// REQUIRES: arm
// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi --arm-add-build-attributes %s -o %t
// RUN: ld.lld %t --no-merge-exidx-entries -o %t2
// RUN: llvm-objdump -s %t2 | FileCheck %s
// RUN: ld.lld %t -o %t3
// RUN: llvm-objdump -s %t3 | FileCheck %s --check-prefix=CHECK-MERGE
/// The ARM.exidx section is a table of 8-byte entries of the form:
/// | PREL31 Relocation to start of function | Unwinding information |
/// The range of addresses covered by the table entry is terminated by the
/// next table entry. This means that an executable section without a .ARM.exidx
/// section does not terminate the range of addresses. To fix this the linker
/// synthesises an EXIDX_CANTUNWIND entry for each section without a .ARM.exidx
/// section.
.syntax unified
/// Expect inline unwind instructions
.section .text.01, "ax", %progbits
.global f1
f1:
.fnstart
bx lr
.save {r7, lr}
.setfp r7, sp, #0
.fnend
/// Expect no unwind information from assembler. The linker must
/// synthesise an EXIDX_CANTUNWIND entry to prevent an exception
/// thrown through f2 from matching against the unwind instructions
/// for f1.
.section .text.02, "ax", %progbits
.global f2
f2:
bx lr
/// Expect 1 EXIDX_CANTUNWIND entry that can be merged into the linker
/// generated EXIDX_CANTUNWIND as if the assembler had generated it.
.section .text.03, "ax",%progbits
.global f3
f3:
.fnstart
bx lr
.cantunwind
.fnend
/// Dummy implementation of personality routines to satisfy reference
/// from exception tables, linker will generate EXIDX_CANTUNWIND.
.section .text.__aeabi_unwind_cpp_pr0, "ax", %progbits
.global __aeabi_unwind_cpp_pr0
__aeabi_unwind_cpp_pr0:
bx lr
/// f1, f2
// CHECK: 100d4 28000100 08849780 24000100 01000000
/// f3, __aeabi_unwind_cpp_pr0
// CHECK-NEXT: 100e4 20000100 01000000 1c000100 01000000
/// sentinel
// CHECK-NEXT: 100f4 18000100 01000000
/// f1, (f2, f3, __aeabi_unwind_cpp_pr0)
// CHECK-MERGE: 100d4 18000100 08849780 14000100 01000000
/// sentinel
// CHECK-MERGE-NEXT: 100e4 18000100 01000000