Summary: | powerpc64 gcc toolchain missing __BYTE_ORDER__ et. al. | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Julio Merino,+1 347 694 0576,New York City <jmmv> | ||||
Component: | bin | Assignee: | freebsd-toolchain (Nobody) <toolchain> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Only Me | CC: | emaste, imp, pkubaj | ||||
Priority: | --- | ||||||
Version: | 12.2-RELEASE | ||||||
Hardware: | powerpc | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
Julio Merino,+1 347 694 0576,New York City
![]() ![]() For some reason I had mistakenly downloaded 12.1-RELEASE instead of 12.2-RELEASE. I have now downloaded the latter and found that the toolchain behaves in the same way... so the problem hasn't been fixed AFAICT. If __BYTE_ORDER__ and __ORDER_LITTLE_ENDIAN__ are not defined they will both evaluate to 0 and the result will be true; can you confirm this is not the case you're seeing? Hah. I came to the same conclusion before seeing your comment. Indeed, the macros are undefined when using the gcc that ships with the base system but they are defined when using gcc9 from ports. (And by looking at the source tree, I understand that they are defined as well when using the clang in the base system.) Created attachment 221660 [details]
Avoid __BYTE_ORDER__
I scanned the stable/12 source tree and found a bunch of files that query __BYTE_ORDER__. Most seem to have provisions for this macro not being defined, but a couple of them do not. The attached patch seems to have helped generate a new powerpc64 userland that works well.
I do not know if this kind of patch is desired, or if instead sys/endian.h or something like that should be modified to define __BYTE_ORDER__ in terms of other available macros when the former is detected to be missing. It seems to me that this would be slightly more robust.
There is also the question of how this problem slipped through QA into a release.
Can you try 13.0-RELEASE? 12 on powerpc* is officially supported, but I don't think anybody still fixes issues with the old toolchain. 13.0-RELEASE switched to LLVM and provides vastly superior experience to 12.2-RELEASE. e35448a901aa56aa232efbc4fe7a73a9bdac3511 broke this, but 6f23df1ae7f6ec3cd06a15c87f0aaaa770b2941b fixed it. |