Selaa lähdekoodia

+ armel support with FPC_ARMEL define
+ armel linker script

git-svn-id: trunk@9156 -

florian 18 vuotta sitten
vanhempi
commit
8a2ab85bc2
2 muutettua tiedostoa jossa 389 lisäystä ja 100 poistoa
  1. 62 0
      compiler/systems/i_linux.pas
  2. 327 100
      compiler/systems/t_linux.pas

+ 62 - 0
compiler/systems/i_linux.pas

@@ -532,6 +532,67 @@ unit i_linux;
             abi : abi_default
           );
 
+{$ifdef ARMEL}
+       system_arm_linux_info : tsysteminfo =
+          (
+            system       : system_arm_Linux;
+            name         : 'Linux for ARMEL';
+            shortname    : 'Linux';
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
+                            tf_use_function_relative_addresses,tf_requires_proper_alignment,tf_smartlink_sections,tf_smartlink_library];
+            cpu          : cpu_arm;
+            unit_env     : 'LINUXUNITS';
+            extradefines : 'UNIX;HASUNIX';
+            exeext       : '';
+            defext       : '.def';
+            scriptext    : '.sh';
+            smartext     : '.sl';
+            unitext      : '.ppu';
+            unitlibext   : '.ppl';
+            asmext       : '.s';
+            objext       : '.o';
+            resext       : '.res';
+            resobjext    : '.or';
+            sharedlibext : '.so';
+            staticlibext : '.a';
+            staticlibprefix : 'libp';
+            sharedlibprefix : 'lib';
+            sharedClibext : '.so';
+            staticClibext : '.a';
+            staticClibprefix : 'lib';
+            sharedClibprefix : 'lib';
+            Cprefix      : '';
+            newline      : #10;
+            dirsep       : '/';
+            assem        : as_gas;
+            assemextern  : as_gas;
+            link         : nil;
+            linkextern   : nil;
+            ar           : ar_gnu_ar;
+            res          : res_none;
+            dbg          : dbg_stabs;
+            script       : script_unix;
+            endian       : endian_little;
+            alignment    :
+              (
+                procalign       : 4;
+                loopalign       : 4;
+                jumpalign       : 0;
+                constalignmin   : 0;
+                constalignmax   : 8;
+                varalignmin     : 0;
+                varalignmax     : 8;
+                localalignmin   : 4;
+                localalignmax   : 8;
+                recordalignmin  : 0;
+                recordalignmax  : 8;
+                maxCrecordalign : 8
+              );
+            first_parm_offset : 8;
+            stacksize    : 262144;
+            abi : abi_eabi
+          );
+{$else ARMEL}
        system_arm_linux_info : tsysteminfo =
           (
             system       : system_arm_Linux;
@@ -591,6 +652,7 @@ unit i_linux;
             stacksize    : 262144;
             abi : abi_default
           );
+{$endif ARMEL}
 
   implementation
 

+ 327 - 100
compiler/systems/t_linux.pas

@@ -665,108 +665,335 @@ begin
       add('}');
 {$endif x86_64}
 
