📄 archive.texi
字号:
@section Archives@strong{Description}@*An archive (or library) is just another BFD. It has a symboltable, although there's not much a user program will do with it.The big difference between an archive BFD and an ordinary BFDis that the archive doesn't have sections. Instead it has achain of BFDs that are considered its contents. These BFDs canbe manipulated like any other. The BFDs contained in anarchive opened for reading will all be opened for reading. Youmay put either input or output BFDs into an archive opened foroutput; they will be handled correctly when the archive is closed.Use @code{bfd_openr_next_archived_file} to step throughthe contents of an archive opened for input. You don'thave to read the entire archive if you don't wantto! Read it until you find what you want.Archive contents of output BFDs are chained through the@code{next} pointer in a BFD. The first one is findable throughthe @code{archive_head} slot of the archive. Set it with@code{bfd_set_archive_head} (q.v.). A given BFD may be in only oneopen output archive at a time.As expected, the BFD archive code is more general than thearchive code of any given environment. BFD archives maycontain files of different formats (e.g., a.out and coff) andeven different architectures. You may even place archivesrecursively into archives!This can cause unexpected confusion, since some archiveformats are more expressive than others. For instance, IntelCOFF archives can preserve long filenames; SunOS a.out archivescannot. If you move a file from the first to the secondformat and back again, the filename may be truncated.Likewise, different a.out environments have differentconventions as to how they truncate filenames, whether theypreserve directory names in filenames, etc. Wheninteroperating with native tools, be sure your files arehomogeneous.Beware: most of these formats do not react well to thepresence of spaces in filenames. We do the best we can, butcan't always handle this case due to restrictions in the format ofarchives. Many Unix utilities are braindead in regards tospaces and such in filenames anyway, so this shouldn't be muchof a restriction.Archives are supported in BFD in @code{archive.c}.@findex bfd_get_next_mapent@subsubsection @code{bfd_get_next_mapent}@strong{Synopsis}@examplesymindex bfd_get_next_mapent (bfd *abfd, symindex previous, carsym **sym);@end example@strong{Description}@*Step through archive @var{abfd}'s symbol table (if ithas one). Successively update @var{sym} with the next symbol'sinformation, returning that symbol's (internal) index into thesymbol table.Supply @code{BFD_NO_MORE_SYMBOLS} as the @var{previous} entry to getthe first one; returns @code{BFD_NO_MORE_SYMBOLS} when you've alreadygot the last one.A @code{carsym} is a canonical archive symbol. The onlyuser-visible element is its name, a null-terminated string.@findex bfd_set_archive_head@subsubsection @code{bfd_set_archive_head}@strong{Synopsis}@examplebfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);@end example@strong{Description}@*Set the head of the chain ofBFDs contained in the archive @var{output} to @var{new_head}.@findex bfd_openr_next_archived_file@subsubsection @code{bfd_openr_next_archived_file}@strong{Synopsis}@examplebfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);@end example@strong{Description}@*Provided a BFD, @var{archive}, containing an archive and NULL, openan input BFD on the first contained element and returns that.Subsequent calls should passthe archive and the previous return value to return a createdBFD to the next contained element. NULL is returned when thereare no more.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -