qemu/ppc.ld
<<
>>
Prefs
   1/* ld script to make i386 Linux kernel
   2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
   3 */
   4OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
   5OUTPUT_ARCH(powerpc:common)
   6ENTRY(_start)
   7SECTIONS
   8{
   9  /* Read-only sections, merged into text segment: */
  10  . = 0x60000000 + SIZEOF_HEADERS;
  11  .interp     : { *(.interp)    }
  12  .hash          : { *(.hash)           }
  13  .dynsym        : { *(.dynsym)         }
  14  .dynstr        : { *(.dynstr)         }
  15  .gnu.version   : { *(.gnu.version)    }
  16  .gnu.version_d   : { *(.gnu.version_d)        }
  17  .gnu.version_r   : { *(.gnu.version_r)        }
  18  .rel.init       : { *(.rel.init) }
  19  .rela.init      : { *(.rela.init) }
  20  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
  21  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
  22  .rel.fini       : { *(.rel.fini) }
  23  .rela.fini      : { *(.rela.fini) }
  24  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
  25  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
  26  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
  27  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
  28  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
  29  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
  30  .rel.tdata      : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
  31  .rela.tdata     : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
  32  .rel.tbss       : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
  33  .rela.tbss      : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
  34  .rel.ctors      : { *(.rel.ctors) }
  35  .rela.ctors     : { *(.rela.ctors) }
  36  .rel.dtors      : { *(.rel.dtors) }
  37  .rela.dtors     : { *(.rela.dtors) }
  38  .rel.got        : { *(.rel.got) }
  39  .rela.got       : { *(.rela.got) }
  40  .rela.got1           : { *(.rela.got1) }
  41  .rela.got2           : { *(.rela.got2) }
  42  .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
  43  .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
  44  .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
  45  .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
  46  .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
  47  .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
  48  .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
  49  .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
  50  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
  51  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
  52  .rel.plt      :
  53  {
  54    *(.rel.plt)
  55    PROVIDE (__rel_iplt_start = .);
  56    *(.rel.iplt)
  57    PROVIDE (__rel_iplt_end = .);
  58  }
  59  .rela.plt       :
  60  {
  61    *(.rela.plt)
  62    PROVIDE (__rela_iplt_start = .);
  63    *(.rela.iplt)
  64    PROVIDE (__rela_iplt_end = .);
  65  }
  66  .init           :
  67  {
  68    KEEP (*(.init))
  69  } =0
  70  .text           :
  71  {
  72    *(.text .stub .text.* .gnu.linkonce.t.*)
  73    KEEP (*(.text.*personality*))
  74    /* .gnu.warning sections are handled specially by elf32.em.  */
  75    *(.gnu.warning)
  76    *(.glink)
  77  } =0x47ff041f
  78  .fini           :
  79  {
  80    KEEP (*(.fini))
  81  } =0x47ff041f
  82  PROVIDE (__etext = .);
  83  PROVIDE (_etext = .);
  84  PROVIDE (etext = .);
  85  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  86  .rodata1        : { *(.rodata1) }
  87  .sdata2         :
  88  {
  89    PROVIDE (_SDA2_BASE_ = 32768);
  90    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
  91  }
  92  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
  93  .eh_frame_hdr : { *(.eh_frame_hdr) }
  94  /* Adjust the address for the data segment.  We want to adjust up to
  95     the same address within the page on the next page up.  */
  96  . = ALIGN (0x10000) - ((0x10000 - .) & (0x10000 - 1)); . = DATA_SEGMENT_ALIGN (0x10000, 0x1000);
  97  /* Exception handling  */
  98  .eh_frame       : { KEEP (*(.eh_frame)) }
  99  .gcc_except_table   : { *(.gcc_except_table .gcc_except_table.*) }
 100  /* Thread Local Storage sections  */
 101  .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
 102  .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
 103  .preinit_array     :
 104  {
 105    PROVIDE (__preinit_array_start = .);
 106    KEEP (*(.preinit_array))
 107    PROVIDE (__preinit_array_end = .);
 108  }
 109  .init_array     :
 110  {
 111     PROVIDE (__init_array_start = .);
 112     KEEP (*(SORT(.init_array.*)))
 113     KEEP (*(.init_array))
 114     PROVIDE (__init_array_end = .);
 115  }
 116  .fini_array     :
 117  {
 118    PROVIDE (__fini_array_start = .);
 119    KEEP (*(.fini_array))
 120    KEEP (*(SORT(.fini_array.*)))
 121    PROVIDE (__fini_array_end = .);
 122  }
 123  .ctors          :
 124  {
 125    /* gcc uses crtbegin.o to find the start of
 126       the constructors, so we make sure it is
 127       first.  Because this is a wildcard, it
 128       doesn't matter if the user does not
 129       actually link against crtbegin.o; the
 130       linker won't look for a file to match a
 131       wildcard.  The wildcard also means that it
 132       doesn't matter which directory crtbegin.o
 133       is in.  */
 134    KEEP (*crtbegin*.o(.ctors))
 135    /* We don't want to include the .ctor section from
 136       the crtend.o file until after the sorted ctors.
 137       The .ctor section from the crtend file contains the
 138       end of ctors marker and it must be last */
 139    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
 140    KEEP (*(SORT(.ctors.*)))
 141    KEEP (*(.ctors))
 142  }
 143  .dtors          :
 144  {
 145    KEEP (*crtbegin*.o(.dtors))
 146    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
 147    KEEP (*(SORT(.dtors.*)))
 148    KEEP (*(.dtors))
 149  }
 150  .jcr            : { KEEP (*(.jcr)) }
 151  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
 152  .got1           : { *(.got1) }
 153  .got2           : { *(.got2) }
 154  .dynamic        : { *(.dynamic) }
 155  .got            : SPECIAL { *(.got) }
 156  . = DATA_SEGMENT_RELRO_END (0, .);
 157  .plt            : SPECIAL { *(.plt) }
 158  .data           :
 159  {
 160    *(.data .data.* .gnu.linkonce.d.*)
 161    KEEP (*(.gnu.linkonce.d.*personality*))
 162    SORT(CONSTRUCTORS)
 163  }
 164  .data1          : { *(.data1) }
 165  .got            : SPECIAL { *(.got) }
 166  /* We want the small data sections together, so single-instruction offsets
 167     can access them all, and initialized data all before uninitialized, so
 168     we can shorten the on-disk segment size.  */
 169  .sdata          :
 170  {
 171    PROVIDE (_SDA_BASE_ = 32768);
 172    *(.sdata .sdata.* .gnu.linkonce.s.*)
 173  }
 174  _edata = .; PROVIDE (edata = .);
 175  __bss_start = .;
 176  .sbss           :
 177  {
 178    PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .);
 179    *(.dynsbss)
 180    *(.sbss .sbss.* .gnu.linkonce.sb.*)
 181    *(.scommon)
 182    PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .);
 183  }
 184  .plt            : SPECIAL { *(.plt) }
 185  .bss            :
 186  {
 187   *(.dynbss)
 188   *(.bss .bss.* .gnu.linkonce.b.*)
 189   *(COMMON)
 190   /* Align here to ensure that the .bss section occupies space up to
 191      _end.  Align after .bss to ensure correct alignment even if the
 192      .bss section disappears because there are no input sections.
 193      FIXME: Why do we need it? When there is no .bss section, we don't
 194      pad the .data section.  */
 195   . = ALIGN(. != 0 ? 32 / 8 : 1);
 196  }
 197  . = ALIGN(32 / 8);
 198  . = ALIGN(32 / 8);
 199  _end = .; PROVIDE (end = .);
 200  . = DATA_SEGMENT_END (.);
 201  /* Stabs debugging sections.  */
 202  .stab 0 : { *(.stab) }
 203  .stabstr 0 : { *(.stabstr) }
 204  .stab.excl 0 : { *(.stab.excl) }
 205  .stab.exclstr 0 : { *(.stab.exclstr) }
 206  .stab.index 0 : { *(.stab.index) }
 207  .stab.indexstr 0 : { *(.stab.indexstr) }
 208  .comment 0 : { *(.comment) }
 209  /* DWARF debug sections.
 210     Symbols in the DWARF debugging sections are relative to the beginning
 211     of the section so we begin them at 0.  */
 212  /* DWARF 1 */
 213  .debug          0 : { *(.debug) }
 214  .line           0 : { *(.line) }
 215  /* GNU DWARF 1 extensions */
 216  .debug_srcinfo  0 : { *(.debug_srcinfo) }
 217  .debug_sfnames  0 : { *(.debug_sfnames) }
 218  /* DWARF 1.1 and DWARF 2 */
 219  .debug_aranges  0 : { *(.debug_aranges) }
 220  .debug_pubnames 0 : { *(.debug_pubnames) }
 221  /* DWARF 2 */
 222  .debug_info     0 : { *(.debug_info) }
 223  .debug_abbrev   0 : { *(.debug_abbrev) }
 224  .debug_line     0 : { *(.debug_line) }
 225  .debug_frame    0 : { *(.debug_frame) }
 226  .debug_str      0 : { *(.debug_str) }
 227  .debug_loc      0 : { *(.debug_loc) }
 228  .debug_macinfo  0 : { *(.debug_macinfo) }
 229  /* SGI/MIPS DWARF 2 extensions */
 230  .debug_weaknames 0 : { *(.debug_weaknames) }
 231  .debug_funcnames 0 : { *(.debug_funcnames) }
 232  .debug_typenames 0 : { *(.debug_typenames) }
 233  .debug_varnames  0 : { *(.debug_varnames) }
 234  /* These must appear regardless of  .  */
 235  /DISCARD/    : { *(.fixup) }
 236  /DISCARD/ : { *(.note.GNU-stack) }
 237}
 238