Linker scripts must die
Sorry for the cheesy title, feel free to change it With the current state and plans of Zig, it's looking like the only case where you need a language other than Zig for writing firmware/software, is if you need a custom linker script. What's worse, the documentation for GCC/LLD linker scripts are not all that great, and they can be hard to understand. The scripting language is also not really powerful enough on its own to do more complex things, so I've seen a case where the C preprocessor has been used to generate linker scripts. If linker scripts could be replaced with Zig code, Zig would end up being an extremely elegant solution for embedded firmware in particular. As far as I see it, there's two parts to solving this: 1. Linking can not be handled by compile time evaluation, but compile time constant values/structures should be available to the linker scripts. Some values, such as fixed memory regions and addresses, could be calculated at compile time. These values are generally useful for both the Zig runtime code itself, and to the linker script. There may be some work to define compile time functions, and pre-defined variable names or struct types that the linker can use. 2. Define a way for Zig code to run at link time, and define functions and data structures that gives the Zig linker code information about the sizes and flags of sections , and instruct the linker how code and data should be laid out in memory. This feature may be dependent on the Zig self-hos
Posted by skyfex on Sep 10, 2019, 10:19 AM
Tags
Related issues
- Some good points here, and I definitely hate the "unalive" movement but like someone else said, it has gone beyond self-censorship to in-...
- It’s hard to take the article seriously when there’s no real discussion about how consciousness is defined and it takes Anthropic’s views...
- you know what i hate?
- > I honestly do not understand why any average person would buy anything else than a macbook today.
- Codex App frequently freezes/stutters on Windows 11 Pro despite sufficient system resources
- Add "Basic" and "Standard" plans
Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments
ux (SaaS)
Some good points here, and I definitely hate the "unalive" movement but like someone else said, it has gone beyond self-censorship to in-...
It’s hard to take the article seriously when there’s no real discussion about how consciousness is defined and it takes Anthropic’s views...
you know what i hate?
> I honestly do not understand why any average person would buy anything else than a macbook today.
Codex App frequently freezes/stutters on Windows 11 Pro despite sufficient system resources
Add "Basic" and "Standard" plans
FEATURE: Multi-window support in Claude Code Desktop
Hi HN I built CookPal to solve a small but annoying problem for myself: I kept saving recipes from websites, TikTok, YouTube, and Instag...
Linker scripts must die
Sorry for the cheesy title, feel free to change it With the current state and plans of Zig, it's looking like the only case where you need a language other than Zig for writing firmware/software, is if you need a custom linker script. What's worse, the documentation for GCC/LLD linker scripts are not all that great, and they can be hard to understand. The scripting language is also not really powerful enough on its own to do more complex things, so I've seen a case where the C preprocessor has been used to generate linker scripts. If linker scripts could be replaced with Zig code, Zig would end up being an extremely elegant solution for embedded firmware in particular. As far as I see it, there's two parts to solving this: 1. Linking can not be handled by compile time evaluation, but compile time constant values/structures should be available to the linker scripts. Some values, such as fixed memory regions and addresses, could be calculated at compile time. These values are generally useful for both the Zig runtime code itself, and to the linker script. There may be some work to define compile time functions, and pre-defined variable names or struct types that the linker can use. 2. Define a way for Zig code to run at link time, and define functions and data structures that gives the Zig linker code information about the sizes and flags of sections , and instruct the linker how code and data should be laid out in memory. This feature may be dependent on the Zig self-hos
Comments (0)
No comments yet. Start the discussion.