comparison lld/test/ELF/pack-dyn-relocs-relr-loop.s @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children 2e18cbf3894f
comparison
equal deleted inserted replaced
147:c2174574ed3a 150:1d019706d866
1 # REQUIRES: aarch64
2 # RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
3 # RUN: ld.lld -pie --pack-dyn-relocs=relr -z max-page-size=4096 --verbose %t.o -o %t 2>&1 | FileCheck %s
4 # RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELR %s
5
6 ## This test makes sure we don't shrink .relr.dyn, otherwise its size may
7 ## 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: 0x2F40 R_AARCH64_RELATIVE - 0x0
16 # RELR-NEXT: 0x2F48 R_AARCH64_RELATIVE - 0x0
17 # RELR-NEXT: 0x3000 R_AARCH64_RELATIVE - 0x0
18 # RELR-NEXT: }
19
20 .section .data.rel.ro
21 .align 3
22 .space 0xce0
23 foo:
24 ## Encoded by the first word of .relr.dyn
25 .quad foo
26
27 ## Encoded by the second word of .relr.dyn
28 .quad foo
29
30 .section .data
31 .align 3
32 ## 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 .data
34 ## 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 foo