xref: /llvm-project/lld/test/ELF/mips-got-page-script.s (revision b1f04d57f5818914d7db506985e2932f217844bd)
1# REQUIRES: mips
2# Check calculation of MIPS GOT page address entries number
3# when a linker script is provided.
4
5# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux -o %t.o %s
6# RUN: echo "SECTIONS { \
7# RUN:          .text : { *(.text) } \
8# RUN:          .data 0x10000 : { *(.data) } }" > %t.script
9# RUN: ld.lld -shared --script %t.script -o %t.so %t.o
10# RUN: llvm-readobj --symbols -A %t.so | FileCheck %s
11
12# CHECK:      Name: foo1
13# CHECK-NEXT: Value: 0x10000
14# CHECK:      Name: foo2
15# CHECK-NEXT: Value: 0x20000
16# CHECK:      Name: foo3
17# CHECK-NEXT: Value: 0x30000
18# CHECK:      Name: foo4
19# CHECK-NEXT: Value: 0x40000
20
21# CHECK:      Local entries [
22# CHECK-NEXT:    Entry {
23# CHECK-NEXT:      Address:
24# CHECK-NEXT:      Access:
25# CHECK-NEXT:      Initial: 0x10000
26# CHECK-NEXT:    }
27# CHECK-NEXT:    Entry {
28# CHECK-NEXT:      Address:
29# CHECK-NEXT:      Access:
30# CHECK-NEXT:      Initial: 0x20000
31# CHECK-NEXT:    }
32# CHECK-NEXT:    Entry {
33# CHECK-NEXT:      Address:
34# CHECK-NEXT:      Access:
35# CHECK-NEXT:      Initial: 0x30000
36# CHECK-NEXT:    }
37# CHECK-NEXT:    Entry {
38# CHECK-NEXT:      Address:
39# CHECK-NEXT:      Access:
40# CHECK-NEXT:      Initial: 0x40000
41# CHECK-NEXT:    }
42# CHECK-NEXT:    Entry {
43# CHECK-NEXT:      Address:
44# CHECK-NEXT:      Access:
45# CHECK-NEXT:      Initial: 0x50000
46# CHECK-NEXT:    }
47# CHECK-NEXT:  ]
48
49  .option pic2
50  .text
51  ld      $v0,%got_page(foo1)($gp)
52  ld      $v0,%got_page(foo2)($gp)
53  ld      $v0,%got_page(foo3)($gp)
54  ld      $v0,%got_page(foo4)($gp)
55
56  .data
57foo1:
58  .space 0x10000
59foo2:
60  .space 0x10000
61foo3:
62  .space 0x10000
63foo4:
64  .word 0
65