1# REQUIRES: mips 2# Check that even if _gp_disp symbol is defined in the shared library 3# we use our own value. 4 5# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o 6# RUN: echo "SECTIONS { \ 7# RUN: . = 0x1000; .text ALIGN(0x1000) : { *(.text) } \ 8# RUN: . = 0x30000; .got : { *(.got) } \ 9# RUN: }" > %t.script 10# RUN: ld.lld -shared --script %t.script -o %t.so %t.o %S/Inputs/mips-gp-disp.so 11# RUN: llvm-readelf --symbols %t.so | FileCheck -check-prefix=INT-SO %s 12# RUN: llvm-readelf --symbols %S/Inputs/mips-gp-disp.so \ 13# RUN: | FileCheck -check-prefix=EXT-SO %s 14# RUN: llvm-objdump -d -t --no-show-raw-insn %t.so | FileCheck --check-prefix=DIS %s 15# RUN: llvm-readelf -r %t.so | FileCheck -check-prefix=REL %s 16 17# INT-SO: 00000000 0 NOTYPE LOCAL HIDDEN ABS _gp_disp 18# EXT-SO: 00020000 0 NOTYPE GLOBAL DEFAULT 9 _gp_disp 19 20# DIS: 00037ff0 l .got 00000000 .hidden _gp 21# DIS: 00002000 g .text 00000000 __start 22# DIS: Disassembly of section .text: 23# DIS-EMPTY: 24# DIS-NEXT: <__start>: 25# DIS-NEXT: lui $8, 3 26# DIS-NEXT: addi $8, $8, 24560 27# ^-- (_gp - __start) & 0xffff 28 29# REL: There are no relocations in this file 30 31 .text 32 .globl __start 33__start: 34 lui $t0,%hi(_gp_disp) 35 addi $t0,$t0,%lo(_gp_disp) 36 lw $v0,%call16(_foo)($gp) 37