Search notes:

GCC options: compare -nostartfiles, -nodefaultlibs, -nolibc, -nostdlib

Compare the effect of the gnu options -nodefaultlibs, -nostartfiles and -nostdlib.
TODO: -nolibc is apparently only available with GCC 8.2.

Mingw

The following table shows how the various gcc options influence some linker options of MinGW.
-nostartfiles -nodefaultlibs -nolibc -nostdlib
…/crt2.o yes ?
…/crtbegin.o yes ?
-lmingw32 yes ?
-lgcc yes ?
-lgcc_eh yes ?
-lmoldname yes ?
-lmingwex yes ?
-lmsvcrt yes ?
-lpthread yes ?
-ladvapi32 yes ?
-lshell32 yes ?
-luser32 yes ?
-lkernel32 yes ?
-liconv yes ?
-lmingw32 yes ?
-lgcc yes ?
-lgcc_eh yes ?
-lmoldname yes ?
-lmingwex yes ?
-lmsvcrt yes ?
…/crtend.o yes ?
-nostdlib seems to be a combination of -nostartfiles and -nodefaultlibs and (as the option name implies) prevents any standard library from being linked with the executable.

Linux

On Linux, I got these differences:
-nostartfiles -nodefaultlibs -nolibc -nostdlib
/usr/lib/Scrt1.o yes ?
/usr/lib/crt1.o yes ?
…/crtbeginS.o yes ?
-lgcc yes ?
-lgcc_s yes ?
-lc yes ?
…/crtendS.o yes ?
/usr/lib/crtn.o yes ?

See also

GCC options
The Standard C Library

Index