neulab/tldr huggingface dataset:
Note that the value of "__attribute__ ((patchable_function_entry (N,M)))" takes precedence over command-line option -fpatchable-function-entry=N,M.  This can be used to increase the area size or to remove it completely on a single function.  If "N=0", no pad location is recorded.
The NOP instructions are inserted at---and maybe before, depending on M---the function entry address, even before the prologue.
The maximum value of N and M is 65535.
Options Controlling the Preprocessor These options control the C preprocessor, which is run on each C source file before actual compilation.
If you use the -E option, nothing is done except preprocessing.  Some of these options make sense only together with -E because they cause the preprocessor output to be unsuitable for actual compilation.
In addition to the options listed here, there are a number of options to control search paths for include files documented in Directory Options. Options to control preprocessor diagnostics are listed in Warning Options.
-D name Predefine name as a macro, with definition 1.
-D name=definition The contents of definition are tokenized and processed as if they appeared during translation phase three in a #define directive.  In particular, the definition is truncated by embedded newline characters.
If you are invoking the preprocessor from a shell or shell-like program you may need to use the shell's quoting syntax to protect characters such as spaces that have a meaning in the shell syntax.
If you wish to define a function-like macro on the command line, write its argument list with surrounding parentheses before the equals sign (if any).  Parentheses are meaningful to most shells, so you should quote the option.  With sh and csh, -D'name(args...)=definition' works.
-D and -U options are processed in the order they are given on the command line.  All -imacros file and -include file options are processed after all -D and -U options.
-U name Cancel any previous definition of name, either built in or provided with a -D option.
-include file Process file as if "#include "file"" appeared as the first line of the primary source file.  However, the first directory searched for file is the preprocessor's working directory instead of the directory containing the main source file.  If not found there, it is searched for in the remainder of the "#include "..."" search chain as normal.
If multiple -include options are given, the files are included in the order they appear on the command line.
-imacros file Exactly like -include, except that any output produced by scanning file is thrown away.  Macros it defines remain defined.  This allows you to acquire all the macros from a header without also processing its declarations.
All files specified by -imacros are processed before all files specified by -include.
-undef Do not predefine any system-specific or GCC-specific macros.  The standard predefined macros remain defined.
-pthread Define additional macros required for using the POSIX threads library.  You should use this option consistently for both compilation and linking.  This option is supported on GNU/Linux targets, most other Unix derivatives, and also on x86 Cygwin and MinGW targets.
-M  Instead of outputting the result of preprocessing, output a rule suitable for make describing the dependencies of the main source file.  The preprocessor outputs one make rule containing the object file name for that source file, a colon, and the names of all the included files, including those coming from -include or -imacros command-line options.
Unless specified explicitly (with -MT or -MQ), the object file name consists of the name of the source file with any suffix replaced with object file suffix and with any leading directory parts removed.  If there are many included files then the rule is split into several lines using \-newline.  The rule has no commands.
This option does not suppress the preprocessor's debug output, such as -dM.  To avoid mixing such debug output with the dependency rules you should explicitly specify the dependency output file with -MF, or use an environment variable like DEPENDENCIES_OUTPUT.  Debug output is still sent to the regular output stream as normal.
Passing -M to the driver implies -E, and suppresses warnings with an implicit -w.
-MM Like -M but do not mention header files that are found in system header directories, nor header files that are included, directly or indirectly, from such a header.
This implies that the choice of angle brackets or double quotes in an #include directive does not in itself determine whether that header appears in -MM dependency output.
-MF file When used with -M or -MM, specifies a file to write the dependencies to.  If no -MF switch is given the preprocessor sends the rules to the same place it would send preprocessed output.
When used with the driver options -MD or -MMD, -MF overrides the default dependency output file.
If file is -, then the dependencies are written to stdout.
-MG In conjunction with an option such as -M requesting dependency generation, -MG assumes missing header files are generated files and adds them to the dependency list without raising an error.  The dependency filename is taken directly from the "#include" directive without prepending any path.  -MG also suppresses preprocessed output, as a missing header file renders this useless.
This feature is used in automatic updating of makefiles.
-Mno-modules Disable dependency generation for compiled module interfaces.
-MP This option instructs CPP to add a phony target for each dependency other than the main file, causing each to depend on nothing.  These dummy rules work around errors make gives if you remove header files without updating the Makefile to match.
This is typical output:
test.o: test.c test.h
test.h:
-MT target Change the target of the rule emitted by dependency generation.  By default CPP takes the name of the main input file, deletes any directory components and any file suffix such as .c, and appends the platform's usual object suffix.  The result is the target.
An -MT option sets the target to be exactly the string you specify. If you want multiple targets, you can specify them as a single argument to -MT, or use multiple -MT options.
For example, -MT '$(objpfx)foo.o' might give
$(objpfx)foo.o: foo.c
-MQ target Same as -MT, but it quotes any characters which are special to Make. -MQ '$(objpfx)foo.o' gives
$$(objpfx)foo.o: foo.c
The default target is automatically quoted, as if it were given with -MQ.
-MD -MD is equivalent to -M -MF file, except that -E is not implied.  The driver determines file based on whether an -o option is given.  If it is, the driver uses its argument but with a suffix of .d, otherwise it takes the name of the input file, removes any directory components and suffix, and applies a .d suffix.
If -MD is used in conjunction with -E, any -o switch is understood to specify the dependency output file, but if used without -E, each -o is understood to specify a target object file.
Since -E is not implied, -MD can be used to generate a dependency output file as a side effect of the compilation process.
-MMD Like -MD except mention only user header files, not system header files.
-fpreprocessed Indicate to the preprocessor that the input file has already been preprocessed.  This suppresses things like macro expansion, trigraph conversion, escaped newline splicing, and processing of most directives.  The preprocessor still recognizes and removes comments, so that you can pass a file preprocessed with -C to the compiler without problems.  In this mode the integrated preprocessor is little more than a tokenizer for the front ends.
-fpreprocessed is implicit if the input file has one of the extensions .i, .ii or .mi.  These are the extensions that GCC uses for preprocessed files created by -save-temps.
-fdirectives-only When preprocessing, handle directives, but do not expand macros.
The option's behavior depends on the -E and -fpreprocessed options.
With -E, preprocessing is limited to the handling of directives such as "#define", "#ifdef", and "#error".  Other preprocessor operations, such as macro expansion and trigraph conversion are not performed. In addition, the -dD option is implicitly enabled.
With -fpreprocessed, predefinition of command line and most builtin macros is disabled.  Macros such as "__LINE__", which are contextually dependent, are handled normally.  This enables compilation of files previously preprocessed with "-E -fdirectives-only".
With both -E and -fpreprocessed, the rules for -fpreprocessed take precedence.  This enables full preprocessing of files previously preprocessed with "-E -fdirectives-only".
-fdollars-in-identifiers Accept $ in identifiers.
-fextended-identifiers Accept universal character names and extended characters in identifiers.  This option is enabled by default for C99 (and later C standard versions) and C++.
-fno-canonical-system-headers When preprocessing, do not shorten system header paths with canonicalization.
-fmax-include-depth=depth Set the maximum depth of the nested #include. The default is 200.
-ftabstop=width Set the distance between tab stops.  This helps the preprocessor report correct column numbers in warnings or errors, even if tabs appear on the line.  If the value is less than 1 or greater than 100, the option is ignored.  The default is 8.
-ftrack-macro-expansion[=level] Track locations of tokens across macro expansions. This allows the compiler to emit diagnostic about the current macro expansion stack when a compilation error occurs in a macro expansion. Using this option makes the preprocessor and the compiler consume more memory. The level parameter can be used to choose the level of precision of token location tracking thus decreasing the memory consumption if necessary. Value 0 of level de-activates this option. Value 1 tracks tokens locations in a degraded mode for the sake of minimal memory overhead. In this mode all tokens resulting from the expansion of an argument of a function-like macro have the same location. Value 2 tracks tokens locations completely. This value is the most memory hungry.  When this option is given no argument, the default parameter value is 2.
Note that "-ftrack-macro-expansion=2" is activated by default.
-fmacro-prefix-map=old=new When preprocessing files residing in directory old, expand the "__FILE__" and "__BASE_FILE__" macros as if the files resided in directory new instead.  This can be used to change an absolute path to a relative path by using . for new which can result in more reproducible builds that are location independent.  This option also affects "__builtin_FILE()" during compilation.  See also -ffile-prefix-map.
-fexec-charset=charset Set the execution character set, used for string and character constants.  The default is UTF-8.  charset can be any encoding supported by the system's "iconv" library routine.
-fwide-exec-charset=charset Set the wide execution character set, used for wide string and character constants.  The default is UTF-32 or UTF-16, whichever corresponds to the width of "wchar_t".  As with -fexec-charset, charset can be any encoding supported by the system's "iconv" library routine; however, you will have problems with encodings that do not fit exactly in "wchar_t".
-finput-charset=charset Set the input character set, used for translation from the character set of the input file to the source character set used by GCC.  If the locale does not specify, or GCC cannot get this information from the locale, the default is UTF-8.  This can be overridden by either the locale or this command-line option.  Currently the command-line option takes precedence if there's a conflict.  charset can be any encoding supported by the system's "iconv" library routine.
-fpch-deps When using precompiled headers, this flag causes the dependency- output flags to also list the files from the precompiled header's dependencies.  If not specified, only the precompiled header are listed and not the files that were used to create it, because those files are not consulted when a precompiled header is used.
-fpch-preprocess This option allows use of a precompiled header together with -E.  It inserts a special "#pragma", "#pragma GCC pch_preprocess "filename"" in the output to mark the place where the precompiled header was found, and its filename.  When -fpreprocessed is in use, GCC recognizes this "#pragma" and loads the PCH.
This option is off by default, because the resulting preprocessed output is only really suitable as input to GCC.  It is switched on by -save-temps.
You should not write this "#pragma" in your own code, but it is safe to edit the filename if the PCH file is available in a different location.  The filename may be absolute or it may be relative to GCC's current directory.
-fworking-directory Enable generation of linemarkers in the preprocessor output that let the compiler know the current working directory at the time of preprocessing.  When this option is enabled, the preprocessor emits, after the initial linemarker, a second linemarker with the current working directory followed by two slashes.  GCC uses this directory, when it's present in the preprocessed input, as the directory emitted as the current working directory in some debugging information formats.  This option is implicitly enabled if debugging information is enabled, but this can be inhibited with the negated form -fno-working-directory.  If the -P flag is present in the command line, this option has no effect, since no "#line" directives are emitted whatsoever.
-A predicate=answer Make an assertion with the predicate predicate and answer answer. This form is preferred to the older form -A predicate(answer), which is still supported, because it does not use shell special characters.
-A -predicate=answer Cancel an assertion with the predicate predicate and answer answer.
-C  Do not discard comments.  All comments are passed through to the output file, except for comments in processed directives, which are deleted along with the directive.
You should be prepared for side effects when using -C; it causes the preprocessor to treat comments as tokens in their own right.  For example, comments appearing at the start of what would be a directive line have the effect of turning that line into an ordinary source line, since the first token on the line is no longer a #.
-CC Do not discard comments, including during macro expansion.  This is like -C, except that comments contained within macros are also passed through to the output file where the macro is expanded.
In addition to the side effects of the -C option, the -CC option causes all C++-style comments inside a macro to be converted to C-style comments.  This is to prevent later use of that macro from inadvertently commenting out the remainder of the source line.
The -CC option is generally used to support lint comments.
-P  Inhibit generation of linemarkers in the output from the preprocessor.  This might be useful when running the preprocessor on something that is not C code, and will be sent to a program which might be confused by the linemarkers.
-traditional -traditional-cpp Try to imitate the behavior of pre-standard C preprocessors, as opposed to ISO C preprocessors.  See the GNU CPP manual for details.
Note that GCC does not otherwise attempt to emulate a pre-standard C compiler, and these options are only supported with the -E switch, or when invoking CPP explicitly.
-trigraphs Support ISO C trigraphs.  These are three-character sequences, all starting with ??, that are defined by ISO C to stand for single characters.  For example, ??/ stands for \, so '??/n' is a character constant for a newline.
The nine trigraphs and their replacements are
Trigraph:       ??(  ??)  ??<  ??>  ??=  ??/  ??'  ??!  ??- Replacement:      [    ]    {    }    #    \    ^    |    ~
By default, GCC ignores trigraphs, but in standard-conforming modes it converts them.  See the -std and -ansi options.
-remap Enable special code to work around file systems which only permit very short file names, such as MS-DOS.
-H  Print the name of each header file used, in addition to other normal activities.  Each name is indented to show how deep in the #include stack it is.  Precompiled header files are also printed, even if they are found to be invalid; an invalid precompiled header file is printed with ...x and a valid one with ...! .
-dletters Says to make debugging dumps during compilation as specified by letters.  The flags documented here are those relevant to the preprocessor.  Other letters are interpreted by the compiler proper, or reserved for future versions of GCC, and so are silently ignored. If you specify letters whose behavior conflicts, the result is undefined.
-dM Instead of the normal output, generate a list of #define directives for all the macros defined during the execution of the preprocessor, including predefined macros.  This gives you a way of finding out what is predefined in your version of the preprocessor.  Assuming you have no file foo.h, the command
touch foo.h; cpp -dM foo.h
shows all the predefined macros.
If you use -dM without the -E option, -dM is interpreted as a synonym for -fdump-rtl-mach.
-dD Like -dM except in two respects: it does not include the predefined macros, and it outputs both the #define directives and the result of preprocessing.  Both kinds of output go to the standard output file.
-dN Like -dD, but emit only the macro names, not their expansions.
-dI Output #include directives in addition to the result of preprocessing.
-dU Like -dD except that only macros that are expanded, or whose definedness is tested in preprocessor directives, are output; the output is delayed until the use or test of the macro; and #undef directives are also output for macros tested but undefined at the time.
-fdebug-cpp This option is only useful for debugging GCC.  When used from CPP or with -E, it dumps debugging information about location maps.  Every token in the output is preceded by the dump of the map its location belongs to.
When used from GCC without -E, this option has no effect.
-Wp,option You can use -Wp,option to bypass the compiler driver and pass option directly through to the preprocessor.  If option contains commas, it is split into multiple options at the commas.  However, many options are modified, translated or interpreted by the compiler driver before being passed to the preprocessor, and -Wp forcibly bypasses this phase.  The preprocessor's direct interface is undocumented and subject to change, so whenever possible you should avoid using -Wp and let the driver handle the options instead.
-Xpreprocessor option Pass option as an option to the preprocessor.  You can use this to supply system-specific preprocessor options that GCC does not recognize.
If you want to pass an option that takes an argument, you must use -Xpreprocessor twice, once for the option and once for the argument.
-no-integrated-cpp Perform preprocessing as a separate pass before compilation.  By default, GCC performs preprocessing as an integrated part of input tokenization and parsing.  If this option is provided, the appropriate language front end (cc1, cc1plus, or cc1obj for C, C++, and Objective-C, respectively) is instead invoked twice, once for preprocessing only and once for actual compilation of the preprocessed input.  This option may be useful in conjunction with the -B or -wrapper options to specify an alternate preprocessor or perform additional processing of the program source between normal preprocessing and compilation.
-flarge-source-files Adjust GCC to expect large source files, at the expense of slower compilation and higher memory usage.
Specifically, GCC normally tracks both column numbers and line numbers within source files and it normally prints both of these numbers in diagnostics.  However, once it has processed a certain number of source lines, it stops tracking column numbers and only tracks line numbers.  This means that diagnostics for later lines do not include column numbers.  It also means that options like -Wmisleading-indentation cease to work at that point, although the compiler prints a note if this happens.  Passing -flarge-source-files significantly increases the number of source lines that GCC can process before it stops tracking columns.
Passing Options to the Assembler You can pass options to the assembler.
-Wa,option Pass option as an option to the assembler.  If option contains commas, it is split into multiple options at the commas.
-Xassembler option Pass option as an option to the assembler.  You can use this to supply system-specific assembler options that GCC does not recognize.
If you want to pass an option that takes an argument, you must use -Xassembler twice, once for the option and once for the argument.
Options for Linking These options come into play when the compiler links object files into an executable output file.  They are meaningless if the compiler is not doing a link step.
object-file-name A file name that does not end in a special recognized suffix is considered to name an object file or library.  (Object files are distinguished from libraries by the linker according to the file contents.)  If linking is done, these object files are used as input to the linker.
-c -S -E  If any of these options is used, then the linker is not run, and object file names should not be used as arguments.
-flinker-output=type This option controls code generation of the link-time optimizer.  By default the linker output is automatically determined by the linker plugin.  For debugging the compiler and if incremental linking with a non-LTO object file is desired, it may be useful to control the type manually.
If type is exec, code generation produces a static binary. In this case -fpic and -fpie are both disabled.
If type is dyn, code generation produces a shared library.  In this case -fpic or -fPIC is preserved, but not enabled automatically. This allows to build shared libraries without position-independent code on architectures where this is possible, i.e. on x86.
If type is pie, code generation produces an -fpie executable. This results in similar optimizations as exec except that -fpie is not disabled if specified at compilation time.
If type is rel, the compiler assumes that incremental linking is done.  The sections containing intermediate code for link-time optimization are merged, pre-optimized, and output to the resulting object file. In addition, if -ffat-lto-objects is specified, binary code is produced for future non-LTO linking. The object file produced by incremental linking is smaller than a static library produced from the same object files.  At link time the result of incremental linking also loads faster than a static library assuming that the majority of objects in the library are used.
Finally nolto-rel configures the compiler for incremental linking where code generation is forced, a final binary is produced, and the intermediate code for later link-time optimization is stripped. When multiple object files are linked together the resulting code is better optimized than with link-time optimizations disabled (for example, cross-module inlining happens), but most of benefits of whole program optimizations are lost.
During the incremental link (by -r) the linker plugin defaults to rel. With current interfaces to GNU Binutils it is however not possible to incrementally link LTO objects and non-LTO objects into a single mixed object file.  If any of object files in incremental link cannot be used for link-time optimization, the linker plugin issues a warning and uses nolto-rel. To maintain whole program optimization, it is recommended to link such objects into static library instead. Alternatively it is possible to use H.J. Lu's binutils with support for mixed objects.
-fuse-ld=bfd Use the bfd linker instead of the default linker.
-fuse-ld=gold Use the gold linker instead of the default linker.
-fuse-ld=lld Use the LLVM lld linker instead of the default linker.
-llibrary -l library Search the library named library when linking.  (The second alternative with the library as a separate argument is only for POSIX compliance and is not recommended.)
The -l option is passed directly to the linker by GCC.  Refer to your linker documentation for exact details.  The general description below applies to the GNU linker.
The linker searches a standard list of directories for the library. The directories searched include several standard system directories plus any that you specify with -L.
Static libraries are archives of object files, and have file names like liblibrary.a.  Some targets also support shared libraries, which typically have names like liblibrary.so.  If both static and shared libraries are found, the linker gives preference to linking with the shared library unless the -static option is used.
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified.  Thus, foo.o -lz bar.o searches library z after file foo.o but before bar.o.  If bar.o refers to functions in z, those functions may not be loaded.
-lobjc You need this special case of the -l option in order to link an Objective-C or Objective-C++ program.
-nostartfiles Do not use the standard system startup files when linking.  The standard system libraries are used normally, unless -nostdlib, -nolibc, or -nodefaultlibs is used.
-nodefaultlibs Do not use the standard system libraries when linking.  Only the libraries you specify are passed to the linker, and options specifying linkage of the system libraries, such as -static-libgcc or -shared-libgcc, are ignored.  The standard startup files are used normally, unless -nostartfiles is used.
The compiler may generate calls to "memcmp", "memset", "memcpy" and "memmove".  These entries are usually resolved by entries in libc. These entry points should be supplied through some other mechanism when this option is specified.
-nolibc Do not use the C library or system libraries tightly coupled with it when linking.  Still link with the startup files, libgcc or toolchain provided language support libraries such as libgnat, libgfortran or libstdc++ unless options preventing their inclusion are used as well. This typically removes -lc from the link command line, as well as system libraries that normally go with it and become meaningless when absence of a C library is assumed, for example -lpthread or -lm in some configurations.  This is intended for bare-board targets when there is indeed no C library available.
-nostdlib Do not use the standard system startup files or libraries when linking.  No startup files and only the libraries you specify are passed to the linker, and options specifying linkage of the system libraries, such as -static-libgcc or -shared-libgcc, are ignored.
One of the standard libraries bypassed by -nostdlib and -nodefaultlibs is libgcc.a, a library of internal subroutines which GCC uses to overcome shortcomings of particular machines, or special needs for some languages.
In most cases, you need libgcc.a even when you want to avoid other standard libraries.  In other words, when you specify -nostdlib or -nodefaultlibs you should usually specify -lgcc as well.  This ensures that you have no unresolved references to internal GCC library subroutines.  (An example of such an internal subroutine is "__main", used to ensure C++ constructors are called.)
-e entry --entry=entry Specify that the program entry point is entry.  The argument is interpreted by the linker; the GNU linker accepts either a symbol name or an address.
-pie Produce a dynamically linked position independent executable on targets that support it.  For predictable results, you must also specify the same set of options used for compilation (-fpie, -fPIE, or model suboptions) when you specify this linker option.
-no-pie Don't produce a dynamically linked position independent executable.
-static-pie Produce a static position independent executable on targets that support it.  A static position independent executable is similar to a static executable, but can be loaded at any address without a dynamic linker.  For predictable results, you must also specify the same set of options used for compilation (-fpie, -fPIE, or model suboptions) when you specify this linker option.
-pthread Link with the POSIX threads library.  This option is supported on GNU/Linux targets, most other Unix derivatives, and also on x86 Cygwin and MinGW targets.  On some targets this option also sets flags for the preprocessor, so it should be used consistently for both compilation and linking.
-r  Produce a relocatable object as output.  This is also known as partial linking.
-rdynamic Pass the flag -export-dynamic to the ELF linker, on targets that support it. This instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. This option is needed for some uses of "dlopen" or to allow obtaining backtraces from within a program.
-s  Remove all symbol table and relocation information from the executable.
-static On systems that support dynamic linking, this overrides -pie and prevents linking with the shared libraries.  On other systems, this option has no effect.
-shared Produce a shared object which can then be linked with other objects to form an executable.  Not all systems support this option.  For predictable results, you must also specify the same set of options used for compilation (-fpic, -fPIC, or model suboptions) when you specify this linker option.[1]
-shared-libgcc -static-libgcc On systems that provide libgcc as a shared library, these options force the use of either the shared or static version, respectively. If no shared version of libgcc was built when the compiler was configured, these options have no effect.
There are several situations in which an application should use the shared libgcc instead of the static version.  The most common of these is when the application wishes to throw and catch exceptions across different shared libraries.  In that case, each of the libraries as well as the application itself should use the shared libgcc.
Therefore, the G++ driver automatically adds -shared-libgcc whenever you build a shared library or a main executable, because C++ programs typically use exceptions, so this is the right thing to do.
If, instead, you use the GCC driver to create shared libraries, you may find that they are not always linked with the shared libgcc.  If GCC finds, at its configuration time, that you have a non-GNU linker or a GNU linker that does not support option --eh-frame-hdr, it links the shared version of libgcc into shared libraries by default. Otherwise, it takes advantage of the linker and optimizes away the linking with the shared version of libgcc, linking with the static version of libgcc by default.  This allows exceptions to propagate through such shared libraries, without incurring relocation costs at library load time.
However, if a library or main executable is supposed to throw or catch exceptions, you must link it using the G++ driver, or using the option -shared-libgcc, such that it is linked with the shared libgcc.
-static-libasan When the -fsanitize=address option is used to link a program, the GCC driver automatically links against libasan.  If libasan is available as a shared library, and the -static option is not used, then this links against the shared version of libasan.  The -static-libasan option directs the GCC driver to link libasan statically, without necessarily linking other libraries statically.
-static-libtsan When the -fsanitize=thread option is used to link a program, the GCC driver automatically links against libtsan.  If libtsan is available as a shared library, and the -static option is not used, then this links against the shared version of libtsan.  The -static-libtsan option directs the GCC driver to link libtsan statically, without necessarily linking other libraries statically.
-static-liblsan When the -fsanitize=leak option is used to link a program, the GCC driver automatically links against liblsan.  If liblsan is available as a shared library, and the -static option is not used, then this links against the shared version of liblsan.  The -static-liblsan option directs the GCC driver to link liblsan statically, without necessarily linking other libraries statically.
-static-libubsan When the -fsanitize=undefined option is used to link a program, the GCC driver automatically links against libubsan.  If libubsan is available as a shared library, and the -static option is not used, then this links against the shared version of libubsan.  The -static-libubsan option directs the GCC driver to link libubsan statically, without necessarily linking other libraries statically.
-static-libstdc++ When the g++ program is used to link a C++ program, it normally automatically links against libstdc++.  If libstdc++ is available as a shared library, and the -static option is not used, then this links against the shared version of libstdc++.  That is normally fine. However, it is sometimes useful to freeze the version of libstdc++ used by the program without going all the way to a fully static link. The -static-libstdc++ option directs the g++ driver to link libstdc++ statically, without necessarily linking other libraries statically.
-symbolic Bind references to global symbols when building a shared object. Warn about any unresolved references (unless overridden by the link editor option -Xlinker -z -Xlinker defs).  Only a few systems support this option.
-T script Use script as the linker script.  This option is supported by most systems using the GNU linker.  On some targets, such as bare-board targets without an operating system, the -T option may be required when linking to avoid references to undefined symbols.
-Xlinker option Pass option as an option to the linker.  You can use this to supply system-specific linker options that GCC does not recognize.
If you want to pass an option that takes a separate argument, you must use -Xlinker twice, once for the option and once for the argument.  For example, to pass -assert definitions, you must write -Xlinker -assert -Xlinker definitions.  It does not work to write -Xlinker "-assert definitions", because this passes the entire string as a single argument, which is not what the linker expects.
When using the GNU linker, it is usually more convenient to pass arguments to linker options using the option=value syntax than as separate arguments.  For example, you can specify -Xlinker -Map=output.map rather than -Xlinker -Map -Xlinker output.map.  Other linkers may not support this syntax for command-line options.
-Wl,option Pass option as an option to the linker.  If option contains commas, it is split 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.  When using the GNU linker, you can also get the same effect with -Wl,-Map=output.map.
-u symbol Pretend the symbol symbol is undefined, to force linking of library modules to define it.  You can use -u multiple times with different symbols to force loading of additional library modules.
-z keyword -z is passed directly on to the linker along with the keyword keyword. See the section in the documentation of your linker for permitted values and their meanings.
Options for Directory Search These options specify directories to search for header files, for libraries and for parts of the compiler:
-I dir -iquote dir -isystem dir -idirafter dir Add the directory dir to the list of directories to be searched for header files during preprocessing.  If dir begins with = or $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix; see --sysroot and -isysroot.
Directories specified with -iquote apply only to the quote form of the directive, "#include "file"".  Directories specified with -I, -isystem, or -idirafter apply to lookup for both the "#include "file"" and "#include <file>" directives.
You can specify any number or combination of these options on the command line to search for header files in several directories.  The lookup order is as follows:
1.  For the quote form of the include directive, the directory of the current file is searched first.
2.  For the quote form of the include directive, the directories specified by -iquote options are searched in left-to-right order, as they appear on the command line.
3.  Directories specified with -I options are scanned in left-to- right order.
4.  Directories specified with -isystem options are scanned in left- to-right order.
5.  Standard system directories are scanned.
6.  Directories specified with -idirafter options are scanned in left-to-right order.
You can use -I to override a system header file, substituting your own version, since these directories are searched before the standard system header file directories.  However, you should not use this option to add directories that contain vendor-supplied system header files; use -isystem for that.
The -isystem and -idirafter options also mark the directory as a system directory, so that it gets the same special treatment that is applied to the standard system directories.
If a standard system include directory, or a directory specified with -isystem, is also specified with -I, the -I option is ignored.  The directory is still searched but as a system directory at its normal position in the system include chain.  This is to ensure that GCC's procedure to fix buggy system headers and the ordering for the "#include_next" directive are not inadvertently changed.  If you really need to change the search order for system directories, use the -nostdinc and/or -isystem options.
-I- Split the include path.  This option has been deprecated.  Please use -iquote instead for -I directories before the -I- and remove the -I- option.
Any directories specified with -I options before -I- are searched only for headers requested with "#include "file""; they are not searched for "#include <file>".  If additional directories are specified with -I options after the -I-, those directories are searched for all #include directives.
In addition, -I- inhibits the use of the directory of the current file directory as the first search directory for "#include "file"". There is no way to override this effect of -I-.
-iprefix prefix Specify prefix as the prefix for subsequent -iwithprefix options.  If the prefix represents a directory, you should include the final /.
-iwithprefix dir -iwithprefixbefore dir Append dir to the prefix specified previously with -iprefix, and add the resulting directory to the include search path. -iwithprefixbefore puts it in the same place -I would; -iwithprefix puts it where -idirafter would.
-isysroot dir This option is like the --sysroot option, but applies only to header files (except for Darwin targets, where it applies to both header files and libraries).  See the --sysroot option for more information.
-imultilib dir Use dir as a subdirectory of the directory containing target-specific C++ headers.
-nostdinc Do not search the standard system directories for header files.  Only the directories explicitly specified with -I, -iquote, -isystem, and/or -idirafter options (and the directory of the current file, if appropriate) are searched.
-nostdinc++ Do not search for header files in the C++-specific standard directories, but do still search the other standard directories. (This option is used when building the C++ library.)
-iplugindir=dir Set the directory to search for plugins that are passed by -fplugin=name instead of -fplugin=path/name.so.  This option is not meant to be used by the user, but only passed by the driver.
-Ldir Add directory dir to the list of directories to be searched for -l.
-Bprefix This option specifies where to find the executables, libraries, include files, and data files of the compiler itself.
The compiler driver program runs one or more of the subprograms cpp, cc1, as and ld.  It tries prefix as a prefix for each program it tries to run, both with and without machine/version/ for the corresponding target machine and compiler version.
For each subprogram to be run, the compiler driver first tries the -B prefix, if any.  If that name is not found, or if -B is not specified, the driver tries two standard prefixes, /usr/lib/gcc/ and /usr/local/lib/gcc/.  If neither of those results in a file name that is found, the unmodified program name is searched for using the directories specified in your PATH environment variable.
The compiler checks to see if the path provided by -B refers to a directory, and if necessary it adds a directory separator character at the end of the path.
-B prefixes that effectively specify directory names also apply to libraries in the linker, because the compiler translates these options into -L options for the linker.  They also apply to include files in the preprocessor, because the compiler translates these options into -isystem options for the preprocessor.  In this case, the compiler appends include to the prefix.
The runtime support file libgcc.a can also be searched for using the -B prefix, if needed.  If it is not found there, the two standard prefixes above are tried, and that is all.  The file is left out of the link if it is not found by those means.
Another way to specify a prefix much like the -B prefix is to use the environment variable GCC_EXEC_PREFIX.
As a special kludge, if the path provided by -B is [dir/]stageN/, where N is a number in the range 0 to 9, then it is replaced by [dir/]include.  This is to help with boot-strapping the compiler.
-no-canonical-prefixes Do not expand any symbolic links, resolve references to /../ or /./, or make the path absolute when generating a relative prefix.
--sysroot=dir Use dir as the logical root directory for headers and libraries.  For example, if the compiler normally searches for headers in /usr/include and libraries in /usr/lib, it instead searches dir/usr/include and dir/usr/lib.
If you use both this option and the -isysroot option, then the --sysroot option applies to libraries, but the -isysroot option applies to header files.
The GNU linker (beginning with version 2.16) has the necessary support for this option.  If your linker does not support this option, the header file aspect of --sysroot still works, but the library aspect does not.
--no-sysroot-suffix For some targets, a suffix is added to the root directory specified with --sysroot, depending on the other options used, so that headers may for example be found in dir/suffix/usr/include instead of dir/usr/include.  This option disables the addition of such a suffix.
Options for Code Generation Conventions These machine-independent options control the interface conventions used in code generation.
Most of them have both positive and negative forms; the negative form of -ffoo is -fno-foo.  In the table below, only one of the forms is listed---the one that is not the default.  You can figure out the other form by either removing no- or adding it.
-fstack-reuse=reuse-level This option controls stack space reuse for user declared local/auto variables and compiler generated temporaries.  reuse_level can be all, named_vars, or none. all enables stack reuse for all local variables and temporaries, named_vars enables the reuse only for user defined local variables with names, and none disables stack reuse completely. The default value is all. The option is needed when the program extends the lifetime of a scoped local variable or a compiler generated temporary beyond the end point defined by the language. When a lifetime of a variable ends, and if the variable lives in memory, the optimizing compiler has the freedom to reuse its stack space with other temporaries or scoped local variables whose live range does not overlap with it. Legacy code extending local lifetime is likely to break with the stack reuse optimization.
int *p; { int local1;
p = &local1; local1 = 10; .... } { int local2; local2 = 20; ... }
if (*p == 10)  // out of scope use of local1 {
struct A { A(int k) : i(k), j(k) { } int i; int j; };
A *ap;
void foo(const A& ar) { ap = &ar; }
void bar() { foo(A(10)); // temp object's lifetime ends when foo returns
{ A a(20); .... } ap->i+= 10;  // ap references out of scope temp whose space // is reused with a. What is the value of ap->i? }
The lifetime of a compiler generated temporary is well defined by the C++ standard. When a lifetime of a temporary ends, and if the temporary lives in memory, the optimizing compiler has the freedom to reuse its stack space with other temporaries or scoped local variables whose live range does not overlap with it. However some of the legacy code relies on the behavior of older compilers in which temporaries' stack space is not reused, the aggressive stack reuse can lead to runtime errors. This option is used to control the temporary stack reuse optimization.
-ftrapv This option generates traps for signed overflow on addition, subtraction, multiplication operations.  The options -ftrapv and -fwrapv override each other, so using -ftrapv -fwrapv on the command- line results in -fwrapv being effective.  Note that only active options override, so using -ftrapv -fwrapv -fno-wrapv on the command- line results in -ftrapv being effective.
-fwrapv This option instructs the compiler to assume that signed arithmetic overflow of addition, subtraction and multiplication wraps around using twos-complement representation.  This flag enables some optimizations and disables others.  The options -ftrapv and -fwrapv override each other, so using -ftrapv -fwrapv on the command-line results in -fwrapv being effective.  Note that only active options override, so using -ftrapv -fwrapv -fno-wrapv on the command-line results in -ftrapv being effective.
-fwrapv-pointer This option instructs the compiler to assume that pointer arithmetic overflow on addition and subtraction wraps around using twos- complement representation.  This flag disables some optimizations which assume pointer overflow is invalid.
-fstrict-overflow This option implies -fno-wrapv -fno-wrapv-pointer and when negated implies -fwrapv -fwrapv-pointer.
-fexceptions Enable exception handling.  Generates extra code needed to propagate exceptions.  For some targets, this implies GCC generates frame unwind information for all functions, which can produce significant data size overhead, although it does not affect execution.  If you do not specify this option, GCC enables it by default for languages like C++ that normally require exception handling, and disables it for languages like C that do not normally require it.  However, you may need to enable this option when compiling C code that needs to interoperate properly with exception handlers written in C++.  You may also wish to disable this option if you are compiling older C++ programs that don't use exception handling.
-fnon-call-exceptions Generate code that allows trapping instructions to throw exceptions. Note that this requires platform-specific runtime support that does not exist everywhere.  Moreover, it only allows trapping instructions to throw exceptions, i.e. memory references or floating-point instructions.  It does not allow exceptions to be thrown from arbitrary signal handlers such as "SIGALRM".
-fdelete-dead-exceptions Consider that instructions that may throw exceptions but don't otherwise contribute to the execution of the program can be optimized away.  This option is enabled by default for the Ada compiler, as permitted by the Ada language specification.  Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
-funwind-tables Similar to -fexceptions, except that it just generates any needed static data, but does not affect the generated code in any other way. You normally do not need to enable this option; instead, a language processor that needs this handling enables it on your behalf.
-fasynchronous-unwind-tables Generate unwind table in DWARF format, if supported by target machine.  The table is exact at each instruction boundary, so it can be used for stack unwinding from asynchronous events (such as debugger or garbage collector).