Skip to content

[Backport v4.0-branch] arch: arm: cortex_m: Force literal pool placement in inline asm block #93125

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

Open
wants to merge 1 commit into
base: v4.0-branch
Choose a base branch
from

Conversation

JarmouniA
Copy link
Contributor

Backport d7d3ae5 from #92569.

Fixes #90777

When LTO is enabled, linker may relocate literal pools out of Thumb LDR
instruction's reach causing "offset out of range" errors while linking.

This commit adds `.ltorg` directive in the inline asm blocks where absolute
addresses are loaded using the `ldr` instructions, in order to ensure that
the literal pool containing the absolute addresses are placed near the
`ldr` instructions.

Note that the `.ltorg` directive is recognised by all toolchains supported
by Zephyr and no toolchain abstraction is provided for now.

Signed-off-by: Stephanos Ioannidis <[email protected]>
(cherry picked from commit d7d3ae5)
@JarmouniA JarmouniA added the Backport Backport PR and backport failure issues label Jul 14, 2025
@github-project-automation github-project-automation bot moved this to To do in Backports Jul 14, 2025
@JarmouniA JarmouniA linked an issue Jul 14, 2025 that may be closed by this pull request
Copy link

@JarmouniA JarmouniA marked this pull request as ready for review July 14, 2025 21:43
@zephyrbot zephyrbot added the area: ARM ARM (32-bit) Architecture label Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARM ARM (32-bit) Architecture Backport Backport PR and backport failure issues
Projects
Status: To do
Development

Successfully merging this pull request may close these issues.

[Backport v4.0-branch] Failed to backport #92569
4 participants