[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1 Archives


Description
Archives are supported in BFD in archive.c. An archive (or library) is just another BFD. It has a symbol table, although there’s not much a user program will do with it. The big difference between an archive BFD and an ordinary BFD is that the archive doesn’t have sections. Instead it has a chain of BFDs considered its contents. These BFDs can be manipulated just like any other. The BFDs contained in an archive opened for reading will all be opened for reading; you may put either input or output BFDs into an archive opened for output; it will be handled correctly when the archive is closed. Use bfd_openr_next_archived_file to step through all the contents of an archive opened for input. It’s not required that you read the entire archive if you don’t want to! Read it until you find what you want. Archive contents of output BFDs are chained through the next pointer in a BFD. The first one is findable through the archive_head slot of the archive. Set it with set_archive_head (q.v.). A given BFD may be in only one open output archive at a time. As expected, the BFD archive code is more general than the archive code of any given environment. BFD archives may contain files of different formats (eg a.out and coff) and even different architectures. You may even place archives recursively into archives! This can cause unexpected confusion, since some archive formats are more expressive than others. For instance intel COFF archives can preserve long filenames; Sun a.out archives cannot. If you move a file from the first to the second format and back again, the filename may be truncated. Likewise, different a.out environments have different conventions as to how they truncate filenames, whether they preserve directory names in filenames, etc. When interoperating with native tools, be sure your files are homogeneous. Beware: most of these formats do not react well to the presence of spaces in filenames. We do the best we can, but can’t always handle this due to restrctions in the format of archives. Many unix utilities are braindead in regards to spaces and such in filenames anyway, so this shouldn’t be much of a restriction.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.0.1 bfd_get_next_mapent

Synopsis

symindex bfd_get_next_mapent(bfd *, symindex previous, carsym ** sym);

Description
This function steps through an archive’s symbol table (if it has one). Successively updates sym with the next symbol’s information, returning that symbol’s (internal) index into the symbol table. Supply BFD_NO_MORE_SYMBOLS as the previous entry to get the first one; returns BFD_NO_MORE_SYMBOLS when you’re already got the last one. A carsym is a canonical archive symbol. The only user-visible element is its name, a null-terminated string.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.0.2 bfd_set_archive_head

Synopsis

boolean bfd_set_archive_head(bfd *output, bfd *new_head);

Description
Used whilst processing archives. Sets the head of the chain of BFDs contained in an archive to new_head.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.0.3 bfd_get_elt_at_index

Synopsis

bfd *bfd_get_elt_at_index(bfd * archive, int index);

Description
Return the bfd which is referenced by the symbol indexed by index. index should have been returned by bfd_get_next_mapent (q.v.).


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.0.4 bfd_openr_next_archived_file

Synopsis

bfd* bfd_openr_next_archived_file(bfd *archive, bfd *previous);

Description
Initially provided a BFD containing an archive and NULL, opens an inpout BFD on the first contained element and returns that. Subsequent calls to bfd_openr_next_archived_file should pass the archive and the previous return value to return a created BFD to the next contained element. NULL is returned when there are no more.


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated on December 11, 2024 using texi2html 5.0.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ < ] Back Previous section in reading order 1.2.2
[ Up ] Up Up section 1.2
[ > ] Forward Next section in reading order 1.2.4
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated on December 11, 2024 using texi2html 5.0.