Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* ld.h -- general linker header file |
18625d54 | 2 | Copyright (C) 1991, 93, 94, 95, 96, 97, 98, 99, 2000 |
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 CM |
60 | /* A file name list */ |
61 | typedef struct name_list | |
62 | { | |
63 | const char *name; | |
64 | struct name_list *next; | |
65 | } name_list; | |
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 | ||
70 | struct wildcard_spec | |
71 | { | |
72 | const char *name; | |
18625d54 | 73 | struct name_list *exclude_name_list; |
252b5132 RH |
74 | boolean sorted; |
75 | }; | |
76 | ||
77 | /* Extra information we hold on sections */ | |
78 | typedef struct user_section_struct | |
79 | { | |
80 | /* Pointer to the section where this data will go */ | |
81 | struct lang_input_statement_struct *file; | |
82 | } section_userdata_type; | |
83 | ||
252b5132 RH |
84 | #define get_userdata(x) ((x)->userdata) |
85 | ||
86 | #define BYTE_SIZE (1) | |
87 | #define SHORT_SIZE (2) | |
88 | #define LONG_SIZE (4) | |
89 | #define QUAD_SIZE (8) | |
90 | ||
91 | /* ALIGN macro changed to ALIGN_N to avoid */ | |
92 | /* conflict in /usr/include/machine/machparam.h */ | |
93 | /* WARNING: If THIS is a 64 bit address and BOUNDARY is a 32 bit int, | |
94 | you must coerce boundary to the same type as THIS. | |
95 | ??? Is there a portable way to avoid this. */ | |
96 | #define ALIGN_N(this, boundary) \ | |
97 | ((( (this) + ((boundary) -1)) & (~((boundary)-1)))) | |
98 | ||
99 | typedef struct | |
100 | { | |
101 | /* 1 => assign space to common symbols even if `relocatable_output'. */ | |
102 | boolean force_common_definition; | |
103 | boolean relax; | |
104 | ||
105 | /* Name of runtime interpreter to invoke. */ | |
106 | char *interpreter; | |
107 | ||
108 | /* Name to give runtime libary from the -soname argument. */ | |
109 | char *soname; | |
110 | ||
111 | /* Runtime library search path from the -rpath argument. */ | |
112 | char *rpath; | |
113 | ||
114 | /* Link time runtime library search path from the -rpath-link | |
115 | argument. */ | |
116 | char *rpath_link; | |
117 | ||
118 | /* Big or little endian as set on command line. */ | |
119 | enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian; | |
120 | ||
121 | /* If true, export all symbols in the dynamic symbol table of an ELF | |
122 | executable. */ | |
123 | boolean export_dynamic; | |
124 | ||
125 | /* If true, build MIPS embedded PIC relocation tables in the output | |
126 | file. */ | |
127 | boolean embedded_relocs; | |
128 | ||
5cc18311 | 129 | /* If true, force generation of a file with a .exe file. */ |
252b5132 RH |
130 | boolean force_exe_suffix; |
131 | ||
132 | /* If true, generate a cross reference report. */ | |
133 | boolean cref; | |
134 | ||
135 | /* If true (which is the default), warn about mismatched input | |
136 | files. */ | |
137 | boolean warn_mismatch; | |
138 | ||
139 | /* Remove unreferenced sections? */ | |
140 | boolean gc_sections; | |
141 | ||
142 | /* Name of shared object whose symbol table should be filtered with | |
143 | this shared object. From the --filter option. */ | |
144 | char *filter_shlib; | |
145 | ||
146 | /* Name of shared object for whose symbol table this shared object | |
147 | is an auxiliary filter. From the --auxiliary option. */ | |
148 | char **auxiliary_filters; | |
149 | ||
150 | /* A version symbol to be applied to the symbol names found in the | |
151 | .exports sections. */ | |
152 | char *version_exports_section; | |
153 | ||
154 | /* If true (the default) check section addresses, once compute, | |
155 | fpor overlaps. */ | |
156 | boolean check_section_addresses; | |
5cc18311 | 157 | |
252b5132 RH |
158 | } args_type; |
159 | ||
160 | extern args_type command_line; | |
161 | ||
162 | typedef int token_code_type; | |
163 | ||
5cc18311 | 164 | typedef struct |
252b5132 RH |
165 | { |
166 | bfd_size_type specified_data_size; | |
167 | boolean magic_demand_paged; | |
168 | boolean make_executable; | |
169 | ||
170 | /* If true, doing a dynamic link. */ | |
171 | boolean dynamic_link; | |
172 | ||
173 | /* If true, -shared is supported. */ | |
174 | /* ??? A better way to do this is perhaps to define this in the | |
175 | ld_emulation_xfer_struct since this is really a target dependent | |
176 | parameter. */ | |
177 | boolean has_shared; | |
178 | ||
179 | /* If true, build constructors. */ | |
180 | boolean build_constructors; | |
181 | ||
182 | /* If true, warn about any constructors. */ | |
183 | boolean warn_constructors; | |
184 | ||
185 | /* If true, warn about merging common symbols with others. */ | |
186 | boolean warn_common; | |
187 | ||
188 | /* If true, only warn once about a particular undefined symbol. */ | |
189 | boolean warn_once; | |
190 | ||
191 | /* If true, warn if multiple global-pointers are needed (Alpha | |
192 | only). */ | |
193 | boolean warn_multiple_gp; | |
194 | ||
195 | /* If true, warn if the starting address of an output section | |
196 | changes due to the alignment of an input section. */ | |
197 | boolean warn_section_align; | |
198 | ||
199 | boolean sort_common; | |
200 | ||
201 | boolean text_read_only; | |
202 | ||
203 | char *map_filename; | |
204 | FILE *map_file; | |
205 | ||
206 | boolean stats; | |
207 | ||
a854a4a7 AM |
208 | /* If set, orphan input sections will be mapped to separate output |
209 | sections. */ | |
210 | boolean unique_orphan_sections; | |
211 | ||
212 | unsigned int split_by_reloc; | |
213 | bfd_size_type split_by_file; | |
252b5132 RH |
214 | } ld_config_type; |
215 | ||
216 | extern ld_config_type config; | |
217 | ||
218 | typedef enum | |
219 | { | |
220 | lang_first_phase_enum, | |
221 | lang_allocating_phase_enum, | |
222 | lang_final_phase_enum | |
223 | } lang_phase_type; | |
224 | ||
225 | extern boolean had_script; | |
226 | extern boolean force_make_executable; | |
227 | ||
228 | /* Non-zero if we are processing a --defsym from the command line. */ | |
229 | extern int parsing_defsym; | |
230 | ||
231 | extern int yyparse PARAMS ((void)); | |
232 | ||
233 | extern void add_cref PARAMS ((const char *, bfd *, asection *, bfd_vma)); | |
234 | extern void output_cref PARAMS ((FILE *)); | |
235 | extern void check_nocrossrefs PARAMS ((void)); | |
236 | ||
45455cdd ILT |
237 | extern void ld_abort PARAMS ((const char *, int, const char *)) |
238 | ATTRIBUTE_NORETURN; | |
239 | ||
a1934524 AM |
240 | /* If gcc >= 2.6, we can give a function name, too. */ |
241 | #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) | |
45455cdd ILT |
242 | #define __PRETTY_FUNCTION__ ((char*) NULL) |
243 | #endif | |
244 | ||
245 | #undef abort | |
246 | #define abort() ld_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) | |
247 | ||
252b5132 | 248 | #endif |