1# REQUIRES: mips
2# Check the primary GOT cannot be made to overflow
3
4# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
5# RUN:         %p/Inputs/mips-64-got-load.s -o %t1.so.o
6# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t2.so.o
7# RUN: ld.lld -shared -mips-got-size 32 %t1.so.o %t2.so.o -o %t-sgot.so
8# RUN: ld.lld -shared -mips-got-size 24 %t1.so.o %t2.so.o -o %t-mgot.so
9# RUN: llvm-readelf -s -A %t-sgot.so | FileCheck -check-prefixes=SYM,SGOT %s
10# RUN: llvm-readelf -s -A %t-mgot.so | FileCheck -check-prefixes=SYM,MGOT %s
11
12# SYM: Symbol table '.symtab'
13# SYM: {{.*}}: [[LOC1:[0-9a-f]+]]  {{.*}} local1
14# SYM: {{.*}}: [[LOC2:[0-9a-f]+]]  {{.*}} local2
15
16# SGOT:      Primary GOT:
17# SGOT-NEXT:  Canonical gp value:
18# SGOT-EMPTY:
19# SGOT-NEXT:  Reserved entries:
20# SGOT-NEXT:  Address     Access          Initial Purpose
21# SGOT-NEXT:   {{.*}} -32752(gp) 0000000000000000 Lazy resolver
22# SGOT-NEXT:   {{.*}} -32744(gp) 8000000000000000 Module pointer (GNU extension)
23# SGOT-EMPTY:
24# SGOT-NEXT:  Local entries:
25# SGOT-NEXT:  Address     Access          Initial
26# SGOT-NEXT:   {{.*}} -32736(gp) [[LOC1]]
27# SGOT-NEXT:   {{.*}} -32728(gp) [[LOC2]]
28
29# MGOT:      Primary GOT:
30# MGOT-NEXT:  Canonical gp value:
31# MGOT-EMPTY:
32# MGOT-NEXT:  Reserved entries:
33# MGOT-NEXT:  Address     Access          Initial Purpose
34# MGOT-NEXT:   {{.*}} -32752(gp) 0000000000000000 Lazy resolver
35# MGOT-NEXT:   {{.*}} -32744(gp) 8000000000000000 Module pointer (GNU extension)
36# MGOT-EMPTY:
37# MGOT-NEXT:  Local entries:
38# MGOT-NEXT:  Address     Access          Initial
39# MGOT-NEXT:   {{.*}} -32736(gp) [[LOC1]]
40# MGOT-EMPTY:
41# MGOT-NEXT:  Number of TLS and multi-GOT entries 1
42
43  .text
44  .global foo2
45foo2:
46  ld $2, %got_disp(local2)($gp)
47
48  .bss
49local2:
50  .word 0
51