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