Add output_type to bfd_link_info
[deliverable/binutils-gdb.git] / ld / emultempl / m68kcoff.em
index e56c71fc3547aa08342efe7047eb847737739f86..d547ad9d48226ee30cf11cc21599e7337904c9f9 100644 (file)
@@ -1,53 +1,52 @@
 # This shell script emits a C file. -*- C -*-
 # It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* Handle embedded relocs for m68k.
-   Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000-2015 Free Software Foundation, Inc.
    Written by Michael Sokolov <msokolov@ivan.Harhan.ORG>, based on generic.em
    by Steve Chamberlain <steve@cygnus.com>, embedded relocs code based on
-   mipsecoff.em by Ian Lance Taylor <ian@cygnus.com>.
+   mipsecoff.em by Ian Lance Taylor <ian@cygnus.com> (now removed).
 
-This file is part of GLD, the Gnu Linker.
+   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 2 of the License, or
-(at your option) any later version.
+   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.
+   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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   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_${EMULATION_NAME}
 
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "bfdlink.h"
 
 #include "ld.h"
 #include "ldmain.h"
+#include "ldexp.h"
+#include "ldlang.h"
 #include "ldfile.h"
 #include "ldemul.h"
 #include "ldmisc.h"
 
-static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
-static void gld${EMULATION_NAME}_after_open PARAMS ((void));
-static void check_sections PARAMS ((bfd *, asection *, PTR));
-static void gld${EMULATION_NAME}_after_allocation PARAMS ((void));
-static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
+static void check_sections (bfd *, asection *, void *);
 
 static void
-gld${EMULATION_NAME}_before_parse ()
+gld${EMULATION_NAME}_before_parse (void)
 {
 #ifndef TARGET_                        /* I.e., if not generic.  */
-  ldfile_set_output_arch ("`echo ${ARCH}`");
+  ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
 #endif /* not TARGET_ */
 }
 
@@ -58,15 +57,17 @@ gld${EMULATION_NAME}_before_parse ()
    time.  */
 
 static void
-gld${EMULATION_NAME}_after_open ()
+gld${EMULATION_NAME}_after_open (void)
 {
   bfd *abfd;
 
+  after_open_default ();
+
   if (! command_line.embedded_relocs
-      || link_info.relocatable)
+      || bfd_link_relocatable (&link_info))
     return;
 
-  for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next)
+  for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
     {
       asection *datasec;
 
@@ -88,13 +89,12 @@ gld${EMULATION_NAME}_after_open ()
        {
          asection *relsec;
 
-         relsec = bfd_make_section (abfd, ".emreloc");
+         relsec = bfd_make_section_with_flags (abfd, ".emreloc",
+                                               (SEC_ALLOC
+                                                | SEC_LOAD
+                                                | SEC_HAS_CONTENTS
+                                                | SEC_IN_MEMORY));
          if (relsec == NULL
-             || ! bfd_set_section_flags (abfd, relsec,
-                                         (SEC_ALLOC
-                                          | SEC_LOAD
-                                          | SEC_HAS_CONTENTS
-                                          | SEC_IN_MEMORY))
              || ! bfd_set_section_alignment (abfd, relsec, 2)
              || ! bfd_set_section_size (abfd, relsec,
                                         datasec->reloc_count * 12))
@@ -103,7 +103,7 @@ gld${EMULATION_NAME}_after_open ()
 
       /* Double check that all other data sections are empty, as is
          required for embedded PIC code.  */
-      bfd_map_over_sections (abfd, check_sections, (PTR) datasec);
+      bfd_map_over_sections (abfd, check_sections, datasec);
     }
 }
 
@@ -111,13 +111,10 @@ gld${EMULATION_NAME}_after_open ()
    relocs.  This is called via bfd_map_over_sections.  */
 
 static void
