Home Explore Blog CI



man-pages

34th chunk of `ld.man`
71bde53b6155fb4798bde7b15cd525ff2762d76ebe3c159a0000000100000fb3
     5.  Merging a common symbol with a previous smaller common symbol.  This is the same as the previous case, except that the symbols are encountered in a different order.

                       <file>(<section>): warning: common of `<symbol>'
                          overriding smaller common
                       <file>(<section>): warning: smaller common is here

       --warn-constructors
           Warn if any global constructors are used.  This is only useful for a few object file formats.  For formats like COFF or ELF, the linker can not detect the use of global constructors.

       --warn-execstack
       --no-warn-execstack
           On ELF platforms this option controls how the linker generates warning messages when it creates an output file with an executable stack.  By default the linker will not warn if the -z execstack command line option
           has been used, but this behaviour can be overridden by the --warn-execstack option.

           On the other hand the linker will normally warn if the stack is made executable because one or more of the input files need an execuable stack and neither of the -z execstack or -z noexecstack command line options
           have been specified.  This warning can be disabled via the --no-warn-execstack option.

           Note:  ELF  format input files specify that they need an executable stack by having a .note.GNU-stack section with the executable bit set in its section flags.  They can specify that they do not need an executable
           stack by having that section, but without the executable flag bit set.  If an input file does not have a .note.GNU-stack section present then the default behaviour is  target  specific.   For  some  targets,  then
           absence of such a section implies that an executable stack is required.  This is often a problem for hand crafted assembler files.

       --warn-multiple-gp
           Warn  if  multiple  global pointer values are required in the output file.  This is only meaningful for certain processors, such as the Alpha.  Specifically, some processors put large‐valued constants in a special
           section.  A special register (the global pointer) points into the middle of this section, so that constants can be loaded efficiently via a base‐register relative  addressing  mode.   Since  the  offset  in  base‐
           register  relative  mode  is  fixed and relatively small (e.g., 16 bits), this limits the maximum size of the constant pool.  Thus, in large programs, it is often necessary to use multiple global pointer values in
           order to be able to address all possible constants.  This option causes a warning to be issued whenever this case occurs.

       --warn-once
           Only warn once for each undefined symbol, rather than once per module which refers to it.

       --warn-rwx-segments
       --no-warn-rwx-segments
           Warn if the linker creates a loadable, non‐zero sized segment that has all three of the read, write and execute permission flags set.  Such a segment represents a potential  security  vulnerability.   In  addition
           warnings will be generated if a thread local storage segment is created with the execute permission flag set, regardless of whether or not it has the read and/or write flags set.

           These warnings are enabled by default.  They can be disabled via the --no-warn-rwx-segments option and re‐enabled via the --warn-rwx-segments option.

       --warn-section-align
           Warn  if  the  address of an output section is changed because of alignment.  Typically, the alignment will be set by an input section.  The address will only be changed if it not explicitly specified; that is, if
           the "SECTIONS" command does not specify a start address for the section.

       --warn-textrel
           Warn if the linker adds DT_TEXTREL to a position‐independent executable or shared object.

       --warn-alternate-em
           Warn if an object has alternate

Title: LD (GNU Linker) Options: Warnings for Constructors, Executable Stacks, Global Pointers, Undefined Symbols, and Segment Permissions
Summary
This section covers various warning options in the GNU linker (ld). It discusses warnings for global constructors (--warn-constructors), executable stacks (--warn-execstack and --no-warn-execstack), multiple global pointer values (--warn-multiple-gp), undefined symbols (--warn-once), read-write-execute segments (--warn-rwx-segments and --no-warn-rwx-segments), section alignment (--warn-section-align), text relocations (--warn-textrel), and alternate em.