Skip to content
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

rp2040: Fix extab section getting put before .text #394

Merged
merged 2 commits into from
Feb 22, 2025

Conversation

Grazfather
Copy link
Contributor

If building a target after #373 happened to create an .ARM.extab* section, it would be placed before .text, which would shift the vector table over and prevent the device from booting.

This would happen almost always in debug builds, but could occasionally happen on --release=fast builds as well.

Fix this by explicitly placing it after .text.

Should fix #373

@marnix
Copy link
Contributor

marnix commented Feb 22, 2025

As we saw in ziglang/zig#22685, somehow Zig (not only current 0.14-pre but also 0.13.0 already) requires an explicit .ARM.extab section in a .ld linker script, at least for thumb and/or ARM, if 'unwind tables' is set.

So I agree this is the correct fix for #389.

And I would suggest to also make the same change in

  • port/raspberrypi/rp2xxx/src/bootroms/RP2040/shared/stage2.ld
  • port/raspberrypi/rp2xxx/rp2350_arm.ld

Thanks for this find and this fix!

(And my apologies if the issue from my 'enable unwind tables by default' caught anyone by surprise.)

@Grazfather
Copy link
Contributor Author

Pushed.
I noticed that on rp2350 the extab section is already placed after the vector table, but that's because that linked explicitly puts the vector table at the start of flash.

We should probably make it s/t the rp2040 linker follows suit (in a follow up).

@mattnite mattnite merged commit 3c4a1c2 into ZigEmbeddedGroup:main Feb 22, 2025
30 checks passed
@Grazfather Grazfather deleted the fix_extab branch February 25, 2025 21:34
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.

3 participants