1 # This shell script emits a C file. -*- C -*-
2 # Copyright 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
4 # This file is part of the GNU Binutils.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 if test -n "$VXWORKS_BASE_EM_FILE" ; then
23 source_em "${srcdir}/emultempl/${VXWORKS_BASE_EM_FILE}.em"
28 static int force_dynamic;
31 vxworks_before_parse (void)
33 ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse} ();
34 config.rpath_separator = ';';
38 vxworks_after_open (void)
40 ${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open} ();
43 && link_info.input_bfds
44 && bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
45 && !_bfd_elf_link_create_dynamic_sections (link_info.input_bfds,
47 einfo ("%X%P: Cannot create dynamic sections %E\n");
51 && bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
52 && elf_hash_table (&link_info)->dynamic_sections_created)
53 einfo ("%X%P: Dynamic sections created in non-dynamic link\n");
58 PARSE_AND_LIST_PROLOGUE=$PARSE_AND_LIST_PROLOGUE'
60 OPTION_FORCE_DYNAMIC = 501
64 PARSE_AND_LIST_LONGOPTS=$PARSE_AND_LIST_LONGOPTS'
65 {"force-dynamic", no_argument, NULL, OPTION_FORCE_DYNAMIC},
68 PARSE_AND_LIST_OPTIONS=$PARSE_AND_LIST_OPTIONS'
70 --force-dynamic Always create dynamic sections\n"));
73 PARSE_AND_LIST_ARGS_CASES=$PARSE_AND_LIST_ARGS_CASES'
74 case OPTION_FORCE_DYNAMIC:
79 # Hook in our routines above. There are three possibilities:
81 # (1) VXWORKS_BASE_EM_FILE did not set the hook's LDEMUL_FOO variable.
82 # We want to define LDEMUL_FOO to vxworks_foo in that case,
84 # (2) VXWORKS_BASE_EM_FILE set the hook's LDEMUL_FOO variable to
85 # gld${EMULATION_NAME}_foo. This means that the file has
86 # replaced elf32.em's default definition, so we simply #define
87 # the current value of LDEMUL_FOO to vxworks_foo.
89 # (3) VXWORKS_BASE_EM_FILE set the hook's LDEMUL_FOO variable to
90 # something other than gld${EMULATION_NAME}_foo. We handle
91 # this case in the same way as (1).
92 for override in before_parse after_open; do
93 var="LDEMUL_`echo ${override} | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
95 if test "${value}" = "gld${EMULATION_NAME}_${override}"; then
97 #define ${value} vxworks_${override}
100 eval $var=vxworks_${override}