https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125194

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Georg-Johann Lay <[email protected]>:

https://gcc.gnu.org/g:701c41191413fdcfeea33b8f49cfebf62b8a6135

commit r17-506-g701c41191413fdcfeea33b8f49cfebf62b8a6135
Author: Georg-Johann Lay <[email protected]>
Date:   Thu May 14 10:21:28 2026 +0200

    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).

Reply via email to