summaryrefslogtreecommitdiff
path: root/test/old-elf/Mips/pc23-range.test
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:57:38 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:57:38 +0000
commit5a5c549fe9a3fef595297bd21d36bed8409dc37d (patch)
treea964c8f5ac85b7b641cac022c5f9bf4eed3d2b9b /test/old-elf/Mips/pc23-range.test
parentfb911942f1434f3d1750f83f25f5e42c80e60638 (diff)
Notes
Diffstat (limited to 'test/old-elf/Mips/pc23-range.test')
-rw-r--r--test/old-elf/Mips/pc23-range.test54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/old-elf/Mips/pc23-range.test b/test/old-elf/Mips/pc23-range.test
new file mode 100644
index 0000000000000..89e9ab7bb73fc
--- /dev/null
+++ b/test/old-elf/Mips/pc23-range.test
@@ -0,0 +1,54 @@
+# Check that LLD shows an error if ADDIUPC immediate is out of range.
+
+# RUN: yaml2obj -format=elf %s > %t.o
+# RUN: not lld -flavor old-gnu -target mipsel -o %t.exe %t.o 2>&1 | FileCheck %s
+
+# CHECK: Relocation out of range in file {{.*}}: reference from __start+4 to T0+4 of type 173 (R_MICROMIPS_PC23_S2)
+
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000080780100"
+# ^ PC23: 1 << 2 = 4 => T0 + 4 - 4 = T0
+ AddressAlign: 16
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ AddressAlign: 0x04
+ Size: 0x4000000
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 4
+ Symbol: T0
+ Type: R_MICROMIPS_PC23_S2
+
+Symbols:
+ Global:
+ - Name: __start
+ Section: .text
+ Type: STT_FUNC
+ Size: 8
+ Other: [ STO_MIPS_MICROMIPS ]
+ - Name: TZ
+ Section: .data
+ Type: STT_FUNC
+ Value: 0
+ Size: 0x2000000
+ - Name: T0
+ Section: .data
+ Type: STT_FUNC
+ Value: 0x2000000
+ Size: 4