summaryrefslogtreecommitdiff
path: root/test/old-elf/Mips/rel-pc26-s2-align.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/Mips/rel-pc26-s2-align.test')
-rw-r--r--test/old-elf/Mips/rel-pc26-s2-align.test44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/old-elf/Mips/rel-pc26-s2-align.test b/test/old-elf/Mips/rel-pc26-s2-align.test
new file mode 100644
index 000000000000..23e660848365
--- /dev/null
+++ b/test/old-elf/Mips/rel-pc26-s2-align.test
@@ -0,0 +1,44 @@
+# Check incorrect alignment handling for R_MIPS_PC26_S2 relocation target.
+
+# RUN: yaml2obj -format=elf %s > %t.o
+# RUN: not lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o 2>&1 \
+# RUN: | FileCheck %s
+
+# CHECK: Relocation not aligned in file {{.*}} reference from T0+0 to T1+0 of type 61 (R_MIPS_PC26_S2)
+
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+# ^ T0 ^ T1
+ AddressAlign: 16
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0
+ Symbol: T1
+ Type: R_MIPS_PC26_S2
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0
+ Size: 4
+ - Name: T1
+ Section: .text
+ Type: STT_FUNC
+ Value: 6
+ Size: 2