Where is int main() defined as weak ? and what about main return value ?

I assume you were not talking to me.
I am very familiar with the linking process, symbols and their attributes, startup code, how library archive files are used/work as well as the more recent LTO capabilities.
I go way back to the early 80s, back when you wrote makefiles by hand and had to explicitly use ranlib on your library archives.
None of what I said conflicts with anything that you just stated.

i.e. when you build an image with the Arduino IDE, the avr-gcc startup code for the particular target processor gets pulled in and that startup code is what has the reference to main()

I was involved with gcc in its early days back in the late 80's primarily on the 68k processors, even heavily argued with Stallman over providing compiler options for structure packing, even added it to the 68k compiler at the time. (Stallman was absolutely opposed to it - He lost).
I also got involved with some porting and back porting code into the gcc linker and archiver when Michael Tiemann founded Cygnus and attempted to take control of the gcc toolset (or at least monetize it) after he did a 29k implementation and then altered the gcc library archive format.
He then tried to charge everyone a licensing fee and/or support fee to use his non GPL linker and archiver code to be able to link images using the new format - which was now the default in gcc.
I made sure that anybody could simply rebuild the archiver and linker to use the old format and not have to pay his "extortion" fee.
Soon after, this was all resolved since he lost all his leverage.

--- bill

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.