5 % NOTE LOCAL KLUGE TO AVOID TOO MUCH WHITESPACE
6 \global\long\def\example{%
8 \let\aboveenvbreak=\par
9 \let\afterenvbreak=\par
12 \global\long\def\Eexample{%
15 \vskip -\parskip% to cancel out effect of following \par
23 * Bfd: (bfd). The Binary File Descriptor library.
29 This file documents the BFD library.
31 Copyright (C) 1991, 2000 Free Software Foundation, Inc.
33 Permission is granted to copy, distribute and/or modify this document
34 under the terms of the GNU Free Documentation License, Version 1.1
35 or any later version published by the Free Software Foundation;
36 with no Invariant Sections, with no Front-Cover Texts, and with no
37 Back-Cover Texts. A copy of the license is included in the
38 section entitled "GNU Free Documentation License".
41 Permission is granted to process this file through Tex and print the
42 results, provided the printed document carries copying permission
43 notice identical to this one except for the removal of this paragraph
44 (this paragraph not being relevant to the printed manual).
51 @c@setchapternewpage odd
52 @settitle LIB BFD, the Binary File Descriptor Library
55 @subtitle{The Binary File Descriptor Library}
57 @subtitle First Edition---BFD version < 3.0
59 @author {Steve Chamberlain}
60 @author {Cygnus Support}
64 \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
65 \xdef\manvers{\$Revision$} % For use in headers, footers too
67 \hfill Cygnus Support\par
68 \hfill sac\@cygnus.com\par
69 \hfill {\it BFD}, \manvers\par
70 \hfill \TeX{}info \texinfoversion\par
72 \global\parindent=0pt % Steve likes it this way
75 @vskip 0pt plus 1filll
76 Copyright @copyright{} 1991 Free Software Foundation, Inc.
78 Permission is granted to copy, distribute and/or modify this document
79 under the terms of the GNU Free Documentation License, Version 1.1
80 or any later version published by the Free Software Foundation;
81 with no Invariant Sections, with no Front-Cover Texts, and with no
82 Back-Cover Texts. A copy of the license is included in the
83 section entitled "GNU Free Documentation License".
88 @node Top, Overview, (dir), (dir)
90 This file documents the binary file descriptor library libbfd.
94 * Overview:: Overview of BFD
95 * BFD front end:: BFD front end
96 * BFD back ends:: BFD back ends
97 * GNU Free Documentation License:: GNU Free Documentation License
101 @node Overview, BFD front end, Top, Top
102 @chapter Introduction
105 BFD is a package which allows applications to use the
106 same routines to operate on object files whatever the object file
107 format. A new object file format can be supported simply by
108 creating a new BFD back end and adding it to the library.
110 BFD is split into two parts: the front end, and the back ends (one for
111 each object file format).
113 @item The front end of BFD provides the interface to the user. It manages
114 memory and various canonical data structures. The front end also
115 decides which back end to use and when to call back end routines.
116 @item The back ends provide BFD its view of the real world. Each back
117 end provides a set of calls which the BFD front end can use to maintain
118 its canonical form. The back ends also may keep around information for
119 their own use, for greater efficiency.
123 * How It Works:: How It Works
124 * What BFD Version 2 Can Do:: What BFD Version 2 Can Do
127 @node History, How It Works, Overview, Overview
130 One spur behind BFD was the desire, on the part of the GNU 960 team at
131 Intel Oregon, for interoperability of applications on their COFF and
132 b.out file formats. Cygnus was providing GNU support for the team, and
133 was contracted to provide the required functionality.
135 The name came from a conversation David Wallace was having with Richard
136 Stallman about the library: RMS said that it would be quite hard---David
137 said ``BFD''. Stallman was right, but the name stuck.
139 At the same time, Ready Systems wanted much the same thing, but for
140 different object file formats: IEEE-695, Oasys, Srecords, a.out and 68k
143 BFD was first implemented by members of Cygnus Support; Steve
144 Chamberlain (@code{sac@@cygnus.com}), John Gilmore
145 (@code{gnu@@cygnus.com}), K. Richard Pixley (@code{rich@@cygnus.com})
146 and David Henkel-Wallace (@code{gumby@@cygnus.com}).
150 @node How It Works, What BFD Version 2 Can Do, History, Overview
151 @section How To Use BFD
153 To use the library, include @file{bfd.h} and link with @file{libbfd.a}.
155 BFD provides a common interface to the parts of an object file
156 for a calling application.
158 When an application sucessfully opens a target file (object, archive, or
159 whatever), a pointer to an internal structure is returned. This pointer
160 points to a structure called @code{bfd}, described in
161 @file{bfd.h}. Our convention is to call this pointer a BFD, and
162 instances of it within code @code{abfd}. All operations on
163 the target object file are applied as methods to the BFD. The mapping is
164 defined within @code{bfd.h} in a set of macros, all beginning
165 with @samp{bfd_} to reduce namespace pollution.
167 For example, this sequence does what you would probably expect:
168 return the number of sections in an object file attached to a BFD
175 unsigned int number_of_sections(abfd)
178 return bfd_count_sections(abfd);
183 The abstraction used within BFD is that an object file has:
189 a number of sections containing raw data (@pxref{Sections}),
191 a set of relocations (@pxref{Relocations}), and
193 some symbol information (@pxref{Symbols}).
196 Also, BFDs opened for archives have the additional attribute of an index
197 and contain subordinate BFDs. This approach is fine for a.out and coff,
198 but loses efficiency when applied to formats such as S-records and
201 @node What BFD Version 2 Can Do, , How It Works, Overview
202 @section What BFD Version 2 Can Do
203 @include bfdsumm.texi
205 @node BFD front end, BFD back ends, Overview, Top
206 @chapter BFD front end
220 * Opening and Closing::
227 @node Memory Usage, Initialization, BFD front end, BFD front end
228 @section Memory usage
229 BFD keeps all of its internal structures in obstacks. There is one obstack
230 per open BFD file, into which the current state is stored. When a BFD is
231 closed, the obstack is deleted, and so everything which has been
232 allocated by BFD for the closing file is thrown away.
234 BFD does not free anything created by an application, but pointers into
235 @code{bfd} structures become invalid on a @code{bfd_close}; for example,
236 after a @code{bfd_close} the vector passed to
237 @code{bfd_canonicalize_symtab} is still around, since it has been
238 allocated by the application, but the data that it pointed to are
241 The general rule is to not close a BFD until all operations dependent
242 upon data from the BFD have been completed, or all the data from within
243 the file has been copied. To help with the management of memory, there
244 is a function (@code{bfd_alloc_size}) which returns the number of bytes
245 in obstacks associated with the supplied BFD. This could be used to
246 select the greediest open BFD, close it to reclaim the memory, perform
247 some operation and reopen the BFD again, to get a fresh copy of the data
250 @node Initialization, Sections, Memory Usage, BFD front end
253 @node Sections, Symbols, Initialization, BFD front end
254 @include section.texi
256 @node Symbols, Archives, Sections, BFD front end
259 @node Archives, Formats, Symbols, BFD front end
260 @include archive.texi
262 @node Formats, Relocations, Archives, BFD front end
265 @node Relocations, Core Files, Formats, BFD front end
268 @node Core Files, Targets, Relocations, BFD front end
271 @node Targets, Architectures, Core Files, BFD front end
272 @include targets.texi
274 @node Architectures, Opening and Closing, Targets, BFD front end
275 @include archures.texi
277 @node Opening and Closing, Internal, Architectures, BFD front end
280 @node Internal, File Caching, Opening and Closing, BFD front end
283 @node File Caching, Linker Functions, Internal, BFD front end
286 @node Linker Functions, Hash Tables, File Caching, BFD front end
289 @node Hash Tables, , Linker Functions, BFD front end
292 @node BFD back ends, GNU Free Documentation License, BFD front end, Top
293 @chapter BFD back ends
295 * What to Put Where::
296 * aout :: a.out backends
297 * coff :: coff backends
298 * elf :: elf backends
300 * oasys :: oasys backends
301 * ieee :: ieee backend
302 * srecord :: s-record backend
305 @node What to Put Where, aout, BFD back ends, BFD back ends
306 All of BFD lives in one directory.
308 @node aout, coff, What to Put Where, BFD back ends
311 @node coff, elf, aout, BFD back ends
312 @include coffcode.texi
314 @node elf, , coff, BFD back ends
316 @c Leave this out until the file has some actual contents...
317 @c @include elfcode.texi
319 @node GNU Free Documentation License, Index, BFD back ends, Top
320 @chapter GNU Free Documentation License
321 @cindex GNU Free Documentation License
323 GNU Free Documentation License
325 Version 1.1, March 2000
327 Copyright (C) 2000 Free Software Foundation, Inc.
328 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
330 Everyone is permitted to copy and distribute verbatim copies
331 of this license document, but changing it is not allowed.
336 The purpose of this License is to make a manual, textbook, or other
337 written document "free" in the sense of freedom: to assure everyone
338 the effective freedom to copy and redistribute it, with or without
339 modifying it, either commercially or noncommercially. Secondarily,
340 this License preserves for the author and publisher a way to get
341 credit for their work, while not being considered responsible for
342 modifications made by others.
344 This License is a kind of "copyleft", which means that derivative
345 works of the document must themselves be free in the same sense. It
346 complements the GNU General Public License, which is a copyleft
347 license designed for free software.
349 We have designed this License in order to use it for manuals for free
350 software, because free software needs free documentation: a free
351 program should come with manuals providing the same freedoms that the
352 software does. But this License is not limited to software manuals;
353 it can be used for any textual work, regardless of subject matter or
354 whether it is published as a printed book. We recommend this License
355 principally for works whose purpose is instruction or reference.
358 1. APPLICABILITY AND DEFINITIONS
360 This License applies to any manual or other work that contains a
361 notice placed by the copyright holder saying it can be distributed
362 under the terms of this License. The "Document", below, refers to any
363 such manual or work. Any member of the public is a licensee, and is
366 A "Modified Version" of the Document means any work containing the
367 Document or a portion of it, either copied verbatim, or with
368 modifications and/or translated into another language.
370 A "Secondary Section" is a named appendix or a front-matter section of
371 the Document that deals exclusively with the relationship of the
372 publishers or authors of the Document to the Document's overall subject
373 (or to related matters) and contains nothing that could fall directly
374 within that overall subject. (For example, if the Document is in part a
375 textbook of mathematics, a Secondary Section may not explain any
376 mathematics.) The relationship could be a matter of historical
377 connection with the subject or with related matters, or of legal,
378 commercial, philosophical, ethical or political position regarding
381 The "Invariant Sections" are certain Secondary Sections whose titles
382 are designated, as being those of Invariant Sections, in the notice
383 that says that the Document is released under this License.
385 The "Cover Texts" are certain short passages of text that are listed,
386 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
387 the Document is released under this License.
389 A "Transparent" copy of the Document means a machine-readable copy,
390 represented in a format whose specification is available to the
391 general public, whose contents can be viewed and edited directly and
392 straightforwardly with generic text editors or (for images composed of
393 pixels) generic paint programs or (for drawings) some widely available
394 drawing editor, and that is suitable for input to text formatters or
395 for automatic translation to a variety of formats suitable for input
396 to text formatters. A copy made in an otherwise Transparent file
397 format whose markup has been designed to thwart or discourage
398 subsequent modification by readers is not Transparent. A copy that is
399 not "Transparent" is called "Opaque".
401 Examples of suitable formats for Transparent copies include plain
402 ASCII without markup, Texinfo input format, LaTeX input format, SGML
403 or XML using a publicly available DTD, and standard-conforming simple
404 HTML designed for human modification. Opaque formats include
405 PostScript, PDF, proprietary formats that can be read and edited only
406 by proprietary word processors, SGML or XML for which the DTD and/or
407 processing tools are not generally available, and the
408 machine-generated HTML produced by some word processors for output
411 The "Title Page" means, for a printed book, the title page itself,
412 plus such following pages as are needed to hold, legibly, the material
413 this License requires to appear in the title page. For works in
414 formats which do not have any title page as such, "Title Page" means
415 the text near the most prominent appearance of the work's title,
416 preceding the beginning of the body of the text.
421 You may copy and distribute the Document in any medium, either
422 commercially or noncommercially, provided that this License, the
423 copyright notices, and the license notice saying this License applies
424 to the Document are reproduced in all copies, and that you add no other
425 conditions whatsoever to those of this License. You may not use
426 technical measures to obstruct or control the reading or further
427 copying of the copies you make or distribute. However, you may accept
428 compensation in exchange for copies. If you distribute a large enough
429 number of copies you must also follow the conditions in section 3.
431 You may also lend copies, under the same conditions stated above, and
432 you may publicly display copies.
435 3. COPYING IN QUANTITY
437 If you publish printed copies of the Document numbering more than 100,
438 and the Document's license notice requires Cover Texts, you must enclose
439 the copies in covers that carry, clearly and legibly, all these Cover
440 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
441 the back cover. Both covers must also clearly and legibly identify
442 you as the publisher of these copies. The front cover must present
443 the full title with all words of the title equally prominent and
444 visible. You may add other material on the covers in addition.
445 Copying with changes limited to the covers, as long as they preserve
446 the title of the Document and satisfy these conditions, can be treated
447 as verbatim copying in other respects.
449 If the required texts for either cover are too voluminous to fit
450 legibly, you should put the first ones listed (as many as fit
451 reasonably) on the actual cover, and continue the rest onto adjacent
454 If you publish or distribute Opaque copies of the Document numbering
455 more than 100, you must either include a machine-readable Transparent
456 copy along with each Opaque copy, or state in or with each Opaque copy
457 a publicly-accessible computer-network location containing a complete
458 Transparent copy of the Document, free of added material, which the
459 general network-using public has access to download anonymously at no
460 charge using public-standard network protocols. If you use the latter
461 option, you must take reasonably prudent steps, when you begin
462 distribution of Opaque copies in quantity, to ensure that this
463 Transparent copy will remain thus accessible at the stated location
464 until at least one year after the last time you distribute an Opaque
465 copy (directly or through your agents or retailers) of that edition to
468 It is requested, but not required, that you contact the authors of the
469 Document well before redistributing any large number of copies, to give
470 them a chance to provide you with an updated version of the Document.
475 You may copy and distribute a Modified Version of the Document under
476 the conditions of sections 2 and 3 above, provided that you release
477 the Modified Version under precisely this License, with the Modified
478 Version filling the role of the Document, thus licensing distribution
479 and modification of the Modified Version to whoever possesses a copy
480 of it. In addition, you must do these things in the Modified Version:
482 A. Use in the Title Page (and on the covers, if any) a title distinct
483 from that of the Document, and from those of previous versions
484 (which should, if there were any, be listed in the History section
485 of the Document). You may use the same title as a previous version
486 if the original publisher of that version gives permission.
487 B. List on the Title Page, as authors, one or more persons or entities
488 responsible for authorship of the modifications in the Modified
489 Version, together with at least five of the principal authors of the
490 Document (all of its principal authors, if it has less than five).
491 C. State on the Title page the name of the publisher of the
492 Modified Version, as the publisher.
493 D. Preserve all the copyright notices of the Document.
494 E. Add an appropriate copyright notice for your modifications
495 adjacent to the other copyright notices.
496 F. Include, immediately after the copyright notices, a license notice
497 giving the public permission to use the Modified Version under the
498 terms of this License, in the form shown in the Addendum below.
499 G. Preserve in that license notice the full lists of Invariant Sections
500 and required Cover Texts given in the Document's license notice.
501 H. Include an unaltered copy of this License.
502 I. Preserve the section entitled "History", and its title, and add to
503 it an item stating at least the title, year, new authors, and
504 publisher of the Modified Version as given on the Title Page. If
505 there is no section entitled "History" in the Document, create one
506 stating the title, year, authors, and publisher of the Document as
507 given on its Title Page, then add an item describing the Modified
508 Version as stated in the previous sentence.
509 J. Preserve the network location, if any, given in the Document for
510 public access to a Transparent copy of the Document, and likewise
511 the network locations given in the Document for previous versions
512 it was based on. These may be placed in the "History" section.
513 You may omit a network location for a work that was published at
514 least four years before the Document itself, or if the original
515 publisher of the version it refers to gives permission.
516 K. In any section entitled "Acknowledgements" or "Dedications",
517 preserve the section's title, and preserve in the section all the
518 substance and tone of each of the contributor acknowledgements
519 and/or dedications given therein.
520 L. Preserve all the Invariant Sections of the Document,
521 unaltered in their text and in their titles. Section numbers
522 or the equivalent are not considered part of the section titles.
523 M. Delete any section entitled "Endorsements". Such a section
524 may not be included in the Modified Version.
525 N. Do not retitle any existing section as "Endorsements"
526 or to conflict in title with any Invariant Section.
528 If the Modified Version includes new front-matter sections or
529 appendices that qualify as Secondary Sections and contain no material
530 copied from the Document, you may at your option designate some or all
531 of these sections as invariant. To do this, add their titles to the
532 list of Invariant Sections in the Modified Version's license notice.
533 These titles must be distinct from any other section titles.
535 You may add a section entitled "Endorsements", provided it contains
536 nothing but endorsements of your Modified Version by various
537 parties--for example, statements of peer review or that the text has
538 been approved by an organization as the authoritative definition of a
541 You may add a passage of up to five words as a Front-Cover Text, and a
542 passage of up to 25 words as a Back-Cover Text, to the end of the list
543 of Cover Texts in the Modified Version. Only one passage of
544 Front-Cover Text and one of Back-Cover Text may be added by (or
545 through arrangements made by) any one entity. If the Document already
546 includes a cover text for the same cover, previously added by you or
547 by arrangement made by the same entity you are acting on behalf of,
548 you may not add another; but you may replace the old one, on explicit
549 permission from the previous publisher that added the old one.
551 The author(s) and publisher(s) of the Document do not by this License
552 give permission to use their names for publicity for or to assert or
553 imply endorsement of any Modified Version.
556 5. COMBINING DOCUMENTS
558 You may combine the Document with other documents released under this
559 License, under the terms defined in section 4 above for modified
560 versions, provided that you include in the combination all of the
561 Invariant Sections of all of the original documents, unmodified, and
562 list them all as Invariant Sections of your combined work in its
565 The combined work need only contain one copy of this License, and
566 multiple identical Invariant Sections may be replaced with a single
567 copy. If there are multiple Invariant Sections with the same name but
568 different contents, make the title of each such section unique by
569 adding at the end of it, in parentheses, the name of the original
570 author or publisher of that section if known, or else a unique number.
571 Make the same adjustment to the section titles in the list of
572 Invariant Sections in the license notice of the combined work.
574 In the combination, you must combine any sections entitled "History"
575 in the various original documents, forming one section entitled
576 "History"; likewise combine any sections entitled "Acknowledgements",
577 and any sections entitled "Dedications". You must delete all sections
578 entitled "Endorsements."
581 6. COLLECTIONS OF DOCUMENTS
583 You may make a collection consisting of the Document and other documents
584 released under this License, and replace the individual copies of this
585 License in the various documents with a single copy that is included in
586 the collection, provided that you follow the rules of this License for
587 verbatim copying of each of the documents in all other respects.
589 You may extract a single document from such a collection, and distribute
590 it individually under this License, provided you insert a copy of this
591 License into the extracted document, and follow this License in all
592 other respects regarding verbatim copying of that document.
595 7. AGGREGATION WITH INDEPENDENT WORKS
597 A compilation of the Document or its derivatives with other separate
598 and independent documents or works, in or on a volume of a storage or
599 distribution medium, does not as a whole count as a Modified Version
600 of the Document, provided no compilation copyright is claimed for the
601 compilation. Such a compilation is called an "aggregate", and this
602 License does not apply to the other self-contained works thus compiled
603 with the Document, on account of their being thus compiled, if they
604 are not themselves derivative works of the Document.
606 If the Cover Text requirement of section 3 is applicable to these
607 copies of the Document, then if the Document is less than one quarter
608 of the entire aggregate, the Document's Cover Texts may be placed on
609 covers that surround only the Document within the aggregate.
610 Otherwise they must appear on covers around the whole aggregate.
615 Translation is considered a kind of modification, so you may
616 distribute translations of the Document under the terms of section 4.
617 Replacing Invariant Sections with translations requires special
618 permission from their copyright holders, but you may include
619 translations of some or all Invariant Sections in addition to the
620 original versions of these Invariant Sections. You may include a
621 translation of this License provided that you also include the
622 original English version of this License. In case of a disagreement
623 between the translation and the original English version of this
624 License, the original English version will prevail.
629 You may not copy, modify, sublicense, or distribute the Document except
630 as expressly provided for under this License. Any other attempt to
631 copy, modify, sublicense or distribute the Document is void, and will
632 automatically terminate your rights under this License. However,
633 parties who have received copies, or rights, from you under this
634 License will not have their licenses terminated so long as such
635 parties remain in full compliance.
638 10. FUTURE REVISIONS OF THIS LICENSE
640 The Free Software Foundation may publish new, revised versions
641 of the GNU Free Documentation License from time to time. Such new
642 versions will be similar in spirit to the present version, but may
643 differ in detail to address new problems or concerns. See
644 http://www.gnu.org/copyleft/.
646 Each version of the License is given a distinguishing version number.
647 If the Document specifies that a particular numbered version of this
648 License "or any later version" applies to it, you have the option of
649 following the terms and conditions either of that specified version or
650 of any later version that has been published (not as a draft) by the
651 Free Software Foundation. If the Document does not specify a version
652 number of this License, you may choose any version ever published (not
653 as a draft) by the Free Software Foundation.
656 ADDENDUM: How to use this License for your documents
658 To use this License in a document you have written, include a copy of
659 the License in the document and put the following copyright and
660 license notices just after the title page:
663 Copyright (c) YEAR YOUR NAME.
664 Permission is granted to copy, distribute and/or modify this document
665 under the terms of the GNU Free Documentation License, Version 1.1
666 or any later version published by the Free Software Foundation;
667 with the Invariant Sections being LIST THEIR TITLES, with the
668 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
669 A copy of the license is included in the section entitled "GNU
670 Free Documentation License".
673 If you have no Invariant Sections, write "with no Invariant Sections"
674 instead of saying which ones are invariant. If you have no
675 Front-Cover Texts, write "no Front-Cover Texts" instead of
676 "Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
678 If your document contains nontrivial examples of program code, we
679 recommend releasing these examples in parallel under your choice of
680 free software license, such as the GNU General Public License,
681 to permit their use in free software.
683 @node Index, , GNU Free Documentation License , Top
688 % I think something like @colophon should be in texinfo. In the
690 \long\def\colophon{\hbox to0pt{}\vfill
691 \centerline{The body of this manual is set in}
692 \centerline{\fontname\tenrm,}
693 \centerline{with headings in {\bf\fontname\tenbf}}
694 \centerline{and examples in {\tt\fontname\tentt}.}
695 \centerline{{\it\fontname\tenit\/} and}
696 \centerline{{\sl\fontname\tensl\/}}
697 \centerline{are used for emphasis.}\vfill}
699 % Blame: doc@cygnus.com, 28mar91.