Fix build on s390x; related to #166 - #173
Conversation
|
I suggest we do, I suspect these macros are breaking the Firefox build that I am debugging right now, so regrouping them would be useful... |
|
This piece of code is a little hairy because the _gcc file that's included a little further down the file is defining functions in the non-gcc case. I would suggest cleaning things up to make sure the _gcc.h uint128 implementation only includes implementations that rely on That way, the series of tests can be identical for type definitions and inclusion of headers, and then you can easily have: then the tests become easier: thoughts? |
|
I think I like that. |
Suggested by Jonathan Protzenko in: FStarLang#173 (comment)
9b76290 to
ce9fc98
Compare
|
Thank you for the suggestion; although I haven't tested it yet, it might be something like this? |
franziskuskiefer
left a comment
There was a problem hiding this comment.
I didn't check all the details, but lgtm.
Suggested by Jonathan Protzenko in: FStarLang#173 (comment)
ce9fc98 to
1953590
Compare
| defined(__aarch64__) || \ | ||
| (defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)) || \ | ||
| defined(__s390x__)) || \ | ||
| (defined(_MSC_VER) && defined(__clang__))) |
There was a problem hiding this comment.
could this last check be true in a hypothetical 32-bit build on windows with clang?
There was a problem hiding this comment.
which would then not have int128
There was a problem hiding this comment.
I've added a !defined(_M_X64) check here; would it be sufficient?
|
this generally looks good -- our CI system has a bug so I'll have to push this to a branch on the fstarlang/kremlin repo, it looks like builds aren't succeeding for external forks can you sign the CLA? thanks!! |
Suggested by Jonathan Protzenko in: FStarLang#173 (comment)
1953590 to
08b8318
Compare
|
Thanks for the review; I've signed the CLA a while ago. |
|
thanks -- for some reason the CLA bot was complaining earlier @beurdouche is there any chance you could give this a go at Mozilla to make sure it doesn't break any of your platforms? that way we can anticipate rather than break you next time you pull this code |
|
ping @beurdouche or @glandium would this fix the Firefox build on various platforms that Debian packages? I'm happy to merge this, I would just like a sanity check that this fixes the build issue |
|
It fixes building NSS on Debian s390x. I haven't checked other architectures. |
|
Thanks Mike. I guess I'll just try to merge this and see what happens, unless you know how to run a candidate build for other Debian-supported platforms (I am no Debian developer so I have no clue). |
|
https://buildd.debian.org/status/package.php?p=nss&suite=sid for MIPS64 it should be for riscv64: I have access to mips64el machine so if you need any test please call me. Thanks. |
|
I've pushed a working version of this PR based on @ueno's sketch (there were multiple issues, including a non-terminated #ifdef along with a #define defining some defined(...) which clang helpfully let me know is UB). I also integrated @FlyGoat's suggestions for the other two platforms. This is on branch protz_feature_detection of kremlin. @FlyGoat can you let me know if this fixes the build? I've also consolidated the ifdefs so that even if we think the platform doesn't support uint128, we always fallback to the verified (albeit, slow) implementation of uint128 using a pair of uint64. For some reason, this was not done before -- I'm hoping this makes the header more resilient and "always working". Meanwhile, I'm running some Everest regression to make sure this doesn't break anything either, including in our compilation path with MSVC. Thanks everyone for the feedback and suggestions, much appreciated. |
|
Everest CI came back green so I'm intending to merge protz_feature_detection at the end of the week. |
|
Can confirm it works on MIPS64EL. |
|
Wonderful, thanks for the help debugging! |
| #define HAS_INT128 ((defined(__x86_64__) || defined(__x86_64) || \ | ||
| defined(__aarch64__) || \ | ||
| (defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)) || \ | ||
| defined(__s390x__)) || \ | ||
| (defined(_MSC_VER) && !defined(_M_X64) && defined(__clang__))) |
There was a problem hiding this comment.
Note that __SIZEOF_INT128__ could be used to automatically add support to the platforms that aren't explicitly listed here but have compiler support for __int128.
|
This is now in NSS master (should be in 3.53). Thanks all ! |
Even after #166 got merged, the NSS build is still failing on s390x as mentioned in:
https://bugzilla.mozilla.org/show_bug.cgi?id=1615557
The architecture has several differences from other arches, but with this change, the build succeeds: