Non-contiguous memory regions support: Avoid calls to abort
[deliverable/binutils-gdb.git] / ld / emultempl / vxworks.em
CommitLineData
f96b4a7b 1# This shell script emits a C file. -*- C -*-
b3adc24a 2# Copyright (C) 2006-2020 Free Software Foundation, Inc.
f96b4a7b
NC
3#
4# This file is part of the GNU Binutils.
5#
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.
10#
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.
15#
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,
19# MA 02110-1301, USA.
20#
21
4f471f39 22if test -n "$VXWORKS_BASE_EM_FILE" ; then
92b93329 23 source_em "${srcdir}/emultempl/${VXWORKS_BASE_EM_FILE}.em"
4f471f39
RS
24fi
25
92b93329 26fragment <<EOF
4f471f39
RS
27
28static int force_dynamic;
29
c76308d2
RS
30static void
31vxworks_before_parse (void)
32{
33 ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse} ();
34 config.rpath_separator = ';';
35}
36
4f471f39
RS
37static void
38vxworks_after_open (void)
39{
40 ${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open} ();
41
42 if (force_dynamic
43 && link_info.input_bfds
f13a99db 44 && bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
4f471f39
RS
45 && !_bfd_elf_link_create_dynamic_sections (link_info.input_bfds,
46 &link_info))
df5f2391 47 einfo (_("%X%P: cannot create dynamic sections %E\n"));
4f471f39
RS
48
49 if (!force_dynamic
0e1862bb 50 && !bfd_link_pic (&link_info)
f13a99db 51 && bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
4f471f39 52 && elf_hash_table (&link_info)->dynamic_sections_created)
df5f2391 53 einfo (_("%X%P: dynamic sections created in non-dynamic link\n"));
4f471f39
RS
54}
55
56EOF
57
58PARSE_AND_LIST_PROLOGUE=$PARSE_AND_LIST_PROLOGUE'
59enum {
60 OPTION_FORCE_DYNAMIC = 501
61};
62'
63
64PARSE_AND_LIST_LONGOPTS=$PARSE_AND_LIST_LONGOPTS'
65 {"force-dynamic", no_argument, NULL, OPTION_FORCE_DYNAMIC},
66'
67
68PARSE_AND_LIST_OPTIONS=$PARSE_AND_LIST_OPTIONS'
69 fprintf (file, _("\
442996ee 70 --force-dynamic Always create dynamic sections\n"));
4f471f39
RS
71'
72
73PARSE_AND_LIST_ARGS_CASES=$PARSE_AND_LIST_ARGS_CASES'
74 case OPTION_FORCE_DYNAMIC:
75 force_dynamic = 1;
76 break;
77'
78
c76308d2
RS
79# Hook in our routines above. There are three possibilities:
80#
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,
83#
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
075a2b89 86# replaced elf.em's default definition, so we simply #define
c76308d2
RS
87# the current value of LDEMUL_FOO to vxworks_foo.
88#
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).
92for override in before_parse after_open; do
b903363e 93 var="LDEMUL_`echo ${override} | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
c76308d2
RS
94 eval value=\$${var}
95 if test "${value}" = "gld${EMULATION_NAME}_${override}"; then
92b93329 96 fragment <<EOF
c76308d2
RS
97#define ${value} vxworks_${override}
98EOF
99 else
100 eval $var=vxworks_${override}
101 fi
102done
This page took 0.574226 seconds and 4 git commands to generate.