Home Explore Blog CI



man-pages

18th chunk of `ld.man`
64c7ca02cd17015c18db68460f71f7349dc70ca4273a7a6f0000000100000fde
 linked against the GNU  C  Library,  a  GLIBC_ABI_DT_RELR  symbol
               version dependency on the shared C Library is added to the output.  Supported for i386 and x86-64.

           relro
           norelro
               Create  an  ELF  "PT_GNU_RELRO" segment header in the object.  This specifies a memory segment that should be made read‐only after relocation, if supported.  Specifying common‐page‐size smaller than the system
               page size will render this protection ineffective.  Don’t create an ELF "PT_GNU_RELRO" segment if norelro.

           report‐relative‐reloc
               Report dynamic relative relocations generated by linker.  Supported for Linux/i386 and Linux/x86_64.

           sectionheader
           nosectionheader
               Generate section header.  Don’t generate section header if nosectionheader is used.  sectionheader is the default.

           separate‐code
           noseparate‐code
               Create separate code "PT_LOAD" segment header in the object.  This specifies a memory segment that should contain only instructions and must be in wholly disjoint pages  from  any  other  data.   Don’t  create
               separate code "PT_LOAD" segment if noseparate‐code is used.

           shstk
               Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK in .note.gnu.property section to indicate compatibility with Intel Shadow Stack.  Supported for Linux/i386 and Linux/x86_64.

           stack-size=value
               Specify a stack size for an ELF "PT_GNU_STACK" segment.  Specifying zero will override any default non‐zero sized "PT_GNU_STACK" segment creation.

           start‐stop‐gc
           nostart‐stop‐gc
               When --gc-sections is in effect, a reference from a retained section to "__start_SECNAME" or "__stop_SECNAME" causes all input sections named "SECNAME" to also be retained, if "SECNAME" is representable as a C
               identifier and either "__start_SECNAME" or "__stop_SECNAME" is synthesized by the linker.  -z start‐stop‐gc disables this effect, allowing sections to be garbage collected as if the special synthesized symbols
               were not defined.  -z start‐stop‐gc has no effect on a definition of "__start_SECNAME" or "__stop_SECNAME" in an object file or linker script.  Such a definition will prevent the linker providing a synthesized
               "__start_SECNAME" or "__stop_SECNAME" respectively, and therefore the special treatment by garbage collection for those references.

           start-stop-visibility=value
               Specify  the  ELF  symbol  visibility  for  synthesized "__start_SECNAME" and "__stop_SECNAME" symbols.  value must be exactly default, internal, hidden, or protected.  If no -z start‐stop‐visibility option is
               given, protected is used for compatibility with historical practice.  However, it’s highly recommended to use -z start-stop-visibility=hidden in new programs and shared libraries so that these symbols are  not
               exported between shared objects, which is not usually what’s intended.

           text
           notext
           textoff
               Report an error if DT_TEXTREL is set, i.e., if the position‐independent or shared object has dynamic relocations in read‐only sections.  Don’t report an error if notext or textoff.

           undefs
               Do not report unresolved symbol references from regular object files, either when creating an executable, or when creating a shared library.  This option is the inverse of -z defs.

           unique‐symbol
           nounique‐symbol
               Avoid duplicated local symbol names in the symbol string table.  Append "."number"" to duplicated local symbol names if unique‐symbol is used.  nounique‐symbol is the default.

           x86-64-baseline
           x86-64-v2
           x86-64-v3
           x86-64-v4
               Specify  the  x86-64  ISA  level  needed  in  .note.gnu.property  section.   x86-64-baseline

Title: LD (GNU Linker) - Keyword Options (Continued): Code Segmentation, Stack Handling, Symbol Visibility, and Architecture-Specific Flags
Summary
This section continues the list of linker options, focusing on creating separate code segments, indicating Intel Shadow Stack compatibility, setting stack size, managing garbage collection of sections, specifying symbol visibility for synthesized symbols, reporting errors for dynamic relocations in read-only sections, suppressing unresolved symbol references, avoiding duplicated local symbol names, and specifying the x86-64 ISA level.