37 lines · plain
1# REQUIRES: aarch642# RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o3# RUN: ld.lld -pie --pack-dyn-relocs=relr -z max-page-size=4096 --verbose %t.o -o %t 2>&1 | FileCheck %s4# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELR %s5 6## This test makes sure we don't shrink .relr.dyn, otherwise its size may7## oscillate between 2 words and 3 words.8 9## The test is very sensitive to the exact section sizes and offsets,10## make sure .data is located at a page boundary.11 12# CHECK: .relr.dyn needs 1 padding word(s)13 14# RELR: .relr.dyn {15# RELR-NEXT: 0x2F30 R_AARCH64_RELATIVE -16# RELR-NEXT: 0x2F38 R_AARCH64_RELATIVE -17# RELR-NEXT: 0x3000 R_AARCH64_RELATIVE -18# RELR-NEXT: }19 20.section .data.rel.ro21.align 322.space 0xcd023foo:24## Encoded by the first word of .relr.dyn25.quad foo26 27## Encoded by the second word of .relr.dyn28.quad foo29 30.section .data31.align 332## If .data is at 0x3000, the relocation will be encoded by the second word.33## If we shrink .relr.dyn, the end of .dynamic will be at 0x2ff8 and .data34## will be at 0x3ff8, we will need the third word to encode this relocation,35## which will cause .relr.dyn to expand again.36.quad foo37