1# REQUIRES: mips 2# Check handling of microMIPS relocations. 3 4# RUN: echo "SECTIONS { \ 5# RUN: . = 0x20000; .text ALIGN(0x100) : { *(.text) } \ 6# RUN: . = 0x20300; .plt : { *(.plt) } \ 7# RUN: . = 0x30000; .data : { *(.data) } \ 8# RUN: }" > %t.script 9 10# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ 11# RUN: -mattr=micromips %S/Inputs/mips-micro.s -o %t1eb.o 12# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ 13# RUN: -mattr=micromips %s -o %t2eb.o 14# RUN: ld.lld -o %teb.exe -script %t.script %t1eb.o %t2eb.o 15# RUN: llvm-objdump -d -t -s --mattr=micromips --no-show-raw-insn %teb.exe \ 16# RUN: | FileCheck --check-prefixes=ASM,EB %s 17# RUN: llvm-readelf -h %teb.exe | FileCheck --check-prefix=ELF %s 18 19# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux \ 20# RUN: -mattr=micromips %S/Inputs/mips-micro.s -o %t1el.o 21# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux \ 22# RUN: -mattr=micromips %s -o %t2el.o 23# RUN: ld.lld -o %tel.exe -script %t.script %t1el.o %t2el.o 24# RUN: llvm-objdump -d -t -s --mattr=micromips --no-show-raw-insn %tel.exe \ 25# RUN: | FileCheck --check-prefixes=ASM,EL %s 26# RUN: llvm-readelf -h %tel.exe | FileCheck --check-prefix=ELF %s 27 28# ASM: 00038000 l .got 00000000 .hidden _gp 29# ASM: 00020100 g F .text 00000000 0x80 foo 30# ASM: 00020110 g .text 00000000 0x80 __start 31 32# EB: Contents of section .data: 33# EB-NEXT: 30000 fffe8111 34 35# EB: Contents of section .debug_info 36# EB-NEXT: 0000 00020111 37 38# EL: Contents of section .data: 39# EL-NEXT: 30000 1181feff 40 41# EL: Contents of section .debug_info 42# EL-NEXT: 0000 11010200 43 44# ASM: <__start>: 45# ASM-NEXT: 20110: lui $3, 1 46# ASM-NEXT: addiu $3, $3, 32495 47# ASM-NEXT: lw $3, -32744($gp) 48# ASM-NEXT: lw $3, -32744($3) 49# ASM-NEXT: beqz16 $6, -32 50# ASM-NEXT: sll $3, $fp, 0 51# ASM-NEXT: b16 -40 52# ASM-NEXT: nop 53# ASM-NEXT: b -44 54 55# ELF: Entry point address: 0x20111 56 57 .text 58 .set micromips 59 .global __start 60__start: 61 lui $3, %hi(_gp_disp) # R_MICROMIPS_HI16 62 addiu $3, $3, %lo(_gp_disp) # R_MICROMIPS_LO16 63 64 lw $3, %call16(foo)($gp) # R_MICROMIPS_CALL16 65 lw $3, %got(foo)($3) # R_MICROMIPS_GOT16 66 67 beqz16 $6, foo # R_MICROMIPS_PC7_S1 68 b16 foo # R_MICROMIPS_PC10_S1 69 b foo # R_MICROMIPS_PC16_S1 70 71 .data 72 .gpword __start # R_MIPS_GPREL32 73 74 .section .debug_info,"",@0x7000001e 75 .word __start # R_MIPS_32 76