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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Georg-Johann Lay <g...@gcc.gnu.org>:

https://gcc.gnu.org/g:0fa06d7fd7820e0d60fd8da381ec45175a675c80

commit r15-7493-g0fa06d7fd7820e0d60fd8da381ec45175a675c80
Author: Georg-Johann Lay <a...@gjlay.de>
Date:   Sun Feb 9 10:55:20 2025 +0100

    AVR: target/118806 - Add -mno-call-main to tweak running main().

    On devices with very limited resources, it may be desirable to run
    main in a more efficient way than provided by the startup code

       XCALL main
       XJMP  exit

    from section .init9.  In AVR-LibC v2.3, that code has been moved to
    libmcu.a, hence symbol __call_main can be satisfied so that the
    respective code is no more pulled in from that library.
    Instead, main can be run by putting it in section .init9.

    The patch adds attributes noreturn and section(".init9"), and
    sets __call_main=0 when it encounters main().

    gcc/
            PR target/118806
            * config/avr/avr.opt (-mcall-main): New option and...
            (avropt_call_main): ...variable.
            * config/avr/avr.cc (avr_no_call_main_p): New variable.
            (avr_insert_attributes) [-mno-call-main, main]: Add attributes
            noreturn and section(".init9") to main.  Set avr_no_call_main_p.
            (avr_file_end) [avr_no_call_main_p]: Define symbol __call_main.
            * doc/invoke.texi (AVR Options) <-mno-call-main>: Document.
            <-mnodevicelib>: Extend explanation.

Reply via email to