gnu/gcc/701c41191413fdcfeea33b8f49cfebf62b8a6135 AVR: target/125194 - Make -mno-call-main work with -flto.
Instead of emitting .global __call_main + __call_main=0 in some
module, it uses a %{mno-call-main: --defsym __call_main=0} spec.
The problem with the old implementation is that avr_no_call_main_p
was set by cc1[plus] (in avr_insert_attributes) but used by lto1
(in avr_file_end). The new approach uses --defsym __call_main=0
in order to avoid link fails due to multiple definitions of __call_main
in *.o and lib<mcu>.a.
PR target/125194
gcc/
* config/avr/avr.cc (avr_no_call_main_p): Remove variable...
(avr_file_end): ...and code that uses it.
(avr_insert_attributes): Same. Add "used" to main attributes
when -mno-call-main.
* config/avr/gen-avr-mmcu-specs.cc (print_mcu): Emit code
for link_no_call_main specs.
* config/avr/specs.h (LINK_SPEC): Add %(link_no_call_main).
3 files changed