53 lines · plain
1# REQUIRES: mips2# Check that GOT entries accessed via 16-bit indexing are allocated3# in the beginning of the GOT.4 5# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o6# RUN: ld.lld %t.o -o %t.exe7# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.exe | FileCheck %s8# RUN: llvm-readelf -s -A %t.exe | FileCheck -check-prefix=GOT %s9 10# CHECK: Disassembly of section .text:11# CHECK-EMPTY:12# CHECK-NEXT: <__start>:13# CHECK-NEXT: lui $2, 014# CHECK-NEXT: lw $2, -32732($2)15# CHECK-NEXT: lui $2, 016# CHECK-NEXT: lw $2, -32728($2)17#18# CHECK: <bar>:19# CHECK-NEXT: lw $2, -32736($2)20# CHECK-NEXT: lw $2, -32744($2)21# CHECK-NEXT: addi $2, $2, {{.*}}22 23# GOT: Symbol table '.symtab'24# GOT: Num: Value Size Type Bind Vis Ndx Name25# GOT: [[LOC:[0-9a-f]+]] 0 NOTYPE LOCAL DEFAULT 4 loc26# GOT: [[START:[0-9a-f]+]] 0 NOTYPE GLOBAL DEFAULT 3 __start27# GOT: [[BAR:[0-9a-f]+]] 0 NOTYPE GLOBAL DEFAULT 3 bar28 29# GOT: Static GOT:30# GOT: Local entries:31# GOT: Address Access Initial32# GOT-NEXT: -32744(gp) 0003000033# GOT-NEXT: -32740(gp) 0004000034# GOT-NEXT: -32736(gp) [[BAR]]35# GOT-NEXT: -32732(gp) [[START]]36# GOT-NEXT: -32728(gp) [[LOC]]37 38 .text39 .global __start, bar40__start:41 lui $2, %got_hi(__start)42 lw $2, %got_lo(__start)($2)43 lui $2, %got_hi(loc)44 lw $2, %got_lo(loc)($2)45bar:46 lw $2, %got(bar)($2)47 lw $2, %got(loc)($2)48 addi $2, $2, %lo(loc)49 50 .data51loc:52 .word 053