Files
clang-p2996/lld/test/ELF/arm-fix-cortex-a8-thunk-align.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

42 lines
1.1 KiB
ArmAsm

// REQUIRES: arm
// RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabihf --arm-add-build-attributes %s -o %t.o
// RUN: ld.lld --fix-cortex-a8 --shared %t.o -o %t2
// RUN: llvm-objdump -d --no-show-raw-insn %t2 | FileCheck %s
/// Test case that for an OutputSection larger than the ThunkSectionSpacing
/// --fix-cortex-a8 will cause the size of the ThunkSection to be rounded up to
/// the nearest 4KiB
.thumb
.section .text.01, "ax", %progbits
.balign 4096
.globl _start
.type _start, %function
_start:
/// state change thunk required
b.w arm_func
thumb_target:
.space 4096 - 10
/// erratum patch needed
nop.w
b.w thumb_target
/// Expect thunk and patch to be inserted here
// CHECK: 00012004 <__ThumbV7PILongThunk_arm_func>:
// CHECK-NEXT: 12004: movw r12, #4088
// CHECK-NEXT: movt r12, #256
// CHECK-NEXT: add r12, pc
// CHECK-NEXT: bx r12
// CHECK: 00013004 <__CortexA8657417_11FFE>:
// CHECK-NEXT: 13004: b.w #-8196
.section .text.02
/// Take us over thunk section spacing
.space 16 * 1024 * 1024
.section .text.03, "ax", %progbits
.arm
.balign 4
.type arm_func, %function
arm_func:
bx lr