https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125194
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
mcall-main
Target Var(avropt_call_main) UInteger Init(1)
Call main and exit (default).
lacks a 'Save' flag, if provided the specified option would prevail as
function specific(!) target option and avropt_call_main could be checked.
The target option should also be present on the linker command, it should
be in the lto_opts section of the LTO objects and merged, but it requires
"consistent" use on all inputs as the merging process simply picks the "first"
explcit(!) setting.
So I think
gcc -c tN.c -flto
gcc tN.o -flto -mno-call-main
should work in all cases,
gcc -c t1.c -mno-call-main -flto
gcc -c t2.c -flto
gcc t1.o t2.o
should also work, but
gcc -c t1.c -mcall-main -flto
gcc -c t2.c -mno-call-main -flto
gcc t1.o t2.o -o a1
gcc t2.o t1.o -o a2
will behave differently for a1 and a2.