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

Zig 0.14 support: Add .ARM.extab to generated ARM linker.ld scripts #370

Open
marnix opened this issue Jan 31, 2025 · 1 comment
Open

Zig 0.14 support: Add .ARM.extab to generated ARM linker.ld scripts #370

marnix opened this issue Jan 31, 2025 · 1 comment

Comments

@marnix
Copy link
Contributor

marnix commented Jan 31, 2025

Per ziglang/zig#22685 (comment), Zig 0.14 has enabled 'unwind tables' for ARM embedded (and most other platforms). Therefore it looks like we need to update tools/generate_linker_script.zig, as part of the upgrade to Zig 0.14 (being done on the current zig-master branch).

diff --git a/tools/generate_linker_script.zig b/tools/generate_linker_script.zig
index 308b055e51..775892c0f6 100644
--- a/tools/generate_linker_script.zig
+++ b/tools/generate_linker_script.zig
@@ -107,6 +107,10 @@
 
         switch (program_args.cpu_arch) {
             .arm, .thumb => try writer.writeAll(
+                \\  .ARM.extab : {
+                \\      *(.ARM.extab* .gnu.linkonce.armextab.*)
+                \\  } >flash0
+                \\  
                 \\  .ARM.exidx : {
                 \\      *(.ARM.exidx* .gnu.linkonce.armexidx.*)
                 \\  } >flash0

I have no idea whether the above is actually correct, but it seems to work for me. (At the time of writing, I did not try to actually debug and look at any stack traces yet...)

I have no idea whether something similar would be needed for RISCV, and/or for other embedded platforms.

@marnix marnix changed the title Add .ARM.extab to generated ARM linker.ld scripts Zig 0.14 support: Add .ARM.extab to generated ARM linker.ld scripts Jan 31, 2025
@marnix
Copy link
Contributor Author

marnix commented Jan 31, 2025

Actually this change can of course already be made on current master (see #373), but it's needed for Zig 0.14.

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

No branches or pull requests

1 participant