# This shell script emits a C file. -*- C -*-
# It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* intel coff loader emulation specific stuff
- Copyright 1991, 1992, 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1991, 1992, 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003,
+ 2005, 2007, 2008 Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
-This file is part of GLD, the Gnu Linker.
+ This file is part of the GNU Binutils.
-GLD 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, 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.
-GLD 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 GLD; see the file COPYING. If not, write to
-the Free Software Foundation, 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. */
+#include "sysdep.h"
#include "libiberty.h"
#include "bfd.h"
-#include "sysdep.h"
#include "bfdlink.h"
/*#include "archures.h"*/
static lib_list_type *syslib_list;
static lib_list_type **syslib_list_tail = &syslib_list;
-static void append PARAMS ((lib_list_type ***, char *));
-static void lnk960_hll PARAMS ((char *));
-static void lnk960_syslib PARAMS ((char *));
-static void lnk960_before_parse PARAMS ((void));
-static void add_on PARAMS ((lib_list_type *, lang_input_file_enum_type));
-static void lnk960_after_parse PARAMS ((void));
-static void lnk960_before_allocation PARAMS ((void));
-static void lnk960_after_allocation PARAMS ((void));
-static void lnk960_set_output_arch PARAMS ((void));
-static char *lnk960_choose_target PARAMS ((int, char **));
-static char *lnk960_get_script PARAMS ((int *));
-
static void
-append (list, name)
- lib_list_type ***list;
- char *name;
+append (lib_list_type ***list, char *name)
{
lib_list_type *element = (lib_list_type *) xmalloc (sizeof (lib_list_type));
static bfd_boolean had_hll_name = FALSE;
static void
-lnk960_hll (name)
- char *name;
+lnk960_hll (char *name)
{
had_hll = TRUE;
if (name != (char *) NULL)
}
}
-static void
-lnk960_syslib (name)
- char *name;
+static void
+lnk960_syslib (char *name)
{
append (&syslib_list_tail, name);
}
-#ifdef GNU960
-
-static void
-lnk960_before_parse ()
-{
- static char *env_variables[] = { "G960LIB", "G960BASE", 0 };
- char **p;
- char *env ;
-
- for (p = env_variables; *p; p++)
- {
- env = (char *) getenv (*p);
- if (env)
- ldfile_add_library_path (concat (env, "/lib/libcoff", ""), FALSE);
- }
-
- env = (char *) getenv ("I960BASE");
- if (env)
- ldfile_add_library_path(concat (env, "/lib", ""), FALSE);
-
- ldfile_output_architecture = bfd_arch_i960;
- ldfile_output_machine = bfd_mach_i960_core;
-}
-
-#else /* not GNU960 */
-
-static void
-lnk960_before_parse ()
+static void
+lnk960_before_parse (void)
{
char *name = getenv ("I960BASE");
einfo ("%P%F I960BASE and G960BASE not set\n");
}
-
- ldfile_add_library_path (concat (name, "/lib", ""), FALSE);
+ ldfile_add_library_path (concat (name, "/lib", (const char *) NULL), FALSE);
ldfile_output_architecture = bfd_arch_i960;
ldfile_output_machine = bfd_mach_i960_core;
}
-#endif /* GNU960 */
-
-
static void
-add_on (list, search)
- lib_list_type *list;
- lang_input_file_enum_type search;
+add_on (lib_list_type *list, lang_input_file_enum_type search)
{
while (list)
{
list = list->next;
}
}
+
static void
-lnk960_after_parse ()
+lnk960_after_parse (void)
{
/* If there has been no arch, default to -KB */
if (ldfile_output_machine_name[0] == 0)
ldfile_add_arch ("KB");
/* if there has been no hll list then add our own */
-
+
if (had_hll && !had_hll_name)
{
append (&hll_list_tail, "cg");
|| ldfile_output_machine == bfd_mach_i960_ca)
append (&hll_list_tail, "fpg");
}
-
+
add_on (hll_list, lang_input_file_is_l_enum);
add_on (syslib_list, lang_input_file_is_search_file_enum);
}
static void
-lnk960_before_allocation ()
-{
-}
-
-static void
-lnk960_after_allocation ()
+lnk960_after_allocation (void)
{
- if (!link_info.relocateable)
+ if (!link_info.relocatable)
{
lang_abs_symbol_at_end_of (".text", "_etext");
lang_abs_symbol_at_end_of (".data", "_edata");
static struct
{
unsigned long number;
- char *name;
+ char *name;
}
machine_table[] =
{
};
static void
-lnk960_set_output_arch ()
+lnk960_set_output_arch (void)
{
/* Set the output architecture and machine if possible */
unsigned int i;
break;
}
}
- bfd_set_arch_mach (output_bfd, ldfile_output_architecture,
+ bfd_set_arch_mach (link_info.output_bfd, ldfile_output_architecture,
ldfile_output_machine);
}
static char *
-lnk960_choose_target (argc, argv)
- int argc ATTRIBUTE_UNUSED;
- char **argv ATTRIBUTE_UNUSED;
+lnk960_choose_target (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
{
-#ifdef GNU960
-
- return bfd_make_targ_name (BFD_COFF_FORMAT, 0);
-
-#else
-
char *from_outside = getenv (TARGET_ENVIRON);
if (from_outside != (char *) NULL)
return from_outside;
#else
return "coff-Intel-big";
#endif
-#endif
-
}
static char *
-lnk960_get_script (isfile)
- int *isfile;
+lnk960_get_script (int *isfile)
EOF
if test -n "$COMPILE_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.relocateable && config.build_constructors)
+ if (link_info.relocatable && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocateable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (link_info.relocatable) 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
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
-{
+fragment <<EOF
+{
*isfile = 1;
- if (link_info.relocateable && config.build_constructors)
+ if (link_info.relocatable && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocateable)
+ else if (link_info.relocatable)
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
-struct ld_emulation_xfer_struct ld_lnk960_emulation =
+struct ld_emulation_xfer_struct ld_lnk960_emulation =
{
lnk960_before_parse,
lnk960_syslib,
lnk960_hll,
lnk960_after_parse,
- NULL, /* after_open */
+ after_open_default,
lnk960_after_allocation,
lnk960_set_output_arch,
lnk960_choose_target,
- lnk960_before_allocation,
+ before_allocation_default,
lnk960_get_script,
"lnk960",
"",
- NULL, /* finish */
+ finish_default,
NULL, /* create output section statements */
NULL, /* open dynamic archive */
NULL, /* place orphan */