diff options
author | Stafford Horne <shorne@gmail.com> | 2025-06-15 05:15:40 +0100 |
---|---|---|
committer | Stafford Horne <shorne@gmail.com> | 2025-06-21 05:46:12 +0100 |
commit | 7a23d8a82634d52878b83582bb50832f85297a41 (patch) | |
tree | d2542318c07843e0270c45f26218761be95775c3 /gdb/python/py-cmd.c | |
parent | e4f71ccd5a5e3cc208b0643fc2ebd4e806cb605e (diff) | |
download | binutils-7a23d8a82634d52878b83582bb50832f85297a41.zip binutils-7a23d8a82634d52878b83582bb50832f85297a41.tar.gz binutils-7a23d8a82634d52878b83582bb50832f85297a41.tar.bz2 |
or1k: Fix disassembly for little-endian binaries
There are some OpenRISC CPUs that have their binaries stored in
little-endian format. Using objdump to disassemble these is
problematic, as some instructions fail to disassemble, for example:
objdump -D -b binary -EB -m or1k test_be.bin
0: 18 60 07 27 l.movhi r3,0x727
4: a8 63 0e 00 l.ori r3,r3,0xe00
8: 9c 63 ff ff l.addi r3,r3,-1
c: bc 43 00 00 l.sfgtui r3,0
10: 13 ff ff fe l.bf 0x8
14: 44 00 48 00 l.jr r9
objdump -D -b binary -EL -m or1k test_le.bin
0: 27 07 60 18 *unknown*
4: 00 0e 63 a8 l.ori r3,r3,0xe00
8: ff ff 63 9c *unknown*
c: 00 00 43 bc l.sfgtui r3,0
10: fe ff ff 13 *unknown*
14: 00 48 00 44 l.jr r9
It was found that the hash function was using the still little-endian
buffer to extract the opcode used for the hash lookup. This didn't work
as it was pulling the wrong hashcode causing instruction lookup to fail.
Fix the hash function by using the normalized/byte-swapped value instead
of the buffer.
Signed-off-by: Stafford Horne <shorne@gmail.com>
Diffstat (limited to 'gdb/python/py-cmd.c')
0 files changed, 0 insertions, 0 deletions