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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [bfd/] [doc/] [bfd.info-6] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
This is bfd.info, produced by makeinfo version 4.0 from bfd.texinfo.
2
 
3
START-INFO-DIR-ENTRY
4
* Bfd: (bfd).                   The Binary File Descriptor library.
5
END-INFO-DIR-ENTRY
6
 
7
   This file documents the BFD library.
8
 
9
   Copyright (C) 1991, 2000 Free Software Foundation, Inc.
10
 
11
   Permission is granted to copy, distribute and/or modify this document
12
     under the terms of the GNU Free Documentation License, Version 1.1
13
     or any later version published by the Free Software Foundation;
14
   with no Invariant Sections, with no Front-Cover Texts, and with no
15
    Back-Cover Texts.  A copy of the license is included in the
16
section entitled "GNU Free Documentation License".
17
 
18

19
File: bfd.info,  Node: coff,  Next: elf,  Prev: aout,  Up: BFD back ends
20
 
21
coff backends
22
=============
23
 
24
   BFD supports a number of different flavours of coff format.  The
25
major differences between formats are the sizes and alignments of
26
fields in structures on disk, and the occasional extra field.
27
 
28
   Coff in all its varieties is implemented with a few common files and
29
a number of implementation specific files. For example, The 88k bcs
30
coff format is implemented in the file `coff-m88k.c'. This file
31
`#include's `coff/m88k.h' which defines the external structure of the
32
coff format for the 88k, and `coff/internal.h' which defines the
33
internal structure. `coff-m88k.c' also defines the relocations used by
34
the 88k format *Note Relocations::.
35
 
36
   The Intel i960 processor version of coff is implemented in
37
`coff-i960.c'. This file has the same structure as `coff-m88k.c',
38
except that it includes `coff/i960.h' rather than `coff-m88k.h'.
39
 
40
Porting to a new version of coff
41
--------------------------------
42
 
43
   The recommended method is to select from the existing
44
implementations the version of coff which is most like the one you want
45
to use.  For example, we'll say that i386 coff is the one you select,
46
and that your coff flavour is called foo.  Copy `i386coff.c' to
47
`foocoff.c', copy `../include/coff/i386.h' to `../include/coff/foo.h',
48
and add the lines to `targets.c' and `Makefile.in' so that your new
49
back end is used. Alter the shapes of the structures in
50
`../include/coff/foo.h' so that they match what you need. You will
51
probably also have to add `#ifdef's to the code in `coff/internal.h' and
52
`coffcode.h' if your version of coff is too wild.
53
 
54
   You can verify that your new BFD backend works quite simply by
55
building `objdump' from the `binutils' directory, and making sure that
56
its version of what's going on and your host system's idea (assuming it
57
has the pretty standard coff dump utility, usually called `att-dump' or
58
just `dump') are the same.  Then clean up your code, and send what
59
you've done to Cygnus. Then your stuff will be in the next release, and
60
you won't have to keep integrating it.
61
 
62
How the coff backend works
63
--------------------------
64
 
65
File layout
66
...........
67
 
68
   The Coff backend is split into generic routines that are applicable
69
to any Coff target and routines that are specific to a particular
70
target.  The target-specific routines are further split into ones which
71
are basically the same for all Coff targets except that they use the
72
external symbol format or use different values for certain constants.
73
 
74
   The generic routines are in `coffgen.c'.  These routines work for
75
any Coff target.  They use some hooks into the target specific code;
76
the hooks are in a `bfd_coff_backend_data' structure, one of which
77
exists for each target.
78
 
79
   The essentially similar target-specific routines are in
80
`coffcode.h'.  This header file includes executable C code.  The
81
various Coff targets first include the appropriate Coff header file,
82
make any special defines that are needed, and then include `coffcode.h'.
83
 
84
   Some of the Coff targets then also have additional routines in the
85
target source file itself.
86
 
87
   For example, `coff-i960.c' includes `coff/internal.h' and
88
`coff/i960.h'.  It then defines a few constants, such as `I960', and
89
includes `coffcode.h'.  Since the i960 has complex relocation types,
90
`coff-i960.c' also includes some code to manipulate the i960 relocs.
91
This code is not in `coffcode.h' because it would not be used by any
92
other target.
93
 
94
Bit twiddling
95
.............
96
 
97
   Each flavour of coff supported in BFD has its own header file
98
describing the external layout of the structures. There is also an
99
internal description of the coff layout, in `coff/internal.h'. A major
100
function of the coff backend is swapping the bytes and twiddling the
101
bits to translate the external form of the structures into the normal
102
internal form. This is all performed in the `bfd_swap'_thing_direction
103
routines. Some elements are different sizes between different versions
104
of coff; it is the duty of the coff version specific include file to
105
override the definitions of various packing routines in `coffcode.h'.
106
E.g., the size of line number entry in coff is sometimes 16 bits, and
107
sometimes 32 bits. `#define'ing `PUT_LNSZ_LNNO' and `GET_LNSZ_LNNO'
108
will select the correct one. No doubt, some day someone will find a
109
version of coff which has a varying field size not catered to at the
110
moment. To port BFD, that person will have to add more `#defines'.
111
Three of the bit twiddling routines are exported to `gdb';
112
`coff_swap_aux_in', `coff_swap_sym_in' and `coff_swap_lineno_in'. `GDB'
113
reads the symbol table on its own, but uses BFD to fix things up.  More
114
of the bit twiddlers are exported for `gas'; `coff_swap_aux_out',
115
`coff_swap_sym_out', `coff_swap_lineno_out', `coff_swap_reloc_out',
116
`coff_swap_filehdr_out', `coff_swap_aouthdr_out',
117
`coff_swap_scnhdr_out'. `Gas' currently keeps track of all the symbol
118
table and reloc drudgery itself, thereby saving the internal BFD
119
overhead, but uses BFD to swap things on the way out, making cross
120
ports much safer.  Doing so also allows BFD (and thus the linker) to
121
use the same header files as `gas', which makes one avenue to disaster
122
disappear.
123
 
124
Symbol reading
125
..............
126
 
127
   The simple canonical form for symbols used by BFD is not rich enough
128
to keep all the information available in a coff symbol table. The back
129
end gets around this problem by keeping the original symbol table
130
around, "behind the scenes".
131
 
132
   When a symbol table is requested (through a call to
133
`bfd_canonicalize_symtab'), a request gets through to
134
`coff_get_normalized_symtab'. This reads the symbol table from the coff
135
file and swaps all the structures inside into the internal form. It
136
also fixes up all the pointers in the table (represented in the file by
137
offsets from the first symbol in the table) into physical pointers to
138
elements in the new internal table. This involves some work since the
139
meanings of fields change depending upon context: a field that is a
140
pointer to another structure in the symbol table at one moment may be
141
the size in bytes of a structure at the next.  Another pass is made
142
over the table. All symbols which mark file names (`C_FILE' symbols)
143
are modified so that the internal string points to the value in the
144
auxent (the real filename) rather than the normal text associated with
145
the symbol (`".file"').
146
 
147
   At this time the symbol names are moved around. Coff stores all
148
symbols less than nine characters long physically within the symbol
149
table; longer strings are kept at the end of the file in the string
150
table. This pass moves all strings into memory and replaces them with
151
pointers to the strings.
152
 
153
   The symbol table is massaged once again, this time to create the
154
canonical table used by the BFD application. Each symbol is inspected
155
in turn, and a decision made (using the `sclass' field) about the
156
various flags to set in the `asymbol'.  *Note Symbols::. The generated
157
canonical table shares strings with the hidden internal symbol table.
158
 
159
   Any linenumbers are read from the coff file too, and attached to the
160
symbols which own the functions the linenumbers belong to.
161
 
162
Symbol writing
163
..............
164
 
165
   Writing a symbol to a coff file which didn't come from a coff file
166
will lose any debugging information. The `asymbol' structure remembers
167
the BFD from which the symbol was taken, and on output the back end
168
makes sure that the same destination target as source target is present.
169
 
170
   When the symbols have come from a coff file then all the debugging
171
information is preserved.
172
 
173
   Symbol tables are provided for writing to the back end in a vector
174
of pointers to pointers. This allows applications like the linker to
175
accumulate and output large symbol tables without having to do too much
176
byte copying.
177
 
178
   This function runs through the provided symbol table and patches
179
each symbol marked as a file place holder (`C_FILE') to point to the
180
next file place holder in the list. It also marks each `offset' field
181
in the list with the offset from the first symbol of the current symbol.
182
 
183
   Another function of this procedure is to turn the canonical value
184
form of BFD into the form used by coff. Internally, BFD expects symbol
185
values to be offsets from a section base; so a symbol physically at
186
0x120, but in a section starting at 0x100, would have the value 0x20.
187
Coff expects symbols to contain their final value, so symbols have
188
their values changed at this point to reflect their sum with their
189
owning section.  This transformation uses the `output_section' field of
190
the `asymbol''s `asection' *Note Sections::.
191
 
192
   * `coff_mangle_symbols'
193
   This routine runs though the provided symbol table and uses the
194
offsets generated by the previous pass and the pointers generated when
195
the symbol table was read in to create the structured hierachy required
196
by coff. It changes each pointer to a symbol into the index into the
197
symbol table of the asymbol.
198
 
199
   * `coff_write_symbols'
200
   This routine runs through the symbol table and patches up the
201
symbols from their internal form into the coff way, calls the bit
202
twiddlers, and writes out the table to the file.
203
 
204
`coff_symbol_type'
205
..................
206
 
207
   *Description*
208
The hidden information for an `asymbol' is described in a
209
`combined_entry_type':
210
 
211
 
212
     typedef struct coff_ptr_struct
213
     {
214
 
215
            /* Remembers the offset from the first symbol in the file for
216
               this symbol. Generated by coff_renumber_symbols. */
217
     unsigned int offset;
218
 
219
            /* Should the value of this symbol be renumbered.  Used for
220
               XCOFF C_BSTAT symbols.  Set by coff_slurp_symbol_table.  */
221
     unsigned int fix_value : 1;
222
 
223
            /* Should the tag field of this symbol be renumbered.
224
               Created by coff_pointerize_aux. */
225
     unsigned int fix_tag : 1;
226
 
227
            /* Should the endidx field of this symbol be renumbered.
228
               Created by coff_pointerize_aux. */
229
     unsigned int fix_end : 1;
230
 
231
            /* Should the x_csect.x_scnlen field be renumbered.
232
               Created by coff_pointerize_aux. */
233
     unsigned int fix_scnlen : 1;
234
 
235
            /* Fix up an XCOFF C_BINCL/C_EINCL symbol.  The value is the
236
               index into the line number entries.  Set by
237
               coff_slurp_symbol_table.  */
238
     unsigned int fix_line : 1;
239
 
240
            /* The container for the symbol structure as read and translated
241
                from the file. */
242
 
243
     union {
244
        union internal_auxent auxent;
245
        struct internal_syment syment;
246
      } u;
247
     } combined_entry_type;
248
 
249
 
250
     /* Each canonical asymbol really looks like this: */
251
 
252
     typedef struct coff_symbol_struct
253
     {
254
        /* The actual symbol which the rest of BFD works with */
255
     asymbol symbol;
256
 
257
        /* A pointer to the hidden information for this symbol */
258
     combined_entry_type *native;
259
 
260
        /* A pointer to the linenumber information for this symbol */
261
     struct lineno_cache_entry *lineno;
262
 
263
        /* Have the line numbers been relocated yet ? */
264
     boolean done_lineno;
265
     } coff_symbol_type;
266
 
267
`bfd_coff_backend_data'
268
.......................
269
 
270
     /* COFF symbol classifications.  */
271
 
272
     enum coff_symbol_classification
273
     {
274
       /* Global symbol.  */
275
       COFF_SYMBOL_GLOBAL,
276
       /* Common symbol.  */
277
       COFF_SYMBOL_COMMON,
278
       /* Undefined symbol.  */
279
       COFF_SYMBOL_UNDEFINED,
280
       /* Local symbol.  */
281
       COFF_SYMBOL_LOCAL,
282
       /* PE section symbol.  */
283
       COFF_SYMBOL_PE_SECTION
284
     };
285
   Special entry points for gdb to swap in coff symbol table parts:
286
     typedef struct
287
     {
288
       void (*_bfd_coff_swap_aux_in) PARAMS ((
289
            bfd            *abfd,
290
            PTR             ext,
291
            int             type,
292
            int             class,
293
            int             indaux,
294
            int             numaux,
295
            PTR             in));
296
 
297
       void (*_bfd_coff_swap_sym_in) PARAMS ((
298
            bfd            *abfd ,
299
            PTR             ext,
300
            PTR             in));
301
 
302
       void (*_bfd_coff_swap_lineno_in) PARAMS ((
303
            bfd            *abfd,
304
            PTR            ext,
305
            PTR             in));
306
   Special entry points for gas to swap out coff parts:
307
      unsigned int (*_bfd_coff_swap_aux_out) PARAMS ((
308
            bfd     *abfd,
309
            PTR     in,
310
            int     type,
311
            int     class,
312
            int     indaux,
313
            int     numaux,
314
            PTR     ext));
315
 
316
      unsigned int (*_bfd_coff_swap_sym_out) PARAMS ((
317
           bfd      *abfd,
318
           PTR      in,
319
           PTR      ext));
320
 
321
      unsigned int (*_bfd_coff_swap_lineno_out) PARAMS ((
322
            bfd     *abfd,
323
            PTR     in,
324
            PTR     ext));
325
 
326
      unsigned int (*_bfd_coff_swap_reloc_out) PARAMS ((
327
            bfd     *abfd,
328
            PTR     src,
329
            PTR     dst));
330
 
331
      unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS ((
332
            bfd     *abfd,
333
            PTR     in,
334
            PTR     out));
335
 
336
      unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS ((
337
            bfd     *abfd,
338
            PTR     in,
339
            PTR     out));
340
 
341
      unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS ((
342
            bfd     *abfd,
343
            PTR     in,
344
            PTR     out));
345
   Special entry points for generic COFF routines to call target
346
dependent COFF routines:
347
      unsigned int _bfd_filhsz;
348
      unsigned int _bfd_aoutsz;
349
      unsigned int _bfd_scnhsz;
350
      unsigned int _bfd_symesz;
351
      unsigned int _bfd_auxesz;
352
      unsigned int _bfd_relsz;
353
      unsigned int _bfd_linesz;
354
      unsigned int _bfd_filnmlen;
355
      boolean _bfd_coff_long_filenames;
356
      boolean _bfd_coff_long_section_names;
357
      unsigned int _bfd_coff_default_section_alignment_power;
358
      boolean _bfd_coff_force_symnames_in_strings;
359
      unsigned int _bfd_coff_debug_string_prefix_length;
360
      void (*_bfd_coff_swap_filehdr_in) PARAMS ((
361
            bfd     *abfd,
362
            PTR     ext,
363
            PTR     in));
364
      void (*_bfd_coff_swap_aouthdr_in) PARAMS ((
365
            bfd     *abfd,
366
            PTR     ext,
367
            PTR     in));
368
      void (*_bfd_coff_swap_scnhdr_in) PARAMS ((
369
            bfd     *abfd,
370
            PTR     ext,
371
            PTR     in));
372
      void (*_bfd_coff_swap_reloc_in) PARAMS ((
373
            bfd     *abfd,
374
            PTR     ext,
375
            PTR     in));
376
      boolean (*_bfd_coff_bad_format_hook) PARAMS ((
377
            bfd     *abfd,
378
            PTR     internal_filehdr));
379
      boolean (*_bfd_coff_set_arch_mach_hook) PARAMS ((
380
            bfd     *abfd,
381
            PTR     internal_filehdr));
382
      PTR (*_bfd_coff_mkobject_hook) PARAMS ((
383
            bfd     *abfd,
384
            PTR     internal_filehdr,
385
            PTR     internal_aouthdr));
386
      boolean (*_bfd_styp_to_sec_flags_hook) PARAMS ((
387
            bfd     *abfd,
388
            PTR     internal_scnhdr,
389
            const char *name,
390
            asection *section,
391
            flagword *flags_ptr));
392
      void (*_bfd_set_alignment_hook) PARAMS ((
393
            bfd     *abfd,
394
            asection *sec,
395
            PTR     internal_scnhdr));
396
      boolean (*_bfd_coff_slurp_symbol_table) PARAMS ((
397
            bfd     *abfd));
398
      boolean (*_bfd_coff_symname_in_debug) PARAMS ((
399
            bfd     *abfd,
400
            struct internal_syment *sym));
401
      boolean (*_bfd_coff_pointerize_aux_hook) PARAMS ((
402
            bfd *abfd,
403
            combined_entry_type *table_base,
404
            combined_entry_type *symbol,
405
            unsigned int indaux,
406
            combined_entry_type *aux));
407
      boolean (*_bfd_coff_print_aux) PARAMS ((
408
            bfd *abfd,
409
            FILE *file,
410
            combined_entry_type *table_base,
411
            combined_entry_type *symbol,
412
            combined_entry_type *aux,
413
            unsigned int indaux));
414
      void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
415
            bfd     *abfd,
416
            struct bfd_link_info *link_info,
417
            struct bfd_link_order *link_order,
418
            arelent *reloc,
419
            bfd_byte *data,
420
            unsigned int *src_ptr,
421
            unsigned int *dst_ptr));
422
      int (*_bfd_coff_reloc16_estimate) PARAMS ((
423
            bfd *abfd,
424
            asection *input_section,
425
            arelent *r,
426
            unsigned int shrink,
427
            struct bfd_link_info *link_info));
428
      enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS ((
429
            bfd *abfd,
430
            struct internal_syment *));
431
      boolean (*_bfd_coff_compute_section_file_positions) PARAMS ((
432
            bfd *abfd));
433
      boolean (*_bfd_coff_start_final_link) PARAMS ((
434
            bfd *output_bfd,
435
            struct bfd_link_info *info));
436
      boolean (*_bfd_coff_relocate_section) PARAMS ((
437
            bfd *output_bfd,
438
            struct bfd_link_info *info,
439
            bfd *input_bfd,
440
            asection *input_section,
441
            bfd_byte *contents,
442
            struct internal_reloc *relocs,
443
            struct internal_syment *syms,
444
            asection **sections));
445
      reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS ((
446
            bfd *abfd,
447
            asection *sec,
448
            struct internal_reloc *rel,
449
            struct coff_link_hash_entry *h,
450
            struct internal_syment *sym,
451
            bfd_vma *addendp));
452
      boolean (*_bfd_coff_adjust_symndx) PARAMS ((
453
            bfd *obfd,
454
            struct bfd_link_info *info,
455
            bfd *ibfd,
456
            asection *sec,
457
            struct internal_reloc *reloc,
458
            boolean *adjustedp));
459
      boolean (*_bfd_coff_link_add_one_symbol) PARAMS ((
460
            struct bfd_link_info *info,
461
            bfd *abfd,
462
            const char *name,
463
            flagword flags,
464
            asection *section,
465
            bfd_vma value,
466
            const char *string,
467
            boolean copy,
468
            boolean collect,
469
            struct bfd_link_hash_entry **hashp));
470
 
471
      boolean (*_bfd_coff_link_output_has_begun) PARAMS ((
472
            bfd * abfd,
473
            struct coff_final_link_info * pfinfo));
474
      boolean (*_bfd_coff_final_link_postscript) PARAMS ((
475
            bfd * abfd,
476
            struct coff_final_link_info * pfinfo));
477
 
478
     } bfd_coff_backend_data;
479
 
480
     #define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
481
 
482
     #define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
483
             ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
484
 
485
     #define bfd_coff_swap_sym_in(a,e,i) \
486
             ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
487
 
488
     #define bfd_coff_swap_lineno_in(a,e,i) \
489
             ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
490
 
491
     #define bfd_coff_swap_reloc_out(abfd, i, o) \
492
             ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
493
 
494
     #define bfd_coff_swap_lineno_out(abfd, i, o) \
495
             ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
496
 
497
     #define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
498
             ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
499
 
500
     #define bfd_coff_swap_sym_out(abfd, i,o) \
501
             ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
502
 
503
     #define bfd_coff_swap_scnhdr_out(abfd, i,o) \
504
             ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
505
 
506
     #define bfd_coff_swap_filehdr_out(abfd, i,o) \
507
             ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
508
 
509
     #define bfd_coff_swap_aouthdr_out(abfd, i,o) \
510
             ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
511
 
512
     #define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
513
     #define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
514
     #define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
515
     #define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
516
     #define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
517
     #define bfd_coff_relsz(abfd)  (coff_backend_info (abfd)->_bfd_relsz)
518
     #define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
519
     #define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
520
     #define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
521
     #define bfd_coff_long_section_names(abfd) \
522
             (coff_backend_info (abfd)->_bfd_coff_long_section_names)
523
     #define bfd_coff_default_section_alignment_power(abfd) \
524
             (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
525
     #define bfd_coff_swap_filehdr_in(abfd, i,o) \
526
             ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
527
 
528
     #define bfd_coff_swap_aouthdr_in(abfd, i,o) \
529
             ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
530
 
531
     #define bfd_coff_swap_scnhdr_in(abfd, i,o) \
532
             ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
533
 
534
     #define bfd_coff_swap_reloc_in(abfd, i, o) \
535
             ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
536
 
537
     #define bfd_coff_bad_format_hook(abfd, filehdr) \
538
             ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
539
 
540
     #define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
541
             ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
542
     #define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
543
             ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
544
 
545
     #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\
546
             ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
547
              (abfd, scnhdr, name, section, flags_ptr))
548
 
549
     #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
550
             ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
551
 
552
     #define bfd_coff_slurp_symbol_table(abfd)\
553
             ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
554
 
555
     #define bfd_coff_symname_in_debug(abfd, sym)\
556
             ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
557
 
558
     #define bfd_coff_force_symnames_in_strings(abfd)\
559
            (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
560
 
561
     #define bfd_coff_debug_string_prefix_length(abfd)\
562
            (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
563
 
564
     #define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
565
             ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
566
              (abfd, file, base, symbol, aux, indaux))
567
 
568
     #define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\
569
             ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
570
              (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
571
 
572
     #define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
573
             ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
574
              (abfd, section, reloc, shrink, link_info))
575
 
576
     #define bfd_coff_classify_symbol(abfd, sym)\
577
             ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
578
              (abfd, sym))
579
 
580
     #define bfd_coff_compute_section_file_positions(abfd)\
581
             ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
582
              (abfd))
583
 
584
     #define bfd_coff_start_final_link(obfd, info)\
585
             ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
586
              (obfd, info))
587
     #define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
588
             ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
589
              (obfd, info, ibfd, o, con, rel, isyms, secs))
590
     #define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
591
             ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
592
              (abfd, sec, rel, h, sym, addendp))
593
     #define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
594
             ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
595
              (obfd, info, ibfd, sec, rel, adjustedp))
596
     #define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\
597
             ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
598
              (info, abfd, name, flags, section, value, string, cp, coll, hashp))
599
 
600
     #define bfd_coff_link_output_has_begun(a,p) \
601
             ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
602
     #define bfd_coff_final_link_postscript(a,p) \
603
             ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
604
 
605
Writing relocations
606
...................
607
 
608
   To write relocations, the back end steps though the canonical
609
relocation table and create an `internal_reloc'. The symbol index to
610
use is removed from the `offset' field in the symbol table supplied.
611
The address comes directly from the sum of the section base address and
612
the relocation offset; the type is dug directly from the howto field.
613
Then the `internal_reloc' is swapped into the shape of an
614
`external_reloc' and written out to disk.
615
 
616
Reading linenumbers
617
...................
618
 
619
   Creating the linenumber table is done by reading in the entire coff
620
linenumber table, and creating another table for internal use.
621
 
622
   A coff linenumber table is structured so that each function is
623
marked as having a line number of 0. Each line within the function is
624
an offset from the first line in the function. The base of the line
625
number information for the table is stored in the symbol associated
626
with the function.
627
 
628
   Note: The PE format uses line number 0 for a flag indicating a new
629
source file.
630
 
631
   The information is copied from the external to the internal table,
632
and each symbol which marks a function is marked by pointing its...
633
 
634
   How does this work ?
635
 
636
Reading relocations
637
...................
638
 
639
   Coff relocations are easily transformed into the internal BFD form
640
(`arelent').
641
 
642
   Reading a coff relocation table is done in the following stages:
643
 
644
   * Read the entire coff relocation table into memory.
645
 
646
   * Process each relocation in turn; first swap it from the external
647
     to the internal form.
648
 
649
   * Turn the symbol referenced in the relocation's symbol index into a
650
     pointer into the canonical symbol table.  This table is the same
651
     as the one returned by a call to `bfd_canonicalize_symtab'. The
652
     back end will call that routine and save the result if a
653
     canonicalization hasn't been done.
654
 
655
   * The reloc index is turned into a pointer to a howto structure, in
656
     a back end specific way. For instance, the 386 and 960 use the
657
     `r_type' to directly produce an index into a howto table vector;
658
     the 88k subtracts a number from the `r_type' field and creates an
659
     addend field.
660
 
661

662
File: bfd.info,  Node: elf,  Prev: coff,  Up: BFD back ends
663
 
664
ELF backends
665
============
666
 
667
   BFD support for ELF formats is being worked on.  Currently, the best
668
supported back ends are for sparc and i386 (running svr4 or Solaris 2).
669
 
670
   Documentation of the internals of the support code still needs to be
671
written.  The code is changing quickly enough that we haven't bothered
672
yet.
673
 
674
`bfd_elf_find_section'
675
......................
676
 
677
   *Synopsis*
678
     struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
679
   *Description*
680
Helper functions for GDB to locate the string tables.  Since BFD hides
681
string tables from callers, GDB needs to use an internal hook to find
682
them.  Sun's .stabstr, in particular, isn't even pointed to by the
683
.stab section, so ordinary mechanisms wouldn't work to find it, even if
684
we had some.
685
 
686

687
File: bfd.info,  Node: GNU Free Documentation License,  Next: Index,  Prev: BFD back ends,  Up: Top
688
 
689
GNU Free Documentation License
690
******************************
691
 
692
   GNU Free Documentation License
693
 
694
   Version 1.1, March 2000
695
 
696
   Copyright (C) 2000  Free Software Foundation, Inc.    59 Temple
697
Place, Suite 330, Boston, MA  02111-1307  USA
698
 
699
   Everyone is permitted to copy and distribute verbatim copies  of
700
this license document, but changing it is not allowed.
701
 
702
   0. PREAMBLE
703
 
704
   The purpose of this License is to make a manual, textbook, or other
705
written document "free" in the sense of freedom: to assure everyone the
706
effective freedom to copy and redistribute it, with or without
707
modifying it, either commercially or noncommercially.  Secondarily,
708
this License preserves for the author and publisher a way to get credit
709
for their work, while not being considered responsible for
710
modifications made by others.
711
 
712
   This License is a kind of "copyleft", which means that derivative
713
works of the document must themselves be free in the same sense.  It
714
complements the GNU General Public License, which is a copyleft license
715
designed for free software.
716
 
717
   We have designed this License in order to use it for manuals for free
718
software, because free software needs free documentation: a free
719
program should come with manuals providing the same freedoms that the
720
software does.  But this License is not limited to software manuals; it
721
can be used for any textual work, regardless of subject matter or
722
whether it is published as a printed book.  We recommend this License
723
principally for works whose purpose is instruction or reference.
724
 
725
   1. APPLICABILITY AND DEFINITIONS
726
 
727
   This License applies to any manual or other work that contains a
728
notice placed by the copyright holder saying it can be distributed
729
under the terms of this License.  The "Document", below, refers to any
730
such manual or work.  Any member of the public is a licensee, and is
731
addressed as "you".
732
 
733
   A "Modified Version" of the Document means any work containing the
734
Document or a portion of it, either copied verbatim, or with
735
modifications and/or translated into another language.
736
 
737
   A "Secondary Section" is a named appendix or a front-matter section
738
of the Document that deals exclusively with the relationship of the
739
publishers or authors of the Document to the Document's overall subject
740
(or to related matters) and contains nothing that could fall directly
741
within that overall subject.  (For example, if the Document is in part a
742
textbook of mathematics, a Secondary Section may not explain any
743
mathematics.)  The relationship could be a matter of historical
744
connection with the subject or with related matters, or of legal,
745
commercial, philosophical, ethical or political position regarding them.
746
 
747
   The "Invariant Sections" are certain Secondary Sections whose titles
748
are designated, as being those of Invariant Sections, in the notice
749
that says that the Document is released under this License.
750
 
751
   The "Cover Texts" are certain short passages of text that are listed,
752
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
753
the Document is released under this License.
754
 
755
   A "Transparent" copy of the Document means a machine-readable copy,
756
represented in a format whose specification is available to the general
757
public, whose contents can be viewed and edited directly and
758
straightforwardly with generic text editors or (for images composed of
759
pixels) generic paint programs or (for drawings) some widely available
760
drawing editor, and that is suitable for input to text formatters or
761
for automatic translation to a variety of formats suitable for input to
762
text formatters.  A copy made in an otherwise Transparent file format
763
whose markup has been designed to thwart or discourage subsequent
764
modification by readers is not Transparent.  A copy that is not
765
"Transparent" is called "Opaque".
766
 
767
   Examples of suitable formats for Transparent copies include plain
768
ASCII without markup, Texinfo input format, LaTeX input format, SGML or
769
XML using a publicly available DTD, and standard-conforming simple HTML
770
designed for human modification.  Opaque formats include PostScript,
771
PDF, proprietary formats that can be read and edited only by
772
proprietary word processors, SGML or XML for which the DTD and/or
773
processing tools are not generally available, and the machine-generated
774
HTML produced by some word processors for output purposes only.
775
 
776
   The "Title Page" means, for a printed book, the title page itself,
777
plus such following pages as are needed to hold, legibly, the material
778
this License requires to appear in the title page.  For works in
779
formats which do not have any title page as such, "Title Page" means
780
the text near the most prominent appearance of the work's title,
781
preceding the beginning of the body of the text.
782
 
783
   2. VERBATIM COPYING
784
 
785
   You may copy and distribute the Document in any medium, either
786
commercially or noncommercially, provided that this License, the
787
copyright notices, and the license notice saying this License applies
788
to the Document are reproduced in all copies, and that you add no other
789
conditions whatsoever to those of this License.  You may not use
790
technical measures to obstruct or control the reading or further
791
copying of the copies you make or distribute.  However, you may accept
792
compensation in exchange for copies.  If you distribute a large enough
793
number of copies you must also follow the conditions in section 3.
794
 
795
   You may also lend copies, under the same conditions stated above, and
796
you may publicly display copies.
797
 
798
   3. COPYING IN QUANTITY
799
 
800
   If you publish printed copies of the Document numbering more than
801
100, and the Document's license notice requires Cover Texts, you must
802
enclose the copies in covers that carry, clearly and legibly, all these
803
Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts
804
on the back cover.  Both covers must also clearly and legibly identify
805
you as the publisher of these copies.  The front cover must present the
806
full title with all words of the title equally prominent and visible.
807
You may add other material on the covers in addition.  Copying with
808
changes limited to the covers, as long as they preserve the title of
809
the Document and satisfy these conditions, can be treated as verbatim
810
copying in other respects.
811
 
812
   If the required texts for either cover are too voluminous to fit
813
legibly, you should put the first ones listed (as many as fit
814
reasonably) on the actual cover, and continue the rest onto adjacent
815
pages.
816
 
817
   If you publish or distribute Opaque copies of the Document numbering
818
more than 100, you must either include a machine-readable Transparent
819
copy along with each Opaque copy, or state in or with each Opaque copy
820
a publicly-accessible computer-network location containing a complete
821
Transparent copy of the Document, free of added material, which the
822
general network-using public has access to download anonymously at no
823
charge using public-standard network protocols.  If you use the latter
824
option, you must take reasonably prudent steps, when you begin
825
distribution of Opaque copies in quantity, to ensure that this
826
Transparent copy will remain thus accessible at the stated location
827
until at least one year after the last time you distribute an Opaque
828
copy (directly or through your agents or retailers) of that edition to
829
the public.
830
 
831
   It is requested, but not required, that you contact the authors of
832
the Document well before redistributing any large number of copies, to
833
give them a chance to provide you with an updated version of the
834
Document.
835
 
836
   4. MODIFICATIONS
837
 
838
   You may copy and distribute a Modified Version of the Document under
839
the conditions of sections 2 and 3 above, provided that you release the
840
Modified Version under precisely this License, with the Modified
841
Version filling the role of the Document, thus licensing distribution
842
and modification of the Modified Version to whoever possesses a copy of
843
it.  In addition, you must do these things in the Modified Version:
844
 
845
   A. Use in the Title Page (and on the covers, if any) a title distinct
846
  from that of the Document, and from those of previous versions
847
(which should, if there were any, be listed in the History section
848
of the Document).  You may use the same title as a previous version
849
if the original publisher of that version gives permission.  B. List on
850
the Title Page, as authors, one or more persons or entities
851
responsible for authorship of the modifications in the Modified
852
Version, together with at least five of the principal authors of the
853
Document (all of its principal authors, if it has less than five).  C.
854
State on the Title page the name of the publisher of the    Modified
855
Version, as the publisher.  D. Preserve all the copyright notices of
856
the Document.  E. Add an appropriate copyright notice for your
857
modifications    adjacent to the other copyright notices.  F. Include,
858
immediately after the copyright notices, a license notice    giving the
859
public permission to use the Modified Version under the    terms of
860
this License, in the form shown in the Addendum below.  G. Preserve in
861
that license notice the full lists of Invariant Sections    and
862
required Cover Texts given in the Document's license notice.  H.
863
Include an unaltered copy of this License.  I. Preserve the section
864
entitled "History", and its title, and add to    it an item stating at
865
least the title, year, new authors, and    publisher of the Modified
866
Version as given on the Title Page.  If    there is no section entitled
867
"History" in the Document, create one    stating the title, year,
868
authors, and publisher of the Document as    given on its Title Page,
869
then add an item describing the Modified    Version as stated in the
870
previous sentence.  J. Preserve the network location, if any, given in
871
the Document for    public access to a Transparent copy of the
872
Document, and likewise    the network locations given in the Document
873
for previous versions    it was based on.  These may be placed in the
874
"History" section.     You may omit a network location for a work that
875
was published at    least four years before the Document itself, or if
876
the original    publisher of the version it refers to gives permission.
877
K. In any section entitled "Acknowledgements" or "Dedications",
878
preserve the section's title, and preserve in the section all the
879
substance and tone of each of the contributor acknowledgements
880
and/or dedications given therein.  L. Preserve all the Invariant
881
Sections of the Document,    unaltered in their text and in their
882
titles.  Section numbers    or the equivalent are not considered part
883
of the section titles.  M. Delete any section entitled "Endorsements".
884
Such a section    may not be included in the Modified Version.  N. Do
885
not retitle any existing section as "Endorsements"    or to conflict in
886
title with any Invariant Section.
887
 
888
   If the Modified Version includes new front-matter sections or
889
appendices that qualify as Secondary Sections and contain no material
890
copied from the Document, you may at your option designate some or all
891
of these sections as invariant.  To do this, add their titles to the
892
list of Invariant Sections in the Modified Version's license notice.
893
These titles must be distinct from any other section titles.
894
 
895
   You may add a section entitled "Endorsements", provided it contains
896
nothing but endorsements of your Modified Version by various
897
parties-for example, statements of peer review or that the text has
898
been approved by an organization as the authoritative definition of a
899
standard.
900
 
901
   You may add a passage of up to five words as a Front-Cover Text, and
902
a passage of up to 25 words as a Back-Cover Text, to the end of the list
903
of Cover Texts in the Modified Version.  Only one passage of
904
Front-Cover Text and one of Back-Cover Text may be added by (or through
905
arrangements made by) any one entity.  If the Document already includes
906
a cover text for the same cover, previously added by you or by
907
arrangement made by the same entity you are acting on behalf of, you
908
may not add another; but you may replace the old one, on explicit
909
permission from the previous publisher that added the old one.
910
 
911
   The author(s) and publisher(s) of the Document do not by this License
912
give permission to use their names for publicity for or to assert or
913
imply endorsement of any Modified Version.
914
 
915
   5. COMBINING DOCUMENTS
916
 
917
   You may combine the Document with other documents released under this
918
License, under the terms defined in section 4 above for modified
919
versions, provided that you include in the combination all of the
920
Invariant Sections of all of the original documents, unmodified, and
921
list them all as Invariant Sections of your combined work in its
922
license notice.
923
 
924
   The combined work need only contain one copy of this License, and
925
multiple identical Invariant Sections may be replaced with a single
926
copy.  If there are multiple Invariant Sections with the same name but
927
different contents, make the title of each such section unique by
928
adding at the end of it, in parentheses, the name of the original
929
author or publisher of that section if known, or else a unique number.
930
Make the same adjustment to the section titles in the list of Invariant
931
Sections in the license notice of the combined work.
932
 
933
   In the combination, you must combine any sections entitled "History"
934
in the various original documents, forming one section entitled
935
"History"; likewise combine any sections entitled "Acknowledgements",
936
and any sections entitled "Dedications".  You must delete all sections
937
entitled "Endorsements."
938
 
939
   6. COLLECTIONS OF DOCUMENTS
940
 
941
   You may make a collection consisting of the Document and other
942
documents released under this License, and replace the individual
943
copies of this License in the various documents with a single copy that
944
is included in the collection, provided that you follow the rules of
945
this License for verbatim copying of each of the documents in all other
946
respects.
947
 
948
   You may extract a single document from such a collection, and
949
distribute it individually under this License, provided you insert a
950
copy of this License into the extracted document, and follow this
951
License in all other respects regarding verbatim copying of that
952
document.
953
 
954
   7. AGGREGATION WITH INDEPENDENT WORKS
955
 
956
   A compilation of the Document or its derivatives with other separate
957
and independent documents or works, in or on a volume of a storage or
958
distribution medium, does not as a whole count as a Modified Version of
959
the Document, provided no compilation copyright is claimed for the
960
compilation.  Such a compilation is called an "aggregate", and this
961
License does not apply to the other self-contained works thus compiled
962
with the Document, on account of their being thus compiled, if they are
963
not themselves derivative works of the Document.
964
 
965
   If the Cover Text requirement of section 3 is applicable to these
966
copies of the Document, then if the Document is less than one quarter
967
of the entire aggregate, the Document's Cover Texts may be placed on
968
covers that surround only the Document within the aggregate.  Otherwise
969
they must appear on covers around the whole aggregate.
970
 
971
   8. TRANSLATION
972
 
973
   Translation is considered a kind of modification, so you may
974
distribute translations of the Document under the terms of section 4.
975
Replacing Invariant Sections with translations requires special
976
permission from their copyright holders, but you may include
977
translations of some or all Invariant Sections in addition to the
978
original versions of these Invariant Sections.  You may include a
979
translation of this License provided that you also include the original
980
English version of this License.  In case of a disagreement between the
981
translation and the original English version of this License, the
982
original English version will prevail.
983
 
984
   9. TERMINATION
985
 
986
   You may not copy, modify, sublicense, or distribute the Document
987
except as expressly provided for under this License.  Any other attempt
988
to copy, modify, sublicense or distribute the Document is void, and will
989
automatically terminate your rights under this License.  However,
990
parties who have received copies, or rights, from you under this
991
License will not have their licenses terminated so long as such parties
992
remain in full compliance.
993
 
994
   10. FUTURE REVISIONS OF THIS LICENSE
995
 
996
   The Free Software Foundation may publish new, revised versions of
997
the GNU Free Documentation License from time to time.  Such new
998
versions will be similar in spirit to the present version, but may
999
differ in detail to address new problems or concerns.  See
1000
http://www.gnu.org/copyleft/.
1001
 
1002
   Each version of the License is given a distinguishing version number.
1003
If the Document specifies that a particular numbered version of this
1004
License "or any later version" applies to it, you have the option of
1005
following the terms and conditions either of that specified version or
1006
of any later version that has been published (not as a draft) by the
1007
Free Software Foundation.  If the Document does not specify a version
1008
number of this License, you may choose any version ever published (not
1009
as a draft) by the Free Software Foundation.
1010
 
1011
   ADDENDUM: How to use this License for your documents
1012
 
1013
   To use this License in a document you have written, include a copy of
1014
the License in the document and put the following copyright and license
1015
notices just after the title page:
1016
 
1017
         Copyright (c)  YEAR  YOUR NAME.
1018
         Permission is granted to copy, distribute and/or modify this document
1019
         under the terms of the GNU Free Documentation License, Version 1.1
1020
         or any later version published by the Free Software Foundation;
1021
         with the Invariant Sections being LIST THEIR TITLES, with the
1022
         Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
1023
         A copy of the license is included in the section entitled "GNU
1024
         Free Documentation License".
1025
 
1026
   If you have no Invariant Sections, write "with no Invariant Sections"
1027
instead of saying which ones are invariant.  If you have no Front-Cover
1028
Texts, write "no Front-Cover Texts" instead of "Front-Cover Texts being
1029
LIST"; likewise for Back-Cover Texts.
1030
 
1031
   If your document contains nontrivial examples of program code, we
1032
recommend releasing these examples in parallel under your choice of
1033
free software license, such as the GNU General Public License, to
1034
permit their use in free software.
1035
 

powered by: WebSVN 2.1.0

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