Home Explore Blog CI



man-pages

31th chunk of `ld.man`
24ac6ef21a2fa328c3e4fa2dcab0e5b4fe1799341c176f060000000100000fb5
 order when it places them in the appropriate output sections.  The symbol alignments considered are sixteen‐byte or larger,
           eight‐byte, four‐byte, two‐byte, and one‐byte. This is to prevent gaps between symbols due to alignment constraints.  If no sorting order is specified, then descending order is assumed.

       --sort-section=name
           This option will apply "SORT_BY_NAME" to all wildcard section patterns in the linker script.

       --sort-section=alignment
           This option will apply "SORT_BY_ALIGNMENT" to all wildcard section patterns in the linker script.

       --spare-dynamic-tags=count
           This option specifies the number of empty slots to leave in the .dynamic section of ELF shared objects.  Empty slots may be needed by post processing tools, such as the prelinker.  The default is 5.

       --split-by-file[=size]
           Similar to --split-by-reloc but creates a new output section for each input file when size is reached.  size defaults to a size of 1 if not given.

       --split-by-reloc[=count]
           Tries to creates extra sections in the output file so that no single output section in the file contains more than count relocations.  This is useful when generating huge relocatable  files  for  downloading  into
           certain  real  time  kernels  with  the COFF object file format; since COFF cannot represent more than 65535 relocations in a single section.  Note that this will fail to work with object file formats which do not
           support arbitrary sections.  The linker will not split up individual input sections for redistribution, so if a single input section contains more than count relocations one output section will contain  that  many
           relocations.  count defaults to a value of 32768.

       --stats
           Compute and display statistics about the operation of the linker, such as execution time and memory usage.

       --sysroot=directory
           Use directory as the location of the sysroot, overriding the configure‐time default.  This option is only supported by linkers that were configured using --with-sysroot.

       --task-link
           This is used by COFF/PE based targets to create a task‐linked object file where all of the global symbols have been converted to statics.

       --traditional-format
           For some targets, the output of ld is different in some ways from the output of some existing linker.  This switch requests ld to use the traditional format instead.

           For  example,  on  SunOS,  ld  combines duplicate entries in the symbol string table.  This can reduce the size of an output file with full debugging information by over 30 percent.  Unfortunately, the SunOS "dbx"
           program can not read the resulting program ("gdb" has no trouble).  The --traditional-format switch tells ld to not combine duplicate entries.

       --section-start=sectionname=org
           Locate a section in the output file at the absolute address given by org.  You may use this option as many times as necessary to locate multiple sections in the command line.  org  must  be  a  single  hexadecimal
           integer; for compatibility with other linkers, you may omit the leading 0x usually associated with hexadecimal values.  Note: there should be no white space between sectionname, the equals sign ("="), and org.

       -Tbss=org
       -Tdata=org
       -Ttext=org
           Same as --section-start, with ".bss", ".data" or ".text" as the sectionname.

       -Ttext-segment=org
           When creating an ELF executable, it will set the address of the first byte of the text segment.

       -Trodata-segment=org
           When  creating  an  ELF  executable  or  shared object for a target where the read‐only data is in its own segment separate from the executable text, it will set the address of the first byte of the read‐only data
           segment.

       -Tldata-segment=org
           When creating an ELF executable

Title: LD (GNU Linker) Options: Sorting, Splitting, and Section Placement
Summary
This section details options for the GNU linker, including controlling the order of common symbols, sorting section patterns, reserving space for dynamic tags, splitting output sections based on file or relocation count, displaying statistics, specifying the sysroot, creating task-linked object files, using traditional output formats, and placing sections at specific addresses using options like --section-start, -Tbss, -Tdata, -Ttext, -Ttext-segment, and -Trodata-segment.