67 lines · plain
1# REQUIRES: mips2# Check R_MIPS_GOT16 relocation calculation.3 4# RUN: echo "SECTIONS { \5# RUN: . = 0x20000; .text : { *(.text) } \6# RUN: . = 0x30000; .got : { *(.got) } \7# RUN: }" > %t.script8 9# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t-be.o10# RUN: ld.lld %t-be.o --script %t.script -o %t-be.exe11# RUN: llvm-readobj --sections -r --symbols -A %t-be.exe \12# RUN: | FileCheck -check-prefix=ELF %s13# RUN: llvm-objdump --no-print-imm-hex -d %t-be.exe | FileCheck --check-prefix=DIS %s14 15# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s -o %t-el.o16# RUN: ld.lld %t-el.o --script %t.script -o %t-el.exe17# RUN: llvm-readobj --sections -r --symbols -A %t-el.exe \18# RUN: | FileCheck -check-prefix=ELF %s19# RUN: llvm-objdump --no-print-imm-hex -d %t-el.exe | FileCheck --check-prefix=DIS %s20 21# RUN: ld.lld -shared %t-be.o --script %t.script -o %t-be.so22# RUN: llvm-readobj --sections -r --symbols -A %t-be.so \23# RUN: | FileCheck -check-prefix=ELF %s24# RUN: llvm-objdump --no-print-imm-hex -d %t-be.so | FileCheck --check-prefix=DIS %s25 26# RUN: ld.lld -shared %t-el.o --script %t.script -o %t-el.so27# RUN: llvm-readobj --sections -r --symbols -A %t-el.so \28# RUN: | FileCheck -check-prefix=ELF %s29# RUN: llvm-objdump --no-print-imm-hex -d %t-el.so | FileCheck --check-prefix=DIS %s30 31 .text32 .globl __start33__start:34 lui $2, %got(v1)35 36 .data37 .globl v138v1:39 .word 040 41# ELF: Section {42# ELF: Name: .got43# ELF: Flags [44# ELF-NEXT: SHF_ALLOC45# ELF-NEXT: SHF_MIPS_GPREL46# ELF-NEXT: SHF_WRITE47# ELF-NEXT: ]48#49# ELF: Relocations [50# ELF-NEXT: ]51#52# ELF: Symbol {53# ELF: Name: v154# ELF-NEXT: Value: 0x[[V1:[0-9A-F]+]]55#56# ELF: {{.*}} GOT {57# ELF-NEXT: Canonical gp value: 0x37FF058#59# ELF: Entry {60# ELF: Address: 0x3000861# ELF-NEXT: Access: -3274462# ELF-NEXT: Initial: 0x[[V1]]63 64# "v1 GOT entry address" - _gp65# 0x30008 - 0x37FF0 = -0x7fe8 == 0x8018 == 3279266# DIS: lui $2, 3279267