Open leecannon opened 2 years ago
A linker script with a section containing a KEEP directive and with a symbol exported into that section is not present in the binary if LTO is enabled.
in linker script:
.stivale2hdr ALIGN(4K) : { KEEP(*(.stivale2hdr)) } :rodata
in root zig file:
pub export const header linksection(".stivale2hdr") = // struct initalization here
If want_lto is set to false or null then the binary will contain the stivale2hdr section
want_lto
stivale2hdr
Next step will be to file an upstream bug report to LLD/LLVM.
A linker script with a section containing a KEEP directive and with a symbol exported into that section is not present in the binary if LTO is enabled.
in linker script:
in root zig file:
If
want_lto
is set to false or null then the binary will contain thestivale2hdr
section