-check_sections (abfd, sec, datasec)
-     bfd *abfd;
-     asection *sec;
-     PTR datasec;
+check_sections (bfd *abfd, asection *sec, void *datasec)
 {
   if ((bfd_get_section_flags (abfd, sec) & SEC_DATA)
-      && sec != (asection *) datasec
+      && sec != datasec
       && sec->reloc_count != 0)
     einfo ("%B%X: section %s has relocs; can not use --embedded-relocs\n",
           abfd, bfd_get_section_name (abfd, sec));
@@ -128,15 +125,15 @@ check_sections (abfd, sec, datasec)
    BFD backend routine to do the work.  */
 
 static void
-gld${EMULATION_NAME}_after_allocation ()
+gld${EMULATION_NAME}_after_allocation (void)
 {
   bfd *abfd;
 
   if (! command_line.embedded_relocs
-      || link_info.relocatable)
+      || bfd_link_relocatable (&link_info))
     return;
 
-  for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next)
+  for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
     {
       asection *datasec, *relsec;
       char *errmsg;
@@ -164,26 +161,25 @@ gld${EMULATION_NAME}_after_allocation ()
 }
 
 static char *
-gld${EMULATION_NAME}_get_script(isfile)
-     int *isfile;
+gld${EMULATION_NAME}_get_script (int *isfile)
 EOF
 
-if test -n "$COMPILE_IN"
+if test x"$COMPILE_IN" = xyes
 then
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
 sc="-f stringify.sed"
 
-cat >>e${EMULATION_NAME}.c <<EOF
-{                           
+fragment <<EOF
+{
   *isfile = 0;
 
-  if (link_info.relocatable && config.build_constructors)
+  if (bfd_link_relocatable (&link_info) && config.build_constructors)
     return
 EOF
 sed $sc ldscripts/${EMULATION_NAME}.xu                 >> e${EMULATION_NAME}.c
-echo '  ; else if (link_info.relocatable) return'     >> e${EMULATION_NAME}.c
+echo '  ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
 sed $sc ldscripts/${EMULATION_NAME}.xr                 >> e${EMULATION_NAME}.c
 echo '  ; else if (!config.text_read_only) return'     >> e${EMULATION_NAME}.c
 sed $sc ldscripts/${EMULATION_NAME}.xbn                >> e${EMULATION_NAME}.c
@@ -196,13 +192,13 @@ echo '; }'                                             >> e${EMULATION_NAME}.c
 else
 # Scripts read from the filesystem.
 
-cat >>e${EMULATION_NAME}.c <<EOF
-{                           
+fragment <<EOF
+{
   *isfile = 1;
 
-  if (link_info.relocatable && config.build_constructors)
+  if (bfd_link_relocatable (&link_info) && config.build_constructors)
     return "ldscripts/${EMULATION_NAME}.xu";
-  else if (link_info.relocatable)
+  else if (bfd_link_relocatable (&link_info))
     return "ldscripts/${EMULATION_NAME}.xr";
   else if (!config.text_read_only)
     return "ldscripts/${EMULATION_NAME}.xbn";
@@ -215,9 +211,9 @@ EOF
 
 fi
 
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
 
-struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = 
+struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
 {
   gld${EMULATION_NAME}_before_parse,
   syslib_default,
@@ -231,7 +227,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
   gld${EMULATION_NAME}_get_script,
   "${EMULATION_NAME}",
   "${OUTPUT_FORMAT}",
-  NULL,        /* finish */
+  finish_default,
   NULL,        /* create output section statements */
   NULL,        /* open dynamic archive */
   NULL,        /* place orphan */
@@ -243,6 +239,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
   NULL,        /* list options */
   NULL,        /* recognized file */
   NULL,        /* find_potential_libraries */
-  NULL /* new_vers_pattern */
+  NULL,        /* new_vers_pattern */
+  NULL /* extra_map_file_text */
 };
 EOF
This page took 0.027964 seconds and 4 git commands to generate.