Skip to content

Add initial big-endian support#1812

Open
aleksapaunovic-htec wants to merge 4 commits intoriscv-collab:masterfrom
aleksapaunovic-htec:be-fixes-ready
Open

Add initial big-endian support#1812
aleksapaunovic-htec wants to merge 4 commits intoriscv-collab:masterfrom
aleksapaunovic-htec:be-fixes-ready

Conversation

@aleksapaunovic-htec
Copy link

This series adds initial big-endian support:

  • Add --with-endian flag.
  • GCC currently doesn't support RVV in big-endian mode. Therefore, we remove the rv64gcv-lp64d multilib option when building the Linux toolchain.

We are working on upstreaming GDB and GCC changes as well. The GDB changes are required for running big-endian tests, as QEMU currently has no big-endian support.

Copy link
Collaborator

@cmuellner cmuellner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for providing this PR!

Besides the issue with the linux headers, I have two more comments:

  • We should probaby add at least one CI/CD job to build a BE toolchain
  • What is the status of the GCC testsuite when building a BE toolchain?

#ifndef _ASM_RISCV_BYTEORDER_H
#define _ASM_RISCV_BYTEORDER_H

#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All linux headers are copied without modification as we don't want downstream changes here.
If we add such non-upstream changes, then there is a risk of breaking the BE build each time we update the linux headers.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, I will be removing the commit for now. We will try upstreaming this in the future.

@aleksapaunovic-htec
Copy link
Author

Hi Christoph,

* We should probaby add at least one CI/CD job to build a BE toolchain

Agreed!

* What is the status of the GCC testsuite when building a BE toolchain?

A lot of the tests implicitly depend on RVV being supported in the compiler, generating a lot of noise when running tests. We have been going through the logs over the last few days, and this appears to be the major difference between BE and LE runs. Actually confirming and fixing this will probably take some time though.

Thank you for taking the time to review this PR!

djtodoro and others added 3 commits January 19, 2026 15:07
GCC currently does not support the RISC-V Vector Extension
on big-endian builds, which causes the stage1 self-tests to fail.
Disabling them is a temporary fix, until we get RVV working on
big-endian systems.
@aleksapaunovic-htec
Copy link
Author

Last week, we sent the v2 of the GCC patch series mentioned above. We tried solving the lack of RVV support and subsequent self-test failures by disabling self-tests within the GCC codebase. However, the maintainers prefer a workaround to disable self-tests in the config. Therefore, I added a commit that should address this issue.

Also, we received a comment regarding our usage of gdb-sim for testing. Although we did manage to run the majority of non-RVV-related tests on gdb-sim, it seems that QEMU is the preferred tool for RISC-V testing. We will be focusing on that in the future.
Current GCC testsuite fixes rely on marking RVV-dependent tests as 'unsupported', which I hope we will be able to upstream in the future (or, more optimistically, that we will have a working RVV extension in the future).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants