[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / mips-64-got.s
blobf81a175d460c2f40e07d402dce70047e58c46629
1 # REQUIRES: mips
2 # Check MIPS N64 ABI GOT relocations
4 # RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
5 # RUN: %p/Inputs/mips-pic.s -o %t.so.o
6 # RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.exe.o
7 # RUN: echo "SECTIONS { . = 0x30000; .text : { *(.text) } }" > %t.script
8 # RUN: ld.lld %t.so.o -shared -soname=t.so -o %t.so
9 # RUN: ld.lld %t.exe.o --script %t.script %t.so -o %t.exe
10 # RUN: llvm-objdump --no-print-imm-hex -d -t --no-show-raw-insn %t.exe | FileCheck %s
11 # RUN: llvm-readelf -r -s -A %t.exe | FileCheck -check-prefix=GOT %s
13 # CHECK: {{[0-9a-f]+}}1c8 l .text 0000000000000000 foo
15 # CHECK: <__start>:
16 # CHECK-NEXT: {{.*}} ld $2, -32736($gp)
17 # CHECK-NEXT: {{.*}} daddiu $2, $2, 456
18 # CHECK-NEXT: {{.*}} addiu $2, $2, -32704
19 # CHECK-NEXT: {{.*}} addiu $2, $2, -32720
20 # CHECK-NEXT: {{.*}} addiu $2, $2, -32712
22 # GOT: There are no relocations in this file.
24 # GOT: Symbol table '.symtab'
25 # GOT: {{.*}}: [[FOO:[0-9a-f]+]] {{.*}} foo
26 # GOT: {{.*}}: [[GP:[0-9a-f]+]] {{.*}} _gp
27 # GOT: {{.*}}: [[BAR:[0-9a-f]+]] {{.*}} bar
29 # GOT: Primary GOT:
30 # GOT-NEXT: Canonical gp value: [[GP]]
31 # GOT-EMPTY:
32 # GOT-NEXT: Reserved entries:
33 # GOT-NEXT: Address Access Initial Purpose
34 # GOT-NEXT: {{.*}} -32752(gp) 0000000000000000 Lazy resolver
35 # GOT-NEXT: {{.*}} -32744(gp) 8000000000000000 Module pointer (GNU extension)
36 # GOT-EMPTY:
37 # GOT-NEXT: Local entries:
38 # GOT-NEXT: Address Access Initial
39 # GOT-NEXT: {{.*}} -32736(gp) 0000000000030000
40 # GOT-NEXT: {{.*}} -32728(gp) 0000000000040000
41 # GOT-NEXT: {{.*}} -32720(gp) [[BAR]]
42 # GOT-NEXT: {{.*}} -32712(gp) [[FOO]]
43 # GOT-EMPTY:
44 # GOT-NEXT: Global entries:
45 # GOT-NEXT: Address Access Initial Sym.Val. Type Ndx Name
46 # GOT-NEXT: {{.*}} -32704(gp) 0000000000000000 0000000000000000 FUNC UND foo1a
48 .text
49 .global __start, bar
50 __start:
51 ld $v0,%got_page(foo)($gp) # R_MIPS_GOT_PAGE
52 daddiu $v0,$v0,%got_ofst(foo) # R_MIPS_GOT_OFST
53 addiu $v0,$v0,%got_disp(foo1a) # R_MIPS_GOT_DISP
54 addiu $v0,$v0,%got_disp(bar) # R_MIPS_GOT_DISP
55 addiu $v0,$v0,%got_disp(foo) # R_MIPS_GOT_DISP
57 bar:
58 nop
59 foo:
60 nop