call to "__real_malloc" in "__wrap_malloc" will call the real "malloc"
function.
You may wish to provide a "__real_malloc" function as well, so that links without the --wrap option will succeed. If you do this, you should not put the definition of "__real_malloc" in the same file as
"__wrap_malloc"; if you do, the assembler may resolve the call before the linker has a chance to wrap it to "malloc".
Only undefined references are replaced by the linker. So, translation unit internal references to symbol are not resolved to "__wrap_symbol". In the next example, the call to "f" in "g" is not resolved to
"__wrap_f".
int
f (void)
{
return 123;
}
int
g (void)
{
return f();
}
--eh-frame-hdr
--no-eh-frame-hdr
Request (--eh-frame-hdr) or suppress (--no-eh-frame-hdr) the creation of ".eh_frame_hdr" section and ELF "PT_GNU_EH_FRAME" segment header.
--no-ld-generated-unwind-info
Request creation of ".eh_frame" unwind info for linker generated code sections like PLT. This option is on by default if linker generated unwind info is supported. This option also controls the generation of
".sframe" stack trace info for linker generated code sections like PLT.
--enable-new-dtags
--disable-new-dtags
This linker can create the new dynamic tags in ELF. But the older ELF systems may not understand them. If you specify --enable-new-dtags, the new dynamic tags will be created as needed and older dynamic tags will
be omitted. If you specify --disable-new-dtags, no new dynamic tags will be created. By default, the new dynamic tags are not created. Note that those options are only available for ELF systems.
--hash-size=number
Set the default size of the linker’s hash tables to a prime number close to number. Increasing this value can reduce the length of time it takes the linker to perform its tasks, at the expense of increasing the
linker’s memory requirements. Similarly reducing this value can reduce the memory requirements at the expense of speed.
--hash-style=style
Set the type of linker’s hash table(s). style can be either "sysv" for classic ELF ".hash" section, "gnu" for new style GNU ".gnu.hash" section or "both" for both the classic ELF ".hash" and new style GNU
".gnu.hash" hash tables. The default depends upon how the linker was configured, but for most Linux based systems it will be "both".
--compress-debug-sections=none
--compress-debug-sections=zlib
--compress-debug-sections=zlib-gnu
--compress-debug-sections=zlib-gabi
--compress-debug-sections=zstd
On ELF platforms, these options control how DWARF debug sections are compressed using zlib.
--compress-debug-sections=none doesn’t compress DWARF debug sections. --compress-debug-sections=zlib-gnu compresses DWARF debug sections and renames them to begin with .zdebug instead of .debug.
--compress-debug-sections=zlib-gabi also compresses DWARF debug sections, but rather than renaming them it sets the SHF_COMPRESSED flag in the sections’ headers.
The --compress-debug-sections=zlib option is an alias for --compress-debug-sections=zlib-gabi.
--compress-debug-sections=zstd compresses DWARF debug sections using zstd.
Note that this option overrides any compression in input debug sections, so if a binary is linked with --compress-debug-sections=none for example, then any compressed debug sections in input files will be
uncompressed before they are copied into the output binary.
The default compression behaviour