llvm-capstone/lld/test/ELF/arm-thunk-nosuitable.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

33 lines
1.1 KiB
ArmAsm

// REQUIRES: arm
// RUN: llvm-mc %s --arm-add-build-attributes --triple=armv7a-linux-gnueabihf --filetype=obj -o %t.o
// RUN: ld.lld %t.o -o %t
// RUN: llvm-objdump --triple=thumbv7a -d --start-address=0x2200b4 --stop-address=0x2200be %t | FileCheck %s
/// Create a conditional branch too far away from a precreated thunk
/// section. This will need a thunk section created within range.
.syntax unified
.thumb
.section .text.0, "ax", %progbits
.space 2 * 1024 * 1024
.globl _start
.type _start, %function
_start:
/// Range of +/- 1 Megabyte, new ThunkSection will need creating after
/// .text.1
beq.w target
.section .text.1, "ax", %progbits
bx lr
// CHECK: <_start>:
// CHECK-NEXT: 2200b4: 00 f0 00 80 beq.w #0
// CHECK: <__Thumbv7ABSLongThunk_target>:
// CHECK-NEXT: 2200b8: 00 f0 01 90 b.w #12582914
// CHECK: 2200bc: 70 47 bx lr
.section .text.2, "ax", %progbits
.space 12 * 1024 * 1024
.globl target
.type target, %function
target: bx lr