diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2015-01-11 22:17:15 -0800 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2015-01-11 22:32:54 -0800 |
commit | 6e255d99ed9dbf6b3fa318b53ab0065e36148f0f (patch) | |
tree | 82d7bdc7adc63bbc0042421bea15bc123e03a9a7 /binutils | |
parent | 00a0bcbb70edb2764df54f16aa8115f49f125c56 (diff) | |
download | riscv-gnu-toolchain-6e255d99ed9dbf6b3fa318b53ab0065e36148f0f.zip riscv-gnu-toolchain-6e255d99ed9dbf6b3fa318b53ab0065e36148f0f.tar.gz riscv-gnu-toolchain-6e255d99ed9dbf6b3fa318b53ab0065e36148f0f.tar.bz2 |
binutils: make objdump of branches more readable
Although we don't know the branch offsets until linker relaxation, we can
still fill in a tentative value to make objdumps of object code more
readable.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/gas/config/tc-riscv.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/binutils/gas/config/tc-riscv.c b/binutils/gas/config/tc-riscv.c index c78bd61..d8ca59e 100644 --- a/binutils/gas/config/tc-riscv.c +++ b/binutils/gas/config/tc-riscv.c @@ -1855,12 +1855,28 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) } break; + case BFD_RELOC_RISCV_JMP: + if (fixP->fx_addsy) + { + /* Fill in a tentative value to improve objdump readability. */ + bfd_vma delta = ENCODE_UJTYPE_IMM (S_GET_VALUE (fixP->fx_addsy) + *valP); + bfd_putl32 (bfd_getl32 (buf) | delta, buf); + } + break; + + case BFD_RELOC_12_PCREL: + if (fixP->fx_addsy) + { + /* Fill in a tentative value to improve objdump readability. */ + bfd_vma delta = ENCODE_SBTYPE_IMM (S_GET_VALUE (fixP->fx_addsy) + *valP); + bfd_putl32 (bfd_getl32 (buf) | delta, buf); + } + break; + case BFD_RELOC_RISCV_PCREL_LO12_S: case BFD_RELOC_RISCV_PCREL_LO12_I: case BFD_RELOC_RISCV_CALL: case BFD_RELOC_RISCV_CALL_PLT: - case BFD_RELOC_RISCV_JMP: - case BFD_RELOC_12_PCREL: case BFD_RELOC_RISCV_ALIGN: break; |