2018-07-24 13:40:37 +08:00
|
|
|
# REQUIRES: mips
|
|
|
|
# Check the primary GOT cannot be made to overflow
|
|
|
|
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
|
|
|
|
# RUN: %p/Inputs/mips-64-got-load.s -o %t1.so.o
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t2.so.o
|
|
|
|
# RUN: ld.lld -shared -mips-got-size 32 %t1.so.o %t2.so.o -o %t-sgot.so
|
|
|
|
# RUN: ld.lld -shared -mips-got-size 24 %t1.so.o %t2.so.o -o %t-mgot.so
|
2019-09-06 15:23:02 +08:00
|
|
|
# RUN: llvm-readelf -s --mips-plt-got %t-sgot.so \
|
|
|
|
# RUN: | FileCheck -check-prefixes=SYM,SGOT %s
|
|
|
|
# RUN: llvm-readelf -s --mips-plt-got %t-mgot.so \
|
|
|
|
# RUN: | FileCheck -check-prefixes=SYM,MGOT %s
|
|
|
|
|
|
|
|
# SYM: Symbol table '.symtab'
|
|
|
|
# SYM: {{.*}}: [[LOC1:[0-9a-f]+]] {{.*}} local1
|
|
|
|
# SYM: {{.*}}: [[LOC2:[0-9a-f]+]] {{.*}} local2
|
2018-07-24 13:40:37 +08:00
|
|
|
|
2019-05-22 23:03:52 +08:00
|
|
|
# SGOT: Primary GOT:
|
2019-09-06 15:23:02 +08:00
|
|
|
# SGOT-NEXT: Canonical gp value:
|
2019-05-22 23:03:52 +08:00
|
|
|
# SGOT-EMPTY:
|
|
|
|
# SGOT-NEXT: Reserved entries:
|
2019-09-06 15:23:02 +08:00
|
|
|
# SGOT-NEXT: Address Access Initial Purpose
|
|
|
|
# SGOT-NEXT: {{.*}} -32752(gp) 0000000000000000 Lazy resolver
|
|
|
|
# SGOT-NEXT: {{.*}} -32744(gp) 8000000000000000 Module pointer (GNU extension)
|
2019-05-22 23:03:52 +08:00
|
|
|
# SGOT-EMPTY:
|
|
|
|
# SGOT-NEXT: Local entries:
|
2019-09-06 15:23:02 +08:00
|
|
|
# SGOT-NEXT: Address Access Initial
|
|
|
|
# SGOT-NEXT: {{.*}} -32736(gp) [[LOC1]]
|
|
|
|
# SGOT-NEXT: {{.*}} -32728(gp) [[LOC2]]
|
2018-07-24 13:40:37 +08:00
|
|
|
|
2019-05-22 23:03:52 +08:00
|
|
|
# MGOT: Primary GOT:
|
2019-09-06 15:23:02 +08:00
|
|
|
# MGOT-NEXT: Canonical gp value:
|
2019-05-22 23:03:52 +08:00
|
|
|
# MGOT-EMPTY:
|
|
|
|
# MGOT-NEXT: Reserved entries:
|
2019-09-06 15:23:02 +08:00
|
|
|
# MGOT-NEXT: Address Access Initial Purpose
|
|
|
|
# MGOT-NEXT: {{.*}} -32752(gp) 0000000000000000 Lazy resolver
|
|
|
|
# MGOT-NEXT: {{.*}} -32744(gp) 8000000000000000 Module pointer (GNU extension)
|
2019-05-22 23:03:52 +08:00
|
|
|
# MGOT-EMPTY:
|
|
|
|
# MGOT-NEXT: Local entries:
|
2019-09-06 15:23:02 +08:00
|
|
|
# MGOT-NEXT: Address Access Initial
|
|
|
|
# MGOT-NEXT: {{.*}} -32736(gp) [[LOC1]]
|
2019-05-22 23:03:52 +08:00
|
|
|
# MGOT-EMPTY:
|
|
|
|
# MGOT-NEXT: Number of TLS and multi-GOT entries 1
|
2018-07-24 13:40:37 +08:00
|
|
|
|
|
|
|
.text
|
|
|
|
.global foo2
|
|
|
|
foo2:
|
|
|
|
ld $2, %got_disp(local2)($gp)
|
|
|
|
|
|
|
|
.bss
|
|
|
|
local2:
|
|
|
|
.word 0
|