44 lines · plain
1# REQUIRES: mips2# Check that default _gp value is calculated relative3# to the GP-relative section with the lowest address.4 5# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o6# RUN: echo "SECTIONS { \7# RUN: .sdata : { *(.sdata) } \8# RUN: .got : { *(.got) } }" > %t.rel.script9# RUN: ld.lld %t.o --script %t.rel.script -shared -o %t.so10# RUN: llvm-readobj -S --symbols %t.so | FileCheck %s11 12 .text13 .global foo14foo:15 lui $gp, %call16(foo)16 17 .sdata18 .word 019 20# CHECK: Section {21# CHECK: Name: .sdata22# CHECK-NEXT: Type: SHT_PROGBITS23# CHECK-NEXT: Flags [24# CHECK-NEXT: SHF_ALLOC25# CHECK-NEXT: SHF_MIPS_GPREL26# CHECK-NEXT: SHF_WRITE27# CHECK-NEXT: ]28# CHECK-NEXT: Address: 0xF029# CHECK: }30# CHECK: Section {31# CHECK: Name: .got32# CHECK-NEXT: Type: SHT_PROGBITS33# CHECK-NEXT: Flags [34# CHECK-NEXT: SHF_ALLOC35# CHECK-NEXT: SHF_MIPS_GPREL36# CHECK-NEXT: SHF_WRITE37# CHECK-NEXT: ]38# CHECK-NEXT: Address: 0x10039# CHECK: }40 41# CHECK: Name: _gp (5)42# CHECK-NEXT: Value: 0x80E043# ^-- 0xF0 + 0x7ff044