Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | /* ld.h -- general linker header file |
2 | Copyright (C) 1991, 93, 94, 95, 96, 97, 98, 1999 | |
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 | |
38 | /* Stubs that do something close enough. */ | |
39 | # define textdomain(String) (String) | |
40 | # define gettext(String) (String) | |
41 | # define dgettext(Domain,Message) (Message) | |
42 | # define dcgettext(Domain,Message,Type) (Message) | |
43 | # define bindtextdomain(Domain,Directory) (Domain) | |
44 | # define _(String) (String) | |
45 | # define N_(String) (String) | |
46 | #endif | |
47 | ||
48 | /* Look in this environment name for the linker to pretend to be */ | |
49 | #define EMULATION_ENVIRON "LDEMULATION" | |
50 | /* If in there look for the strings: */ | |
51 | ||
52 | /* Look in this variable for a target format */ | |
53 | #define TARGET_ENVIRON "GNUTARGET" | |
54 | ||
55 | /* Input sections which are put in a section of this name are actually | |
56 | discarded. */ | |
57 | #define DISCARD_SECTION_NAME "/DISCARD/" | |
58 | ||
59 | /* A wildcard specification. This is only used in ldgram.y, but it | |
60 | winds up in ldgram.h, so we need to define it outside. */ | |
61 | ||
62 | struct wildcard_spec | |
63 | { | |
64 | const char *name; | |
65 | const char *exclude_name; | |
66 | boolean sorted; | |
67 | }; | |
68 | ||
69 | /* Extra information we hold on sections */ | |
70 | typedef struct user_section_struct | |
71 | { | |
72 | /* Pointer to the section where this data will go */ | |
73 | struct lang_input_statement_struct *file; | |
74 | } section_userdata_type; | |
75 | ||
76 | ||
77 | #define get_userdata(x) ((x)->userdata) | |
78 | ||
79 | #define BYTE_SIZE (1) | |
80 | #define SHORT_SIZE (2) | |
81 | #define LONG_SIZE (4) | |
82 | #define QUAD_SIZE (8) | |
83 | ||
84 | /* ALIGN macro changed to ALIGN_N to avoid */ | |
85 | /* conflict in /usr/include/machine/machparam.h */ | |
86 | /* WARNING: If THIS is a 64 bit address and BOUNDARY is a 32 bit int, | |
87 | you must coerce boundary to the same type as THIS. | |
88 | ??? Is there a portable way to avoid this. */ | |
89 | #define ALIGN_N(this, boundary) \ | |
90 | ((( (this) + ((boundary) -1)) & (~((boundary)-1)))) | |
91 | ||
92 | typedef struct | |
93 | { | |
94 | /* 1 => assign space to common symbols even if `relocatable_output'. */ | |
95 | boolean force_common_definition; | |
96 | boolean relax; | |
97 | ||
98 | /* Name of runtime interpreter to invoke. */ | |
99 | char *interpreter; | |
100 | ||
101 | /* Name to give runtime libary from the -soname argument. */ | |
102 | char *soname; | |
103 | ||
104 | /* Runtime library search path from the -rpath argument. */ | |
105 | char *rpath; | |
106 | ||
107 | /* Link time runtime library search path from the -rpath-link | |
108 | argument. */ | |
109 | char *rpath_link; | |
110 | ||
111 | /* Big or little endian as set on command line. */ | |
112 | enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian; | |
113 | ||
114 | /* If true, export all symbols in the dynamic symbol table of an ELF | |
115 | executable. */ | |
116 | boolean export_dynamic; | |
117 | ||
118 | /* If true, build MIPS embedded PIC relocation tables in the output | |
119 | file. */ | |
120 | boolean embedded_relocs; | |
121 | ||
122 | /* If true, force generation of a file with a .exe file. */ | |
123 | boolean force_exe_suffix; | |
124 | ||
125 | /* If true, generate a cross reference report. */ | |
126 | boolean cref; | |
127 | ||
128 | /* If true (which is the default), warn about mismatched input | |
129 | files. */ | |
130 | boolean warn_mismatch; | |
131 | ||
132 | /* Remove unreferenced sections? */ | |
133 | boolean gc_sections; | |
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 | ||
147 | /* If true (the default) check section addresses, once compute, | |
148 | fpor overlaps. */ | |
149 | boolean check_section_addresses; | |
150 | ||
151 | } args_type; | |
152 | ||
153 | extern args_type command_line; | |
154 | ||
155 | typedef int token_code_type; | |
156 | ||
157 | typedef struct | |
158 | { | |
159 | bfd_size_type specified_data_size; | |
160 | boolean magic_demand_paged; | |
161 | boolean make_executable; | |
162 | ||
163 | /* If true, doing a dynamic link. */ | |
164 | boolean dynamic_link; | |
165 | ||
166 | /* If true, -shared is supported. */ | |
167 | /* ??? A better way to do this is perhaps to define this in the | |
168 | ld_emulation_xfer_struct since this is really a target dependent | |
169 | parameter. */ | |
170 | boolean has_shared; | |
171 | ||
172 | /* If true, build constructors. */ | |
173 | boolean build_constructors; | |
174 | ||
175 | /* If true, warn about any constructors. */ | |
176 | boolean warn_constructors; | |
177 | ||
178 | /* If true, warn about merging common symbols with others. */ | |
179 | boolean warn_common; | |
180 | ||
181 | /* If true, only warn once about a particular undefined symbol. */ | |
182 | boolean warn_once; | |
183 | ||
184 | /* If true, warn if multiple global-pointers are needed (Alpha | |
185 | only). */ | |
186 | boolean warn_multiple_gp; | |
187 | ||
188 | /* If true, warn if the starting address of an output section | |
189 | changes due to the alignment of an input section. */ | |
190 | boolean warn_section_align; | |
191 | ||
192 | boolean sort_common; | |
193 | ||
194 | boolean text_read_only; | |
195 | ||
196 | char *map_filename; | |
197 | FILE *map_file; | |
198 | ||
199 | boolean stats; | |
200 | ||
201 | int split_by_reloc; | |
202 | boolean split_by_file; | |
203 | } ld_config_type; | |
204 | ||
205 | extern ld_config_type config; | |
206 | ||
207 | typedef enum | |
208 | { | |
209 | lang_first_phase_enum, | |
210 | lang_allocating_phase_enum, | |
211 | lang_final_phase_enum | |
212 | } lang_phase_type; | |
213 | ||
214 | extern boolean had_script; | |
215 | extern boolean force_make_executable; | |
216 | ||
217 | /* Non-zero if we are processing a --defsym from the command line. */ | |
218 | extern int parsing_defsym; | |
219 | ||
220 | extern int yyparse PARAMS ((void)); | |
221 | ||
222 | extern void add_cref PARAMS ((const char *, bfd *, asection *, bfd_vma)); | |
223 | extern void output_cref PARAMS ((FILE *)); | |
224 | extern void check_nocrossrefs PARAMS ((void)); | |
225 | ||
226 | #endif |