Commit | Line | Data |
---|---|---|
2ed9fe47 | 1 | /* ld.h -- general linker header file |
26c7ca95 | 2 | Copyright (C) 1991, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. |
2fa0b342 DHW |
3 | |
4 | This file is part of GLD, the Gnu Linker. | |
5 | ||
6 | GLD is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
c1074477 | 8 | the Free Software Foundation; either version 2, or (at your option) |
2fa0b342 DHW |
9 | any later version. |
10 | ||
11 | GLD is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
2ed9fe47 ILT |
17 | along with GLD; see the file COPYING. If not, write to the Free |
18 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
2fa0b342 | 20 | |
2a9fa50c ILT |
21 | #ifndef LD_H |
22 | #define LD_H | |
2fa0b342 | 23 | |
26c7ca95 ILT |
24 | #ifdef HAVE_LOCALE_H |
25 | # include <locale.h> | |
8bc8f4bc | 26 | #endif |
26c7ca95 ILT |
27 | |
28 | #ifdef ENABLE_NLS | |
29 | # include <libintl.h> | |
30 | # define _(String) gettext (String) | |
31 | # ifdef gettext_noop | |
32 | # define N_(String) gettext_noop (String) | |
33 | # else | |
34 | # define N_(String) (String) | |
35 | # endif | |
8bc8f4bc TT |
36 | #else |
37 | /* Stubs that do something close enough. */ | |
26c7ca95 ILT |
38 | # define textdomain(String) (String) |
39 | # define gettext(String) (String) | |
40 | # define dgettext(Domain,Message) (Message) | |
41 | # define dcgettext(Domain,Message,Type) (Message) | |
42 | # define bindtextdomain(Domain,Directory) (Domain) | |
43 | # define _(String) (String) | |
44 | # define N_(String) (String) | |
8bc8f4bc | 45 | #endif |
26c7ca95 ILT |
46 | |
47 | #ifndef LC_MESSAGES | |
48 | # define LC_MESSAGES 0 | |
8bc8f4bc TT |
49 | #endif |
50 | ||
6799c638 ILT |
51 | /* Look in this environment name for the linker to pretend to be */ |
52 | #define EMULATION_ENVIRON "LDEMULATION" | |
53 | /* If in there look for the strings: */ | |
54 | ||
55 | /* Look in this variable for a target format */ | |
56 | #define TARGET_ENVIRON "GNUTARGET" | |
57 | ||
58 | /* Input sections which are put in a section of this name are actually | |
59 | discarded. */ | |
60 | #define DISCARD_SECTION_NAME "/DISCARD/" | |
61 | ||
26c7ca95 ILT |
62 | /* A wildcard specification. This is only used in ldgram.y, but it |
63 | winds up in ldgram.h, so we need to define it outside. */ | |
64 | ||
65 | struct wildcard_spec | |
66 | { | |
67 | const char *name; | |
68 | boolean sorted; | |
69 | }; | |
70 | ||
2fa0b342 | 71 | /* Extra information we hold on sections */ |
2a9fa50c ILT |
72 | typedef struct user_section_struct |
73 | { | |
2fa0b342 DHW |
74 | /* Pointer to the section where this data will go */ |
75 | struct lang_input_statement_struct *file; | |
76 | } section_userdata_type; | |
77 | ||
78 | ||
79 | #define get_userdata(x) ((x)->userdata) | |
2fa0b342 | 80 | |
c1074477 DE |
81 | #define BYTE_SIZE (1) |
82 | #define SHORT_SIZE (2) | |
83 | #define LONG_SIZE (4) | |
2a9fa50c | 84 | #define QUAD_SIZE (8) |
2fa0b342 | 85 | |
c1074477 DE |
86 | /* ALIGN macro changed to ALIGN_N to avoid */ |
87 | /* conflict in /usr/include/machine/machparam.h */ | |
2a9fa50c | 88 | /* WARNING: If THIS is a 64 bit address and BOUNDARY is a 32 bit int, |
73f5d5fe DE |
89 | you must coerce boundary to the same type as THIS. |
90 | ??? Is there a portable way to avoid this. */ | |
2a9fa50c ILT |
91 | #define ALIGN_N(this, boundary) \ |
92 | ((( (this) + ((boundary) -1)) & (~((boundary)-1)))) | |
2fa0b342 | 93 | |
2a9fa50c ILT |
94 | typedef struct |
95 | { | |
2fa0b342 DHW |
96 | /* 1 => assign space to common symbols even if `relocatable_output'. */ |
97 | boolean force_common_definition; | |
c1074477 | 98 | boolean relax; |
809ee7e0 ILT |
99 | |
100 | /* Name of runtime interpreter to invoke. */ | |
101 | char *interpreter; | |
102 | ||
103 | /* Name to give runtime libary from the -soname argument. */ | |
104 | char *soname; | |
105 | ||
106 | /* Runtime library search path from the -rpath argument. */ | |
107 | char *rpath; | |
943fbd5b | 108 | |
6799c638 ILT |
109 | /* Link time runtime library search path from the -rpath-link |
110 | argument. */ | |
111 | char *rpath_link; | |
112 | ||
943fbd5b KR |
113 | /* Big or little endian as set on command line. */ |
114 | enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian; | |
115 | ||
116 | /* If true, export all symbols in the dynamic symbol table of an ELF | |
117 | executable. */ | |
118 | boolean export_dynamic; | |
119 | ||
120 | /* If true, build MIPS embedded PIC relocation tables in the output | |
121 | file. */ | |
122 | boolean embedded_relocs; | |
cd09553a ILT |
123 | |
124 | /* If true, force generation of a file with a .exe file. */ | |
125 | boolean force_exe_suffix; | |
126 | ||
127 | /* If true, generate a cross reference report. */ | |
128 | boolean cref; | |
8bc8f4bc TT |
129 | |
130 | /* If true (which is the default), warn about mismatched input | |
131 | files. */ | |
132 | boolean warn_mismatch; | |
133 | ||
134 | /* Name of shared object whose symbol table should be filtered with | |
135 | this shared object. From the --filter option. */ | |
136 | char *filter_shlib; | |
137 | ||
138 | /* Name of shared object for whose symbol table this shared object | |
139 | is an auxiliary filter. From the --auxiliary option. */ | |
140 | char **auxiliary_filters; | |
71b012a8 RH |
141 | |
142 | /* Remove unreferenced sections? */ | |
143 | boolean gc_sections; | |
2fa0b342 DHW |
144 | } args_type; |
145 | ||
2a9fa50c ILT |
146 | extern args_type command_line; |
147 | ||
2fa0b342 DHW |
148 | typedef int token_code_type; |
149 | ||
150 | typedef struct | |
151 | { | |
c1074477 | 152 | bfd_size_type specified_data_size; |
2fa0b342 DHW |
153 | boolean magic_demand_paged; |
154 | boolean make_executable; | |
2fa0b342 | 155 | |
2a9fa50c ILT |
156 | /* If true, doing a dynamic link. */ |
157 | boolean dynamic_link; | |
158 | ||
71b012a8 RH |
159 | /* If true, -shared is supported. */ |
160 | /* ??? A better way to do this is perhaps to define this in the | |
161 | ld_emulation_xfer_struct since this is really a target dependent | |
162 | parameter. */ | |
163 | boolean has_shared; | |
164 | ||
6799c638 | 165 | /* If true, build constructors. */ |
2fa0b342 | 166 | boolean build_constructors; |
c1074477 | 167 | |
6799c638 ILT |
168 | /* If true, warn about any constructors. */ |
169 | boolean warn_constructors; | |
170 | ||
c1074477 DE |
171 | /* If true, warn about merging common symbols with others. */ |
172 | boolean warn_common; | |
2fa0b342 | 173 | |
809ee7e0 ILT |
174 | /* If true, only warn once about a particular undefined symbol. */ |
175 | boolean warn_once; | |
176 | ||
6799c638 ILT |
177 | /* If true, warn if multiple global-pointers are needed (Alpha |
178 | only). */ | |
179 | boolean warn_multiple_gp; | |
180 | ||
8bc8f4bc TT |
181 | /* If true, warn if the starting address of an output section |
182 | changes due to the alignment of an input section. */ | |
183 | boolean warn_section_align; | |
184 | ||
b6316534 | 185 | boolean sort_common; |
2a9fa50c | 186 | |
c1074477 DE |
187 | boolean text_read_only; |
188 | ||
2a9fa50c ILT |
189 | char *map_filename; |
190 | FILE *map_file; | |
c1074477 | 191 | |
2a9fa50c | 192 | boolean stats; |
943fbd5b KR |
193 | |
194 | int split_by_reloc; | |
195 | boolean split_by_file; | |
2fa0b342 | 196 | } ld_config_type; |
2fa0b342 | 197 | |
2a9fa50c | 198 | extern ld_config_type config; |
2fa0b342 | 199 | |
2a9fa50c ILT |
200 | typedef enum |
201 | { | |
2fa0b342 DHW |
202 | lang_first_phase_enum, |
203 | lang_allocating_phase_enum, | |
2a9fa50c ILT |
204 | lang_final_phase_enum |
205 | } lang_phase_type; | |
2fa0b342 | 206 | |
2a9fa50c ILT |
207 | extern boolean had_script; |
208 | extern boolean force_make_executable; | |
2fa0b342 | 209 | |
6799c638 ILT |
210 | /* Non-zero if we are processing a --defsym from the command line. */ |
211 | extern int parsing_defsym; | |
212 | ||
2a9fa50c | 213 | extern int yyparse PARAMS ((void)); |
c1074477 | 214 | |
cd09553a ILT |
215 | extern void add_cref PARAMS ((const char *, bfd *, asection *, bfd_vma)); |
216 | extern void output_cref PARAMS ((FILE *)); | |
8bc8f4bc | 217 | extern void check_nocrossrefs PARAMS ((void)); |
cd09553a | 218 | |
2a9fa50c | 219 | #endif |