Skip to content

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

@marnix

Description

@marnix

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions