⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bfd.texinfo

📁 早期freebsd实现
💻 TEXINFO
📖 第 1 页 / 共 2 页
字号:
language.@emph{Information can be lost during canonicalization.} The BFDinternal canonical form of the external formats is not exhaustive; thereare structures in input formats for which there is no directrepresentation internally.  This means that the BFD back endscannot maintain all possible data richness through the transformationbetween external to internal and back to external formats.This limitation is only a problem when an application reads oneformat and writes another.  Each BFD back end is responsible formaintaining as much data as possible, and the internal BFDcanonical form has structures which are opaque to the BFD core,and exported only to the back ends. When a file is read in one format,the canonical form is generated for BFD and the application. At thesame time, the back end saves away any information which may otherwisebe lost. If the data is then written back in the same format, the backend routine will be able to use the canonical form provided by theBFD core as well as the information it prepared earlier.  Sincethere is a great deal of commonality between back ends, this mechanismis very useful. There is no information lost for this reason whenlinking or copying big endian COFF to little endian COFF, or @code{a.out} to@code{b.out}.  When a mixture of formats is linked, the information isonly lost from the files whose format differs from the destination.@node Mechanism,  , BFD information loss, What BFD Version 1 Can Do@subsection Mechanism The greatest potential for loss of information is when there is leastoverlap between the information provided by the source format, thatstored by the canonical format, and the information needed by thedestination format. A brief description of the canonical form may helpyou appreciate what kinds of data you can count on preserving acrossconversions.@cindex BFD canonical format@cindex internal object-file format@table @emph@item filesInformation on target machine architecture, particular implementationand format type are stored on a per-file basis. Other informationincludes a demand pageable bit and a write protected bit.  Note thatinformation like Unix magic numbers is not stored here---only the magicnumbers' meaning, so a @code{ZMAGIC} file would have both the demandpageable bit and the write protected text bit set.  The byte order ofthe target is stored on a per-file basis, so that big- and little-endianobject files may be linked with one another.@c FIXME: generalize above from "link"?@item sectionsEach section in the input file contains the name of the section, theoriginal address in the object file, various flags, size and alignmentinformation and pointers into other BFD data structures.@item symbolsEach symbol contains a pointer to the object file which originallydefined it, its name, its value, and various flag bits.  When aBFD back end reads in a symbol table, the back end relocates allsymbols to make them relative to the base of the section where they weredefined.  This ensures that each symbol points to its containingsection.  Each symbol also has a varying amount of hidden data to containprivate data for the BFD back end.  Since the symbol points to theoriginal file, the private data format for that symbol is accessible.@code{gld} can operate on a collection of symbols of wildly differentformats without problems.Normal global and simple local symbols are maintained on output, so anoutput file (no matter its format) will retain symbols pointing tofunctions and to global, static, and common variables.  Some symbolinformation is not worth retaining; in @code{a.out} type information isstored in the symbol table as long symbol names.  This information wouldbe useless to most COFF debuggers; the linker has command line switchesto allow users to throw it away.There is one word of type information within the symbol, so if theformat supports symbol type information within symbols (for example COFF,IEEE, Oasys) and the type is simple enough to fit within one word(nearly everything but aggregates) the information will be preserved.@item relocation levelEach canonical BFD relocation record contains a pointer to the symbol torelocate to, the offset of the data to relocate, the section the datais in and a pointer to a relocation type descriptor. Relocation isperformed effectively by message passing through the relocation typedescriptor and symbol pointer. It allows relocations to be performedon output data using a relocation method only available in one of theinput formats. For instance, Oasys provides a byte relocation format.A relocation record requesting this relocation type would pointindirectly to a routine to perform this, so the relocation may beperformed on a byte being written to a COFF file, even though 68k COFFhas no such relocation type.@item line numbersObject formats can contain, for debugging purposes, some form of mappingbetween symbols, source line numbers, and addresses in the output file.These addresses have to be relocated along with the symbol information.Each symbol with an associated list of line number records points to thefirst record of the list.  The head of a line number list consists of apointer to the symbol, which allows divination of the address of thefunction whose line number is being described. The rest of the list ismade up of pairs: offsets into the section and line numbers. Any formatwhich can simply derive this information can pass it successfullybetween formats (COFF, IEEE and Oasys).@end table@c FIXME: what is this line about?  Do we want introductory remarks @c FIXME... on back ends?  commented out for now.@c What is a backend@node BFD front end, BFD back end, Overview, Top@chapter BFD front end@include  bfd.texi@menu* Memory Usage::* Initialization::* Sections::* Symbols::* Archives::* Formats::* Relocations::* Core Files::* Targets::* Architectures::* Opening and Closing::* Constructors::* Internal::* File Caching::@end menu@node Memory Usage, Initialization, BFD front end, BFD front end@section Memory UsageBFD keeps all its internal structures in obstacks. There is one obstackper open BFD file, into which the current state is stored. When a BFD isclosed, the obstack is deleted, and so everything which has beenallocated by libbfd for the closing file will be thrown away.BFD will not free anything created by an application, but pointers into@code{bfd} structures will be invalidated on a @code{bfd_close}; for example,after a @code{bfd_close} the vector passed to@code{bfd_canonicalize_symtab} will still be around, since it has beenallocated by the application, but the data that it pointed to will belost.The general rule is not to close a BFD until all operations dependentupon data from the BFD have been completed, or all the data from withinthe file has been copied. To help with the management of memory, there is a function(@code{bfd_alloc_size}) which returns the number of bytes in obstacksassociated with the supplied BFD. This could be used to select thegreediest open BFD, close it to reclaim the memory, perform someoperation and reopen the BFD again, to get a fresh copy of the data structures.@node Initialization, Sections, Memory Usage, BFD front end@include  init.texi@node Sections, Symbols, Initialization, BFD front end@include  section.texi@node Symbols, Archives, Sections, BFD front end@include  syms.texi@node Archives, Formats, Symbols, BFD front end@include  archive.texi@node Formats, Relocations, Archives, BFD front end@include  format.texi@node Relocations, Core Files, Formats, BFD front end@include  reloc.texi@node Core Files, Targets, Relocations, BFD front end@include  core.texi@node Targets, Architectures, Core Files, BFD front end@include  targets.texi@node Architectures, Opening and Closing, Targets, BFD front end@include  archures.texi@node Opening and Closing, Constructors, Architectures, BFD front end@include  opncls.texi@node Constructors, Internal, Opening and Closing, BFD front end@include  ctor.texi@node Internal, File Caching, Constructors, BFD front end@include  libbfd.texi@node File Caching,  , Internal, BFD front end@include  cache.texi@node BFD back end, Index, BFD front end, Top@chapter BFD back end@menu* What to put where::* aout ::	a.out backends* coff ::	coff backends@ignore* oasys ::	oasys backends* ieee ::	ieee backend* srecord ::	s-record backend@end ignore@end menu@node What to Put Where, aout, BFD back end, BFD back endAll of BFD lives in one directory.@node aout, coff, What to Put Where, BFD back end@include  aoutx.texi@node coff,  , aout, BFD back end@include  coffcode.texi@node Index,  , BFD back end, Top@unnumbered Index@printindex cp@tex% I think something like @colophon should be in texinfo.  In the% meantime:\long\def\colophon{\hbox to0pt{}\vfill\centerline{The body of this manual is set in}\centerline{\fontname\tenrm,}\centerline{with headings in {\bf\fontname\tenbf}}\centerline{and examples in {\tt\fontname\tentt}.}\centerline{{\it\fontname\tenit\/} and}\centerline{{\sl\fontname\tensl\/}}\centerline{are used for emphasis.}\vfill}\page\colophon% Blame: pesch@cygnus.com, 28mar91.@end tex@contents@bye

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -