7.3.3.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 -nostdlib or -nodefaultlibs is used.

  • -Wl,-nodefault

    Do not use the standard system libraries when linking. Only the 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. Usually, the standard start-up files are used, unless using -nostartfiles. The compiler may generate calls to memcmp, memset, memcpy, and memmove. These entries are usually resolved by entries in libc and 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 to ensure 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.

  • -Wl,-Map

    Generates Map file.