]>
Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* ld.h -- general linker header file |
b7a26f91 | 2 | Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002 |
252b5132 RH |
3 | Free Software Foundation, Inc. |
4 | ||
5 | This file is part of GLD, the Gnu Linker. | |
6 | ||
7 | GLD 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, or (at your option) | |
10 | any later version. | |
11 | ||
12 | GLD 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. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GLD; see the file COPYING. If not, write to the Free | |
19 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
20 | 02111-1307, USA. */ | |
21 | ||
22 | #ifndef LD_H | |
23 | #define LD_H | |
24 | ||
25 | #ifdef HAVE_LOCALE_H | |
26 | # include <locale.h> | |
27 | #endif | |
28 | ||
29 | #ifdef ENABLE_NLS | |
30 | # include <libintl.h> | |
31 | # define _(String) gettext (String) | |
32 | # ifdef gettext_noop | |
33 | # define N_(String) gettext_noop (String) | |
34 | # else | |
35 | # define N_(String) (String) | |
36 | # endif | |
37 | #else | |
897083bd AM |
38 | # define gettext(Msgid) (Msgid) |
39 | # define dgettext(Domainname, Msgid) (Msgid) | |
40 | # define dcgettext(Domainname, Msgid, Category) (Msgid) | |
41 | # define textdomain(Domainname) while (0) /* nothing */ | |
42 | # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */ | |
252b5132 RH |
43 | # define _(String) (String) |
44 | # define N_(String) (String) | |
45 | #endif | |
46 | ||
c20f4f8c AM |
47 | #include "bin-bugs.h" |
48 | ||
252b5132 RH |
49 | /* Look in this environment name for the linker to pretend to be */ |
50 | #define EMULATION_ENVIRON "LDEMULATION" | |
51 | /* If in there look for the strings: */ | |
52 | ||
53 | /* Look in this variable for a target format */ | |
54 | #define TARGET_ENVIRON "GNUTARGET" | |
55 | ||
56 | /* Input sections which are put in a section of this name are actually | |
57 | discarded. */ | |
58 | #define DISCARD_SECTION_NAME "/DISCARD/" | |
59 | ||
18625d54 | 60 | /* A file name list */ |
89cdebba KH |
61 | typedef struct name_list { |
62 | const char *name; | |
63 | struct name_list *next; | |
64 | } | |
65 | name_list; | |
18625d54 | 66 | |
252b5132 RH |
67 | /* A wildcard specification. This is only used in ldgram.y, but it |
68 | winds up in ldgram.h, so we need to define it outside. */ | |
69 | ||
89cdebba | 70 | struct wildcard_spec { |
252b5132 | 71 | const char *name; |
18625d54 | 72 | struct name_list *exclude_name_list; |
b34976b6 | 73 | bfd_boolean sorted; |
252b5132 RH |
74 | }; |
75 | ||
b6bf44ba AM |
76 | struct wildcard_list { |
77 | struct wildcard_list *next; | |
78 | struct wildcard_spec spec; | |
79 | }; | |
80 | ||
252b5132 | 81 | /* Extra information we hold on sections */ |
89cdebba | 82 | typedef struct user_section_struct { |
252b5132 RH |
83 | /* Pointer to the section where this data will go */ |
84 | struct lang_input_statement_struct *file; | |
85 | } section_userdata_type; | |
86 | ||
252b5132 RH |
87 | #define get_userdata(x) ((x)->userdata) |
88 | ||
89 | #define BYTE_SIZE (1) | |
90 | #define SHORT_SIZE (2) | |
91 | #define LONG_SIZE (4) | |
92 | #define QUAD_SIZE (8) | |
93 | ||
89cdebba | 94 | typedef struct { |
252b5132 | 95 | /* 1 => assign space to common symbols even if `relocatable_output'. */ |
b34976b6 | 96 | bfd_boolean force_common_definition; |
4818e05f | 97 | |
b7a26f91 | 98 | /* 1 => do not assign addresses to common symbols. */ |
b34976b6 AM |
99 | bfd_boolean inhibit_common_definition; |
100 | bfd_boolean relax; | |
252b5132 RH |
101 | |
102 | /* Name of runtime interpreter to invoke. */ | |
103 | char *interpreter; | |
104 | ||
105 | /* Name to give runtime libary from the -soname argument. */ | |
106 | char *soname; | |
107 | ||
108 | /* Runtime library search path from the -rpath argument. */ | |
109 | char *rpath; | |
110 | ||
111 | /* Link time runtime library search path from the -rpath-link | |
112 | argument. */ | |
113 | char *rpath_link; | |
114 | ||
115 | /* Big or little endian as set on command line. */ | |
116 | enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian; | |
117 | ||
b34976b6 | 118 | /* If TRUE, build MIPS embedded PIC relocation tables in the output |
252b5132 | 119 | file. */ |
b34976b6 | 120 | bfd_boolean embedded_relocs; |
252b5132 | 121 | |
b34976b6 AM |
122 | /* If TRUE, force generation of a file with a .exe file. */ |
123 | bfd_boolean force_exe_suffix; | |
252b5132 | 124 | |
b34976b6 AM |
125 | /* If TRUE, generate a cross reference report. */ |
126 | bfd_boolean cref; | |
252b5132 | 127 | |
b34976b6 | 128 | /* If TRUE (which is the default), warn about mismatched input |
252b5132 | 129 | files. */ |
b34976b6 | 130 | bfd_boolean warn_mismatch; |
252b5132 RH |
131 | |
132 | /* Remove unreferenced sections? */ | |
b34976b6 | 133 | bfd_boolean gc_sections; |
252b5132 RH |
134 | |
135 | /* Name of shared object whose symbol table should be filtered with | |
136 | this shared object. From the --filter option. */ | |
137 | char *filter_shlib; | |
138 | ||
139 | /* Name of shared object for whose symbol table this shared object | |
140 | is an auxiliary filter. From the --auxiliary option. */ | |
141 | char **auxiliary_filters; | |
142 | ||
143 | /* A version symbol to be applied to the symbol names found in the | |
144 | .exports sections. */ | |
145 | char *version_exports_section; | |
146 | ||
b34976b6 | 147 | /* If TRUE (the default) check section addresses, once compute, |
252b5132 | 148 | fpor overlaps. */ |
b34976b6 | 149 | bfd_boolean check_section_addresses; |
5cc18311 | 150 | |
252b5132 RH |
151 | } args_type; |
152 | ||
153 | extern args_type command_line; | |
154 | ||
155 | typedef int token_code_type; | |
156 | ||
89cdebba | 157 | typedef struct { |
252b5132 | 158 | bfd_size_type specified_data_size; |
b34976b6 AM |
159 | bfd_boolean magic_demand_paged; |
160 | bfd_boolean make_executable; | |
252b5132 | 161 | |
b34976b6 AM |
162 | /* If TRUE, doing a dynamic link. */ |
163 | bfd_boolean dynamic_link; | |
252b5132 | 164 | |
b34976b6 | 165 | /* If TRUE, -shared is supported. */ |
252b5132 RH |
166 | /* ??? A better way to do this is perhaps to define this in the |
167 | ld_emulation_xfer_struct since this is really a target dependent | |
168 | parameter. */ | |
b34976b6 | 169 | bfd_boolean has_shared; |
252b5132 | 170 | |
b34976b6 AM |
171 | /* If TRUE, build constructors. */ |
172 | bfd_boolean build_constructors; | |
252b5132 | 173 | |
b34976b6 AM |
174 | /* If TRUE, warn about any constructors. */ |
175 | bfd_boolean warn_constructors; | |
252b5132 | 176 | |
b34976b6 AM |
177 | /* If TRUE, warn about merging common symbols with others. */ |
178 | bfd_boolean warn_common; | |
252b5132 | 179 | |
b34976b6 AM |
180 | /* If TRUE, only warn once about a particular undefined symbol. */ |
181 | bfd_boolean warn_once; | |
252b5132 | 182 | |
b34976b6 | 183 | /* If TRUE, warn if multiple global-pointers are needed (Alpha |
252b5132 | 184 | only). */ |
b34976b6 | 185 | bfd_boolean warn_multiple_gp; |
252b5132 | 186 | |
b34976b6 | 187 | /* If TRUE, warn if the starting address of an output section |
252b5132 | 188 | changes due to the alignment of an input section. */ |
b34976b6 | 189 | bfd_boolean warn_section_align; |
252b5132 | 190 | |
b34976b6 AM |
191 | /* If TRUE, warning messages are fatal */ |
192 | bfd_boolean fatal_warnings; | |
7ce691ae | 193 | |
b34976b6 | 194 | bfd_boolean sort_common; |
252b5132 | 195 | |
b34976b6 | 196 | bfd_boolean text_read_only; |
252b5132 RH |
197 | |
198 | char *map_filename; | |
199 | FILE *map_file; | |
200 | ||
b34976b6 | 201 | bfd_boolean stats; |
252b5132 | 202 | |
a854a4a7 AM |
203 | /* If set, orphan input sections will be mapped to separate output |
204 | sections. */ | |
b34976b6 | 205 | bfd_boolean unique_orphan_sections; |
a854a4a7 AM |
206 | |
207 | unsigned int split_by_reloc; | |
208 | bfd_size_type split_by_file; | |
361b220e CD |
209 | |
210 | /* If set, only search library directories explicitly selected | |
211 | on the command line. */ | |
b34976b6 | 212 | bfd_boolean only_cmd_line_lib_dirs; |
252b5132 RH |
213 | } ld_config_type; |
214 | ||
215 | extern ld_config_type config; | |
216 | ||
89cdebba | 217 | typedef enum { |
252b5132 RH |
218 | lang_first_phase_enum, |
219 | lang_allocating_phase_enum, | |
220 | lang_final_phase_enum | |
221 | } lang_phase_type; | |
222 | ||
b9a8de1e | 223 | extern FILE * saved_script_handle; |
b34976b6 | 224 | extern bfd_boolean force_make_executable; |
252b5132 RH |
225 | |
226 | /* Non-zero if we are processing a --defsym from the command line. */ | |
227 | extern int parsing_defsym; | |
228 | ||
229 | extern int yyparse PARAMS ((void)); | |
230 | ||
231 | extern void add_cref PARAMS ((const char *, bfd *, asection *, bfd_vma)); | |
232 | extern void output_cref PARAMS ((FILE *)); | |
233 | extern void check_nocrossrefs PARAMS ((void)); | |
234 | ||
45455cdd ILT |
235 | extern void ld_abort PARAMS ((const char *, int, const char *)) |
236 | ATTRIBUTE_NORETURN; | |
237 | ||
a1934524 AM |
238 | /* If gcc >= 2.6, we can give a function name, too. */ |
239 | #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) | |
45455cdd ILT |
240 | #define __PRETTY_FUNCTION__ ((char*) NULL) |
241 | #endif | |
242 | ||
243 | #undef abort | |
244 | #define abort() ld_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) | |
245 | ||
252b5132 | 246 | #endif |