aboutsummaryrefslogtreecommitdiff
path: root/test/old-elf/Mips/rel-eh-02.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/Mips/rel-eh-02.test')
-rw-r--r--test/old-elf/Mips/rel-eh-02.test130
1 files changed, 130 insertions, 0 deletions
diff --git a/test/old-elf/Mips/rel-eh-02.test b/test/old-elf/Mips/rel-eh-02.test
new file mode 100644
index 000000000000..e78c967ed301
--- /dev/null
+++ b/test/old-elf/Mips/rel-eh-02.test
@@ -0,0 +1,130 @@
+# Conditions:
+# a) Linking a non-shared executable file.
+# b) Relocations' targets are symbols defined in the shared object.
+# Check:
+# a) The R_MIPS_REL32 relocation is not created for any symbols.
+# b) The R_MIPS_COPY relocation is created for the D1 symbol.
+# c) No entries in the dynamic symbols table has the STO_MIPS_PLT flag.
+#
+# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
+# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o
+# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
+# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so
+# RUN: llvm-readobj -dt -r %t.exe | FileCheck -check-prefix=PLT-SYM %s
+
+# PLT-SYM: Relocations [
+# PLT-SYM-NEXT: Section (5) .rel.dyn {
+# PLT-SYM-NEXT: 0x{{[0-9A-F]+}} R_MIPS_COPY D1 0x0
+# PLT-SYM-NEXT: }
+
+# PLT-SYM: DynamicSymbols [
+# PLT-SYM-NOT: Other: 8
+
+# so.o
+---
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Size: 8
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Size: 0x08
+ AddressAlign: 4
+ Flags: [SHF_WRITE, 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
+ - Name: D1
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0
+ Size: 4
+
+# o.o
+---
+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
+ Size: 0x08
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Size: 0x08
+ AddressAlign: 16
+ Flags: [SHF_WRITE, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0
+ Symbol: T1
+ Type: R_MIPS_26
+ - Offset: 4
+ Symbol: D1
+ Type: R_MIPS_PC32
+
+- Name: .rel.data
+ Type: SHT_REL
+ Info: .data
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0
+ Symbol: T1
+ Type: R_MIPS_EH
+ - Offset: 4
+ Symbol: T2
+ Type: R_MIPS_EH
+ - Offset: 8
+ Symbol: D1
+ Type: R_MIPS_EH
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 8
+ - Name: T1
+ Type: STT_FUNC
+ - Name: T2
+ Type: STT_FUNC
+ - Name: D0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0x0
+ Size: 8
+ - Name: D1
+ Type: STT_OBJECT
+...