Changes from Paul Kranenburg which bring us into sync with his sources:
[unix-history] / gnu / usr.bin / ld / ld.h
CommitLineData
6a61ea88 1/*
1c8a0fd5 2 * $Id: ld.h,v 1.10 1994/02/13 20:41:34 jkh Exp $
6a61ea88 3 */
1136f72d
PR
4/*-
5 * This code is derived from software copyrighted by the Free Software
6 * Foundation.
7 *
8 * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
9 */
10
11#define SUN_COMPAT
12
13#ifndef N_SIZE
14#define N_SIZE 0xc
15#endif
16
17#ifndef min
18#define min(a,b) ((a) < (b) ? (a) : (b))
19#endif
20
21#ifndef __P
22#ifndef __STDC__
23#define __P(a) ()
24#else
25#define __P(a) a
26#endif
27#endif
28
29/* If compiled with GNU C, use the built-in alloca */
30#if defined(__GNUC__) || defined(sparc)
31#define alloca __builtin_alloca
32#endif
33
6a61ea88
JH
34#ifdef __FreeBSD__
35#define FreeBSD
36#endif
37
1136f72d
PR
38#include "md.h"
39#include "link.h"
40
41/* Macro to control the number of undefined references printed */
42#define MAX_UREFS_PRINTED 10
43
44/* Align to power-of-two boundary */
45#define PALIGN(x,p) (((x) + (u_long)(p) - 1) & (-(u_long)(p)))
46
47/* Align to machine dependent boundary */
48#define MALIGN(x) PALIGN(x,MAX_ALIGNMENT)
49
1136f72d 50/* Define this to specify the default executable format. */
1136f72d 51#ifndef DEFAULT_MAGIC
6a61ea88 52#ifdef FreeBSD
5e358090 53#define DEFAULT_MAGIC QMAGIC
6a61ea88
JH
54extern int netzmagic;
55#else
56#define DEFAULT_MAGIC ZMAGIC
57#endif
1136f72d 58#endif
1136f72d
PR
59
60
61/*
62 * Ok. Following are the relocation information macros. If your
63 * system should not be able to use the default set (below), you must
64 * define the following:
65
66 * relocation_info: This must be typedef'd (or #define'd) to the type
67 * of structure that is stored in the relocation info section of your
68 * a.out files. Often this is defined in the a.out.h for your system.
69 *
70 * RELOC_ADDRESS (rval): Offset into the current section of the
71 * <whatever> to be relocated. *Must be an lvalue*.
72 *
73 * RELOC_EXTERN_P (rval): Is this relocation entry based on an
74 * external symbol (1), or was it fully resolved upon entering the
75 * loader (0) in which case some combination of the value in memory
76 * (if RELOC_MEMORY_ADD_P) and the extra (if RELOC_ADD_EXTRA) contains
77 * what the value of the relocation actually was. *Must be an lvalue*.
78 *
79 * RELOC_TYPE (rval): If this entry was fully resolved upon
80 * entering the loader, what type should it be relocated as?
81 *
82 * RELOC_SYMBOL (rval): If this entry was not fully resolved upon
83 * entering the loader, what is the index of it's symbol in the symbol
84 * table? *Must be a lvalue*.
85 *
86 * RELOC_MEMORY_ADD_P (rval): This should return true if the final
87 * relocation value output here should be added to memory, or if the
88 * section of memory described should simply be set to the relocation
89 * value.
90 *
91 * RELOC_ADD_EXTRA (rval): (Optional) This macro, if defined, gives
92 * an extra value to be added to the relocation value based on the
93 * individual relocation entry. *Must be an lvalue if defined*.
94 *
95 * RELOC_PCREL_P (rval): True if the relocation value described is
96 * pc relative.
97 *
98 * RELOC_VALUE_RIGHTSHIFT (rval): Number of bits right to shift the
99 * final relocation value before putting it where it belongs.
100 *
101 * RELOC_TARGET_SIZE (rval): log to the base 2 of the number of
102 * bytes of size this relocation entry describes; 1 byte == 0; 2 bytes
103 * == 1; 4 bytes == 2, and etc. This is somewhat redundant (we could
104 * do everything in terms of the bit operators below), but having this
105 * macro could end up producing better code on machines without fancy
106 * bit twiddling. Also, it's easier to understand/code big/little
107 * endian distinctions with this macro.
108 *
109 * RELOC_TARGET_BITPOS (rval): The starting bit position within the
110 * object described in RELOC_TARGET_SIZE in which the relocation value
111 * will go.
112 *
113 * RELOC_TARGET_BITSIZE (rval): How many bits are to be replaced
114 * with the bits of the relocation value. It may be assumed by the
115 * code that the relocation value will fit into this many bits. This
116 * may be larger than RELOC_TARGET_SIZE if such be useful.
117 *
118 *
119 * Things I haven't implemented
120 * ----------------------------
121 *
122 * Values for RELOC_TARGET_SIZE other than 0, 1, or 2.
123 *
124 * Pc relative relocation for External references.
125 *
126 *
127 */
128
129
130/* Default macros */
131#ifndef RELOC_ADDRESS
132
133#define RELOC_ADDRESS(r) ((r)->r_address)
134#define RELOC_EXTERN_P(r) ((r)->r_extern)
135#define RELOC_TYPE(r) ((r)->r_symbolnum)
136#define RELOC_SYMBOL(r) ((r)->r_symbolnum)
137#define RELOC_MEMORY_SUB_P(r) 0
138#define RELOC_MEMORY_ADD_P(r) 1
139#undef RELOC_ADD_EXTRA
140#define RELOC_PCREL_P(r) ((r)->r_pcrel)
141#define RELOC_VALUE_RIGHTSHIFT(r) 0
142#if defined(RTLD) && defined(SUN_COMPAT)
143#define RELOC_TARGET_SIZE(r) (2) /* !!!!! Sun BUG compatible */
144#else
145#define RELOC_TARGET_SIZE(r) ((r)->r_length)
146#endif
147#define RELOC_TARGET_BITPOS(r) 0
148#define RELOC_TARGET_BITSIZE(r) 32
149
150#define RELOC_JMPTAB_P(r) ((r)->r_jmptable)
151#define RELOC_BASEREL_P(r) ((r)->r_baserel)
152#define RELOC_RELATIVE_P(r) ((r)->r_relative)
153#define RELOC_COPY_P(r) ((r)->r_copy)
154#define RELOC_LAZY_P(r) ((r)->r_jmptable)
155
156#define CHECK_GOT_RELOC(r) ((r)->r_pcrel)
157
158#endif
159
160/*
161 * Internal representation of relocation types
162 */
163#define RELTYPE_EXTERN 1
164#define RELTYPE_JMPSLOT 2
165#define RELTYPE_BASEREL 4
166#define RELTYPE_RELATIVE 8
167#define RELTYPE_COPY 16
168
169#ifdef nounderscore
170#define LPREFIX '.'
171#else
172#define LPREFIX 'L'
173#endif
174
175#ifndef TEXT_START
176#define TEXT_START(x) N_TXTADDR(x)
177#endif
178
179#ifndef DATA_START
180#define DATA_START(x) N_DATADDR(x)
181#endif
6a61ea88 182
1136f72d
PR
183/* If a this type of symbol is encountered, its name is a warning
184 message to print each time the symbol referenced by the next symbol
185 table entry is referenced.
186
187 This feature may be used to allow backwards compatibility with
188 certain functions (eg. gets) but to discourage programmers from
189 their use.
190
191 So if, for example, you wanted to have ld print a warning whenever
192 the function "gets" was used in their C program, you would add the
193 following to the assembler file in which gets is defined:
194
195 .stabs "Obsolete function \"gets\" referenced",30,0,0,0
196 .stabs "_gets",1,0,0,0
197
198 These .stabs do not necessarily have to be in the same file as the
199 gets function, they simply must exist somewhere in the compilation. */
200
201#ifndef N_WARNING
202#define N_WARNING 0x1E /* Warning message to print if symbol
203 included */
204#endif /* This is input to ld */
205
206/* Special global symbol types understood by GNU LD. */
207
208/* The following type indicates the definition of a symbol as being
209 an indirect reference to another symbol. The other symbol
210 appears as an undefined reference, immediately following this symbol.
211
212 Indirection is asymmetrical. The other symbol's value will be used
213 to satisfy requests for the indirect symbol, but not vice versa.
214 If the other symbol does not have a definition, libraries will
215 be searched to find a definition.
216
217 So, for example, the following two lines placed in an assembler
218 input file would result in an object file which would direct gnu ld
219 to resolve all references to symbol "foo" as references to symbol
220 "bar".
221
222 .stabs "_foo",11,0,0,0
223 .stabs "_bar",1,0,0,0
224
225 Note that (11 == (N_INDR | N_EXT)) and (1 == (N_UNDF | N_EXT)). */
226
227#ifndef N_INDR
228#define N_INDR 0xa
229#endif
230
231/* The following symbols refer to set elements. These are expected
232 only in input to the loader; they should not appear in loader
233 output (unless relocatable output is requested). To be recognized
234 by the loader, the input symbols must have their N_EXT bit set.
235 All the N_SET[ATDB] symbols with the same name form one set. The
236 loader collects all of these elements at load time and outputs a
237 vector for each name.
238 Space (an array of 32 bit words) is allocated for the set in the
239 data section, and the n_value field of each set element value is
240 stored into one word of the array.
241 The first word of the array is the length of the set (number of
242 elements). The last word of the vector is set to zero for possible
243 use by incremental loaders. The array is ordered by the linkage
244 order; the first symbols which the linker encounters will be first
245 in the array.
246
247 In C syntax this looks like:
248
249 struct set_vector {
250 unsigned int length;
251 unsigned int vector[length];
252 unsigned int always_zero;
253 };
254
255 Before being placed into the array, each element is relocated
256 according to its type. This allows the loader to create an array
257 of pointers to objects automatically. N_SETA type symbols will not
258 be relocated.
259
260 The address of the set is made into an N_SETV symbol
261 whose name is the same as the name of the set.
262 This symbol acts like a N_DATA global symbol
263 in that it can satisfy undefined external references.
264
265 For the purposes of determining whether or not to load in a library
266 file, set element definitions are not considered "real
267 definitions"; they will not cause the loading of a library
268 member.
269
270 If relocatable output is requested, none of this processing is
271 done. The symbols are simply relocated and passed through to the
272 output file.
273
274 So, for example, the following three lines of assembler code
275 (whether in one file or scattered between several different ones)
276 will produce a three element vector (total length is five words;
277 see above), referenced by the symbol "_xyzzy", which will have the
278 addresses of the routines _init1, _init2, and _init3.
279
280 *NOTE*: If symbolic addresses are used in the n_value field of the
281 defining .stabs, those symbols must be defined in the same file as
282 that containing the .stabs.
283
284 .stabs "_xyzzy",23,0,0,_init1
285 .stabs "_xyzzy",23,0,0,_init2
286 .stabs "_xyzzy",23,0,0,_init3
287
288 Note that (23 == (N_SETT | N_EXT)). */
289
290#ifndef N_SETA
291#define N_SETA 0x14 /* Absolute set element symbol */
292#endif /* This is input to LD, in a .o file. */
293
294#ifndef N_SETT
295#define N_SETT 0x16 /* Text set element symbol */
296#endif /* This is input to LD, in a .o file. */
297
298#ifndef N_SETD
299#define N_SETD 0x18 /* Data set element symbol */
300#endif /* This is input to LD, in a .o file. */
301
302#ifndef N_SETB
303#define N_SETB 0x1A /* Bss set element symbol */
304#endif /* This is input to LD, in a .o file. */
305
306/* Macros dealing with the set element symbols defined in a.out.h */
307#define SET_ELEMENT_P(x) ((x) >= N_SETA && (x) <= (N_SETB|N_EXT))
308#define TYPE_OF_SET_ELEMENT(x) ((x) - N_SETA + N_ABS)
309
310#ifndef N_SETV
311#define N_SETV 0x1C /* Pointer to set vector in data area. */
312#endif /* This is output from LD. */
313
314
315#ifndef __GNU_STAB__
316
317/* Line number for the data section. This is to be used to describe
318 the source location of a variable declaration. */
319#ifndef N_DSLINE
320#define N_DSLINE (N_SLINE+N_DATA-N_TEXT)
321#endif
322
323/* Line number for the bss section. This is to be used to describe
324 the source location of a variable declaration. */
325#ifndef N_BSLINE
326#define N_BSLINE (N_SLINE+N_BSS-N_TEXT)
327#endif
328
329#endif /* not __GNU_STAB__ */
330\f
6a61ea88
JH
331
332typedef struct localsymbol {
333 struct nzlist nzlist; /* n[z]list from file */
334 struct glosym *symbol; /* Corresponding global symbol,
335 if any */
336 struct localsymbol *next; /* List of definitions */
337 struct file_entry *entry; /* Backpointer to file */
338 long gotslot_offset; /* Position in GOT, if any */
339 int symbolnum; /* Position in output nlist */
340 int flags;
341#define LS_L_SYMBOL 1 /* Local symbol starts with an `L' */
342#define LS_WRITE 2 /* Symbol goes in output symtable */
343#define LS_RENAME 4 /* xlat name to `<file>.<name>' */
344#define LS_GOTSLOTCLAIMED 8 /* This symbol has a GOT entry */
345} localsymbol_t;
346
1136f72d
PR
347/* Symbol table */
348
349/*
350 * Global symbol data is recorded in these structures, one for each global
351 * symbol. They are found via hashing in 'symtab', which points to a vector
352 * of buckets. Each bucket is a chain of these structures through the link
353 * field.
354 */
355
356typedef struct glosym {
6a61ea88
JH
357 struct glosym *link; /* Next symbol hash bucket. */
358 char *name; /* Name of this symbol. */
359 long value; /* Value of this symbol */
360 localsymbol_t *refs; /* Chain of local symbols from object
361 files pertaining to this global
362 symbol */
363 localsymbol_t *sorefs;/* Same for local symbols from shared
364 object files. */
365
366 char *warning; /* message, from N_WARNING nlists */
367 int common_size; /* Common size */
368 int symbolnum; /* Symbol index in output symbol table */
369 int rrs_symbolnum; /* Symbol index in RRS symbol table */
370
371 struct nlist *def_nlist; /* The local symbol that gave this
372 global symbol its definition */
373
374 char defined; /* Definition of this symbol */
375 char so_defined; /* Definition of this symbol in a shared
376 object. These go into the RRS symbol table */
377 u_char undef_refs; /* Count of number of "undefined"
378 messages printed for this symbol */
379 u_char mult_defs; /* Same for "multiply defined" symbols */
380 struct glosym *alias; /* For symbols of type N_INDR, this
381 points at the real symbol. */
382 int setv_count; /* Number of elements in N_SETV symbols */
383 int size; /* Size of this symbol (either from N_SIZE
384 symbols or a from shared object's RRS */
385 int aux; /* Auxiliary type information conveyed in
386 the `n_other' field of nlists */
1136f72d
PR
387
388 /* The offset into one of the RRS tables, -1 if not used */
6a61ea88
JH
389 long jmpslot_offset;
390 long gotslot_offset;
1136f72d 391
6a61ea88 392 long flags;
1136f72d 393
6a61ea88
JH
394#define GS_DEFINED 1 /* Symbol has definition (notyetused)*/
395#define GS_REFERENCED 2 /* Symbol is referred to by something
396 interesting */
397#define GS_TRACE 4 /* Symbol will be traced */
398#define GS_JMPSLOTCLAIMED 8 /* */
399#define GS_GOTSLOTCLAIMED 0x10 /* Some state bits concerning */
400#define GS_CPYRELOCRESERVED 0x20 /* entries in GOT and PLT tables */
401#define GS_CPYRELOCCLAIMED 0x40 /* */
1136f72d 402
1136f72d
PR
403} symbol;
404
405/* Number of buckets in symbol hash table */
6a61ea88 406#define SYMTABSIZE 1009
1136f72d 407
6a61ea88
JH
408/* The symbol hash table: a vector of SYMTABSIZE pointers to struct glosym. */
409extern symbol *symtab[];
1136f72d
PR
410#define FOR_EACH_SYMBOL(i,sp) { \
411 int i; \
6a61ea88 412 for (i = 0; i < SYMTABSIZE; i++) { \
1136f72d
PR
413 register symbol *sp; \
414 for (sp = symtab[i]; sp; sp = sp->link)
415
416#define END_EACH_SYMBOL }}
417
6a61ea88
JH
418/* # of global symbols referenced and not defined. */
419extern int undefined_global_sym_count;
1136f72d 420
6a61ea88
JH
421/* # of undefined symbols referenced by shared objects */
422extern int undefined_shobj_sym_count;
1136f72d 423
6a61ea88
JH
424/* # of multiply defined symbols. */
425extern int multiple_def_count;
1136f72d 426
6a61ea88
JH
427/* # of common symbols. */
428extern int common_defined_global_count;
1136f72d 429
6a61ea88
JH
430/* # of warning symbols encountered. */
431extern int warning_count;
1136f72d 432
6a61ea88
JH
433/*
434 * Define a linked list of strings which define symbols which should be
435 * treated as set elements even though they aren't. Any symbol with a prefix
436 * matching one of these should be treated as a set element.
437 *
438 * This is to make up for deficiencies in many assemblers which aren't willing
439 * to pass any stabs through to the loader which they don't understand.
440 */
441struct string_list_element {
442 char *str;
443 struct string_list_element *next;
444};
1136f72d 445
6a61ea88
JH
446extern symbol *entry_symbol; /* the entry symbol, if any */
447extern symbol *edata_symbol; /* the symbol _edata */
448extern symbol *etext_symbol; /* the symbol _etext */
449extern symbol *end_symbol; /* the symbol _end */
450extern symbol *got_symbol; /* the symbol __GLOBAL_OFFSET_TABLE_ */
451extern symbol *dynamic_symbol; /* the symbol __DYNAMIC */
1136f72d 452
1136f72d
PR
453/*
454 * Each input file, and each library member ("subfile") being loaded, has a
455 * `file_entry' structure for it.
456 *
457 * For files specified by command args, these are contained in the vector which
458 * `file_table' points to.
459 *
460 * For library members, they are dynamically allocated, and chained through the
461 * `chain' field. The chain is found in the `subfiles' field of the
462 * `file_entry'. The `file_entry' objects for the members have `superfile'
463 * fields pointing to the one for the library.
464 */
465
466struct file_entry {
6a61ea88 467 char *filename; /* Name of this file. */
1136f72d
PR
468 /*
469 * Name to use for the symbol giving address of text start Usually
470 * the same as filename, but for a file spec'd with -l this is the -l
471 * switch itself rather than the filename.
472 */
6a61ea88
JH
473 char *local_sym_name;
474 struct exec header; /* The file's a.out header. */
475 localsymbol_t *symbols; /* Symbol table of the file. */
476 int nsymbols; /* Number of symbols in above array. */
477 int string_size; /* Size in bytes of string table. */
478 char *strings; /* Pointer to the string table when
479 in core, NULL otherwise */
480 int strings_offset; /* Offset of string table,
481 (normally N_STROFF() + 4) */
1136f72d 482 /*
6a61ea88
JH
483 * Next two used only if `relocatable_output' or if needed for
484 * output of undefined reference line numbers.
1136f72d 485 */
6a61ea88
JH
486 struct relocation_info *textrel; /* Text relocations */
487 int ntextrel; /* # of text relocations */
488 struct relocation_info *datarel; /* Data relocations */
489 int ndatarel; /* # of data relocations */
1136f72d
PR
490
491 /*
6a61ea88 492 * Relation of this file's segments to the output file.
1136f72d 493 */
6a61ea88
JH
494 int text_start_address; /* Start of this file's text segment
495 in the output file core image. */
496 int data_start_address; /* Start of this file's data segment
497 in the output file core image. */
498 int bss_start_address; /* Start of this file's bss segment
499 in the output file core image. */
500 struct file_entry *subfiles; /* For a library, points to chain of
501 entries for the library members. */
502 struct file_entry *superfile; /* For library member, points to the
503 library's own entry. */
504 struct file_entry *chain; /* For library member, points to next
505 entry for next member. */
506 int starting_offset; /* For a library member, offset of the
507 member within the archive. Zero for
508 files that are not library members.*/
509 int total_size; /* Size of contents of this file,
510 if library member. */
0f052032 511#ifdef SUN_COMPAT
6a61ea88
JH
512 struct file_entry *silly_archive;/* For shared libraries which have
513 a .sa companion */
0f052032 514#endif
6a61ea88
JH
515 int lib_major, lib_minor; /* Version numbers of a shared object */
516
517 int flags;
518#define E_IS_LIBRARY 1 /* File is a an archive */
519#define E_HEADER_VALID 2 /* File's header has been read */
520#define E_SEARCH_DIRS 4 /* Search directories for file */
521#define E_SEARCH_DYNAMIC 8 /* Search for shared libs allowed */
522#define E_JUST_SYMS 0x10 /* File is used for incremental load */
523#define E_DYNAMIC 0x20 /* File is a shared object */
524#define E_SCRAPPED 0x40 /* Ignore this file */
525#define E_SYMBOLS_USED 0x80 /* Symbols from this entry were used */
1136f72d
PR
526};
527
6a61ea88
JH
528/*
529 * Section start addresses.
530 */
531extern int text_size; /* total size of text. */
532extern int text_start; /* start of text */
533extern int text_pad; /* clear space between text and data */
534extern int data_size; /* total size of data. */
535extern int data_start; /* start of data */
536extern int data_pad; /* part of bss segment within data */
1136f72d 537
6a61ea88
JH
538extern int bss_size; /* total size of bss. */
539extern int bss_start; /* start of bss */
1136f72d 540
6a61ea88
JH
541extern int text_reloc_size; /* total size of text relocation. */
542extern int data_reloc_size; /* total size of data relocation. */
1136f72d
PR
543
544/*
545 * Runtime Relocation Section (RRS).
546 * This describes the data structures that go into the output text and data
547 * segments to support the run-time linker. The RRS can be empty (plain old
548 * static linking), or can just exist of GOT and PLT entries (in case of
549 * statically linked PIC code).
550 */
6a61ea88 551extern int rrs_section_type; /* What's in the RRS section */
1136f72d
PR
552#define RRS_NONE 0
553#define RRS_PARTIAL 1
554#define RRS_FULL 2
6a61ea88
JH
555extern int rrs_text_size; /* Size of RRS text additions */
556extern int rrs_text_start; /* Location of above */
557extern int rrs_data_size; /* Size of RRS data additions */
558extern int rrs_data_start; /* Location of above */
1136f72d
PR
559
560/* Version number to put in __DYNAMIC (set by -V) */
6a61ea88
JH
561extern int soversion;
562#ifndef DEFAULT_SOVERSION
563#define DEFAULT_SOVERSION LD_VERSION_BSD
564#endif
1136f72d 565
6a61ea88 566extern int pc_relocation; /* Current PC reloc value */
1136f72d 567
6a61ea88 568extern int number_of_shobjs; /* # of shared objects linked in */
1136f72d 569
6a61ea88
JH
570/* Current link mode */
571extern int link_mode;
572#define DYNAMIC 1 /* Consider shared libraries */
573#define SYMBOLIC 2 /* Force symbolic resolution */
574#define FORCEARCHIVE 4 /* Force inclusion of all members
575 of archives */
576#define SHAREABLE 8 /* Build a shared object */
577#define SILLYARCHIVE 16 /* Process .sa companions, if any */
1136f72d 578
6a61ea88
JH
579extern int outdesc; /* Output file descriptor. */
580extern struct exec outheader; /* Output file header. */
581extern int magic; /* Output file magic. */
582extern int oldmagic;
583extern int relocatable_output;
1136f72d 584
6a61ea88
JH
585/* Size of a page. */
586extern int page_size;
1136f72d 587
6a61ea88
JH
588extern char **search_dirs; /* Directories to search for libraries. */
589extern int n_search_dirs; /* Length of above. */
1136f72d 590
6a61ea88 591extern int write_map; /* write a load map (`-M') */
1136f72d 592
1136f72d
PR
593void read_header __P((int, struct file_entry *));
594void read_entry_symbols __P((int, struct file_entry *));
595void read_entry_strings __P((int, struct file_entry *));
596void read_entry_relocation __P((int, struct file_entry *));
0f052032
JH
597void enter_file_symbols __P((struct file_entry *));
598void read_file_symbols __P((struct file_entry *));
1c8a0fd5
PR
599int set_element_prefixed_p __P((char *));
600int text_offset __P((struct file_entry *));
601int file_open __P((struct file_entry *));
602void each_file __P((void (*)(), void *));
603void each_full_file __P((void (*)(), void *));
604unsigned long check_each_file __P((unsigned long (*)(), void *));
6a61ea88 605void mywrite __P((void *, int, int, int));
1c8a0fd5 606void padfile __P((int,int));
1136f72d
PR
607
608/* In warnings.c: */
609void perror_name __P((char *));
610void perror_file __P((struct file_entry *));
1136f72d
PR
611void print_symbols __P((FILE *));
612char *get_file_name __P((struct file_entry *));
613void print_file_name __P((struct file_entry *, FILE *));
614void prline_file_name __P((struct file_entry *, FILE *));
615int do_warnings __P((FILE *));
616
617/* In etc.c: */
1c8a0fd5
PR
618void *xmalloc __P((size_t));
619void *xrealloc __P((void *, size_t));
0f052032 620char *concat __P((const char *, const char *, const char *));
1136f72d
PR
621
622/* In symbol.c: */
623void symtab_init __P((int));
624symbol *getsym __P((char *)), *getsym_soft __P((char *));
625
626/* In lib.c: */
627void search_library __P((int, struct file_entry *));
628void read_shared_object __P((int, struct file_entry *));
629int findlib __P((struct file_entry *));
630
631/* In shlib.c: */
0f052032 632char *findshlib __P((char *, int *, int *, int));
1136f72d 633void add_search_dir __P((char *));
1c8a0fd5
PR
634void add_search_path __P((char *));
635void std_search_path __P((void));
636int getdewey __P((int[], char *));
637int cmpndewey __P((int[], int, int[], int));
1136f72d
PR
638
639/* In rrs.c: */
640void init_rrs __P((void));
80f25b52 641int rrs_add_shobj __P((struct file_entry *));
27b6ced7
JH
642void alloc_rrs_reloc __P((struct file_entry *, symbol *));
643void alloc_rrs_segment_reloc __P((struct file_entry *, struct relocation_info *));
644void alloc_rrs_jmpslot __P((struct file_entry *, symbol *));
645void alloc_rrs_gotslot __P((struct file_entry *, struct relocation_info *, localsymbol_t *));
646void alloc_rrs_cpy_reloc __P((struct file_entry *, symbol *));
647
648int claim_rrs_reloc __P((struct file_entry *, struct relocation_info *, symbol *, long *));
649long claim_rrs_jmpslot __P((struct file_entry *, struct relocation_info *, symbol *, long));
650long claim_rrs_gotslot __P((struct file_entry *, struct relocation_info *, struct localsymbol *, long));
651long claim_rrs_internal_gotslot __P((struct file_entry *, struct relocation_info *, struct localsymbol *, long));
652void claim_rrs_cpy_reloc __P((struct file_entry *, struct relocation_info *, symbol *));
653void claim_rrs_segment_reloc __P((struct file_entry *, struct relocation_info *));
1c8a0fd5
PR
654void consider_rrs_section_lengths __P((void));
655void relocate_rrs_addresses __P((void));
656void write_rrs __P((void));
1136f72d
PR
657
658/* In <md>.c */
659void md_init_header __P((struct exec *, int, int));
660long md_get_addend __P((struct relocation_info *, unsigned char *));
661void md_relocate __P((struct relocation_info *, long, unsigned char *, int));
662void md_make_jmpslot __P((jmpslot_t *, long, long));
663void md_fix_jmpslot __P((jmpslot_t *, long, u_long));
664int md_make_reloc __P((struct relocation_info *, struct relocation_info *, int));
665void md_make_jmpreloc __P((struct relocation_info *, struct relocation_info *, int));
666void md_make_gotreloc __P((struct relocation_info *, struct relocation_info *, int));
667void md_make_copyreloc __P((struct relocation_info *, struct relocation_info *));
1c8a0fd5 668void md_set_breakpoint __P((long, long *));
1136f72d
PR
669
670#ifdef NEED_SWAP
671void md_swapin_exec_hdr __P((struct exec *));
672void md_swapout_exec_hdr __P((struct exec *));
673void md_swapin_reloc __P((struct relocation_info *, int));
674void md_swapout_reloc __P((struct relocation_info *, int));
675void md_swapout_jmpslot __P((jmpslot_t *, int));
676
677/* In xbits.c: */
678void swap_longs __P((long *, int));
679void swap_symbols __P((struct nlist *, int));
680void swap_zsymbols __P((struct nzlist *, int));
681void swap_ranlib_hdr __P((struct ranlib *, int));
6a61ea88
JH
682void swap__dynamic __P((struct link_dynamic *));
683void swap_section_dispatch_table __P((struct section_dispatch_table *));
684void swap_so_debug __P((struct so_debug *));
685void swapin_sod __P((struct sod *, int));
686void swapout_sod __P((struct sod *, int));
1136f72d
PR
687void swapout_fshash __P((struct fshash *, int));
688#endif