Zig cc huge intermediate binary objects

Yes you can see everything in the first forum post that I did on the topic Static linking newlibc as libc, freestanding on ARM, zig + c libraries - #2 by simoneruffini
There you can find the link to the repo… unfortunately I link to custom-arm libc (newlib nano) that is available only by installing a package (on arch arm-none-eabi-newlib and arm-none-eabi-gcc, arm-none-eabi-binutils to build with make). I have to do this because zig doesn’t have the libc for this specific freestanding target (embedded platorm).

Maybe the linker step is not fully the problem because the makefile built elf has malloc, realloc and free symbols too. But I just did a test to see if all the symbols of the makefile built elf are in the zig elf and they are not (the zig one especially misses some important ones like ErrorHandler), here the output:

simone@simone-thinkpad> diff <(arm-none-eabi-nm build/test.elf | cut -d" " -f3|sort) <(arm-none-eabi-nm zig-out/bin/test.elf | cut -d" " -f3|sort )                                                                                                            ~/Documents/test/stm32f446re
0a1,4
>
>
>
> abs
2,3d5
< __aeabi_idiv0
< __aeabi_ldiv0
47d48
< Error_Handler
60,62d60
< filtered_sample15.7
< filtered_sample31.4
< filtered_sample7.10
75,76d72
< HAL_Delay
< HAL_GetTick
78,98d73
< HAL_GPIO_WritePin
< HAL_IncTick
< HAL_Init
< HAL_InitTick
< HAL_MspInit
< HAL_NVIC_SetPriority
< HAL_NVIC_SetPriorityGrouping
< HAL_RCC_ClockConfig
< HAL_RCC_GetHCLKFreq
< HAL_RCC_GetPCLK1Freq
< HAL_RCC_GetPCLK2Freq
< HAL_RCC_GetSysClockFreq
< HAL_RCC_OscConfig
< HAL_SYSTICK_Config
< HAL_TIM_Base_Init
< HAL_TIM_Base_MspInit
< HAL_TIM_Base_Start
< HAL_TIMEx_MasterConfigSynchronization
< HAL_UART_Init
< HAL_UART_MspInit
< HAL_UART_Transmit
101,103d75
< hmedfilt15.14
< hmedfilt31.13
< hmedfilt7.15
118a91
> .L_MergedGlobals
122a96,117
> main.filtered_sample15
> main.filtered_sample31
> main.filtered_sample7
> main.hmedfilt15.2
> main.hmedfilt15.3
> main.hmedfilt15.4
> main.hmedfilt31.2
> main.hmedfilt31.3
> main.hmedfilt31.4
> main.hmedfilt7.2
> main.hmedfilt7.3
> main.hmedfilt7.4
> main.medfilt_wndw15
> main.medfilt_wndw31
> main.medfilt_wndw7
> main.sample_cnt
> main.time_end15
> main.time_end31
> main.time_end7
> main.time_start15
> main.time_start31
> main.time_start7
129,133d123
< MEDFILT_Init
< MEDFILT_Insert
< medfilt_wndw15.1
< medfilt_wndw31.2
< medfilt_wndw7.0
138d127
< memset
141,143d129
< MX_GPIO_Init
< MX_TIM7_Init
< MX_USART2_UART_Init
145,146d130
< NVIC_EncodePriority
< __NVIC_SetPriority
170d153
< sample_cnt.12
192d174
< SystemClock_Config
211,217d192
< TIM_Base_SetConfig
< time_end15.6
< time_end31.3
< time_end7.9
< time_start15.8
< time_start31.5
< time_start7.11
220,221d194
< UART_SetConfig
< UART_WaitOnFlagUntilTimeout
229d201
< uwTickFreq