Home | History | Annotate | Download | only in ldscripts
      1 /* Script for --shared -z combreloc: shared library, combine & sort relocs */
      2 OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux",
      3 	      "elf32-sh-linux")
      4 OUTPUT_ARCH(sh)
      5 ENTRY(_start)
      6 SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
      7 SECTIONS
      8 {
      9   /* Read-only sections, merged into text segment: */
     10   . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
     11   .note.gnu.build-id : { *(.note.gnu.build-id) }
     12   .hash           : { *(.hash) }
     13   .gnu.hash       : { *(.gnu.hash) }
     14   .dynsym         : { *(.dynsym) }
     15   .dynstr         : { *(.dynstr) }
     16   .gnu.version    : { *(.gnu.version) }
     17   .gnu.version_d  : { *(.gnu.version_d) }
     18   .gnu.version_r  : { *(.gnu.version_r) }
     19   .rela.dyn       :
     20     {
     21       *(.rela.init)
     22       *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
     23       *(.rela.fini)
     24       *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
     25       *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
     26       *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
     27       *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
     28       *(.rela.ctors)
     29       *(.rela.dtors)
     30       *(.rela.got)
     31       *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
     32       *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
     33       *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
     34       *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
     35       *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
     36     }
     37   .rela.ifunc.dyn       :
     38     {
     39       *(.rela.ifunc.*)
     40     }
     41   .rela.plt       : { *(.rela.plt) }
     42   .init           :
     43   {
     44     KEEP (*(.init))
     45   } =0
     46   .plt            : { *(.plt) }
     47   .text           :
     48   {
     49     *(.text .stub .text.* .gnu.linkonce.t.*)
     50     /* .gnu.warning sections are handled specially by elf32.em.  */
     51     *(.gnu.warning)
     52   } =0
     53   .fini           :
     54   {
     55     KEEP (*(.fini))
     56   } =0
     57   PROVIDE (__etext = .);
     58   PROVIDE (_etext = .);
     59   PROVIDE (etext = .);
     60   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
     61   .rodata1        : { *(.rodata1) }
     62   .eh_frame_hdr : { *(.eh_frame_hdr) }
     63   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
     64   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
     65   /* Adjust the address for the data segment.  We want to adjust up to
     66      the same address within the page on the next page up.  */
     67   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
     68   /* Exception handling  */
     69   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
     70   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
     71   /* Thread Local Storage sections  */
     72   .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
     73   .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
     74   .preinit_array     :
     75   {
     76     KEEP (*(.preinit_array))
     77   }
     78   .init_array     :
     79   {
     80      KEEP (*(SORT(.init_array.*)))
     81      KEEP (*(.init_array))
     82   }
     83   .fini_array     :
     84   {
     85     KEEP (*(.fini_array))
     86     KEEP (*(SORT(.fini_array.*)))
     87   }
     88   .ctors          :
     89   {
     90     /* gcc uses crtbegin.o to find the start of
     91        the constructors, so we make sure it is
     92        first.  Because this is a wildcard, it
     93        doesn't matter if the user does not
     94        actually link against crtbegin.o; the
     95        linker won't look for a file to match a
     96        wildcard.  The wildcard also means that it
     97        doesn't matter which directory crtbegin.o
     98        is in.  */
     99     KEEP (*crtbegin.o(.ctors))
    100     KEEP (*crtbegin?.o(.ctors))
    101     /* We don't want to include the .ctor section from
    102        the crtend.o file until after the sorted ctors.
    103        The .ctor section from the crtend file contains the
    104        end of ctors marker and it must be last */
    105     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
    106     KEEP (*(SORT(.ctors.*)))
    107     KEEP (*(.ctors))
    108   }
    109   .dtors          :
    110   {
    111     KEEP (*crtbegin.o(.dtors))
    112     KEEP (*crtbegin?.o(.dtors))
    113     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
    114     KEEP (*(SORT(.dtors.*)))
    115     KEEP (*(.dtors))
    116   }
    117   .jcr            : { KEEP (*(.jcr)) }
    118   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
    119   .dynamic        : { *(.dynamic) }
    120   . = DATA_SEGMENT_RELRO_END (0, .);
    121   .data           :
    122   {
    123     PROVIDE (__data_start = .);
    124     *(.data .data.* .gnu.linkonce.d.*)
    125     SORT(CONSTRUCTORS)
    126   }
    127   .data1          : { *(.data1) }
    128   .note.ABI-tag   : { *(.note.ABI-tag) }
    129   .got            : { *(.got.plt) *(.got) }
    130   /* We want the small data sections together, so single-instruction offsets
    131      can access them all, and initialized data all before uninitialized, so
    132      we can shorten the on-disk segment size.  */
    133   .sdata          :
    134   {
    135     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
    136     *(.sdata .sdata.* .gnu.linkonce.s.*)
    137   }
    138   _edata = .; PROVIDE (edata = .);
    139   __bss_start = .;
    140   .sbss           :
    141   {
    142     *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
    143     *(.dynsbss)
    144     *(.sbss .sbss.* .gnu.linkonce.sb.*)
    145     *(.scommon)
    146   }
    147   .bss            :
    148   {
    149    *(.dynbss)
    150    *(.bss .bss.* .gnu.linkonce.b.*)
    151    *(COMMON)
    152    /* Align here to ensure that the .bss section occupies space up to
    153       _end.  Align after .bss to ensure correct alignment even if the
    154       .bss section disappears because there are no input sections.
    155       FIXME: Why do we need it? When there is no .bss section, we don't
    156       pad the .data section.  */
    157    . = ALIGN(. != 0 ? 32 / 8 : 1);
    158   }
    159   . = ALIGN(32 / 8);
    160   . = ALIGN(32 / 8);
    161   _end = .; PROVIDE (end = .);
    162   . = DATA_SEGMENT_END (.);
    163   /* Stabs debugging sections.  */
    164   .stab          0 : { *(.stab) }
    165   .stabstr       0 : { *(.stabstr) }
    166   .stab.excl     0 : { *(.stab.excl) }
    167   .stab.exclstr  0 : { *(.stab.exclstr) }
    168   .stab.index    0 : { *(.stab.index) }
    169   .stab.indexstr 0 : { *(.stab.indexstr) }
    170   .comment       0 : { *(.comment) }
    171   /* DWARF debug sections.
    172      Symbols in the DWARF debugging sections are relative to the beginning
    173      of the section so we begin them at 0.  */
    174   /* DWARF 1 */
    175   .debug          0 : { *(.debug) }
    176   .line           0 : { *(.line) }
    177   /* GNU DWARF 1 extensions */
    178   .debug_srcinfo  0 : { *(.debug_srcinfo) }
    179   .debug_sfnames  0 : { *(.debug_sfnames) }
    180   /* DWARF 1.1 and DWARF 2 */
    181   .debug_aranges  0 : { *(.debug_aranges) }
    182   .debug_pubnames 0 : { *(.debug_pubnames) }
    183   /* DWARF 2 */
    184   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
    185   .debug_abbrev   0 : { *(.debug_abbrev) }
    186   .debug_line     0 : { *(.debug_line) }
    187   .debug_frame    0 : { *(.debug_frame) }
    188   .debug_str      0 : { *(.debug_str) }
    189   .debug_loc      0 : { *(.debug_loc) }
    190   .debug_macinfo  0 : { *(.debug_macinfo) }
    191   /* SGI/MIPS DWARF 2 extensions */
    192   .debug_weaknames 0 : { *(.debug_weaknames) }
    193   .debug_funcnames 0 : { *(.debug_funcnames) }
    194   .debug_typenames 0 : { *(.debug_typenames) }
    195   .debug_varnames  0 : { *(.debug_varnames) }
    196   /* DWARF 3 */
    197   .debug_pubtypes 0 : { *(.debug_pubtypes) }
    198   .debug_ranges   0 : { *(.debug_ranges) }
    199   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
    200   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
    201 }
    202