Commit | Line | Data |
---|---|---|
1c0d3aa6 | 1 | # This shell script emits a C file. -*- C -*- |
b3adc24a | 2 | # Copyright (C) 2006-2020 Free Software Foundation, Inc. |
92b93329 | 3 | # Contributed by: |
c3b7224a | 4 | # Brain.lin (brain.lin@sunplusct.com) |
1c0d3aa6 NC |
5 | # Mei Ligang (ligang@sunnorth.com.cn) |
6 | # Pei-Lin Tsai (pltsai@sunplus.com) | |
7 | ||
f96b4a7b | 8 | # This file is part of the GNU Binutils. |
1c0d3aa6 NC |
9 | # |
10 | # This program is free software; you can redistribute it and/or modify | |
11 | # it under the terms of the GNU General Public License as published by | |
f96b4a7b | 12 | # the Free Software Foundation; either version 3 of the License, or |
1c0d3aa6 NC |
13 | # (at your option) any later version. |
14 | # | |
15 | # This program is distributed in the hope that it will be useful, | |
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | # GNU General Public License for more details. | |
19 | # | |
20 | # You should have received a copy of the GNU General Public License | |
21 | # along with this program; if not, write to the Free Software | |
f96b4a7b NC |
22 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
23 | # MA 02110-1301, USA. | |
1c0d3aa6 NC |
24 | # |
25 | ||
075a2b89 | 26 | # This file is sourced from elf.em, and defines extra score-elf |
1c0d3aa6 NC |
27 | # specific routines. |
28 | # | |
92b93329 | 29 | fragment <<EOF |
1c0d3aa6 | 30 | |
c3b7224a NC |
31 | #include "elf32-score.h" |
32 | ||
1c0d3aa6 | 33 | static void |
e6c7cdec | 34 | gld${EMULATION_NAME}_before_parse (void) |
1c0d3aa6 NC |
35 | { |
36 | #ifndef TARGET_ /* I.e., if not generic. */ | |
c3b7224a | 37 | ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown); |
1c0d3aa6 | 38 | #endif /* not TARGET_ */ |
66be1055 | 39 | input_flags.dynamic = ${DYNAMIC_LINK-TRUE}; |
c3b7224a | 40 | config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`; |
e2caaa1f | 41 | config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`; |
5c3261b0 | 42 | link_info.check_relocs_after_open_input = TRUE; |
5fd104ad AM |
43 | EOF |
44 | if test -n "$COMMONPAGESIZE"; then | |
45 | fragment <<EOF | |
576438f0 | 46 | link_info.relro = DEFAULT_LD_Z_RELRO; |
5fd104ad AM |
47 | EOF |
48 | fi | |
49 | fragment <<EOF | |
1c0d3aa6 NC |
50 | } |
51 | ||
52 | static void | |
53 | score_elf_after_open (void) | |
54 | { | |
f13a99db | 55 | if (strstr (bfd_get_target (link_info.output_bfd), "score") == NULL) |
1c0d3aa6 NC |
56 | { |
57 | /* The score backend needs special fields in the output hash structure. | |
58 | These will only be created if the output format is an score format, | |
59 | hence we do not support linking and changing output formats at the | |
60 | same time. Use a link followed by objcopy to change output formats. */ | |
df5f2391 AM |
61 | einfo (_("%F%P: error: cannot change output format " |
62 | "whilst linking %s binaries\n"), "S+core"); | |
1c0d3aa6 NC |
63 | return; |
64 | } | |
65 | ||
66 | /* Call the standard elf routine. */ | |
67 | gld${EMULATION_NAME}_after_open (); | |
68 | } | |
69 | ||
70 | EOF | |
71 | ||
c3b7224a NC |
72 | # Define some shell vars to insert bits of code into the standard elf |
73 | # parse_args and list_options functions. | |
74 | # | |
75 | PARSE_AND_LIST_PROLOGUE='' | |
76 | PARSE_AND_LIST_SHORTOPTS= | |
77 | PARSE_AND_LIST_LONGOPTS='' | |
78 | PARSE_AND_LIST_OPTIONS='' | |
79 | PARSE_AND_LIST_ARGS_CASES='' | |
80 | ||
1c0d3aa6 NC |
81 | # We have our own after_open and before_allocation functions, but they call |
82 | # the standard routines, so give them a different name. | |
83 | LDEMUL_AFTER_OPEN=score_elf_after_open | |
84 | ||
85 | # Replace the elf before_parse function with our own. | |
86 | LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse |