brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · da82eed Raw
98 lines · plain
1# REQUIRES: mips2# Check R_MIPS_26 relocation handling.3 4# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t1.o5# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \6# RUN:         %S/Inputs/mips-dynamic.s -o %t2.o7# RUN: ld.lld %t2.o -shared -o %t.so8# RUN: ld.lld %t1.o %t.so -o %t.exe9# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t.exe | FileCheck %s10# RUN: llvm-readobj -S --dynamic-table -r -A %t.exe \11# RUN:   | FileCheck -check-prefix=REL %s12 13# CHECK:      Disassembly of section .text:14# CHECK-EMPTY:15# CHECK-NEXT: <bar>:16# CHECK-NEXT:   [[BAR:[0-9a-f]+]]:  jal  0x[[LOC:[0-9a-f]+]] <loc>17# CHECK-NEXT:   {{.*}}:              nop18#19# CHECK:      <__start>:20# CHECK-NEXT:   {{.*}}:       jal     0x[[BAR]] <bar>21# CHECK-NEXT:   {{.*}}:       nop22# CHECK-NEXT:   {{.*}}:       jal     0x[[FOO0:[0-9a-f]+]]23#                                     ^-- gotplt[foo0]24# CHECK-NEXT:   {{.*}}:       nop25#26# CHECK:      <loc>:27# CHECK-NEXT:   [[LOC]]:      nop28# CHECK-EMPTY:29# CHECK-NEXT: Disassembly of section .plt:30# CHECK-EMPTY:31# CHECK-NEXT: <.plt>:32# CHECK-NEXT:   {{.*}}:       lui     $gp, 0x333# CHECK-NEXT:   {{.*}}:       lw      $25, {{.*}}($gp)34# CHECK-NEXT:   {{.*}}:       addiu   $gp, $gp, {{.*}}35# CHECK-NEXT:   {{.*}}:       subu    $24, $24, $gp36# CHECK-NEXT:   {{.*}}:       move    $15, $ra37# CHECK-NEXT:   {{.*}}:       srl     $24, $24, 0x238# CHECK-NEXT:   {{.*}}:       jalr    $2539# CHECK-NEXT:   {{.*}}:       addiu   $24, $24, -0x240# CHECK-NEXT:   [[FOO0]]:     lui     $15, 0x341# CHECK-NEXT:   {{.*}}:       lw      $25, {{.*}}($15)42# CHECK-NEXT:   {{.*}}:       jr      $2543# CHECK-NEXT:   {{.*}}:       addiu   $24, $15, {{.*}}44 45# REL:      Name: .plt46# REL-NEXT: Type: SHT_PROGBITS47# REL-NEXT: Flags [ (0x6)48# REL-NEXT:   SHF_ALLOC49# REL-NEXT:   SHF_EXECINSTR50# REL-NEXT: ]51# REL-NEXT: Address: 0x[[PLTADDR:[0-9A-F]+]]52 53# REL:      Name: .got.plt54# REL-NEXT: Type: SHT_PROGBITS55# REL-NEXT: Flags [ (0x3)56# REL-NEXT:   SHF_ALLOC57# REL-NEXT:   SHF_WRITE58# REL-NEXT: ]59# REL-NEXT: Address: 0x[[GOTPLTADDR:[0-9A-F]+]]60 61# REL: 0x70000032  MIPS_PLTGOT  0x[[GOTPLTADDR]]62 63# REL: Relocations [64# REL-NEXT:   Section (7) .rel.plt {65# REL-NEXT:     0x[[PLTSLOT:[0-9A-F]+]] R_MIPS_JUMP_SLOT foo066# REL-NEXT:   }67# REL-NEXT: ]68 69# REL:      Primary GOT {70# REL:        Local entries [71# REL-NEXT:   ]72# REL-NEXT:   Global entries [73# REL-NEXT:   ]74# REL:      PLT GOT {75# REL:        Entries [76# REL-NEXT:     Entry {77# REL-NEXT:       Address: 0x[[PLTSLOT]]78# REL-NEXT:       Initial: 0x[[PLTADDR]]79# REL-NEXT:       Value: 0x080# REL-NEXT:       Type: Function81# REL-NEXT:       Section: Undefined82# REL-NEXT:       Name: foo083# REL-NEXT:     }84# REL-NEXT:   ]85 86  .text87  .globl bar88bar:89  jal loc         # R_MIPS_26 against .text + offset90 91  .globl __start92__start:93  jal bar         # R_MIPS_26 against global 'bar' from object file94  jal foo0        # R_MIPS_26 against 'foo0' from DSO95 96loc:97  nop98