1 # This shell script emits a C file. -*- C -*-
2 # Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004
3 # Free Software Foundation, Inc.
5 # This file is part of GLD, the Gnu Linker.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # This file is sourced from elf32.em, and defines extra zpu-elf
25 cat >>e${EMULATION_NAME}.c <<EOF
27 static int no_pipeline_knowledge = 0;
30 gld${EMULATION_NAME}_before_parse (void)
32 #ifndef TARGET_ /* I.e., if not generic. */
33 ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
34 #endif /* not TARGET_ */
35 config.dynamic_link = ${DYNAMIC_LINK-TRUE};
36 config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
40 zpu_elf_after_open (void)
42 if (strstr (bfd_get_target (output_bfd), "zpu") == NULL)
44 /* The zpu backend needs special fields in the output hash structure.
45 These will only be created if the output format is an zpu format,
46 hence we do not support linking and changing output formats at the
47 same time. Use a link followed by objcopy to change output formats. */
48 einfo ("%F%X%P: error: cannot change output format whilst linking ZPU binaries\n");
53 /* Call the standard elf routine. */
54 gld${EMULATION_NAME}_after_open ();
63 /* Call the elf32.em routine. */
64 gld${EMULATION_NAME}_finish ();
70 # Define some shell vars to insert bits of code into the standard elf
71 # parse_args and list_options functions.
73 PARSE_AND_LIST_PROLOGUE='
76 PARSE_AND_LIST_SHORTOPTS=p
78 PARSE_AND_LIST_LONGOPTS='
81 PARSE_AND_LIST_OPTIONS='
84 PARSE_AND_LIST_ARGS_CASES='
87 # We have our own after_open and before_allocation functions, but they call
88 # the standard routines, so give them a different name.
89 LDEMUL_AFTER_OPEN=zpu_elf_after_open
91 # Replace the elf before_parse function with our own.
92 LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse
94 # Call the extra zpu-elf function
95 LDEMUL_FINISH=zpu_elf_finish