[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / arm-fpic-got.s
blob9881806a3b9fb984fb8b9f884e45d671b5a53125
1 // REQUIRES: arm
2 // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o
3 // RUN: ld.lld %t.o -o %t
4 // RUN: llvm-readobj -S %t | FileCheck %s
5 // RUN: llvm-readobj -S --symbols %t | FileCheck -check-prefix=SYMBOLS %s
6 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn --triple=armv7a-none-linux-gnueabi %t | FileCheck --check-prefix=CODE %s
8 // Test the R_ARM_GOT_PREL relocation
9 .syntax unified
10 .text
11 .globl _start
12 .align 2
13 _start:
14 ldr r0, .LCPI0_0
15 .LPC0_0:
16 ldr r0, [pc, r0]
17 ldr r0, [r0]
18 bx lr
19 .LCPI0_0:
20 .Ltmp0:
21 // Generate R_ARM_GOT_PREL
22 .long val(GOT_PREL)-((.LPC0_0+8)-.Ltmp0)
24 .data
25 .type val,%object
26 .globl val
27 .align 2
28 val:
29 .long 10
30 .size val, 4
32 // CHECK: Section {
33 // CHECK: Name: .got
34 // CHECK-NEXT: Type: SHT_PROGBITS
35 // CHECK-NEXT: Flags [
36 // CHECK-NEXT: SHF_ALLOC
37 // CHECK-NEXT: SHF_WRITE
38 // CHECK-NEXT: ]
39 // CHECK-NEXT: Address: 0x30128
40 // CHECK-NEXT: Offset:
41 // CHECK-NEXT: Size: 4
42 // CHECK-NEXT: Link:
43 // CHECK-NEXT: Info:
44 // CHECK-NEXT: AddressAlignment: 4
45 // CHECK-NEXT: EntrySize:
47 // SYMBOLS: Name: val
48 // SYMBOLS-NEXT: Value: 0x4012C
49 // SYMBOLS-NEXT: Size: 4
50 // SYMBOLS-NEXT: Binding: Global
51 // SYMBOLS-NEXT: Type: Object
52 // SYMBOLS-NEXT: Other:
53 // SYMBOLS-NEXT: Section: .data
55 // CODE: Disassembly of section .text:
56 // CODE-EMPTY:
57 // CODE-NEXT: <_start>:
58 // CODE-NEXT: 20114: ldr r0, [pc, #8]
59 // CODE-NEXT: 20118: ldr r0, [pc, r0]
60 // CODE-NEXT: 2011c: ldr r0, [r0]
61 // CODE-NEXT: 20120: bx lr
62 // 0x11124 + 0x1008 + 8 = 0x12128 = .got
63 // CODE-NEXT: 20124: 08 00 01 00