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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759383047, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/C-C-plus-plus/GCC/options/no/compare-nostartfiles-nodefaultlibs-nolibc-nostdlib(98): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78