Zig on STM32: huge binary after update to 0.12

Thank you for these insights, @haydenridd.
To resolve the issue, I have used the following instruction: elf.link_gc_sections = true;
Option summary:

elf.entry = .{ .symbol_name = "Reset_Handler" }; 
elf.want_lto = false; // -flto
elf.link_data_sections = true; // -fdata-sections
elf.link_function_sections = true; // -ffunction-sections
elf.link_gc_sections = true; // -Wl,--gc-sections

Notes:

  • The NOLOAD section is required for the _user_heap_stack symbol (See this topic for details.
  • I have corrected v7e-m+dp to v7e-m+fp (Upon verification, my component only has a single-precision FPU).
  • Regarding the Reset_Handler, I am uncertain as well. The linker script already sets it.

I have committed the fixes.

Bonus question:

  • How can I enable float parsing with the libc ( -u _printf_float linker option) ?
  • Is it possible to generate a .map file using lld ?
1 Like