#7516 closed Patches (fixed)
Define endianity for ARM
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | None |
Version: | Boost 1.51.0 | Severity: | Problem |
Keywords: | Cc: |
Description
There are two cases here.
- GCC and Clang define
__ARMEL__
on little-endian ARM and__ARMEB__
on big-endian ARM, so if either is defined, use it. - Visual C++ for WinCE target (not sure about ARM version of Win8 yet) however does not define absolutely anything specific. It defines
__ARM__
andARM
, but that might be defined in other compilers on big-endian too and_M_ARM
one would expect in analogy to_M_X64
and similar is not defined. However there are no big-endian Windows API implementations at all, so the attached patch simply defaults to little-endian if_WIN32
is defined.
Note: The attached patch is minimal to get things to work, but the various _M_*
defines can probably be excluded from the condition if they get covered by _WIN32
.
Attachments (1)
Change History (8)
by , 10 years ago
Attachment: | boost.endian.arm.patch added |
---|
follow-up: 4 comment:1 by , 10 years ago
Owner: | set to |
---|---|
Version: | Boost 1.52.0 → Boost 1.51.0 |
Which library are you using that makes use of this internal file?
John, I've assigned this ticket to you as you are the last that updated the file. If you agree with the modification I could apply it myself.
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 10 years ago
Which library are you using that makes use of this internal file?
After update from 1.43 to 1.51 something in Boost.Test appears to have pulled it in.
Thanks for fixing.
comment:5 by , 10 years ago
this change is not yet in 1.52.0.
since i don't use glibc (first check, which would use endian.h), my armel device was not detected correctly.
modern gcc's (iirc 4.4+) provide __BYTE_ORDER__
so the code should do the following:
#if defined(__GNUC__) && defined(__BYTE_ORDER__) # if __BYTE_ORDER__ == __LITTLE_ENDIAN__ ... #elif defined(__GLIBC__) #include <endian.h> #else ... eternally incomplete cpu-specific ifdef hell here #endif
comment:6 by , 10 years ago
btw, this file is used by something during compilation of boost. so using boost 1.52.0, linux with musl libc, and armel cpu, compilation of boost fails with an #error.
Patch (-p1, non-tortoise) fixing endianity detection for WinCE (and Windows 8 for ARM, probably)