summaryrefslogtreecommitdiff
path: root/test/ELF/mips-gp-disp.s
diff options
context:
space:
mode:
Diffstat (limited to 'test/ELF/mips-gp-disp.s')
-rw-r--r--test/ELF/mips-gp-disp.s34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/ELF/mips-gp-disp.s b/test/ELF/mips-gp-disp.s
new file mode 100644
index 0000000000000..a08829c18bd4a
--- /dev/null
+++ b/test/ELF/mips-gp-disp.s
@@ -0,0 +1,34 @@
+# Check that even if _gp_disp symbol is defined in the shared library
+# we use our own value.
+
+# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
+# RUN: ld.lld -shared -o %t.so %t.o %S/Inputs/mips-gp-disp.so
+# RUN: llvm-readobj -symbols %t.so | FileCheck -check-prefix=INT-SO %s
+# RUN: llvm-readobj -symbols %S/Inputs/mips-gp-disp.so \
+# RUN: | FileCheck -check-prefix=EXT-SO %s
+# RUN: llvm-objdump -d -t %t.so | FileCheck -check-prefix=DIS %s
+# RUN: llvm-readobj -relocations %t.so | FileCheck -check-prefix=REL %s
+
+# REQUIRES: mips
+
+# INT-SO-NOT: Name: _gp_disp
+
+# EXT-SO: Name: _gp_disp
+# EXT-SO-NEXT: Value: 0x20010
+
+# DIS: Disassembly of section .text:
+# DIS-NEXT: __start:
+# DIS-NEXT: 10000: 3c 08 00 01 lui $8, 1
+# DIS-NEXT: 10004: 21 08 7f f0 addi $8, $8, 32752
+# ^-- 0x37ff0 & 0xffff
+# DIS: 00027ff0 *ABS* 00000000 _gp
+
+# REL: Relocations [
+# REL-NEXT: ]
+
+ .text
+ .globl __start
+__start:
+ lui $t0,%hi(_gp_disp)
+ addi $t0,$t0,%lo(_gp_disp)
+ lw $v0,%call16(_foo)($gp)