/* This file is is generated by a shell script.  DO NOT EDIT! */

/* emulate the original gld for the given i386go32
   Copyright (C) 1991-2014 Free Software Foundation, Inc.
   Written by Steve Chamberlain steve@cygnus.com

   This file is part of the GNU Binutils.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
   MA 02110-1301, USA.  */

#define TARGET_IS_i386go32

#include "sysdep.h"
#include "bfd.h"
#include "bfdlink.h"

#include "ld.h"
#include "ldmain.h"
#include "ldmisc.h"

#include "ldexp.h"
#include "ldlang.h"
#include "ldfile.h"
#include "ldemul.h"


static void
gldi386go32_before_parse (void)
{
#ifndef TARGET_			/* I.e., if not generic.  */
  ldfile_set_output_arch ("i386", bfd_arch_unknown);
#endif /* not TARGET_ */
}


static char *
gldi386go32_get_script (int *isfile)
{
  *isfile = 0;

  if (link_info.relocatable && config.build_constructors)
    return
"/* Script for ld -Ur: link w/out relocation, do create constructors */\n\
/* Copyright (C) 2014 Free Software Foundation, Inc.\n\
   Copying and distribution of this script, with or without modification,\n\
   are permitted in any medium without royalty provided the copyright\n\
   notice and this notice are preserved.  */\n\
OUTPUT_FORMAT(\"coff-go32\")\n\
SECTIONS\n\
{\n\
  .text  : {\n\
    *(.text)\n\
    *(.const*)\n\
    *(.ro*)\n\
  }\n\
  .data  : {\n\
    __environ = . ;\n\
    PROVIDE(_environ = .) ;\n\
    LONG(0) ;\n\
    *(.data)\n\
    /* Ugly workaround to prevent entire .bss to have attribute CONTENT */\n\
    /* for C++ executables. */\n\
    *()\n\
  }\n\
  .ctor : {\n\
    *(SORT(.ctors.*))\n\
    *(.ctor)\n"
"  }\n\
  .dtor : {\n\
    *(SORT(.dtors.*))\n\
    *(.dtor)\n\
  }\n\
  .bss  :\n\
  {\n\
    *(.bss)\n\
    *(COMMON)\n\
  }\n\
  /* Discard LTO sections.  */\n\
  /DISCARD/ : { *(gnu.lto_*) }\n\
  /* Stabs debugging sections.  */\n\
  .stab 0 : { *(.stab) }\n\
  .stabstr 0 : { *(.stabstr) }\n\
  /* DWARF debug sections.\n\
     Symbols in the DWARF debugging sections are relative to the beginning\n\
     of the section so we begin them at 0.  */\n\
  /* DWARF 1 */\n\
  .debug          0 : { *(.debug) }\n\
  .line           0 : { *(.line) }\n\
  /* GNU DWARF 1 extensions */\n\
  .debug_srcinfo  0 : { *(.debug_srcinfo) }\n\
  .debug_sfnames  0 : { *(.debug_sfnames) }\n\
  /* DWARF 1.1 and DWARF 2 */\n"
"  .debug_aranges  0 : { *(.debug_aranges) }\n\
  .debug_pubnames 0 : { *(.debug_pubnames) }\n\
  /* DWARF 2 */\n\
  .debug_info     0 : { *(.debug_info) }\n\
  .debug_abbrev   0 : { *(.debug_abbrev) }\n\
  .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }\n\
  .debug_frame    0 : { *(.debug_frame) }\n\
  .debug_str      0 : { *(.debug_str) }\n\
  .debug_loc      0 : { *(.debug_loc) }\n\
  .debug_macinfo  0 : { *(.debug_macinfo) }\n\
  /* SGI/MIPS DWARF 2 extensions */\n\
  .debug_weaknames 0 : { *(.debug_weaknames) }\n\
  .debug_funcnames 0 : { *(.debug_funcnames) }\n\
  .debug_typenames 0 : { *(.debug_typenames) }\n\
  .debug_varnames  0 : { *(.debug_varnames) }\n\
  /* DWARF 3 */\n\
  .debug_pubtypes 0 : { *(.debug_pubtypes) }\n\
  .debug_ranges   0 : { *(.debug_ranges) }\n\
  /* DWARF Extension.  */\n\
  .debug_macro    0 : { *(.debug_macro) }\n\
}\n\n"
  ; else if (link_info.relocatable) return
"/* Script for ld -r: link without relocation */\n\
/* Copyright (C) 2014 Free Software Foundation, Inc.\n\
   Copying and distribution of this script, with or without modification,\n\
   are permitted in any medium without royalty provided the copyright\n\
   notice and this notice are preserved.  */\n\
OUTPUT_FORMAT(\"coff-go32\")\n\
SECTIONS\n\
{\n\
  .text  : {\n\
    *(.text)\n\
    *(.const*)\n\
    *(.ro*)\n\
  }\n\
  .data  : {\n\
    __environ = . ;\n\
    PROVIDE(_environ = .) ;\n\
    LONG(0) ;\n\
    *(.data)\n\
    /* Ugly workaround to prevent entire .bss to have attribute CONTENT */\n\
    /* for C++ executables. */\n\
    *()\n\
  }\n\
  .bss  :\n\
  {\n\
    *(.bss)\n"
"    *(COMMON)\n\
  }\n\
  /* Discard LTO sections.  */\n\
  /DISCARD/ : { *(gnu.lto_*) }\n\
  /* Stabs debugging sections.  */\n\
  .stab 0 : { *(.stab) }\n\
  .stabstr 0 : { *(.stabstr) }\n\
  /* DWARF debug sections.\n\
     Symbols in the DWARF debugging sections are relative to the beginning\n\
     of the section so we begin them at 0.  */\n\
  /* DWARF 1 */\n\
  .debug          0 : { *(.debug) }\n\
  .line           0 : { *(.line) }\n\
  /* GNU DWARF 1 extensions */\n\
  .debug_srcinfo  0 : { *(.debug_srcinfo) }\n\
  .debug_sfnames  0 : { *(.debug_sfnames) }\n\
  /* DWARF 1.1 and DWARF 2 */\n\
  .debug_aranges  0 : { *(.debug_aranges) }\n\
  .debug_pubnames 0 : { *(.debug_pubnames) }\n\
  /* DWARF 2 */\n\
  .debug_info     0 : { *(.debug_info) }\n\
  .debug_abbrev   0 : { *(.debug_abbrev) }\n\
  .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }\n\
  .debug_frame    0 : { *(.debug_frame) }\n\
  .debug_str      0 : { *(.debug_str) }\n"
"  .debug_loc      0 : { *(.debug_loc) }\n\
  .debug_macinfo  0 : { *(.debug_macinfo) }\n\
  /* SGI/MIPS DWARF 2 extensions */\n\
  .debug_weaknames 0 : { *(.debug_weaknames) }\n\
  .debug_funcnames 0 : { *(.debug_funcnames) }\n\
  .debug_typenames 0 : { *(.debug_typenames) }\n\
  .debug_varnames  0 : { *(.debug_varnames) }\n\
  /* DWARF 3 */\n\
  .debug_pubtypes 0 : { *(.debug_pubtypes) }\n\
  .debug_ranges   0 : { *(.debug_ranges) }\n\
  /* DWARF Extension.  */\n\
  .debug_macro    0 : { *(.debug_macro) }\n\
}\n\n"
  ; else if (!config.text_read_only) return
"/* Script for -N: mix text and data on same page; don't align data */\n\
/* Copyright (C) 2014 Free Software Foundation, Inc.\n\
   Copying and distribution of this script, with or without modification,\n\
   are permitted in any medium without royalty provided the copyright\n\
   notice and this notice are preserved.  */\n\
OUTPUT_FORMAT(\"coff-go32-exe\")\n\
ENTRY (start)\n\
SECTIONS\n\
{\n\
  .text  0x1000+SIZEOF_HEADERS : {\n\
    *(.text)\n\
    *(.text.*)\n\
    *(.gnu.linkonce.t*)\n\
    *(.const*)\n\
    *(.ro*)\n\
    *(.gnu.linkonce.r*)\n\
    etext  =  . ; PROVIDE(_etext = .) ;\n\
    . = ALIGN(0x200);\n\
  }\n\
  .data  . : {\n\
    djgpp_first_ctor = . ;\n\
    *(SORT(.ctors.*))\n\
    *(.ctor)\n\
    *(.ctors)\n\
    djgpp_last_ctor = . ;\n"
"    djgpp_first_dtor = . ;\n\
    *(SORT(.dtors.*))\n\
    *(.dtor)\n\
    *(.dtors)\n\
    djgpp_last_dtor = . ;\n\
    __environ = . ;\n\
    PROVIDE(_environ = .) ;\n\
    LONG(0) ;\n\
    *(.data)\n\
    *(.data.*)\n\
    /* Ugly workaround to prevent entire .bss to have attribute CONTENT */\n\
    /* for C++ executables. */\n\
    *( .bss.*)\n\
    *(.gcc_exc*)\n\
    ___EH_FRAME_BEGIN__ = . ;\n\
    *(.eh_fram*)\n\
    ___EH_FRAME_END__ = . ;\n\
    LONG(0);\n\
    *(.gnu.linkonce.d*)\n\
    edata  =  . ; PROVIDE(_edata = .) ;\n\
    . = ALIGN(0x200);\n\
  }\n\
  .bss  SIZEOF(.data) + ADDR(.data) :\n\
  {\n\
    *(.bss .gnu.linkonce.b.*)\n"
"    *(COMMON)\n\
     end = . ; PROVIDE(_end = .) ;\n\
     . = ALIGN(0x200);\n\
  }\n\
  /* Discard LTO sections.  */\n\
  /DISCARD/ : { *(gnu.lto_*) }\n\
  /* Stabs debugging sections.  */\n\
  .stab 0 : { *(.stab) }\n\
  .stabstr 0 : { *(.stabstr) }\n\
  /* DWARF debug sections.\n\
     Symbols in the DWARF debugging sections are relative to the beginning\n\
     of the section so we begin them at 0.  */\n\
  /* DWARF 1 */\n\
  .debug          0 : { *(.debug) }\n\
  .line           0 : { *(.line) }\n\
  /* GNU DWARF 1 extensions */\n\
  .debug_srcinfo  0 : { *(.debug_srcinfo) }\n\
  .debug_sfnames  0 : { *(.debug_sfnames) }\n\
  /* DWARF 1.1 and DWARF 2 */\n\
  .debug_aranges  0 : { *(.debug_aranges) }\n\
  .debug_pubnames 0 : { *(.debug_pubnames) }\n\
  /* DWARF 2 */\n\
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }\n\
  .debug_abbrev   0 : { *(.debug_abbrev) }\n\
  .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }\n"
"  .debug_frame    0 : { *(.debug_frame) }\n\
  .debug_str      0 : { *(.debug_str) }\n\
  .debug_loc      0 : { *(.debug_loc) }\n\
  .debug_macinfo  0 : { *(.debug_macinfo) }\n\
  /* SGI/MIPS DWARF 2 extensions */\n\
  .debug_weaknames 0 : { *(.debug_weaknames) }\n\
  .debug_funcnames 0 : { *(.debug_funcnames) }\n\
  .debug_typenames 0 : { *(.debug_typenames) }\n\
  .debug_varnames  0 : { *(.debug_varnames) }\n\
  /* DWARF 3 */\n\
  .debug_pubtypes 0 : { *(.debug_pubtypes) }\n\
  .debug_ranges   0 : { *(.debug_ranges) }\n\
  /* DWARF Extension.  */\n\
  .debug_macro    0 : { *(.debug_macro) }\n\
}\n\n"
  ; else if (!config.magic_demand_paged) return
"/* Script for -n: mix text and data on same page */\n\
/* Copyright (C) 2014 Free Software Foundation, Inc.\n\
   Copying and distribution of this script, with or without modification,\n\
   are permitted in any medium without royalty provided the copyright\n\
   notice and this notice are preserved.  */\n\
OUTPUT_FORMAT(\"coff-go32-exe\")\n\
ENTRY (start)\n\
SECTIONS\n\
{\n\
  .text  0x1000+SIZEOF_HEADERS : {\n\
    *(.text)\n\
    *(.text.*)\n\
    *(.gnu.linkonce.t*)\n\
    *(.const*)\n\
    *(.ro*)\n\
    *(.gnu.linkonce.r*)\n\
    etext  =  . ; PROVIDE(_etext = .) ;\n\
    . = ALIGN(0x200);\n\
  }\n\
  .data  ALIGN(0x200) : {\n\
    djgpp_first_ctor = . ;\n\
    *(SORT(.ctors.*))\n\
    *(.ctor)\n\
    *(.ctors)\n\
    djgpp_last_ctor = . ;\n"
"    djgpp_first_dtor = . ;\n\
    *(SORT(.dtors.*))\n\
    *(.dtor)\n\
    *(.dtors)\n\
    djgpp_last_dtor = . ;\n\
    __environ = . ;\n\
    PROVIDE(_environ = .) ;\n\
    LONG(0) ;\n\
    *(.data)\n\
    *(.data.*)\n\
    /* Ugly workaround to prevent entire .bss to have attribute CONTENT */\n\
    /* for C++ executables. */\n\
    *( .bss.*)\n\
    *(.gcc_exc*)\n\
    ___EH_FRAME_BEGIN__ = . ;\n\
    *(.eh_fram*)\n\
    ___EH_FRAME_END__ = . ;\n\
    LONG(0);\n\
    *(.gnu.linkonce.d*)\n\
    edata  =  . ; PROVIDE(_edata = .) ;\n\
    . = ALIGN(0x200);\n\
  }\n\
  .bss  SIZEOF(.data) + ADDR(.data) :\n\
  {\n\
    *(.bss .gnu.linkonce.b.*)\n"
"    *(COMMON)\n\
     end = . ; PROVIDE(_end = .) ;\n\
     . = ALIGN(0x200);\n\
  }\n\
  /* Discard LTO sections.  */\n\
  /DISCARD/ : { *(gnu.lto_*) }\n\
  /* Stabs debugging sections.  */\n\
  .stab 0 : { *(.stab) }\n\
  .stabstr 0 : { *(.stabstr) }\n\
  /* DWARF debug sections.\n\
     Symbols in the DWARF debugging sections are relative to the beginning\n\
     of the section so we begin them at 0.  */\n\
  /* DWARF 1 */\n\
  .debug          0 : { *(.debug) }\n\
  .line           0 : { *(.line) }\n\
  /* GNU DWARF 1 extensions */\n\
  .debug_srcinfo  0 : { *(.debug_srcinfo) }\n\
  .debug_sfnames  0 : { *(.debug_sfnames) }\n\
  /* DWARF 1.1 and DWARF 2 */\n\
  .debug_aranges  0 : { *(.debug_aranges) }\n\
  .debug_pubnames 0 : { *(.debug_pubnames) }\n\
  /* DWARF 2 */\n\
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }\n\
  .debug_abbrev   0 : { *(.debug_abbrev) }\n\
  .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }\n"
"  .debug_frame    0 : { *(.debug_frame) }\n\
  .debug_str      0 : { *(.debug_str) }\n\
  .debug_loc      0 : { *(.debug_loc) }\n\
  .debug_macinfo  0 : { *(.debug_macinfo) }\n\
  /* SGI/MIPS DWARF 2 extensions */\n\
  .debug_weaknames 0 : { *(.debug_weaknames) }\n\
  .debug_funcnames 0 : { *(.debug_funcnames) }\n\
  .debug_typenames 0 : { *(.debug_typenames) }\n\
  .debug_varnames  0 : { *(.debug_varnames) }\n\
  /* DWARF 3 */\n\
  .debug_pubtypes 0 : { *(.debug_pubtypes) }\n\
  .debug_ranges   0 : { *(.debug_ranges) }\n\
  /* DWARF Extension.  */\n\
  .debug_macro    0 : { *(.debug_macro) }\n\
}\n\n"
  ; else return
"/* Default linker script, for normal executables */\n\
/* Copyright (C) 2014 Free Software Foundation, Inc.\n\
   Copying and distribution of this script, with or without modification,\n\
   are permitted in any medium without royalty provided the copyright\n\
   notice and this notice are preserved.  */\n\
OUTPUT_FORMAT(\"coff-go32-exe\")\n\
ENTRY (start)\n\
SECTIONS\n\
{\n\
  .text  0x1000+SIZEOF_HEADERS : {\n\
    *(.text)\n\
    *(.text.*)\n\
    *(.gnu.linkonce.t*)\n\
    *(.const*)\n\
    *(.ro*)\n\
    *(.gnu.linkonce.r*)\n\
    etext  =  . ; PROVIDE(_etext = .) ;\n\
    . = ALIGN(0x200);\n\
  }\n\
  .data  ALIGN(0x200) : {\n\
    djgpp_first_ctor = . ;\n\
    *(SORT(.ctors.*))\n\
    *(.ctor)\n\
    *(.ctors)\n\
    djgpp_last_ctor = . ;\n"
"    djgpp_first_dtor = . ;\n\
    *(SORT(.dtors.*))\n\
    *(.dtor)\n\
    *(.dtors)\n\
    djgpp_last_dtor = . ;\n\
    __environ = . ;\n\
    PROVIDE(_environ = .) ;\n\
    LONG(0) ;\n\
    *(.data)\n\
    *(.data.*)\n\
    /* Ugly workaround to prevent entire .bss to have attribute CONTENT */\n\
    /* for C++ executables. */\n\
    *( .bss.*)\n\
    *(.gcc_exc*)\n\
    ___EH_FRAME_BEGIN__ = . ;\n\
    *(.eh_fram*)\n\
    ___EH_FRAME_END__ = . ;\n\
    LONG(0);\n\
    *(.gnu.linkonce.d*)\n\
    edata  =  . ; PROVIDE(_edata = .) ;\n\
    . = ALIGN(0x200);\n\
  }\n\
  .bss  SIZEOF(.data) + ADDR(.data) :\n\
  {\n\
    *(.bss .gnu.linkonce.b.*)\n"
"    *(COMMON)\n\
     end = . ; PROVIDE(_end = .) ;\n\
     . = ALIGN(0x200);\n\
  }\n\
  /* Discard LTO sections.  */\n\
  /DISCARD/ : { *(gnu.lto_*) }\n\
  /* Stabs debugging sections.  */\n\
  .stab 0 : { *(.stab) }\n\
  .stabstr 0 : { *(.stabstr) }\n\
  /* DWARF debug sections.\n\
     Symbols in the DWARF debugging sections are relative to the beginning\n\
     of the section so we begin them at 0.  */\n\
  /* DWARF 1 */\n\
  .debug          0 : { *(.debug) }\n\
  .line           0 : { *(.line) }\n\
  /* GNU DWARF 1 extensions */\n\
  .debug_srcinfo  0 : { *(.debug_srcinfo) }\n\
  .debug_sfnames  0 : { *(.debug_sfnames) }\n\
  /* DWARF 1.1 and DWARF 2 */\n\
  .debug_aranges  0 : { *(.debug_aranges) }\n\
  .debug_pubnames 0 : { *(.debug_pubnames) }\n\
  /* DWARF 2 */\n\
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }\n\
  .debug_abbrev   0 : { *(.debug_abbrev) }\n\
  .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }\n"
"  .debug_frame    0 : { *(.debug_frame) }\n\
  .debug_str      0 : { *(.debug_str) }\n\
  .debug_loc      0 : { *(.debug_loc) }\n\
  .debug_macinfo  0 : { *(.debug_macinfo) }\n\
  /* SGI/MIPS DWARF 2 extensions */\n\
  .debug_weaknames 0 : { *(.debug_weaknames) }\n\
  .debug_funcnames 0 : { *(.debug_funcnames) }\n\
  .debug_typenames 0 : { *(.debug_typenames) }\n\
  .debug_varnames  0 : { *(.debug_varnames) }\n\
  /* DWARF 3 */\n\
  .debug_pubtypes 0 : { *(.debug_pubtypes) }\n\
  .debug_ranges   0 : { *(.debug_ranges) }\n\
  /* DWARF Extension.  */\n\
  .debug_macro    0 : { *(.debug_macro) }\n\
}\n\n"
; }

struct ld_emulation_xfer_struct ld_i386go32_emulation =
{
  gldi386go32_before_parse,
  syslib_default,
  hll_default,
  after_parse_default,
  after_open_default,
  after_allocation_default,
  set_output_arch_default,
  ldemul_default_target,
  before_allocation_default,
  gldi386go32_get_script,
  "i386go32",
  "coff-go32",
  finish_default,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL
};
