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