[zep fromtree] [1.1] Fix alignment problems with IAR and Zephyr#7
Conversation
|
Not sure whether this is a good fix, the root cause is, Zephyr's |
44cf6ed to
1c16831
Compare
tomi-font
left a comment
There was a problem hiding this comment.
Please submit this fix upstream: https://github.com/Mbed-TLS/TF-PSA-Crypto
And then cherry-pick it here.
|
Hi @tomi-font , I also consider push to upstream. My main consideration is, this #ifndef __packed
#define __packed __attribute__((__packed__))
#endifShould it be handled in Zephyr? thanks. |
|
I think this change is generic enough that it could be accepted upstream. We want to avoid local patches in this repo whenever you can. |
|
Wait, I think the concern raised by @zejiang0jason is correct. Upstream TF-PSA-Crypto follows what's being suggested by IAR compiler for when it comes to access unaligned data, so I think this is fine. I suspect that as @zejiang0jason stated the problem in Zephyr is in https://github.com/zephyrproject-rtos/zephyr/blob/b9b37edd2cc561cad6f782465a2a5bf5da44df4b/include/zephyr/toolchain/iar/iccarm.h#L153-L155, which is in the main Zephyr repo. There |
|
Yes, we had a lot of issues with IAR-aware modules using __packed in the expected IAR-way, but rest of zephyr expecing a __packed from GNU. I will defer this to @LoveKarlsson who has been trying to fix this upstream here: Mbed-TLS#410 |
|
My fixes for this has now been merged and backported to 1.1 and mbedtls3.6 |
|
@zejiang0jason can you please replace the commit in this PR with the |
1c16831 to
d98c5ce
Compare
updated, thanks. |
d98c5ce to
c8080e3
Compare
|
Now you only need to change the commit title to have the |
c8080e3 to
eba804c
Compare
|
Thanks, added.
|
tomi-font
left a comment
There was a problem hiding this comment.
remove the [1.1] and we're good
I thought about this as well, but |
|
ah 😄 we're good then |
|
I would just put a space between the two brackets. |
Since __packed is a reserved keyword for IAR compilers, and Zephyr defines it to attribute(__packed__), some typedef constructs in TF-PSA-Crypto does not work with attribute(packed), only with the keyword __packed. Added changelog entry. This fix temporary undefs the macro and restores it after the typedefs. Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@qt.io> (cherry picked from commit e544d70)
eba804c to
b67ce56
Compare
done |
In IAR
__packedcan be used for type definition, as described: https://mypages.iar.com/s/article/Accessing-Unaligned-DataZephyr defined
__packedas__attribute__((__packed__)), which makes__packedcan't be used for typedef. THe error is:Recover the
__packedtemporarily, make it can be used for typedef.The error can reproduced by project
samples/drivers/crypto/