Skip to content

Conversation

@LoveKarlsson
Copy link

Description

Since __packed is a reserved keyword for the IAR compilers, and Zephyr defines it attribute(packed), some typdef constructs in mbedtls does not work with attribute(packed), only with the keyword packed.

This fix checks if __packed is a macro and temporary undefines it so the typedefs works correctly.

PR checklist

Please tick as appropriate and edit the reasons (e.g.: "backport: not needed because this is a new feature")

  • changelog not required
  • 3.6 backport not sure if required
  • 2.28 backport not required
  • tests not required

Since __packed is a reserved keyword for the IAR compilers, and
Zephyr defines it attribute(__packed__), some typdef constructs
in mbedtls does not work with attribute(packed), only with the
keyword packed.

This fix checks if __packed is a macro and temporary undefines it
so the typedefs works correctly.

Signed-off-by: Lars-Ove Karlsson <[email protected]>
@LoveKarlsson
Copy link
Author

@nashif, could you take a look at this, please? Without this fix, these typedefs will use ordinary alignment, potentially causing problems when executing code

@LoveKarlsson
Copy link
Author

I've also have a PR on the mbedTLS for this, but the header file have switched place in the latest versions, and Zephyr uses an old, modified version.

@tomi-font
Copy link
Collaborator

I've also have a PR on the mbedTLS for this, but the header file have switched place in the latest versions, and Zephyr uses an old, modified version.

Could you also submit this fix to the upstream 3.6 branch? It's the LTS version, latest released (3.6.3), we have it here and so cherry picking from there will be just fine.

@LoveKarlsson
Copy link
Author

LoveKarlsson commented Jun 2, 2025

Is this the one? https://github.com/Mbed-TLS/mbedtls, branch mbedtls-3.6?

@LoveKarlsson
Copy link
Author

I've made one here: Mbed-TLS/mbedtls#10202

@tomi-font
Copy link
Collaborator

Great. I'd say let's wait for the PR to received feedback/get merged upstream, and we can cherry pick the commit from upstream here.

@LoveKarlsson
Copy link
Author

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants