OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [oc/] [gdb-5.0/] [bfd/] [libaout.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 104 markom
/* BFD back-end data structures for a.out (and similar) files.
2
   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
3
   Free Software Foundation, Inc.
4
   Written by Cygnus Support.
5
 
6
This file is part of BFD, the Binary File Descriptor library.
7
 
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2 of the License, or
11
(at your option) any later version.
12
 
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
21
 
22
#ifndef LIBAOUT_H
23
#define LIBAOUT_H
24
 
25
/* We try to encapsulate the differences in the various a.out file
26
   variants in a few routines, and otherwise share large masses of code.
27
   This means we only have to fix bugs in one place, most of the time.  */
28
 
29
#include "bfdlink.h"
30
 
31
/* Parameterize the a.out code based on whether it is being built
32
   for a 32-bit architecture or a 64-bit architecture.  */
33
#if ARCH_SIZE==64
34
#define GET_WORD bfd_h_get_64
35
#define GET_SWORD bfd_h_get_signed_64
36
#define PUT_WORD bfd_h_put_64
37
#ifndef NAME
38
#define NAME(x,y) CAT3(x,_64_,y)
39
#endif
40
#define JNAME(x) CAT(x,_64)
41
#define BYTES_IN_WORD 8
42
#else /* ARCH_SIZE == 32 */
43
#define GET_WORD bfd_h_get_32
44
#define GET_SWORD bfd_h_get_signed_32
45
#define PUT_WORD bfd_h_put_32
46
#ifndef NAME
47
#define NAME(x,y) CAT3(x,_32_,y)
48
#endif
49
#define JNAME(x) CAT(x,_32)
50
#define BYTES_IN_WORD 4
51
#endif /* ARCH_SIZE==32 */
52
 
53
/* Declare at file level, since used in parameter lists, which have
54
   weird scope.  */
55
struct external_exec;
56
struct external_nlist;
57
struct reloc_ext_external;
58
struct reloc_std_external;
59
 
60
/* a.out backend linker hash table entries.  */
61
 
62
struct aout_link_hash_entry
63
{
64
  struct bfd_link_hash_entry root;
65
  /* Whether this symbol has been written out.  */
66
  boolean written;
67
  /* Symbol index in output file.  */
68
  int indx;
69
};
70
 
71
/* a.out backend linker hash table.  */
72
 
73
struct aout_link_hash_table
74
{
75
  struct bfd_link_hash_table root;
76
};
77
 
78
/* Look up an entry in an a.out link hash table.  */
79
 
80
#define aout_link_hash_lookup(table, string, create, copy, follow) \
81
  ((struct aout_link_hash_entry *) \
82
   bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
83
 
84
/* Traverse an a.out link hash table.  */
85
 
86
#define aout_link_hash_traverse(table, func, info)                      \
87
  (bfd_link_hash_traverse                                               \
88
   (&(table)->root,                                                     \
89
    (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func),  \
90
    (info)))
91
 
92
/* Get the a.out link hash table from the info structure.  This is
93
   just a cast.  */
94
 
95
#define aout_hash_table(p) ((struct aout_link_hash_table *) ((p)->hash))
96
 
97
/* Back-end information for various a.out targets.  */
98
struct aout_backend_data
99
{
100
  /* Are ZMAGIC files mapped contiguously?  If so, the text section may
101
     need more padding, if the segment size (granularity for memory access
102
     control) is larger than the page size.  */
103
  unsigned char zmagic_mapped_contiguous;
104
  /* If this flag is set, ZMAGIC/NMAGIC file headers get mapped in with the
105
     text section, which starts immediately after the file header.
106
     If not, the text section starts on the next page.  */
107
  unsigned char text_includes_header;
108
 
109
  /* If this flag is set, then if the entry address is not in the
110
     first SEGMENT_SIZE bytes of the text section, it is taken to be
111
     the address of the start of the text section.  This can be useful
112
     for kernels.  */
113
  unsigned char entry_is_text_address;
114
 
115
  /* The value to pass to N_SET_FLAGS.  */
116
  unsigned char exec_hdr_flags;
117
 
118
  /* If the text section VMA isn't specified, and we need an absolute
119
     address, use this as the default.  If we're producing a relocatable
120
     file, zero is always used.  */
121
  /* ?? Perhaps a callback would be a better choice?  Will this do anything
122
     reasonable for a format that handles multiple CPUs with different
123
     load addresses for each?  */
124
  bfd_vma default_text_vma;
125
 
126
  /* Callback for setting the page and segment sizes, if they can't be
127
     trivially determined from the architecture.  */
128
  boolean (*set_sizes) PARAMS ((bfd *));
129
 
130
  /* zmagic files only. For go32, the length of the exec header contributes
131
     to the size of the text section in the file for alignment purposes but
132
     does *not* get counted in the length of the text section. */
133
  unsigned char exec_header_not_counted;
134
 
135
  /* Callback from the add symbols phase of the linker code to handle
136
     a dynamic object.  */
137
  boolean (*add_dynamic_symbols) PARAMS ((bfd *, struct bfd_link_info *,
138
                                          struct external_nlist **,
139
                                          bfd_size_type *, char **));
140
 
141
  /* Callback from the add symbols phase of the linker code to handle
142
     adding a single symbol to the global linker hash table.  */
143
  boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *,
144
                                     const char *, flagword, asection *,
145
                                     bfd_vma, const char *, boolean,
146
                                     boolean,
147
                                     struct bfd_link_hash_entry **));
148
 
149
  /* Called to handle linking a dynamic object.  */
150
  boolean (*link_dynamic_object) PARAMS ((struct bfd_link_info *, bfd *));
151
 
152
  /* Called for each global symbol being written out by the linker.
153
     This should write out the dynamic symbol information.  */
154
  boolean (*write_dynamic_symbol) PARAMS ((bfd *, struct bfd_link_info *,
155
                                           struct aout_link_hash_entry *));
156
 
157
  /* If this callback is not NULL, the linker calls it for each reloc.
158
     RELOC is a pointer to the unswapped reloc.  If *SKIP is set to
159
     true, the reloc will be skipped.  *RELOCATION may be changed to
160
     change the effects of the relocation.  */
161
  boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *info,
162
                                          bfd *input_bfd,
163
                                          asection *input_section,
164
                                          struct aout_link_hash_entry *h,
165
                                          PTR reloc, bfd_byte *contents,
166
                                          boolean *skip,
167
                                          bfd_vma *relocation));
168
 
169
  /* Called at the end of a link to finish up any dynamic linking
170
     information.  */
171
  boolean (*finish_dynamic_link) PARAMS ((bfd *, struct bfd_link_info *));
172
};
173
#define aout_backend_info(abfd) \
174
        ((CONST struct aout_backend_data *)((abfd)->xvec->backend_data))
175
 
176
/* This is the layout in memory of a "struct exec" while we process it.
177
   All 'lengths' are given as a number of bytes.
178
   All 'alignments' are for relinkable files only;  an alignment of
179
        'n' indicates the corresponding segment must begin at an
180
        address that is a multiple of (2**n).  */
181
 
182
struct internal_exec
183
{
184
    long a_info;                /* Magic number and flags, packed */
185
    bfd_vma a_text;             /* length of text, in bytes  */
186
    bfd_vma a_data;             /* length of data, in bytes  */
187
    bfd_vma a_bss;              /* length of uninitialized data area in mem */
188
    bfd_vma a_syms;             /* length of symbol table data in file */
189
    bfd_vma a_entry;            /* start address */
190
    bfd_vma a_trsize;           /* length of text's relocation info, in bytes */
191
    bfd_vma a_drsize;           /* length of data's relocation info, in bytes */
192
    /* Added for i960 */
193
    bfd_vma a_tload;            /* Text runtime load address */
194
    bfd_vma a_dload;            /* Data runtime load address */
195
    unsigned char a_talign;     /* Alignment of text segment */
196
    unsigned char a_dalign;     /* Alignment of data segment */
197
    unsigned char a_balign;     /* Alignment of bss segment */
198
    char a_relaxable;           /* Enough info for linker relax */
199
};
200
 
201
/* Magic number is written
202
< MSB          >
203
3130292827262524232221201918171615141312111009080706050403020100
204
< FLAGS        >< MACHINE TYPE ><  MAGIC NUMBER                >
205
*/
206
/* Magic number for NetBSD is
207
<MSB           >
208
3130292827262524232221201918171615141312111009080706050403020100
209
< FLAGS    >< MACHINE TYPE     ><  MAGIC NUMBER                >
210
*/
211
 
212
enum machine_type {
213
  M_UNKNOWN = 0,
214
  M_68010 = 1,
215
  M_68020 = 2,
216
  M_SPARC = 3,
217
  /* skip a bunch so we don't run into any of suns numbers */
218
  /* make these up for the ns32k*/
219
  M_NS32032 = (64),             /* ns32032 running ? */
220
  M_NS32532 = (64 + 5),         /* ns32532 running mach */
221
 
222
  M_386 = 100,
223
  M_29K = 101,          /* AMD 29000 */
224
  M_386_DYNIX = 102,    /* Sequent running dynix */
225
  M_ARM = 103,          /* Advanced Risc Machines ARM */
226
  M_SPARCLET = 131,     /* SPARClet = M_SPARC + 128 */
227
  M_386_NETBSD = 134,   /* NetBSD/i386 binary */
228
  M_68K_NETBSD = 135,   /* NetBSD/m68k binary */
229
  M_68K4K_NETBSD = 136, /* NetBSD/m68k4k binary */
230
  M_532_NETBSD = 137,   /* NetBSD/ns32k binary */
231
  M_SPARC_NETBSD = 138, /* NetBSD/sparc binary */
232
  M_PMAX_NETBSD = 139,  /* NetBSD/pmax (MIPS little-endian) binary */
233
  M_VAX_NETBSD = 140,   /* NetBSD/vax binary */
234
  M_ALPHA_NETBSD = 141, /* NetBSD/alpha binary */
235
  M_ARM6_NETBSD = 143,  /* NetBSD/arm32 binary */
236
  M_SPARCLET_1 = 147,   /* 0x93, reserved */
237
  M_MIPS1 = 151,        /* MIPS R2000/R3000 binary */
238
  M_MIPS2 = 152,        /* MIPS R4000/R6000 binary */
239
  M_SPARCLET_2 = 163,   /* 0xa3, reserved */
240
  M_SPARCLET_3 = 179,   /* 0xb3, reserved */
241
  M_SPARCLET_4 = 195,   /* 0xc3, reserved */
242
  M_HP200 = 200,        /* HP 200 (68010) BSD binary */
243
  M_HP300 = (300 % 256), /* HP 300 (68020+68881) BSD binary */
244
  M_HPUX = (0x20c % 256), /* HP 200/300 HPUX binary */
245
  M_SPARCLET_5 = 211,   /* 0xd3, reserved */
246
  M_SPARCLET_6 = 227,   /* 0xe3, reserved */
247
  /*  M_SPARCLET_7 = 243        / * 0xf3, reserved */
248
  M_SPARCLITE_LE = 243
249
};
250
 
251
#define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)
252
 
253
#ifndef N_MAGIC
254
# define N_MAGIC(exec) ((exec).a_info & 0xffff)
255
#endif
256
 
257
#ifndef N_MACHTYPE
258
# define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
259
#endif
260
 
261
#ifndef N_FLAGS
262
# define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
263
#endif
264
 
265
#ifndef N_SET_INFO
266
# define N_SET_INFO(exec, magic, type, flags) \
267
((exec).a_info = ((magic) & 0xffff) \
268
 | (((int)(type) & 0xff) << 16) \
269
 | (((flags) & 0xff) << 24))
270
#endif
271
 
272
#ifndef N_SET_DYNAMIC
273
# define N_SET_DYNAMIC(exec, dynamic) \
274
((exec).a_info = (dynamic) ? ((exec).a_info | 0x80000000) : \
275
((exec).a_info & 0x7fffffff))
276
#endif
277
 
278
#ifndef N_SET_MAGIC
279
# define N_SET_MAGIC(exec, magic) \
280
((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
281
#endif
282
 
283
#ifndef N_SET_MACHTYPE
284
# define N_SET_MACHTYPE(exec, machtype) \
285
((exec).a_info = \
286
 ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
287
#endif
288
 
289
#ifndef N_SET_FLAGS
290
# define N_SET_FLAGS(exec, flags) \
291
((exec).a_info = \
292
 ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
293
#endif
294
 
295
typedef struct aout_symbol {
296
  asymbol symbol;
297
  short desc;
298
  char other;
299
  unsigned char type;
300
} aout_symbol_type;
301
 
302
/* The `tdata' struct for all a.out-like object file formats.
303
   Various things depend on this struct being around any time an a.out
304
   file is being handled.  An example is dbxread.c in GDB.  */
305
 
306
struct aoutdata {
307
  struct internal_exec *hdr;            /* exec file header */
308
  aout_symbol_type *symbols;            /* symtab for input bfd */
309
 
310
  /* For ease, we do this */
311
  asection *textsec;
312
  asection *datasec;
313
  asection *bsssec;
314
 
315
  /* We remember these offsets so that after check_file_format, we have
316
     no dependencies on the particular format of the exec_hdr.  */
317
  file_ptr sym_filepos;
318
  file_ptr str_filepos;
319
 
320
  /* Size of a relocation entry in external form */
321
  unsigned reloc_entry_size;
322
 
323
  /* Size of a symbol table entry in external form */
324
  unsigned symbol_entry_size;
325
 
326
  /* Page size - needed for alignment of demand paged files. */
327
  unsigned long page_size;
328
 
329
  /* Segment size - needed for alignment of demand paged files. */
330
  unsigned long segment_size;
331
 
332
  /* Zmagic disk block size - need to align the start of the text
333
     section in ZMAGIC binaries.  Normally the same as page_size.  */
334
  unsigned long zmagic_disk_block_size;
335
 
336
  unsigned exec_bytes_size;
337
  unsigned vma_adjusted : 1;
338
 
339
  /* used when a bfd supports several highly similar formats */
340
  enum
341
    {
342
      default_format = 0,
343
      /* Used on HP 9000/300 running HP/UX.  See hp300hpux.c.  */
344
      gnu_encap_format,
345
      /* Used on Linux, 386BSD, etc.  See include/aout/aout64.h.  */
346
      q_magic_format
347
    } subformat;
348
 
349
  enum
350
    {
351
      undecided_magic = 0,
352
      z_magic,
353
      o_magic,
354
      n_magic
355
    } magic;
356
 
357
  /* A buffer for find_nearest_line.  */
358
  char *line_buf;
359
 
360
  /* The external symbol information.  */
361
  struct external_nlist *external_syms;
362
  bfd_size_type external_sym_count;
363
  bfd_window sym_window;
364
  char *external_strings;
365
  bfd_size_type external_string_size;
366
  bfd_window string_window;
367
  struct aout_link_hash_entry **sym_hashes;
368
 
369
  /* A pointer for shared library information.  */
370
  PTR dynamic_info;
371
 
372
  /* A mapping from local symbols to offsets into the global offset
373
     table, used when linking on SunOS.  This is indexed by the symbol
374
     index.  */
375
  bfd_vma *local_got_offsets;
376
};
377
 
378
struct  aout_data_struct {
379
    struct aoutdata a;
380
    struct internal_exec e;
381
};
382
 
383
#define adata(bfd)              ((bfd)->tdata.aout_data->a)
384
#define exec_hdr(bfd)           (adata(bfd).hdr)
385
#define obj_aout_symbols(bfd)   (adata(bfd).symbols)
386
#define obj_textsec(bfd)        (adata(bfd).textsec)
387
#define obj_datasec(bfd)        (adata(bfd).datasec)
388
#define obj_bsssec(bfd)         (adata(bfd).bsssec)
389
#define obj_sym_filepos(bfd)    (adata(bfd).sym_filepos)
390
#define obj_str_filepos(bfd)    (adata(bfd).str_filepos)
391
#define obj_reloc_entry_size(bfd) (adata(bfd).reloc_entry_size)
392
#define obj_symbol_entry_size(bfd) (adata(bfd).symbol_entry_size)
393
#define obj_aout_subformat(bfd) (adata(bfd).subformat)
394
#define obj_aout_external_syms(bfd) (adata(bfd).external_syms)
395
#define obj_aout_external_sym_count(bfd) (adata(bfd).external_sym_count)
396
#define obj_aout_sym_window(bfd) (adata(bfd).sym_window)
397
#define obj_aout_external_strings(bfd) (adata(bfd).external_strings)
398
#define obj_aout_external_string_size(bfd) (adata(bfd).external_string_size)
399
#define obj_aout_string_window(bfd) (adata(bfd).string_window)
400
#define obj_aout_sym_hashes(bfd) (adata(bfd).sym_hashes)
401
#define obj_aout_dynamic_info(bfd) (adata(bfd).dynamic_info)
402
 
403
/* We take the address of the first element of an asymbol to ensure that the
404
   macro is only ever applied to an asymbol */
405
#define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd))
406
 
407
/* Information we keep for each a.out section.  This is currently only
408
   used by the a.out backend linker.  */
409
 
410
struct aout_section_data_struct
411
{
412
  /* The unswapped relocation entries for this section.  */
413
  PTR relocs;
414
};
415
 
416
#define aout_section_data(s) \
417
  ((struct aout_section_data_struct *) (s)->used_by_bfd)
418
 
419
#define set_aout_section_data(s,v) \
420
  ((s)->used_by_bfd = (PTR)&(v)->relocs)
421
 
422
/* Prototype declarations for functions defined in aoutx.h  */
423
 
424
boolean
425
NAME(aout,squirt_out_relocs) PARAMS ((bfd *abfd, asection *section));
426
 
427
boolean
428
NAME(aout,make_sections) PARAMS ((bfd *));
429
 
430
const bfd_target *
431
NAME(aout,some_aout_object_p) PARAMS ((bfd *abfd,
432
                                       struct internal_exec *execp,
433
                                       const bfd_target *(*callback)(bfd *)));
434
 
435
boolean
436
NAME(aout,mkobject) PARAMS ((bfd *abfd));
437
 
438
enum machine_type
439
NAME(aout,machine_type) PARAMS ((enum bfd_architecture arch,
440
                                 unsigned long machine,
441
                                 boolean *unknown));
442
 
443
boolean
444
NAME(aout,set_arch_mach) PARAMS ((bfd *abfd, enum bfd_architecture arch,
445
                                  unsigned long machine));
446
 
447
boolean
448
NAME(aout,new_section_hook) PARAMS ((bfd *abfd, asection *newsect));
449
 
450
boolean
451
NAME(aout,set_section_contents) PARAMS ((bfd *abfd, sec_ptr section,
452
                         PTR location, file_ptr offset, bfd_size_type count));
453
 
454
asymbol *
455
NAME(aout,make_empty_symbol) PARAMS ((bfd *abfd));
456
 
457
boolean
458
NAME(aout,translate_symbol_table) PARAMS ((bfd *, aout_symbol_type *,
459
                                           struct external_nlist *,
460
                                           bfd_size_type, char *,
461
                                           bfd_size_type,
462
                                           boolean dynamic));
463
 
464
boolean
465
NAME(aout,slurp_symbol_table) PARAMS ((bfd *abfd));
466
 
467
boolean
468
NAME(aout,write_syms) PARAMS ((bfd *abfd));
469
 
470
void
471
NAME(aout,reclaim_symbol_table) PARAMS ((bfd *abfd));
472
 
473
long
474
NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *abfd));
475
 
476
long
477
NAME(aout,get_symtab) PARAMS ((bfd *abfd, asymbol **location));
478
 
479
void
480
NAME(aout,swap_ext_reloc_in) PARAMS ((bfd *, struct reloc_ext_external *,
481
                                      arelent *, asymbol **, bfd_size_type));
482
void
483
NAME(aout,swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *,
484
                                      arelent *, asymbol **, bfd_size_type));
485
 
486
reloc_howto_type *
487
NAME(aout,reloc_type_lookup) PARAMS ((bfd *abfd,
488
                                      bfd_reloc_code_real_type code));
489
 
490
boolean
491
NAME(aout,slurp_reloc_table) PARAMS ((bfd *abfd, sec_ptr asect,
492
                                      asymbol **symbols));
493
 
494
long
495
NAME(aout,canonicalize_reloc) PARAMS ((bfd *abfd, sec_ptr section,
496
                                       arelent **relptr, asymbol **symbols));
497
 
498
long
499
NAME(aout,get_reloc_upper_bound) PARAMS ((bfd *abfd, sec_ptr asect));
500
 
501
void
502
NAME(aout,reclaim_reloc) PARAMS ((bfd *ignore_abfd, sec_ptr ignore));
503
 
504
alent *
505
NAME(aout,get_lineno) PARAMS ((bfd *ignore_abfd, asymbol *ignore_symbol));
506
 
507
void
508
NAME(aout,print_symbol) PARAMS ((bfd *ignore_abfd, PTR file,
509
                            asymbol *symbol, bfd_print_symbol_type how));
510
 
511
void
512
NAME(aout,get_symbol_info) PARAMS ((bfd *ignore_abfd,
513
                           asymbol *symbol, symbol_info *ret));
514
 
515
boolean
516
NAME(aout,find_nearest_line) PARAMS ((bfd *abfd, asection *section,
517
      asymbol **symbols, bfd_vma offset, CONST char **filename_ptr,
518
      CONST char **functionname_ptr, unsigned int *line_ptr));
519
 
520
long
521
NAME(aout,read_minisymbols) PARAMS ((bfd *, boolean, PTR *, unsigned int *));
522
 
523
asymbol *
524
NAME(aout,minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
525
                                         asymbol *));
526
 
527
int
528
NAME(aout,sizeof_headers) PARAMS ((bfd *abfd, boolean exec));
529
 
530
boolean
531
NAME(aout,adjust_sizes_and_vmas) PARAMS ((bfd *abfd,
532
       bfd_size_type *text_size, file_ptr *text_end));
533
 
534
void
535
NAME(aout,swap_exec_header_in) PARAMS ((bfd *abfd,
536
       struct external_exec *raw_bytes, struct internal_exec *execp));
537
 
538
void
539
NAME(aout,swap_exec_header_out) PARAMS ((bfd *abfd,
540
       struct internal_exec *execp, struct external_exec *raw_bytes));
541
 
542
struct bfd_hash_entry *
543
NAME(aout,link_hash_newfunc)
544
  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
545
 
546
boolean
547
NAME(aout,link_hash_table_init)
548
     PARAMS ((struct aout_link_hash_table *, bfd *,
549
              struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
550
                                          struct bfd_hash_table *,
551
                                          const char *)));
552
 
553
struct bfd_link_hash_table *
554
NAME(aout,link_hash_table_create) PARAMS ((bfd *));
555
 
556
boolean
557
NAME(aout,link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
558
 
559
boolean
560
NAME(aout,final_link) PARAMS ((bfd *, struct bfd_link_info *,
561
                               void (*) (bfd *, file_ptr *, file_ptr *,
562
                                         file_ptr *)));
563
 
564
boolean
565
NAME(aout,bfd_free_cached_info) PARAMS ((bfd *));
566
 
567
/* A.out uses the generic versions of these routines... */
568
 
569
#define aout_32_get_section_contents    _bfd_generic_get_section_contents
570
 
571
#define aout_64_get_section_contents    _bfd_generic_get_section_contents
572
#ifndef NO_WRITE_HEADER_KLUDGE
573
#define NO_WRITE_HEADER_KLUDGE 0
574
#endif
575
 
576
#ifndef aout_32_bfd_is_local_label_name
577
#define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name
578
#endif
579
 
580
#ifndef WRITE_HEADERS
581
#define WRITE_HEADERS(abfd, execp)                                            \
582
      {                                                                       \
583
        bfd_size_type text_size; /* dummy vars */                             \
584
        file_ptr text_end;                                                    \
585
        if (adata(abfd).magic == undecided_magic)                             \
586
          NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end);     \
587
                                                                              \
588
        execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE;        \
589
        execp->a_entry = bfd_get_start_address (abfd);                        \
590
                                                                              \
591
        execp->a_trsize = ((obj_textsec (abfd)->reloc_count) *                \
592
                           obj_reloc_entry_size (abfd));                      \
593
        execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *                \
594
                           obj_reloc_entry_size (abfd));                      \
595
        NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes);           \
596
                                                                              \
597
        if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false;         \
598
        if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)           \
599
            != EXEC_BYTES_SIZE)                                               \
600
          return false;                                                       \
601
        /* Now write out reloc info, followed by syms and strings */          \
602
                                                                              \
603
        if (bfd_get_outsymbols (abfd) != (asymbol **) NULL                    \
604
            && bfd_get_symcount (abfd) != 0)                                   \
605
          {                                                                   \
606
            if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) != 0) \
607
              return false;                                                   \
608
                                                                              \
609
            if (! NAME(aout,write_syms)(abfd)) return false;                  \
610
          }                                                                   \
611
                                                                              \
612
        if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) != 0)    \
613
          return false;                                                       \
614
        if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd)))         \
615
          return false;                                                       \
616
                                                                              \
617
        if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) != 0)    \
618
          return false;                                                       \
619
        if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd)))          \
620
          return false;                                                       \
621
      }
622
#endif
623
 
624
#endif /* ! defined (LIBAOUT_H) */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.