diff options
author | Jim Wilson <jimw@sifive.com> | 2019-03-30 10:12:12 -0700 |
---|---|---|
committer | Jim Wilson <jimw@sifive.com> | 2019-03-30 10:12:12 -0700 |
commit | ae2b14c73cd42b067e9687219155ed044210f0c1 (patch) | |
tree | c92a4bbd4bdb671014ddd4a117f780c6aa458114 /bfd/elfnn-riscv.c | |
parent | 7734102d6d8b5a0ccea166f8e944f84dc896b9ae (diff) | |
download | gdb-ae2b14c73cd42b067e9687219155ed044210f0c1.zip gdb-ae2b14c73cd42b067e9687219155ed044210f0c1.tar.gz gdb-ae2b14c73cd42b067e9687219155ed044210f0c1.tar.bz2 |
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.
Diffstat (limited to 'bfd/elfnn-riscv.c')
-rw-r--r-- | bfd/elfnn-riscv.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index bb114e5..dba1025 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -3416,9 +3416,12 @@ _bfd_riscv_relax_call (bfd *abfd, asection *sec, asection *sym_sec, auipc = bfd_get_32 (abfd, contents + rel->r_offset); jalr = bfd_get_32 (abfd, contents + rel->r_offset + 4); rd = (jalr >> OP_SH_RD) & OP_MASK_RD; - rvc = rvc && VALID_RVC_J_IMM (foff) && ARCH_SIZE == 32; + rvc = rvc && VALID_RVC_J_IMM (foff); - if (rvc && (rd == 0 || rd == X_RA)) + /* C.J exists on RV32 and RV64, but C.JAL is RV32-only. */ + rvc = rvc && (rd == 0 || (rd == X_RA && ARCH_SIZE == 32)); + + if (rvc) { /* Relax to C.J[AL] rd, addr. */ r_type = R_RISCV_RVC_JUMP; |