-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Preparations to make RIOT 64-bit ready #20154
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks reassuringly straightforward!
#endif | ||
|
||
-#if defined(__SIZEOF_INT128__) || ((__clang_major__ * 100 + __clang_minor__) >= 302) | ||
+#if ((__clang_major__ * 100 + __clang_minor__) >= 302) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that one I don't understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question - @fzi-haxel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On x86_64, __SIZEOF_INT128__
is defined, therefore __int128
is used, but this leads to this GCC warning:
build/pkg/micro-ecc/types.h:98:18: error: ISO C does not support ‘__int128’ types [-Werror=pedantic]
98 | typedef unsigned __int128 uECC_dword_t;
In retrospect, simply not using __int128
does not seem to be the most elegant solution. Another option would be:
__extension__ typedef unsigned __int128 uECC_dword_t;
However, the GCC documentation points out the following when using __extension__
only system header files should use these escape routes.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused: clang accepts __int128
even though it is not part of the C standard but gcc does not?
What I also do not understand: if __int128
is a built-in data type on gcc (>= 4.1) wouldn't I still get the warning even with the typedef? (Which definitiv would be actually used?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If -Wpedantic
is enabled, yes.
Example: https://godbolt.org/z/bsYq49jGY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using __extension__
would get rid of the warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, actually, I tried this (using gcc 13.2.1) but still got the warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? I just tested it with (13.2.0) and didn't get this warning.
But GCC 13 now gives this warning during linking
/usr/bin/ld: warning: /work/tests/pkg/micro-ecc/bin/native/cpu/tramp.o: missing .note.GNU-stack section implies executable stack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, no, sorry, I think there was a PEBCAK issue (I always confuse the order of arguments for typedef).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened an issue upstream with some suggested solutions
-typedef int mp_int_t; // must be pointer size | ||
-typedef unsigned mp_uint_t; // must be pointer size | ||
+typedef intptr_t mp_int_t; // must be pointer size | ||
+typedef uintptr_t mp_uint_t; // must be pointer size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are using our own fork anyway, you might as well open the PR there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True - but actually unrelated to this PR, isn't it?
Sorry - got confused by the highlighting for the patch file here. I thought that was an actual diff instead of an added file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a PR in the fork.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is merged, waiting for #20208 to get merged before we can drop this patch.
Btw @fzi-haxel by no means I wanted to take over your contribution. I just got excited about your PR and the idea to have (finally) 64 bit support (for native) in RIOT and I thought that @benpicco had a good point that we could potentially speed up things by splitting the PR. Since the PR did seem stall somewhat, I just moved forward without asking you first. I hope that was okay with you!? |
Fixed compilation errors. Mostly DEBUG/printf formatting and void pointer casting. Added another hardcoded offset for gnrc_sixlowpan_frag_* tests. Increased mem size of lua test in case of 64 bit. Reduced required backtrace size to 3 in native backtrace test.
Created separate PR (RIOT-OS#20165) This reverts commit 055471a.
Merged in upstream
Fix for failed murdock test
Additional bug found by compiling all tests with llvm. Interestingly, this didn't crash the 64 bit tests before nor did it give a warning in GCC.
Added missing DOXYGEN documentation
a15c541
to
47ce2a2
Compare
I rebased on current master (including @fzi-haxel's |
I pushed three more PRs to Olegs branch:
Merge as you deem fit |
Dropped micropython patches due to upstream merge
Created separate PR (RIOT-OS#20196) This reverts commit 09f4453.
Or not... I added a new PR and compiled all examples/tests for avr-rss2, iotlab-m3, sipeed-longan-nano-tft, esp32-wroom-32, native and "native64". |
I think this PR has become a bit complicated to review and is probably still a bit too big to be easily discussed. I believe the best way to proceed with the PR is to break it down into smaller PRs that can be merged step by step. |
Probably you're right. Should I fix this one? |
All commits and review change requests in this PR should now be included in other smaller PRs.
Therefore, I think you could close this PR. |
Adopted from #19890
Contribution description
Following @benpicco's proposal I handpicked the patches from #19890 that only prepare the code base for 64bit support.
All changes are done by @fzi-haxel.
Testing procedure
All tests and applications should remain unchanged for existing platforms.