# Zig on STM32: huge binary after update to 0.12

**URL:** <https://ziggit.dev/t/zig-on-stm32-huge-binary-after-update-to-0-12/4353>\
**Category:** Help\
**Tags:** embedded, c, compiler, build-system\
**Created:** [May 17, 2024, 12:12pm UTC](https://ziggit.dev/t/zig-on-stm32-huge-binary-after-update-to-0-12/4353 "2024-05-17T12:12:18Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Sazerac](https://ziggit.dev/user_avatar/ziggit.dev/sazerac/32/2084_2.png) [@Sazerac](https://ziggit.dev/u/Sazerac)\
**Post date:** [May 21, 2024, 11:55am UTC](https://ziggit.dev/t/zig-on-stm32-huge-binary-after-update-to-0-12/4353/8 "2024-05-21T11:55:56Z")

</div>

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

```zig
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](https://ziggit.dev/t/static-linking-newlibc-as-libc-freestanding-on-arm-zig-c-libraries/3078/5) 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 ?

---

_[View the full topic](https://ziggit.dev/t/zig-on-stm32-huge-binary-after-update-to-0-12/4353)._
