]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/mips-gp-lowest.s
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / test / ELF / mips-gp-lowest.s
1 # REQUIRES: mips
2 # Check that default _gp value is calculated relative
3 # to the GP-relative section with the lowest address.
4
5 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
6 # RUN: echo "SECTIONS { \
7 # RUN:          .sdata : { *(.sdata) } \
8 # RUN:          .got  : { *(.got) } }" > %t.rel.script
9 # RUN: ld.lld %t.o --script %t.rel.script -shared -o %t.so
10 # RUN: llvm-readobj -s -t %t.so | FileCheck %s
11
12   .text
13   .global foo
14 foo:
15   lui  $gp, %call16(foo)
16
17   .sdata
18   .word 0
19
20 # CHECK:      Section {
21 # CHECK:        Name: .sdata
22 # CHECK-NEXT:   Type: SHT_PROGBITS
23 # CHECK-NEXT:   Flags [
24 # CHECK-NEXT:     SHF_ALLOC
25 # CHECK-NEXT:     SHF_MIPS_GPREL
26 # CHECK-NEXT:     SHF_WRITE
27 # CHECK-NEXT:   ]
28 # CHECK-NEXT:   Address: 0xF0
29 # CHECK:      }
30 # CHECK:      Section {
31 # CHECK:        Name: .got
32 # CHECK-NEXT:   Type: SHT_PROGBITS
33 # CHECK-NEXT:   Flags [
34 # CHECK-NEXT:     SHF_ALLOC
35 # CHECK-NEXT:     SHF_MIPS_GPREL
36 # CHECK-NEXT:     SHF_WRITE
37 # CHECK-NEXT:   ]
38 # CHECK-NEXT:   Address: 0x100
39 # CHECK:      }
40
41 # CHECK:      Name: _gp (5)
42 # CHECK-NEXT: Value: 0x80E0
43 #                    ^-- 0xF0 + 0x7ff0