Page 1 of 1
How gcc fills up crti.S
Posted: Fri Jan 31, 2020 3:02 pm
by siavoshkc
In meaty skeleton, in file crti.S there is a remark noting "/* gcc will nicely put the contents of crtbegin.o's .init section here. */". I am confused. Where is this crtbegin.o? And how gcc knows to fill crti.S with it?
Re: How gcc fills up crti.S
Posted: Sat Feb 01, 2020 2:27 am
by Octocontrabass
siavoshkc wrote:Where is this crtbegin.o?
It's provided by GCC.
siavoshkc wrote:And how gcc knows to fill crti.S with it?
You tell it to do that in the makefile. The linker automatically combines sections with the same name in the order they're linked. There are sections named ".init" and ".fini" in crtbegin.o, just like the ones in crti.S, and crti.o is linked before crtbegin.o.
Re: How gcc fills up crti.S
Posted: Sat Feb 01, 2020 10:09 am
by siavoshkc
There was no explanation about this in the meaty skeleton page. Maybe a good idea to add a section about this.
Is there any page explaining those file sources?
Re: How gcc fills up crti.S
Posted: Sun Feb 02, 2020 3:50 am
by Octocontrabass