diff options
Diffstat (limited to 'test/ELF/riscv-jal-error.test')
-rw-r--r-- | test/ELF/riscv-jal-error.test | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/test/ELF/riscv-jal-error.test b/test/ELF/riscv-jal-error.test new file mode 100644 index 0000000000000..9df95c9cc4ea6 --- /dev/null +++ b/test/ELF/riscv-jal-error.test @@ -0,0 +1,93 @@ +# .option norelax +# .global _start +# +# _start: +# L1: +# jal x0, L1 + 0x100000 +# L2: +# jal x0, L2 - 0x100002 +# L3: +# jal x0, L3 + 1 +# L4: +# c.jal L4 + 1 +# +# REQUIRES: riscv +# RUN: yaml2obj %s -o %t.o +# RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s +# +# CHECK: {{.*}}(.text+0x0): relocation R_RISCV_JAL out of range +# CHECK: {{.*}}(.text+0x4): relocation R_RISCV_JAL out of range +# CHECK: {{.*}}(.text+0x8): improper alignment for relocation R_RISCV_JAL +# CHECK: {{.*}}(.text+0xC): improper alignment for relocation R_RISCV_RVC_JUMP + +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_RISCV + Flags: [ EF_RISCV_RVC, EF_RISCV_FLOAT_ABI_SOFT ] +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x0000000000000002 + Content: 6F0000806FF0FF7F6F0000000120 + - Name: .rela.text + Type: SHT_RELA + Flags: [ SHF_INFO_LINK ] + Link: .symtab + AddressAlign: 0x0000000000000004 + Info: .text + Relocations: + - Offset: 0x0000000000000000 + Symbol: L1 + Type: R_RISCV_JAL + Addend: 1048576 + - Offset: 0x0000000000000004 + Symbol: L2 + Type: R_RISCV_JAL + Addend: -1048578 + - Offset: 0x0000000000000008 + Symbol: L3 + Type: R_RISCV_JAL + Addend: 1 + - Offset: 0x000000000000000C + Symbol: L4 + Type: R_RISCV_RVC_JUMP + Addend: 1 + - Name: .data + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + AddressAlign: 0x0000000000000001 + Content: '' + - Name: .bss + Type: SHT_NOBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + AddressAlign: 0x0000000000000001 +Symbols: + Local: + - Name: .text + Type: STT_SECTION + Section: .text + - Name: .data + Type: STT_SECTION + Section: .data + - Name: .bss + Type: STT_SECTION + Section: .bss + - Name: L1 + Section: .text + - Name: L2 + Section: .text + Value: 0x0000000000000004 + - Name: L3 + Section: .text + Value: 0x0000000000000008 + - Name: L4 + Section: .text + Value: 0x000000000000000C + Global: + - Name: _start + Section: .text +... |