aboutsummaryrefslogtreecommitdiff
path: root/test/old-elf/Mips/la25-stub-npic-shared.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/Mips/la25-stub-npic-shared.test')
-rw-r--r--test/old-elf/Mips/la25-stub-npic-shared.test152
1 files changed, 152 insertions, 0 deletions
diff --git a/test/old-elf/Mips/la25-stub-npic-shared.test b/test/old-elf/Mips/la25-stub-npic-shared.test
new file mode 100644
index 000000000000..72bac30f86ad
--- /dev/null
+++ b/test/old-elf/Mips/la25-stub-npic-shared.test
@@ -0,0 +1,152 @@
+# Check that PLT entries are created for branch relocations
+# when a PIC shared library function is called from non-pic code.
+
+# RUN: yaml2obj -format=elf -docnum 1 %s > %t-pic.o
+# RUN: yaml2obj -format=elf -docnum 2 %s > %t-reg.o
+# RUN: yaml2obj -format=elf -docnum 3 %s > %t-micro.o
+# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-pic.o
+# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-reg.o %t-micro.o %t.so
+
+# RUN: llvm-objdump -s -t %t.exe | FileCheck %s
+
+# CHECK: Contents of section .plt:
+# CHECK-NEXT: 400190 40001c3c 0020998f 00209c27 23c01c03
+# CHECK-NEXT: 4001a0 2578e003 82c01800 09f82003 feff1827
+# CHECK-NEXT: 4001b0 40000f3c 0820f98d 08002003 0820f825
+# ^ PLT.T1
+# CHECK-NEXT: 4001c0 00799307 22ff0000 9945020f
+# ^ PLT.T2
+
+# CHECK: Contents of section .text:
+# CHECK-NEXT: 4001cc 6c001000 f8ff0000 f7ff1f00 f6ffff03
+# ^ T0 ^ PLT.T1 (0x4001b0)
+# ^ 0x4001d0 -32 = 0x4001b0
+# ^ ...
+# CHECK-NEXT: 4001dc 2000e000 70000000 ee030000 0000ecff
+# ^ T3 ^ PLT.T2
+# ^ ...
+# CHECK-NEXT: 4001ec 7f00f5ff
+
+# CHECK: SYMBOL TABLE:
+# CHECK: 004001cc g F .text 00000010 T0
+# CHECK: 004001dc g F .text 00000014 T3
+
+# pic.o
+---
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32,
+ EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_MICROMIPS]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Size: 8
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+Symbols:
+ Global:
+ - Name: T1
+ Section: .text
+ Type: STT_FUNC
+ Value: 0
+ Size: 4
+ - Name: T2
+ Section: .text
+ Type: STT_FUNC
+ Value: 4
+ Size: 4
+ Other: [STO_MIPS_MICROMIPS]
+
+# reg.o
+---
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC]
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 4
+ Size: 16
+
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 0x04
+ Info: .text
+ Relocations:
+ - Offset: 0
+ Symbol: T1
+ Type: R_MIPS_26
+ - Offset: 4
+ Symbol: T1
+ Type: R_MIPS_PC16
+ - Offset: 8
+ Symbol: T1
+ Type: R_MIPS_PC21_S2
+ - Offset: 12
+ Symbol: T1
+ Type: R_MIPS_PC26_S2
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Size: 16
+ - Name: T1
+
+# micro.o
+---
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC, EF_MIPS_MICROMIPS]
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 4
+ Size: 20
+
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 0x04
+ Info: .text
+ Relocations:
+ - Offset: 0
+ Symbol: T2
+ Type: R_MICROMIPS_26_S1
+ - Offset: 4
+ Symbol: T2
+ Type: R_MICROMIPS_PC7_S1
+ - Offset: 8
+ Symbol: T2
+ Type: R_MICROMIPS_PC10_S1
+ - Offset: 12
+ Symbol: T2
+ Type: R_MICROMIPS_PC16_S1
+ - Offset: 16
+ Symbol: T2
+ Type: R_MICROMIPS_PC23_S2
+
+Symbols:
+ Global:
+ - Name: T3
+ Section: .text
+ Size: 20
+ Other: [STO_MIPS_MICROMIPS]
+ - Name: T2
+...