-
Notifications
You must be signed in to change notification settings - Fork 206
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
#define 'HAVE_UNALIGNED_ACCESS' and [-Wcast-align] warnings on 32bit armv7l #85
Comments
Additional Info:
Sould be the following?
|
Jako Chirimen <[email protected]> writes:
Now I'm chasing kind of the [-Wcast-align] warnings which happens when I build c-Lightning on 32bit armv7l machine.
```ccan/ccan/crypto/sha256/sha256.c: In function 'add':
ccan/ccan/crypto/sha256/sha256.c:213:22: warning: cast increases required alignment of target type [-Wcast-align]
Transform(ctx->s, (const uint32_t *)data, blocks);
^
Interesting!
I noticed the 'HAVE_UNALIGNED_ACCESS' macro affects some many-bits calculation especially for
crypto.
```
$ find . -name '*.h' | xargs grep "UNALIGNED"
./ccan/config.h:#define HAVE_UNALIGNED_ACCESS 1
./external/libwally-core/src/config.h:#define HAVE_UNALIGNED_ACCESS 1
./external/libwally-core/src/ccan_config.h:#if HAVE_UNALIGNED_ACCESS
```
It means the following in my understanding. Right?
HAVE_UNALIGNED_ACCESS=0 --> pointers are aligned appropriately in advance.
HAVE_UNALIGNED_ACCESS=1 --> pointers may not be aligned. need check and re-align.
No. HAVE_UNALIGNED_ACCESS=1 means you can access pointers with
"unnatural" alignment. x86, for example, allows you to do this.
Interestingly, my rPi thinks it can do it too, but perhaps unaligned
accesses actually trap, and it would perform better with this unset?
Cheers,
Rusty.
|
Thank you very much for your comment. Please forgive me what I can is leave some unorganized comments for now because this problem includes some composite and difficult issues.
This is also my guess, it relates virtual memory allocates granularity, or, ARM processor’s failure. If the former, x86s allocates at least 4KB and didn’t touch non-commitment area by lucky. Anyway, As I told you at (3), to believe processor manufacturer’s document completely is sometimes risky in my opinion. I know Prof. Tanenbaum and David N. Cutler were consumed time by that kind of issues. Current conclusion:If I were you, when ARM processor detect by configure or make, I allocates alignment sensitive memory area by only aligned memory allocate functions. And, add Best Regards, |
Now I'm chasing kind of the [-Wcast-align] warnings which happens when I build c-Lightning on 32bit armv7l machine.
Brief system info is:
Full information is the following.
warning.txt
system-info.txt
I noticed the 'HAVE_UNALIGNED_ACCESS' macro affects some many-bits calculation especially for
crypto.
It means the following in my understanding. Right?
HAVE_UNALIGNED_ACCESS=0 --> pointers are aligned appropriately in advance.
HAVE_UNALIGNED_ACCESS=1 --> pointers may not be aligned. need check and re-align.
If my understanding is correct, the following logic is upside-down?
CURRENT: lightning/ccan/ccan/crypto/sha256/sha256.c
should be:
the above code affects the following process.
Could you take a look at the codes and give me a comment?
Thanks in advance.
The text was updated successfully, but these errors were encountered: