Index: test/ELF/riscv-branch.test =================================================================== --- test/ELF/riscv-branch.test +++ test/ELF/riscv-branch.test @@ -1,118 +0,0 @@ -# .option norelax -# .global _start -# _start: -# beq x0, x0, _start -# -# .section .reloc_max, "ax", @progbits -# L1: -# beq x0, x0, L1 + 0xffe -# -# .section .reloc_min, "ax", @progbits -# L2: -# beq x0, x0, L2 - 0x1000 -# -# REQUIRES: riscv -# RUN: yaml2obj %s -o %t.o -# RUN: ld.lld %t.o -o %t -# RUN: obj2yaml %t | FileCheck %s -# -# CHECK: - Name: .text -# CHECK: Content: '63000000' -# 11000: 00000063 beqz zero,11000 <_start> -# -# CHECK: - Name: .reloc_max -# CHECK: Content: E30F007E -# 11004: 7e000fe3 beqz zero,12002 -# -# CHECK: - Name: .reloc_min -# CHECK: Content: '63000080' -# 11008: 80000063 beqz zero,10008 - ---- !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: '63000000' - - Name: .rela.text - Type: SHT_RELA - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000000 - Symbol: _start - Type: R_RISCV_BRANCH - - 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 - - Name: .reloc_max - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: E30F007E - - Name: .rela.reloc_max - Type: SHT_RELA - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .reloc_max - Relocations: - - Offset: 0x0000000000000000 - Symbol: L1 - Type: R_RISCV_BRANCH - Addend: 4094 - - Name: .reloc_min - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: '63000080' - - Name: .rela.reloc_min - Type: SHT_RELA - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .reloc_min - Relocations: - - Offset: 0x0000000000000000 - Symbol: L2 - Type: R_RISCV_BRANCH - Addend: -4096 -Symbols: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .reloc_max - Type: STT_SECTION - Section: .reloc_max - - Name: L1 - Section: .reloc_max - - Name: .reloc_min - Type: STT_SECTION - Section: .reloc_min - - Name: L2 - Section: .reloc_min - - Name: _start - Section: .text - Binding: STB_GLOBAL -... Index: test/ELF/riscv-call.test =================================================================== --- test/ELF/riscv-call.test +++ test/ELF/riscv-call.test @@ -1,94 +0,0 @@ -# .option norelax -# .global _start -# _start: -# call _start + 4 -# -# .section .reloc_neg, "ax", @progbits -# L1: -# call L1 - 4 -# -# REQUIRES: riscv -# RUN: yaml2obj %s -o %t.o -# RUN: ld.lld %t.o -o %t -# RUN: obj2yaml %t | FileCheck %s -# -# CHECK: - Name: .text -# CHECK: Content: '97000000E7804000' -# -# 11000: 00000097 auipc ra,0x0 -# 11004: 004080e7 jalr 4(ra) -# -# CHECK: - Name: .reloc_neg -# CHECK: Content: 97000000E780C0FF -# -# 11008: 00000097 auipc ra,0x0 -# 1100c: ffc080e7 jalr -4(ra) - ---- !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: '97000000E7800000' - - Name: .rela.text - Type: SHT_RELA - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000000 - Symbol: _start - Type: R_RISCV_CALL - Addend: 4 - - 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 - - Name: .reloc_neg - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: '97000000E7800000' - - Name: .rela.reloc_neg - Type: SHT_RELA - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .reloc_neg - Relocations: - - Offset: 0x0000000000000000 - Symbol: L1 - Type: R_RISCV_CALL - Addend: -4 -Symbols: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .reloc_neg - Type: STT_SECTION - Section: .reloc_neg - - Name: L1 - Section: .reloc_neg - - Name: _start - Section: .text - Binding: STB_GLOBAL -... Index: test/ELF/riscv-hi20-lo12.test =================================================================== --- test/ELF/riscv-hi20-lo12.test +++ test/ELF/riscv-hi20-lo12.test @@ -1,85 +0,0 @@ -# .option norelax -# .global _start -# -# .section .reloc_12345678, "ax", @progbits -# _start: -# foo = 0x12345678 -# lui a0, %hi(foo) -# addi a0, a0, %lo(foo) -# lw a0, %lo(foo)(a0) -# -# .section .reloc_fedcba98, "ax", @progbits -# foo = 0xfedcba98 -# lui a0, %hi(foo) -# addi a0, a0, %lo(foo) -# -# REQUIRES: riscv -# RUN: yaml2obj %s -o %t.o -# RUN: ld.lld %t.o -o %t -# RUN: obj2yaml %t | FileCheck %s -# -# CHECK: - Name: .reloc_12345678 -# CHECK: Content: '375534121305856703258567' -# 11000: 12345537 lui a0,0x12345 -# 11004: 67850513 addi a0,a0,1656 # 12345678 <__global_pointer$+0x12332e78> -# 11008: 67852503 lw a0,1656(a0) -# -# CHECK: - Name: .reloc_fedcba98 -# CHECK: Content: 37C5DCFE130585A9 -# 1100c: fedcc537 lui a0,0xfedcc -# 11010: a9850513 addi a0,a0,-1384 # fedcba98 <__global_pointer$+0xfedb9298> - ---- !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: '' - - 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 - - Name: .reloc_12345678 - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: '375534121305856703258567' - - Name: .reloc_fedcba98 - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: 37C5DCFE130585A9 -Symbols: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .reloc_12345678 - Type: STT_SECTION - Section: .reloc_12345678 - - Name: foo - Value: 0x00000000FEDCBA98 - - Name: .reloc_fedcba98 - Type: STT_SECTION - Section: .reloc_fedcba98 - - Name: _start - Section: .reloc_12345678 - Binding: STB_GLOBAL -... Index: test/ELF/riscv-jal-error.test =================================================================== --- test/ELF/riscv-jal-error.test +++ test/ELF/riscv-jal-error.test @@ -1,92 +0,0 @@ -# .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: - - 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 - - Name: _start - Section: .text - Binding: STB_GLOBAL -... Index: test/ELF/riscv-jal.test =================================================================== --- test/ELF/riscv-jal.test +++ test/ELF/riscv-jal.test @@ -1,160 +0,0 @@ -# .option norelax -# .global _start -# -# .section .reloc_zero, "ax", @progbits -# _start: -# L1: -# jal x0, L1 -# L2: -# c.jal L2 -# -# .section .reloc_max, "ax", @progbits -# L3: -# jal x0, L3 + 0xffffe -# L4: -# c.jal L4 + 0x7fe -# -# .section .reloc_min, "ax", @progbits -# L5: -# jal x0, L5 - 0x100000 -# L6: -# c.jal L6 - 0x800 -# -# REQUIRES: riscv -# RUN: yaml2obj %s -o %t.o -# RUN: ld.lld %t.o -o %t -# RUN: obj2yaml %t | FileCheck %s -# -# CHECK: - Name: .reloc_zero -# CHECK: Content: 6F0000000120 -# 11000: 0000006f j 11000 -# 11004: 2001 jal 11004 -# -# CHECK: - Name: .reloc_max -# CHECK: Content: 6FF0FF7FFD2F -# 11006: 7ffff06f j 111004 -# 1100a: 2ffd jal 11808 -# -# CHECK: - Name: .reloc_min -# CHECK: Content: 6F0000800130 -# 1100c: 8000006f j fff1100c -# 11010: 3001 jal 10810 - ---- !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: '' - - 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 - - Name: .reloc_zero - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: 6F0000000120 - - Name: .rela.reloc_zero - Type: SHT_RELA - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .reloc_zero - Relocations: - - Offset: 0x0000000000000000 - Symbol: L1 - Type: R_RISCV_JAL - - Offset: 0x0000000000000004 - Symbol: L2 - Type: R_RISCV_RVC_JUMP - - Name: .reloc_max - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: 6FF0FF7FFD2F - - Name: .rela.reloc_max - Type: SHT_RELA - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .reloc_max - Relocations: - - Offset: 0x0000000000000000 - Symbol: L3 - Type: R_RISCV_JAL - Addend: 1048574 - - Offset: 0x0000000000000004 - Symbol: L4 - Type: R_RISCV_RVC_JUMP - Addend: 2046 - - Name: .reloc_min - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: 6F0000800130 - - Name: .rela.reloc_min - Type: SHT_RELA - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .reloc_min - Relocations: - - Offset: 0x0000000000000000 - Symbol: L5 - Type: R_RISCV_JAL - Addend: -1048576 - - Offset: 0x0000000000000004 - Symbol: L6 - Type: R_RISCV_RVC_JUMP - Addend: -2048 -Symbols: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .reloc_zero - Type: STT_SECTION - Section: .reloc_zero - - Name: L1 - Section: .reloc_zero - - Name: L2 - Section: .reloc_zero - Value: 0x0000000000000004 - - Name: .reloc_max - Type: STT_SECTION - Section: .reloc_max - - Name: L3 - Section: .reloc_max - - Name: L4 - Section: .reloc_max - Value: 0x0000000000000004 - - Name: .reloc_min - Type: STT_SECTION - Section: .reloc_min - - Name: L5 - Section: .reloc_min - - Name: L6 - Section: .reloc_min - Value: 0x0000000000000004 - - Name: _start - Section: .reloc_zero - Binding: STB_GLOBAL -... Index: test/ELF/riscv-pcrel-hilo.test =================================================================== --- test/ELF/riscv-pcrel-hilo.test +++ test/ELF/riscv-pcrel-hilo.test @@ -1,102 +0,0 @@ -# .option norelax -# .global _start -# -# _start: -# auipc a0, %pcrel_hi(_start + 4) -# addi a0, a0, %pcrel_lo(_start) -# -# .section .reloc_neg, "ax", @progbits -# L1: -# auipc a0, %pcrel_hi(L1 - 2) -# addi a0, a0, %pcrel_lo(L1) -# -# -# REQUIRES: riscv -# RUN: yaml2obj %s -o %t.o -# RUN: ld.lld %t.o -o %t -# RUN: obj2yaml %t | FileCheck %s -# -# CHECK: - Name: .text -# CHECK: Content: '1705000013054500' -# 11000: 00000517 auipc a0,0x0 -# 11004: 00450513 addi a0,a0,4 # 11004 <_start+0x4> -# -# CHECK: - Name: .reloc_neg -# CHECK: Content: 170500001305E5FF -# 11008: 00000517 auipc a0,0x0 -# 1100c: ffe50513 addi a0,a0,-2 # 11006 <_start+0x6> - ---- !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: '1705000013050500' - - Name: .rela.text - Type: SHT_RELA - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000000 - Symbol: _start - Type: R_RISCV_PCREL_HI20 - Addend: 4 - - Offset: 0x0000000000000004 - Symbol: _start - Type: R_RISCV_PCREL_LO12_I - - 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 - - Name: .reloc_neg - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: '1705000013050500' - - Name: .rela.reloc_neg - Type: SHT_RELA - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .reloc_neg - Relocations: - - Offset: 0x0000000000000000 - Symbol: L1 - Type: R_RISCV_PCREL_HI20 - Addend: -2 - - Offset: 0x0000000000000004 - Symbol: L1 - Type: R_RISCV_PCREL_LO12_I -Symbols: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .reloc_neg - Type: STT_SECTION - Section: .reloc_neg - - Name: L1 - Section: .reloc_neg - - Name: _start - Section: .text - Binding: STB_GLOBAL -...