Skip to content

Commit ae2b14c

Browse files
author
Jim Wilson
committed
RISC-V: Relax tail/j to c.j for RV64.
2019-03-30 Andrew Waterman <andrew@sifive.com> bfd/ * elfnn-riscv.c (_bfd_riscv_relax_call): Only check ARCH_SIZE for rd == X_RA case.
1 parent 7734102 commit ae2b14c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

bfd/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2019-03-30 Andrew Waterman <andrew@sifive.com>
2+
3+
* elfnn-riscv.c (_bfd_riscv_relax_call): Only check ARCH_SIZE for
4+
rd == X_RA case.
5+
16
2019-03-29 Max Filippov <jcmvbkbc@gmail.com>
27

38
* elf32-xtensa.c (shrink_dynamic_reloc_sections): Add

bfd/elfnn-riscv.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,9 +3416,12 @@ _bfd_riscv_relax_call (bfd *abfd, asection *sec, asection *sym_sec,
34163416
auipc = bfd_get_32 (abfd, contents + rel->r_offset);
34173417
jalr = bfd_get_32 (abfd, contents + rel->r_offset + 4);
34183418
rd = (jalr >> OP_SH_RD) & OP_MASK_RD;
3419-
rvc = rvc && VALID_RVC_J_IMM (foff) && ARCH_SIZE == 32;
3419+
rvc = rvc && VALID_RVC_J_IMM (foff);
34203420

3421-
if (rvc && (rd == 0 || rd == X_RA))
3421+
/* C.J exists on RV32 and RV64, but C.JAL is RV32-only. */
3422+
rvc = rvc && (rd == 0 || (rd == X_RA && ARCH_SIZE == 32));
3423+
3424+
if (rvc)
34223425
{
34233426
/* Relax to C.J[AL] rd, addr. */
34243427
r_type = R_RISCV_RVC_JUMP;

0 commit comments

Comments
 (0)