+{$ifdef ARM}
+      if target_info.abi=abi_eabi then
+        begin
+          { from GNU ld (CodeSourcery Sourcery G++ Lite 2007q3-53) 2.18.50.20070820 }
+          add('/* Script for -z combreloc: combine and sort reloc sections */');
+          add('OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",');
+          add('	      "elf32-littlearm")');
+          add('OUTPUT_ARCH(arm)');
+          add('ENTRY(_start)');
+          add('SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");');
+          add('SECTIONS');
+          add('{');
+          add('  /* Read-only sections, merged into text segment: */');
+          add('  PROVIDE (__executable_start = 0x8000); . = 0x8000;');
+          add('  .interp         : { *(.interp) }');
+          add('  .note.gnu.build-id : { *(.note.gnu.build-id) }');
+          add('  .hash           : { *(.hash) }');
+          add('  .gnu.hash       : { *(.gnu.hash) }');
+          add('  .dynsym         : { *(.dynsym) }');
+          add('  .dynstr         : { *(.dynstr) }');
+          add('  .gnu.version    : { *(.gnu.version) }');
+          add('  .gnu.version_d  : { *(.gnu.version_d) }');
+          add('  .gnu.version_r  : { *(.gnu.version_r) }');
+          add('  .rel.dyn        :');
+          add('    {');
+          add('      *(.rel.init)');
+          add('      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)');
+          add('      *(.rel.fini)');
+          add('      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)');
+          add('      *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)');
+          add('      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)');
+          add('      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)');
+          add('      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)');
+          add('      *(.rel.ctors)');
+          add('      *(.rel.dtors)');
+          add('      *(.rel.got)');
+          add('      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)');
+          add('    }');
+          add('  .rela.dyn       :');
+          add('    {');
+          add('      *(.rela.init)');
+          add('      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)');
+          add('      *(.rela.fini)');
+          add('      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)');
+          add('      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)');
+          add('      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)');
+          add('      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)');
+          add('      *(.rela.ctors)');
+          add('      *(.rela.dtors)');
+          add('      *(.rela.got)');
+          add('      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)');
+          add('    }');
+          add('  .rel.plt        : { *(.rel.plt) }');
+          add('  .rela.plt       : { *(.rela.plt) }');
+          add('  .init           :');
+          add('  {');
+          add('    KEEP (*(.init))');
+          add('  } =0');
+          add('  .plt            : { *(.plt) }');
+          add('  .text           :');
+          add('  {');
+          add('    *(.text .stub .text.* .gnu.linkonce.t.*)');
+          add('    KEEP (*(.text.*personality*))');
+          add('    /* .gnu.warning sections are handled specially by elf32.em.  */');
+          add('    *(.gnu.warning)');
+          add('    *(.glue_7t) *(.glue_7) *(.vfp11_veneer)');
+          add('  } =0');
+          add('  .fini           :');
+          add('  {');
+          add('    KEEP (*(.fini))');
+          add('  } =0');
+          add('  PROVIDE (__etext = .);');
+          add('  PROVIDE (_etext = .);');
+          add('  PROVIDE (etext = .);');
+          add('  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }');
+          add('  .rodata1        : { *(.rodata1) }');
+          add('  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) }');
+          add('   __exidx_start = .;');
+          add('  .ARM.exidx   : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }');
+          add('   __exidx_end = .;');
+          add('  .eh_frame_hdr : { *(.eh_frame_hdr) }');
+          add('  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }');
+          add('  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }');
+          add('  /* Adjust the address for the data segment.  We want to adjust up to');
+          add('     the same address within the page on the next page up.  */');
+          add('  . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1));');
+          add('  /* Exception handling  */');
+          add('  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }');
+          add('  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }');
+          add('  /* Thread Local Storage sections  */');
+          add('  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }');
+          add('  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }');
+          add('  .preinit_array     :');
+          add('  {');
+          add('    PROVIDE_HIDDEN (__preinit_array_start = .);');
+          add('    KEEP (*(.preinit_array))');
+          add('    PROVIDE_HIDDEN (__preinit_array_end = .);');
+          add('  }');
+          add('  .init_array     :');
+          add('  {');
+          add('     PROVIDE_HIDDEN (__init_array_start = .);');
+          add('     KEEP (*(SORT(.init_array.*)))');
+          add('     KEEP (*(.init_array))');
+          add('     PROVIDE_HIDDEN (__init_array_end = .);');
+          add('  }');
+          add('  .fini_array     :');
+          add('  {');
+          add('    PROVIDE_HIDDEN (__fini_array_start = .);');
+          add('    KEEP (*(.fini_array))');
+          add('    KEEP (*(SORT(.fini_array.*)))');
+          add('    PROVIDE_HIDDEN (__fini_array_end = .);');
+          add('  }');
+          add('  .ctors          :');
+          add('  {');
+          add('    /* gcc uses crtbegin.o to find the start of');
+          add('       the constructors, so we make sure it is');
+          add('       first.  Because this is a wildcard, it');
+          add('       doesn''t matter if the user does not');
+          add('       actually link against crtbegin.o; the');
+          add('       linker won''t look for a file to match a');
+          add('       wildcard.  The wildcard also means that it');
+          add('       doesn''t matter which directory crtbegin.o');
+          add('       is in.  */');
+          add('    KEEP (*crtbegin.o(.ctors))');
+          add('    KEEP (*crtbegin?.o(.ctors))');
+          add('    /* We don''t want to include the .ctor section from');
+          add('       the crtend.o file until after the sorted ctors.');
+          add('       The .ctor section from the crtend file contains the');
+          add('       end of ctors marker and it must be last */');
+          add('    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))');
+          add('    KEEP (*(SORT(.ctors.*)))');
+          add('    KEEP (*(.ctors))');
+          add('  }');
+          add('  .dtors          :');
+          add('  {');
+          add('    KEEP (*crtbegin.o(.dtors))');
+          add('    KEEP (*crtbegin?.o(.dtors))');
+          add('    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))');
+          add('    KEEP (*(SORT(.dtors.*)))');
+          add('    KEEP (*(.dtors))');
+          add('  }');
+          add('  .jcr            : { KEEP (*(.jcr)) }');
+          add('  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }');
+          add('  .dynamic        : { *(.dynamic) }');
+          add('  .got            : { *(.got.plt) *(.got) }');
+          add('  .data           :');
+          add('  {');
+          add('    __data_start = . ;');
+          add('    *(.data .data.* .gnu.linkonce.d.*)');
+
+          { extra by FPC }
+          add('    KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
+
+          add('    KEEP (*(.gnu.linkonce.d.*personality*))');
+          add('    SORT(CONSTRUCTORS)');
+          add('  }');
+          add('  .data1          : { *(.data1) }');
+          add('  _edata = .; PROVIDE (edata = .);');
+          add('  __bss_start = .;');
+          add('  __bss_start__ = .;');
+          add('  .bss            :');
+          add('  {');
+          add('   *(.dynbss)');
+          add('   *(.bss .bss.* .gnu.linkonce.b.*)');
+          add('   *(COMMON)');
+          add('   /* Align here to ensure that the .bss section occupies space up to');
+          add('      _end.  Align after .bss to ensure correct alignment even if the');
+          add('      .bss section disappears because there are no input sections.');
+          add('      FIXME: Why do we need it? When there is no .bss section, we don''t');
+          add('      pad the .data section.  */');
+          add('   . = ALIGN(. != 0 ? 32 / 8 : 1);');
+          add('  }');
+          add('  _bss_end__ = . ; __bss_end__ = . ;');
+          add('  . = ALIGN(32 / 8);');
+          add('  . = ALIGN(32 / 8);');
+          add('  __end__ = . ;');
+          add('  _end = .; PROVIDE (end = .);');
+          add('  /* Stabs debugging sections.  */');
+          add('  .stab          0 : { *(.stab) }');
+          add('  .stabstr       0 : { *(.stabstr) }');
+          add('  .stab.excl     0 : { *(.stab.excl) }');
+          add('  .stab.exclstr  0 : { *(.stab.exclstr) }');
+          add('  .stab.index    0 : { *(.stab.index) }');
+          add('  .stab.indexstr 0 : { *(.stab.indexstr) }');
+          add('  .comment       0 : { *(.comment) }');
+          add('  /* DWARF debug sections.');
+          add('     Symbols in the DWARF debugging sections are relative to the beginning');
+          add('     of the section so we begin them at 0.  */');
+          add('  /* DWARF 1 */');
+          add('  .debug          0 : { *(.debug) }');
+          add('  .line           0 : { *(.line) }');
+          add('  /* GNU DWARF 1 extensions */');
+          add('  .debug_srcinfo  0 : { *(.debug_srcinfo) }');
+          add('  .debug_sfnames  0 : { *(.debug_sfnames) }');
+          add('  /* DWARF 1.1 and DWARF 2 */');
+          add('  .debug_aranges  0 : { *(.debug_aranges) }');
+          add('  .debug_pubnames 0 : { *(.debug_pubnames) }');
+          add('  /* DWARF 2 */');
+          add('  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }');
+          add('  .debug_abbrev   0 : { *(.debug_abbrev) }');
+          add('  .debug_line     0 : { *(.debug_line) }');
+          add('  .debug_frame    0 : { *(.debug_frame) }');
+          add('  .debug_str      0 : { *(.debug_str) }');
+          add('  .debug_loc      0 : { *(.debug_loc) }');
+          add('  .debug_macinfo  0 : { *(.debug_macinfo) }');
+          add('  /* SGI/MIPS DWARF 2 extensions */');
+          add('  .debug_weaknames 0 : { *(.debug_weaknames) }');
+          add('  .debug_funcnames 0 : { *(.debug_funcnames) }');
+          add('  .debug_typenames 0 : { *(.debug_typenames) }');
+          add('  .debug_varnames  0 : { *(.debug_varnames) }');
+          add('  /* DWARF 3 */');
+          add('  .debug_pubtypes 0 : { *(.debug_pubtypes) }');
+          add('  .debug_ranges   0 : { *(.debug_ranges) }');
+          add('    .stack         0x80000 :');
+          add('  {');
+          add('    _stack = .;');
+          add('    *(.stack)');
+          add('  }');
+          add('  .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }');
+          add('  .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }');
+          add('  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }');
+          add('}');
+        end
+      else
+{$endif ARM}
 
 {$ifndef LINKERSCRIPT_INCLUDED}
-      {Sections.}
-      add('SECTIONS');
-      add('{');
-      {Read-only sections, merged into text segment:}
-      add('  PROVIDE (__executable_start = 0x010000); . = 0x010000 +0x100;');
-      add('  .interp         : { *(.interp) }');
-      add('  .hash           : { *(.hash) }');
-      add('  .dynsym         : { *(.dynsym) }');
-      add('  .dynstr         : { *(.dynstr) }');
-      add('  .gnu.version    : { *(.gnu.version) }');
-      add('  .gnu.version_d  : { *(.gnu.version_d) }');
-      add('  .gnu.version_r  : { *(.gnu.version_r) }');
-      add('  .rel.dyn        :');
-      add('    {');
-      add('      *(.rel.init)');
-      add('      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)');
-      add('      *(.rel.fini)');
-      add('      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)');
-      add('      *(.rel.data.rel.ro*)');
-      add('      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)');
-      add('      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)');
-      add('      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)');
-      add('      *(.rel.got)');
-      add('      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)');
-      add('    }');
-      add('  .rela.dyn       :');
-      add('    {');
-      add('      *(.rela.init)');
-      add('      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)');
-      add('      *(.rela.fini)');
-      add('      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)');
-      add('      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)');
-      add('      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)');
-      add('      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)');
-      add('      *(.rela.got)');
-      add('      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)');
-      add('    }');
-      add('  .rel.plt        : { *(.rel.plt) }');
-      add('  .rela.plt       : { *(.rela.plt) }');
-      add('  .init           :');
-      add('  {');
-      add('    KEEP (*(.init))');
-      add('  } =0x90909090');
-      add('  .plt            : { *(.plt) }');
-      add('  .text           :');
-      add('  {');
-      add('    *(.text .stub .text.* .gnu.linkonce.t.*)');
-      add('    KEEP (*(.text.*personality*))');
-      {.gnu.warning sections are handled specially by elf32.em.}
-      add('    *(.gnu.warning)');
-      add('  } =0x90909090');
-      add('  .fini           :');
-      add('  {');
-      add('    KEEP (*(.fini))');
-      add('  } =0x90909090');
-      add('  PROVIDE (_etext = .);');
-      add('  .rodata         :');
-      add('  {');
-      add('    *(.rodata .rodata.* .gnu.linkonce.r.*)');
-      add('  }');
-      {Adjust the address for the data segment.  We want to adjust up to
-       the same address within the page on the next page up.}
-      add('  . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1));');
-      add('  .dynamic        : { *(.dynamic) }');
-      add('  .got            : { *(.got) }');
-      add('  .got.plt        : { *(.got.plt) }');
-      add('  .data           :');
-      add('  {');
-      add('    *(.data .data.* .gnu.linkonce.d.*)');
-      add('    KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
-      add('    KEEP (*(.gnu.linkonce.d.*personality*))');
-      add('  }');
-      add('  PROVIDE (_edata = .);');
-      add('  PROVIDE (edata = .);');
-    {$ifdef zsegment_threadvars}
-      add('  _z = .;');
-      add('  .threadvar 0 : AT (_z) { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }');
-      add('  PROVIDE (_threadvar_size = SIZEOF(.threadvar));');
-      add('  . = _z + SIZEOF (.threadvar);');
-    {$else}
-      add('  .threadvar : { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }');
-    {$endif}
-      add('  __bss_start = .;');
-      add('  .bss            :');
-      add('  {');
-      add('   *(.dynbss)');
-      add('   *(.bss .bss.* .gnu.linkonce.b.*)');
-      add('   *(COMMON)');
-      {Align here to ensure that the .bss section occupies space up to
-       _end.  Align after .bss to ensure correct alignment even if the
-       .bss section disappears because there are no input sections.}
-      add('   . = ALIGN(32 / 8);');
-      add('  }');
-      add('  . = ALIGN(32 / 8);');
-      add('  PROVIDE (_end = .);');
-      add('  PROVIDE (end = .);');
-      {Stabs debugging sections.}
-      add('  .stab          0 : { *(.stab) }');
-      add('  .stabstr       0 : { *(.stabstr) }');
-      add('}');
+        begin
+          {Sections.}
+          add('SECTIONS');
+          add('{');
+          {Read-only sections, merged into text segment:}
+          add('  PROVIDE (__executable_start = 0x010000); . = 0x010000 +0x100;');
+          add('  .interp         : { *(.interp) }');
+          add('  .hash           : { *(.hash) }');
+          add('  .dynsym         : { *(.dynsym) }');
+          add('  .dynstr         : { *(.dynstr) }');
+          add('  .gnu.version    : { *(.gnu.version) }');
+          add('  .gnu.version_d  : { *(.gnu.version_d) }');
+          add('  .gnu.version_r  : { *(.gnu.version_r) }');
+          add('  .rel.dyn        :');
+          add('    {');
+          add('      *(.rel.init)');
+          add('      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)');
+          add('      *(.rel.fini)');
+          add('      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)');
+          add('      *(.rel.data.rel.ro*)');
+          add('      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)');
+          add('      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)');
+          add('      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)');
+          add('      *(.rel.got)');
+          add('      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)');
+          add('    }');
+          add('  .rela.dyn       :');
+          add('    {');
+          add('      *(.rela.init)');
+          add('      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)');
+          add('      *(.rela.fini)');
+          add('      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)');
+          add('      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)');
+          add('      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)');
+          add('      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)');
+          add('      *(.rela.got)');
+          add('      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)');
+          add('    }');
+          add('  .rel.plt        : { *(.rel.plt) }');
+          add('  .rela.plt       : { *(.rela.plt) }');
+          add('  .init           :');
+          add('  {');
+          add('    KEEP (*(.init))');
+          add('  } =0x90909090');
+          add('  .plt            : { *(.plt) }');
+          add('  .text           :');
+          add('  {');
+          add('    *(.text .stub .text.* .gnu.linkonce.t.*)');
+          add('    KEEP (*(.text.*personality*))');
+          {.gnu.warning sections are handled specially by elf32.em.}
+          add('    *(.gnu.warning)');
+          add('  } =0x90909090');
+          add('  .fini           :');
+          add('  {');
+          add('    KEEP (*(.fini))');
+          add('  } =0x90909090');
+          add('  PROVIDE (_etext = .);');
+          add('  .rodata         :');
+          add('  {');
+          add('    *(.rodata .rodata.* .gnu.linkonce.r.*)');
+          add('  }');
+          {Adjust the address for the data segment.  We want to adjust up to
+           the same address within the page on the next page up.}
+          add('  . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1));');
+          add('  .dynamic        : { *(.dynamic) }');
+          add('  .got            : { *(.got) }');
+          add('  .got.plt        : { *(.got.plt) }');
+          add('  .data           :');
+          add('  {');
+          add('    *(.data .data.* .gnu.linkonce.d.*)');
+          add('    KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
+          add('    KEEP (*(.gnu.linkonce.d.*personality*))');
+          add('  }');
+          add('  PROVIDE (_edata = .);');
+          add('  PROVIDE (edata = .);');
+        {$ifdef zsegment_threadvars}
+          add('  _z = .;');
+          add('  .threadvar 0 : AT (_z) { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }');
+          add('  PROVIDE (_threadvar_size = SIZEOF(.threadvar));');
+          add('  . = _z + SIZEOF (.threadvar);');
+        {$else}
+          add('  .threadvar : { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }');
+        {$endif}
+          add('  __bss_start = .;');
+          add('  .bss            :');
+          add('  {');
+          add('   *(.dynbss)');
+          add('   *(.bss .bss.* .gnu.linkonce.b.*)');
+          add('   *(COMMON)');
+          {Align here to ensure that the .bss section occupies space up to
+           _end.  Align after .bss to ensure correct alignment even if the
+           .bss section disappears because there are no input sections.}
+          add('   . = ALIGN(32 / 8);');
+          add('  }');
+          add('  . = ALIGN(32 / 8);');
+          add('  PROVIDE (_end = .);');
+          add('  PROVIDE (end = .);');
+          {Stabs debugging sections.}
+          add('  .stab          0 : { *(.stab) }');
+          add('  .stabstr       0 : { *(.stabstr) }');
+          add('}');
+        end;
 {$endif LINKERSCRIPT_INCLUDED}
       { Write and Close response }
       writetodisk;