use a declarative table for CLI linker argument parsing #14663
Labels
contributor friendly
This issue is limited in scope and/or knowledge of Zig internals.
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
zig cc
Zig as a drop-in C compiler feature
Milestone
In Zig's CLI, linker arguments are parsed here:
zig/src/main.zig
Lines 1788 to 2222 in 705e9cb
The problem is that it's not a complete list, and some aliased forms are not supported. A declarative table of linker arguments would be easier to compare against other linker implementations. The table could also be initially seeded by examining the output of LLD's Options.td files, for example.
Note that some linker arguments are special-cased and handled inline with other arguments, like this:
zig/src/main.zig
Lines 1606 to 1668 in 705e9cb
It is important to keep this logic how it is, but it could integrate with a declarative linker arg parsing system if it were flexible enough.
I think the key here is going to be not making the API too abstract. Something akin to a "linker argument iterator" might work nicely.
This will improve the robustness of zig cc as a drop-in linker.
The text was updated successfully, but these errors were encountered: