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