[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / mips-pc-relocs.s
blob7d23f9d7469a484760f13fe71348d0e69bb68bad
1 # REQUIRES: mips
2 # Check R_MIPS_PCxxx relocations calculation.
4 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
5 # RUN: -mcpu=mips32r6 %s -o %t1.o
6 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
7 # RUN: -mcpu=mips32r6 %S/Inputs/mips-dynamic.s -o %t2.o
8 # RUN: echo "SECTIONS { \
9 # RUN: . = 0x10000; .text ALIGN(0x10000) : { *(.text) } \
10 # RUN: . = 0x30000; .data : { *(.data) } \
11 # RUN: }" > %t.script
12 # RUN: ld.lld %t1.o %t2.o -script %t.script -o %t.exe
13 # RUN: llvm-objdump --no-print-imm-hex --mcpu=mips32r6 -d -t -s --no-show-raw-insn %t.exe \
14 # RUN: | FileCheck %s
16 .text
17 .globl __start
18 __start:
19 lwpc $6, _foo # R_MIPS_PC19_S2
20 beqc $5, $6, _foo # R_MIPS_PC16
21 beqzc $9, _foo # R_MIPS_PC21_S2
22 bc _foo # R_MIPS_PC26_S2
23 aluipc $2, %pcrel_hi(_foo) # R_MIPS_PCHI16
24 addiu $2, $2, %pcrel_lo(_foo) # R_MIPS_PCLO16
26 .data
27 .word _foo+8-. # R_MIPS_PC32
29 # CHECK: 00020000 g .text 00000000 __start
30 # CHECK: 00020020 g .text 00000000 _foo
32 # CHECK: Contents of section .data:
33 # CHECK-NEXT: 30000 ffff0028 00000000 00000000 00000000
34 # ^-- 0x20020 + 8 - 0x30000
36 # CHECK: Disassembly of section .text:
37 # CHECK-EMPTY:
38 # CHECK-NEXT: <__start>:
39 # CHECK-NEXT: 20000: lwpc $6, 32
40 # ^-- (0x20020-0x20000)>>2
41 # CHECK-NEXT: 20004: beqc $5, $6, 0x20020
42 # ^-- (0x20020-4-0x20004)>>2
43 # CHECK-NEXT: 20008: nop
44 # CHECK-NEXT: 2000c: beqzc $9, 0x20020
45 # ^-- (0x20020-4-0x2000c)>>2
46 # CHECK-NEXT: 20010: nop
47 # CHECK-NEXT: 20014: bc 0x20020
48 # ^-- (0x20020-4-0x200014)>>2
49 # CHECK-NEXT: 20018: aluipc $2, 0
50 # ^-- %hi(0x20020-0x20018)
51 # CHECK-NEXT: 2001c: addiu $2, $2, 4
52 # ^-- %lo(0x20020-0x2001c)