* NEWS: Mention new linker map file generation and the
[deliverable/binutils-gdb.git] / ld / ld.h
1 /* ld.h -- general linker header file
2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002
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 # 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 */
43 # define _(String) (String)
44 # define N_(String) (String)
45 #endif
46
47 #include "bin-bugs.h"
48
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
60 /* A file name list */
61 typedef struct name_list {
62 const char *name;
63 struct name_list *next;
64 }
65 name_list;
66
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 const char *name;
72 struct name_list *exclude_name_list;
73 bfd_boolean sorted;
74 };
75
76 struct wildcard_list {
77 struct wildcard_list *next;
78 struct wildcard_spec spec;
79 };
80
81 struct map_symbol_def {
82 struct bfd_link_hash_entry *entry;
83 struct map_symbol_def *next;
84 };
85
86 /* Extra information we hold on sections */
87 typedef struct lean_user_section_struct {
88 /* For output sections: pointer to the section where this data will go. */
89 struct lang_input_statement_struct *file;
90 } lean_section_userdata_type;
91
92 /* The initial part of fat_user_section_struct has to be idential with
93 lean_user_section_struct. */
94 typedef struct fat_user_section_struct {
95 /* For output sections: pointer to the section where this data will go. */
96 struct lang_input_statement_struct *file;
97 /* For input sections, when writing a map file: head / tail of a linked
98 list of hash table entries for symbols defined in this section. */
99 struct map_symbol_def *map_symbol_def_head;
100 struct map_symbol_def **map_symbol_def_tail;
101 } fat_section_userdata_type;
102
103 #define SECTION_USERDATA_SIZE \
104 (command_line.reduce_memory_overheads \
105 ? sizeof (lean_section_userdata_type) \
106 : sizeof (fat_section_userdata_type))
107
108 #define get_userdata(x) ((x)->userdata)
109
110 #define BYTE_SIZE (1)
111 #define SHORT_SIZE (2)
112 #define LONG_SIZE (4)
113 #define QUAD_SIZE (8)
114
115 typedef struct {
116 /* 1 => assign space to common symbols even if `relocatable_output'. */
117 bfd_boolean force_common_definition;
118
119 /* 1 => do not assign addresses to common symbols. */
120 bfd_boolean inhibit_common_definition;
121 bfd_boolean relax;
122
123 /* Name of runtime interpreter to invoke. */
124 char *interpreter;
125
126 /* Name to give runtime libary from the -soname argument. */
127 char *soname;
128
129 /* Runtime library search path from the -rpath argument. */
130 char *rpath;
131
132 /* Link time runtime library search path from the -rpath-link
133 argument. */
134 char *rpath_link;
135
136 /* Big or little endian as set on command line. */
137 enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian;
138
139 /* If TRUE, build MIPS embedded PIC relocation tables in the output
140 file. */
141 bfd_boolean embedded_relocs;
142
143 /* If TRUE, force generation of a file with a .exe file. */
144 bfd_boolean force_exe_suffix;
145
146 /* If TRUE, generate a cross reference report. */
147 bfd_boolean cref;
148
149 /* If TRUE (which is the default), warn about mismatched input
150 files. */
151 bfd_boolean warn_mismatch;
152
153 /* Remove unreferenced sections? */
154 bfd_boolean gc_sections;
155
156 /* Name of shared object whose symbol table should be filtered with
157 this shared object. From the --filter option. */
158 char *filter_shlib;
159
160 /* Name of shared object for whose symbol table this shared object
161 is an auxiliary filter. From the --auxiliary option. */
162 char **auxiliary_filters;
163
164 /* A version symbol to be applied to the symbol names found in the
165 .exports sections. */
166 char *version_exports_section;
167
168 /* If TRUE (the default) check section addresses, once compute,
169 fpor overlaps. */
170 bfd_boolean check_section_addresses;
171
172 /* If TRUE allow the linking of input files in an unknown architecture
173 assuming that the user knows what they are doing. This was the old
174 behaviour of the linker. The new default behaviour is to reject such
175 input files. */
176 bfd_boolean accept_unknown_input_arch;
177
178 /* If TRUE reduce memory overheads, at the expense of speed.
179 This will cause map file generation to use an O(N^2) algorithm. */
180 bfd_boolean reduce_memory_overheads;
181
182 } args_type;
183
184 extern args_type command_line;
185
186 typedef int token_code_type;
187
188 typedef struct {
189 bfd_size_type specified_data_size;
190 bfd_boolean magic_demand_paged;
191 bfd_boolean make_executable;
192
193 /* If TRUE, doing a dynamic link. */
194 bfd_boolean dynamic_link;
195
196 /* If TRUE, -shared is supported. */
197 /* ??? A better way to do this is perhaps to define this in the
198 ld_emulation_xfer_struct since this is really a target dependent
199 parameter. */
200 bfd_boolean has_shared;
201
202 /* If TRUE, build constructors. */
203 bfd_boolean build_constructors;
204
205 /* If TRUE, warn about any constructors. */
206 bfd_boolean warn_constructors;
207
208 /* If TRUE, warn about merging common symbols with others. */
209 bfd_boolean warn_common;
210
211 /* If TRUE, only warn once about a particular undefined symbol. */
212 bfd_boolean warn_once;
213
214 /* If TRUE, warn if multiple global-pointers are needed (Alpha
215 only). */
216 bfd_boolean warn_multiple_gp;
217
218 /* If TRUE, warn if the starting address of an output section
219 changes due to the alignment of an input section. */
220 bfd_boolean warn_section_align;
221
222 /* If TRUE, warning messages are fatal */
223 bfd_boolean fatal_warnings;
224
225 bfd_boolean sort_common;
226
227 bfd_boolean text_read_only;
228
229 char *map_filename;
230 FILE *map_file;
231
232 bfd_boolean stats;
233
234 /* If set, orphan input sections will be mapped to separate output
235 sections. */
236 bfd_boolean unique_orphan_sections;
237
238 unsigned int split_by_reloc;
239 bfd_size_type split_by_file;
240
241 /* If set, only search library directories explicitly selected
242 on the command line. */
243 bfd_boolean only_cmd_line_lib_dirs;
244 } ld_config_type;
245
246 extern ld_config_type config;
247
248 typedef enum {
249 lang_first_phase_enum,
250 lang_allocating_phase_enum,
251 lang_final_phase_enum
252 } lang_phase_type;
253
254 extern FILE * saved_script_handle;
255 extern bfd_boolean force_make_executable;
256
257 /* Non-zero if we are processing a --defsym from the command line. */
258 extern int parsing_defsym;
259
260 extern int yyparse (void);
261 extern void add_cref (const char *, bfd *, asection *, bfd_vma);
262 extern void output_cref (FILE *);
263 extern void check_nocrossrefs (void);
264 extern void ld_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
265
266 /* If gcc >= 2.6, we can give a function name, too. */
267 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
268 #define __PRETTY_FUNCTION__ NULL
269 #endif
270
271 #undef abort
272 #define abort() ld_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
273
274 #endif
This page took 0.038472 seconds and 5 git commands to generate.