61 lines · plain
1# REQUIRES: mips2# Check MIPS N64 ABI GOT relocations3 4# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \5# RUN: %p/Inputs/mips-pic.s -o %t.so.o6# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.exe.o7# RUN: echo "SECTIONS { . = 0x30000; .text : { *(.text) } }" > %t.script8# RUN: ld.lld %t.so.o -shared -soname=t.so -o %t.so9# RUN: ld.lld %t.exe.o --script %t.script %t.so -o %t.exe10# RUN: llvm-objdump --no-print-imm-hex -d -t --no-show-raw-insn %t.exe | FileCheck %s11# RUN: llvm-readelf -r -s -A %t.exe | FileCheck -check-prefix=GOT %s12 13# CHECK: {{[0-9a-f]+}}1c8 l .text 0000000000000000 foo14 15# CHECK: <__start>:16# CHECK-NEXT: {{.*}} ld $2, -32736($gp)17# CHECK-NEXT: {{.*}} daddiu $2, $2, 45618# CHECK-NEXT: {{.*}} addiu $2, $2, -3270419# CHECK-NEXT: {{.*}} addiu $2, $2, -3272020# CHECK-NEXT: {{.*}} addiu $2, $2, -3271221 22# GOT: There are no relocations in this file.23 24# GOT: Symbol table '.symtab'25# GOT: {{.*}}: [[FOO:[0-9a-f]+]] {{.*}} foo26# GOT: {{.*}}: [[GP:[0-9a-f]+]] {{.*}} _gp27# GOT: {{.*}}: [[BAR:[0-9a-f]+]] {{.*}} bar28 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 Purpose34# GOT-NEXT: {{.*}} -32752(gp) 0000000000000000 Lazy resolver35# GOT-NEXT: {{.*}} -32744(gp) 8000000000000000 Module pointer (GNU extension)36# GOT-EMPTY:37# GOT-NEXT: Local entries:38# GOT-NEXT: Address Access Initial39# GOT-NEXT: {{.*}} -32736(gp) 000000000003000040# GOT-NEXT: {{.*}} -32728(gp) 000000000004000041# 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 Name46# GOT-NEXT: {{.*}} -32704(gp) 0000000000000000 0000000000000000 FUNC UND foo1a47 48 .text49 .global __start, bar50__start:51 ld $v0,%got_page(foo)($gp) # R_MIPS_GOT_PAGE52 daddiu $v0,$v0,%got_ofst(foo) # R_MIPS_GOT_OFST53 addiu $v0,$v0,%got_disp(foo1a) # R_MIPS_GOT_DISP54 addiu $v0,$v0,%got_disp(bar) # R_MIPS_GOT_DISP55 addiu $v0,$v0,%got_disp(foo) # R_MIPS_GOT_DISP56 57bar:58 nop59foo:60 nop61