XESPV: fix linker relocation issue

This commit is contained in:
Alexey Lapshin
2025-11-03 19:07:27 +07:00
parent 1b1d501ab6
commit 080042594e

View File

@@ -2015,6 +2015,7 @@ perform_relocation (const reloc_howto_type *howto,
case R_RISCV_DELETE: case R_RISCV_DELETE:
return bfd_reloc_ok; return bfd_reloc_ok;
#if RISCV_XESPV2P1
case R_RISCV_ESP_LP_OFFSET_9: case R_RISCV_ESP_LP_OFFSET_9:
if (!VALID_ESP_LP_OFFSET_9 (value)) if (!VALID_ESP_LP_OFFSET_9 (value))
return bfd_reloc_overflow; return bfd_reloc_overflow;
@@ -2026,6 +2027,7 @@ perform_relocation (const reloc_howto_type *howto,
return bfd_reloc_overflow; return bfd_reloc_overflow;
value = ENCODE_ESP_LP_OFFSET_12 (value); value = ENCODE_ESP_LP_OFFSET_12 (value);
break; break;
#endif
default: default:
return bfd_reloc_notsupported; return bfd_reloc_notsupported;
@@ -2734,8 +2736,10 @@ riscv_elf_relocate_section (bfd *output_bfd,
case R_RISCV_COPY: case R_RISCV_COPY:
case R_RISCV_JUMP_SLOT: case R_RISCV_JUMP_SLOT:
case R_RISCV_RELATIVE: case R_RISCV_RELATIVE:
#ifdef RISCV_XESPV2P1
case R_RISCV_ESP_LP_OFFSET_9: case R_RISCV_ESP_LP_OFFSET_9:
case R_RISCV_ESP_LP_OFFSET_12: case R_RISCV_ESP_LP_OFFSET_12:
#endif
/* These require nothing of us at all. */ /* These require nothing of us at all. */
continue; continue;
@@ -2754,6 +2758,12 @@ riscv_elf_relocate_section (bfd *output_bfd,
/* These require no special handling beyond perform_relocation. */ /* These require no special handling beyond perform_relocation. */
break; break;
#ifndef RISCV_XESPV2P1
case R_RISCV_VENDOR:
vendor_rel = rel;
continue;
#endif
case R_RISCV_SET_ULEB128: case R_RISCV_SET_ULEB128:
if (uleb128_set_rel == NULL) if (uleb128_set_rel == NULL)
{ {