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

Correctly "detect" host endianness on MIPS #802

Merged
merged 1 commit into from
Nov 12, 2016

Conversation

xen0n
Copy link
Contributor

@xen0n xen0n commented Nov 6, 2016

Counter-intuitively, Linux on MIPS reports the same machine name in
uname(2) output, regardless of endianness. So the current check is
bogus, and will fail on little-endian boxes. However, because the endianness
is not runtime reconfigurable, binaries are guaranteed to only work on
platforms with the same endianness. Hence, we can rely on compile-time
cfg() checks to provide the correct host triple, despite the kernel
not providing that information.

Counter-intuitively, Linux on MIPS reports the same machine name in
`uname(2)` output, regardless of endianness. So the current check is
bogus, and will fail on little-endian boxes. However, because the
endianness is not runtime reconfigurable, binaries are guaranteed to
only work on platforms with the same endianness. Hence, we can rely on
compile-time `cfg()` checks to provide the correct host triple, despite
the kernel not providing that information.
@brson brson merged commit 4fcdfdc into rust-lang:master Nov 12, 2016
@brson
Copy link
Contributor

brson commented Nov 12, 2016

Thanks!

@xen0n xen0n deleted the mips-endianness branch November 16, 2016 05:04
@xen0n xen0n mentioned this pull request Nov 16, 2016
8 tasks
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