Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Abstract the target endianness with a macro #21

Open
wants to merge 1 commit into
base: or1k-master
Choose a base branch
from

Conversation

smaeul
Copy link
Contributor

@smaeul smaeul commented Jun 19, 2022

In addition to running code on the AR100 in little-endian mode, this is how I tested my little-endian toolchain patches. I'm not sure if this is worth merging in its current state, but at least it documents what parts of the code would need to be changed.


Only a few changes are needed to swap the target instruction endianness.
Most of these places are already conditional on the host endianness, but
the changes are not completely overlapping. Add a macro for the target
endianness so it can be swapped out.

In the future, this choice could come from the config file, but that
requires more refactoring.

Signed-off-by: Samuel Holland [email protected]

Only a few changes are needed to swap the target instruction endianness.
Most of these places are already conditional on the host endianness, but
the changes are not completely overlapping. Add a macro for the target
endianness so it can be swapped out.

In the future, this choice could come from the config file, but that
requires more refactoring.

Signed-off-by: Samuel Holland <[email protected]>
@@ -64,7 +64,12 @@
#endif /* ULONGEST */

/* Endianness convenience macros */
#define TARGET_BIG_ENDIAN
Copy link
Member

Choose a reason for hiding this comment

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

To switch this to little endian you just remove this line? I think just adding a comment explaining the purpose of the TARGET_BIG_ENDIAN macro should be good enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's right.

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.

2 participants