Skip to content

LTO discards NXP Kinetis Flash Config #90426

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

Closed
mspeder opened this issue May 24, 2025 · 2 comments · Fixed by #90770
Closed

LTO discards NXP Kinetis Flash Config #90426

mspeder opened this issue May 24, 2025 · 2 comments · Fixed by #90770
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: NXP NXP priority: low Low impact/importance bug

Comments

@mspeder
Copy link
Contributor

mspeder commented May 24, 2025

Describe the bug
When Link Time Optimization is active, the __kinetis_flash_config section is discarded by the linker

To Reproduce
Compile a kinetis project with CONFIG_LTO=y and look at map file.

Fix
Attribute "used" must be added to to prevent unwanted deletion in zephyr/soc/nxp/kinetis
/flash_configuration.c :

uint8_t __attribute__((used)) __kinetis_flash_config_section __kinetis_flash_config[] = {

@mspeder mspeder added the bug The issue is a bug, or the PR is fixing a bug label May 24, 2025
@henrikbrixandersen
Copy link
Member

Please submit a PR for fixing this.

@jevidin
Copy link

jevidin commented May 24, 2025

Hi @henrikbrixandersen

Can I take a look at this as my first issue? I know we have Good first issue labels, but it seems like they're mostly re-implementing C libs.

Thanks!

@dleach02 dleach02 added the priority: low Low impact/importance bug label May 27, 2025
mspeder added a commit to mspeder/zephyr that referenced this issue May 28, 2025
This is a fix for issue zephyrproject-rtos#90426 .
Marking __kinetis_flash_config  with __used attribute prevents unwanted deletion when compiling with LTO.

Signed-off-by: Matthieu Speder <[email protected]>
mspeder added a commit to mspeder/zephyr that referenced this issue May 29, 2025
This is a fix for issue zephyrproject-rtos#90426 .
Marking __kinetis_flash_config  with __used attribute prevents
unwanted deletion when compiling with LTO.

Signed-off-by: Matthieu Speder <[email protected]>
kartben pushed a commit that referenced this issue May 31, 2025
This is a fix for issue #90426 .
Marking __kinetis_flash_config  with __used attribute prevents
unwanted deletion when compiling with LTO.

Signed-off-by: Matthieu Speder <[email protected]>
Shreyas-Shankar155 pushed a commit to MihiraMadhava/zephyr that referenced this issue Jun 3, 2025
This is a fix for issue zephyrproject-rtos#90426 .
Marking __kinetis_flash_config  with __used attribute prevents
unwanted deletion when compiling with LTO.

Signed-off-by: Matthieu Speder <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: NXP NXP priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants