summaryrefslogtreecommitdiff
path: root/test/elf/Mips/gotsym.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/elf/Mips/gotsym.test')
-rw-r--r--test/elf/Mips/gotsym.test43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/elf/Mips/gotsym.test b/test/elf/Mips/gotsym.test
new file mode 100644
index 0000000000000..4581901958aae
--- /dev/null
+++ b/test/elf/Mips/gotsym.test
@@ -0,0 +1,43 @@
+# Check _gp_disp and GOT_OFFSET_TABLE value
+#
+# RUN: yaml2obj -format=elf %s > %t.o
+# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t.so %t.o
+# RUN: llvm-objdump -h -t %t.so | FileCheck -check-prefix=SHARED %s
+
+# SHARED: Sections:
+# SHARED: Idx Name Size Address Type
+# SHARED: 6 .got 00000008 0000000000001000 DATA
+# SHARED: SYMBOL TABLE:
+# SHARED: 00001000 g *ABS* 00000000 _GLOBAL_OFFSET_TABLE_
+# SHARED: 00008ff0 g *ABS* 00000000 _gp
+# SHARED: 00008ff0 g *ABS* 00000000 _gp_disp
+
+# RUN: lld -flavor gnu -target mipsel -e main --noinhibit-exec -o %t.exe %t.o
+# RUN: llvm-objdump -h -t %t.exe | FileCheck -check-prefix=EXE %s
+
+# EXE: Sections:
+# EXE: Idx Name Size Address Type
+# EXE: 7 .got 00000008 0000000000401000 DATA
+# EXE: SYMBOL TABLE:
+# EXE: 00401000 g *ABS* 00000000 _GLOBAL_OFFSET_TABLE_
+# EXE: 00408ff0 g *ABS* 00000000 _gp
+# EXE: 00408ff0 g *ABS* 00000000 _gp_disp
+
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ]
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x10
+ Size: 0x04
+
+Symbols:
+ Global:
+ - Name: main
+ Section: .text