diff options
Diffstat (limited to 'bfd/elfnn-riscv.c')
-rw-r--r-- | bfd/elfnn-riscv.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 8739673..ec8a3e7 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -1646,27 +1646,27 @@ perform_relocation (const reloc_howto_type *howto, break; case R_RISCV_JAL: - if (!VALID_UJTYPE_IMM (value)) + if (!VALID_JTYPE_IMM (value)) return bfd_reloc_overflow; - value = ENCODE_UJTYPE_IMM (value); + value = ENCODE_JTYPE_IMM (value); break; case R_RISCV_BRANCH: - if (!VALID_SBTYPE_IMM (value)) + if (!VALID_BTYPE_IMM (value)) return bfd_reloc_overflow; - value = ENCODE_SBTYPE_IMM (value); + value = ENCODE_BTYPE_IMM (value); break; case R_RISCV_RVC_BRANCH: - if (!VALID_RVC_B_IMM (value)) + if (!VALID_CBTYPE_IMM (value)) return bfd_reloc_overflow; - value = ENCODE_RVC_B_IMM (value); + value = ENCODE_CBTYPE_IMM (value); break; case R_RISCV_RVC_JUMP: - if (!VALID_RVC_J_IMM (value)) + if (!VALID_CJTYPE_IMM (value)) return bfd_reloc_overflow; - value = ENCODE_RVC_J_IMM (value); + value = ENCODE_CJTYPE_IMM (value); break; case R_RISCV_RVC_LUI: @@ -1679,12 +1679,12 @@ perform_relocation (const reloc_howto_type *howto, contents + rel->r_offset); insn = (insn & ~MATCH_C_LUI) | MATCH_C_LI; riscv_put_insn (howto->bitsize, insn, contents + rel->r_offset); - value = ENCODE_RVC_IMM (0); + value = ENCODE_CITYPE_IMM (0); } - else if (!VALID_RVC_LUI_IMM (RISCV_CONST_HIGH_PART (value))) + else if (!VALID_CITYPE_LUI_IMM (RISCV_CONST_HIGH_PART (value))) return bfd_reloc_overflow; else - value = ENCODE_RVC_LUI_IMM (RISCV_CONST_HIGH_PART (value)); + value = ENCODE_CITYPE_LUI_IMM (RISCV_CONST_HIGH_PART (value)); break; case R_RISCV_32: @@ -4139,7 +4139,7 @@ _bfd_riscv_relax_call (bfd *abfd, asection *sec, asection *sym_sec, cause the PC-relative offset to later increase, so we need to add in the max alignment of any section inclusive from the call to the target. Otherwise, we only need to use the alignment of the current section. */ - if (VALID_UJTYPE_IMM (foff)) + if (VALID_JTYPE_IMM (foff)) { if (sym_sec->output_section == sec->output_section && sym_sec->output_section != bfd_abs_section_ptr) @@ -4148,7 +4148,7 @@ _bfd_riscv_relax_call (bfd *abfd, asection *sec, asection *sym_sec, } /* See if this function call can be shortened. */ - if (!VALID_UJTYPE_IMM (foff) && !(!bfd_link_pic (link_info) && near_zero)) + if (!VALID_JTYPE_IMM (foff) && !(!bfd_link_pic (link_info) && near_zero)) return TRUE; /* Shorten the function call. */ @@ -4157,7 +4157,7 @@ _bfd_riscv_relax_call (bfd *abfd, asection *sec, asection *sym_sec, auipc = bfd_getl32 (contents + rel->r_offset); jalr = bfd_getl32 (contents + rel->r_offset + 4); rd = (jalr >> OP_SH_RD) & OP_MASK_RD; - rvc = rvc && VALID_RVC_J_IMM (foff); + rvc = rvc && VALID_CJTYPE_IMM (foff); /* C.J exists on RV32 and RV64, but C.JAL is RV32-only. */ rvc = rvc && (rd == 0 || (rd == X_RA && ARCH_SIZE == 32)); @@ -4169,7 +4169,7 @@ _bfd_riscv_relax_call (bfd *abfd, asection *sec, asection *sym_sec, auipc = rd == 0 ? MATCH_C_J : MATCH_C_JAL; len = 2; } - else if (VALID_UJTYPE_IMM (foff)) + else if (VALID_JTYPE_IMM (foff)) { /* Relax to JAL rd, addr. */ r_type = R_RISCV_JAL; @@ -4298,8 +4298,8 @@ _bfd_riscv_relax_lui (bfd *abfd, if (use_rvc && ELFNN_R_TYPE (rel->r_info) == R_RISCV_HI20 - && VALID_RVC_LUI_IMM (RISCV_CONST_HIGH_PART (symval)) - && VALID_RVC_LUI_IMM (RISCV_CONST_HIGH_PART (symval) + && VALID_CITYPE_LUI_IMM (RISCV_CONST_HIGH_PART (symval)) + && VALID_CITYPE_LUI_IMM (RISCV_CONST_HIGH_PART (symval) + (link_info->relro ? 2 * ELF_MAXPAGESIZE : ELF_MAXPAGESIZE))) { |