Home Explore Blog CI



man-pages

10th chunk of `ld.man`
fe3c19bacd41739bff6f790f9849c0c8955fa0cc963e36f50000000100000fbb
 the link map if the -M option is used:

                          0x00000001                foo = 0x1
                          [0x0000000c]                foo = (foo * 0x4)
                          [0x0000000c]                foo = (foo + 0x8)

               See Expressions for more information about expressions in linker scripts.

           •   How GNU properties are merged.

               When the linker merges input .note.gnu.property sections into one output .note.gnu.property section, some properties are removed or updated.  These actions are reported in the link map.  For example:

                       Removed property 0xc0000002 to merge foo.o (0x1) and bar.o (not found)

               This indicates that property 0xc0000002 is removed from output when merging properties in  foo.o, whose property 0xc0000002 value is 0x1, and bar.o, which doesn’t have property 0xc0000002.

                       Updated property 0xc0010001 (0x1) to merge foo.o (0x1) and bar.o (0x1)

               This indicates that property 0xc0010001 value is updated to 0x1 in output when merging properties in  foo.o, whose 0xc0010001 property value is 0x1, and bar.o, whose 0xc0010001 property value is 0x1.

       --print-map-discarded
       --no-print-map-discarded
           Print (or do not print) the list of discarded and garbage collected sections in the link map.  Enabled by default.

       --print-map-locals
       --no-print-map-locals
           Print (or do not print) local symbols in the link map.  Local symbols will have the text (local) printed before their name, and will be listed after all of the global symbols in a given section.   Temporary  local
           symbols (typically those that start with .L) will not be included in the output.  Disabled by default.

       -n
       --nmagic
           Turn off page alignment of sections, and disable linking against shared libraries.  If the output format supports Unix style magic numbers, mark the output as "NMAGIC".

       -N
       --omagic
           Set  the  text  and data sections to be readable and writable.  Also, do not page‐align the data segment, and disable linking against shared libraries.  If the output format supports Unix style magic numbers, mark
           the output as "OMAGIC". Note: Although a writable text section is allowed for PE‐COFF targets, it does not conform to the format specification published by Microsoft.

       --no-omagic
           This option negates most of the effects of the -N option.  It sets the text section to be read‐only, and forces the data segment to be page‐aligned.  Note - this option  does  not  enable  linking  against  shared
           libraries.  Use -Bdynamic for this.

       -o output
       --output=output
           Use output as the name for the program produced by ld; if this option is not specified, the name a.out is used by default.  The script command "OUTPUT" can also specify the output file name.

       --dependency-file=depfile
           Write  a  dependency file to depfile.  This file contains a rule suitable for "make" describing the output file and all the input files that were read to produce it.  The output is similar to the compiler’s output
           with -M -MP.  Note that there is no option like the compiler’s -MM, to exclude "system files" (which is not a well‐specified concept in the linker, unlike "system headers" in the compiler).   So  the  output  from
           --dependency-file is always specific to the exact state of the installation where it was produced, and should not be copied into distributed makefiles without careful editing.

       -O level
           If  level  is  a  numeric values greater than zero ld optimizes the output.  This might take significantly longer and therefore probably should only be enabled for the final binary.  At the moment this option only
           affects ELF shared library generation.  Future releases of the linker may make more use of this option.  Also currently

Title: LD (GNU Linker) - Link Map Options and Other Miscellaneous Options
Summary
This section details options related to the link map, including printing discarded sections and local symbols. It covers options like `-n` and `-N` that affect section alignment and shared library linking, the `-o` option for specifying the output file name, and the `--dependency-file` option for generating a makefile dependency list. Lastly, it explains the `-O` option for optimization.