Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / pack-dyn-relocs-relr-loop.s
blob24f39cc390b8650abf0b39e40e1ea7929e758df8
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
6 ## This test makes sure we don't shrink .relr.dyn, otherwise its size may
7 ## oscillate between 2 words and 3 words.
9 ## The test is very sensitive to the exact section sizes and offsets,
10 ## make sure .data is located at a page boundary.
12 # CHECK: .relr.dyn needs 1 padding word(s)
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: }
20 .section .data.rel.ro
21 .align 3
22 .space 0xcd0
23 foo:
24 ## Encoded by the first word of .relr.dyn
25 .quad foo
27 ## Encoded by the second word of .relr.dyn
28 .quad foo
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