[PATCH 0/2] riscv: Fix gas when encoding BE floats/doubles

Branislav Brzak Branislav.Brzak@Syrmia.com
Thu Jun 15 11:09:26 GMT 2023


RISCV gas currently does not take into consideration -mbig-endian
directive when encoding floats and doubles. The effect is that when
-mbig-endian is supplied floats and doubles are endian flipped only
on 2-byte boundaries, for example:

.data:
      .float 1.1

Compiled as LE will be encoded as: 0xcdcc8c3f
And BE encoded will be: 0x8c3fcdcc

The correct sequence is 0x3f8ccccd

This patch introduces a fix in float/double endian encoding and
set of tests that verify validity of LE and BE float and double
encoding.

Branislav Brzak (2):
      gas: Fix float/double BE encoding in RISCV.
      riscv: Add LE/BE float/double encoding tests.

 gas/config/tc-riscv.c
 gas/testsuite/gas/riscv/double-be.d | 18 ++++++++++++++++++
 gas/testsuite/gas/riscv/double-le.d | 18 ++++++++++++++++++
 gas/testsuite/gas/riscv/double.s    | 21 +++++++++++++++++++++
 gas/testsuite/gas/riscv/float-be.d  | 13 +++++++++++++
 gas/testsuite/gas/riscv/float-le.d  | 13 +++++++++++++
 gas/testsuite/gas/riscv/float.s     | 21 +++++++++++++++++++++
 7 files changed, 105 insertions(+), 1 deletion(-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tc-riscv.c-md_atof-Use-target_big_endian-instead-of-.patch
Type: text/x-patch
Size: 747 bytes
Desc: 0001-tc-riscv.c-md_atof-Use-target_big_endian-instead-of-.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20230615/323b3c75/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-LE-BE-float-double-encoding-tests.patch
Type: text/x-patch
Size: 5211 bytes
Desc: 0002-Add-LE-BE-float-double-encoding-tests.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20230615/323b3c75/attachment-0003.bin>


More information about the Binutils mailing list