-
Notifications
You must be signed in to change notification settings - Fork 784
-
Notifications
You must be signed in to change notification settings - Fork 784
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
Assertion failures in mruby-pack on big endian #4190
Comments
Do you have |
I'm guessing it isn't explicitly defined. I'm going to close this now, and if there are still assertion failures with it defined, I'll reopen. |
I just wanted to confirm that defining /* define on big endian machines; used by MRB_NAN_BOXING */
-//#define MRB_ENDIAN_BIG
+#include <endian.h>
+#if (BYTE_ORDER == BIG_ENDIAN)
+#define MRB_ENDIAN_BIG
+#endif |
That would be a nice idea. I was working on a different solution that relies on the dynamic endian check. |
The `MRB_ENDIAN_BIG` macro is originally used for `NaN` boxing. We cannot assume it is defined on every big endian platform (#4190 is the case). So instead of relying on untrusted `MRB_ENDIAN_BIG`, we use `BYTE_ORDER` macro with a fallback function to check endian in runtime.
You had to define this macro on big endian platforms, but it is very error-prone. So define the macro automatically if possible.
`cpp` does not raise error on undefined macro access in condition.
The `MRB_ENDIAN_BIG` macro is originally used for `NaN` boxing. We cannot assume it is defined on every big endian platform (mruby#4190 is the case). So instead of relying on untrusted `MRB_ENDIAN_BIG`, we use `BYTE_ORDER` macro with a fallback function to check endian in runtime.
You had to define this macro on big endian platforms, but it is very error-prone. So define the macro automatically if possible.
`cpp` does not raise error on undefined macro access in condition.
The good news is mruby 2.0.0 works on OpenBSD/sparc64 (previous versions failed to build). However, running the tests shows the following failures:
These failures do not occur on OpenBSD/amd64, and the test output leads me to believe this may be a general mruby-pack issue on big endian systems.
The text was updated successfully, but these errors were encountered: