On Wed Aug 23, 2023 at 3:57 PM EEST, Jo Van Bulck wrote: > On 22.08.23 12:14, Jarkko Sakkinen wrote: > > Do you still need nostdfiles and nostartfiles with freestanding? > > Thanks, good question. I tested that compiling with only -ffreestanding > yields: > > /* snipped */ > /usr/local/bin/ld: > /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/rcrt1.o: in > function `_start': > (.text+0x24): undefined reference to `main' > /* snipped */ > > So we definitely still need -nostartfiles to prevent the compiler/linker > from introducing the standard system startup functions. However, in my > understanding, -nostdlib (which is what I assume you mean with > nostdfiles) already implies the individual options -nodefaultlibs and > -nostartfiles. > > Thus, we definitely still need -nostartfiles and I'm not 100% sure we > don't need -nostdlib (though it compiles fine for me with only > -nostartfiles). Gcc only specifies: > > -ffreestanding > Assert that compilation targets a freestanding environment. This > implies -fno-builtin. A freestanding environment is one in which the > standard library may not exist, and program startup may not necessarily > be at "main". > > Bottom line: I suggest to keep -nostdlib to be sure and remove > -nostartfiles (as it is redundant). I'll include this in the next patch > iteration. > > Best, > Jo OK, cool, sounds like plan. BR, Jarkko