Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / aarch64-combined-dynrel.s
blobd9c88054d3abd3d8c667d94b501150f8563bf4f7
1 // REQUIRES: aarch64
2 // RUN: llvm-mc --triple=aarch64-linux-gnu -filetype=obj -o %t.o %s
3 // RUN: echo "SECTIONS { \
4 // RUN: .text : { *(.text) } \
5 // RUN: .rela.dyn : { *(.rela.dyn) *(.rela.plt) } \
6 // RUN: } " > %t.script
7 // RUN: ld.lld %t.o -o %t.so --shared --script %t.script
8 // RUN: llvm-readobj --section-headers --dynamic-table %t.so | FileCheck %s
10 // The linker script above combines the .rela.dyn and .rela.plt into a single
11 // table. ELF is clear that the DT_PLTRELSZ should match the subset of
12 // relocations that is associated with the PLT. It is less clear about what
13 // the value of DT_RELASZ should be. ELF implies that it should be the size
14 // of the single table so that DT_RELASZ includes DT_PLTRELSZ. The loader in
15 // glibc permits this as long as .rela.plt comes after .rela.dyn in the
16 // combined table.
17 .text
18 .globl func
19 .type func, %function
20 .globl foo
21 .type foo, %object
23 .globl _start
24 .type _start, %function
25 _start:
26 bl func
27 adrp x8, :got:foo
28 ldr x8, [x8, :got_lo12:foo]
29 ret
31 // CHECK: Name: .rela.dyn
32 // CHECK-NEXT: Type: SHT_RELA
33 // CHECK-NEXT: Flags [
34 // CHECK-NEXT: SHF_ALLOC
35 // CHECK-NEXT: SHF_INFO_LINK
36 // CHECK-NEXT: ]
37 // CHECK-NEXT: Address:
38 // CHECK-NEXT: Offset:
39 // CHECK-NEXT: Size: 48
41 // CHECK: 0x0000000000000008 RELASZ 48
42 // CHECK: 0x0000000000000002 PLTRELSZ 24