40 lines · plain
1# REQUIRES: mips2# Check that relocatable object produced by LLD has zero gp0 value.3 4# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o5# RUN: ld.lld -r -o %t-rel.o %t.o6# RUN: llvm-readobj -A %t-rel.o | FileCheck --check-prefix=REL %s7 8# RUN: echo "SECTIONS { \9# RUN: .rodata ALIGN(0x1000) : { *(.rodata) } \10# RUN: . = 0x20000; .text : { *(.text) } \11# RUN: }" > %t.script12# RUN: ld.lld -shared --script %t.script -o %t.so %S/Inputs/mips-gp0-non-zero.o13# RUN: llvm-objdump -s -t %t.so | FileCheck --check-prefix=DUMP %s14 15# REL: GP: 0x016 17# DUMP: SYMBOL TABLE:18# DUMP: 00020008 l .text 00000000 bar19# DUMP: 00020004 l .text 00000000 foo20# DUMP: 00028000 l .got 00000000 .hidden _gp21 22# DUMP: Contents of section .rodata:23# DUMP: 1000 fffffff4 fffffff824# ^ 0x20004 + 0x7ff0 - 0x2800025# ^ 0x20008 + 0x7ff0 - 0x2800026 27 .text28 .global __start29__start:30 lw $t0,%call16(__start)($gp)31foo:32 nop33bar:34 nop35 36 .section .rodata, "a"37v:38 .gpword foo39 .gpword bar40