7.6.2.1 General

  • -Wl,option

    Pass option as an option to the linker. If the option contains commas, it splits into multiple options at the commas. You can use this syntax to pass an argument to the option. For example, `-Wl,-Map,output.map' passes `-Map output.map' to the linker.

  • -Wl, -nostartfiles

    Do not use the standard system startup files when linking. The standard system libraries are normally used unless using -nostdlib or -nodefaultlibs.

  • -Wl,-nodefault

    Do not use the standard system libraries when linking. Onlythe specified libraries will be passed to the linker. Options specifying linkage of the system libraries, such as -static-libgcc or -shared-libgcc, will be ignored. The standard start-up files are normally used, unless using -nostartfiles. The compiler may generate calls to memcmp, memset, memcpy, and memmove. Entries in libc can solve these entries. These entry points should be supplied through some other mechanism when this option is specified.

  • -Wl,-nostdlib

    Do not use the standard system start-up files or libraries when linking.

    One of the standard libraries bypassed by -nostdlib and -nodefaultlibs is libgcc.a, a library of internal subroutines that GCC uses to overcome shortcomings of particular machines or special needs for some languages. In most cases, you need libgcc.a even when avoiding other standard libraries. In other words, when you specify -nostdlib or -nodefaultlibs, you should usually specify -lgcc as well, which ensures that you have no unresolved references to internal GCC library subroutines.

  • -Wl,-s

    Remove all symbol table and relocation information from the executable.

  • -Wl,-static

    On systems that support dynamic linking, this prevents linking with the shared libraries. On other systems, this option has no effect.