You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
6.4 KiB
HTML
157 lines
6.4 KiB
HTML
15 years ago
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>Archives - Untitled</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html">
|
||
|
<meta name="description" content="Untitled">
|
||
|
<meta name="generator" content="makeinfo 4.7">
|
||
|
<link title="Top" rel="start" href="index.html#Top">
|
||
|
<link rel="up" href="BFD-front-end.html#BFD-front-end" title="BFD front end">
|
||
|
<link rel="prev" href="Symbols.html#Symbols" title="Symbols">
|
||
|
<link rel="next" href="Formats.html#Formats" title="Formats">
|
||
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||
|
<!--
|
||
|
This file documents the BFD library.
|
||
|
|
||
|
Copyright (C) 1991, 2000, 2001, 2003, 2006, 2007 Free Software Foundation, Inc.
|
||
|
|
||
|
Permission is granted to copy, distribute and/or modify this document
|
||
|
under the terms of the GNU Free Documentation License, Version 1.1 or
|
||
|
any later version published by the Free Software Foundation; with the
|
||
|
Invariant Sections being ``GNU General Public License'' and ``Funding
|
||
|
Free Software'', the Front-Cover texts being (a) (see below), and with
|
||
|
the Back-Cover Texts being (b) (see below). A copy of the license is
|
||
|
included in the section entitled ``GNU Free Documentation License''.
|
||
|
|
||
|
(a) The FSF's Front-Cover Text is:
|
||
|
|
||
|
A GNU Manual
|
||
|
|
||
|
(b) The FSF's Back-Cover Text is:
|
||
|
|
||
|
You have freedom to copy and modify this GNU Manual, like GNU
|
||
|
software. Copies published by the Free Software Foundation raise
|
||
|
funds for GNU development.-->
|
||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||
|
<style type="text/css"><!--
|
||
|
pre.display { font-family:inherit }
|
||
|
pre.format { font-family:inherit }
|
||
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
||
|
pre.smallexample { font-size:smaller }
|
||
|
pre.smalllisp { font-size:smaller }
|
||
|
span.sc { font-variant:small-caps }
|
||
|
span.roman { font-family: serif; font-weight: normal; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="node">
|
||
|
<p>
|
||
|
<a name="Archives"></a>Next: <a rel="next" accesskey="n" href="Formats.html#Formats">Formats</a>,
|
||
|
Previous: <a rel="previous" accesskey="p" href="Symbols.html#Symbols">Symbols</a>,
|
||
|
Up: <a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
|
||
|
<hr><br>
|
||
|
</div>
|
||
|
|
||
|
<h3 class="section">2.8 Archives</h3>
|
||
|
|
||
|
<p><strong>Description</strong><br>
|
||
|
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.
|
||
|
|
||
|
<p>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 that are considered its contents. These BFDs can
|
||
|
be manipulated 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; they will be handled correctly when the archive is closed.
|
||
|
|
||
|
<p>Use <code>bfd_openr_next_archived_file</code> to step through
|
||
|
the contents of an archive opened for input. You don't
|
||
|
have to read the entire archive if you don't want
|
||
|
to! Read it until you find what you want.
|
||
|
|
||
|
<p>Archive contents of output BFDs are chained through the
|
||
|
<code>next</code> pointer in a BFD. The first one is findable through
|
||
|
the <code>archive_head</code> slot of the archive. Set it with
|
||
|
<code>bfd_set_archive_head</code> (q.v.). A given BFD may be in only one
|
||
|
open output archive at a time.
|
||
|
|
||
|
<p>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 (e.g., a.out and coff) and
|
||
|
even different architectures. You may even place archives
|
||
|
recursively into archives!
|
||
|
|
||
|
<p>This can cause unexpected confusion, since some archive
|
||
|
formats are more expressive than others. For instance, Intel
|
||
|
COFF archives can preserve long filenames; SunOS 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.
|
||
|
|
||
|
<p>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 case due to restrictions 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.
|
||
|
|
||
|
<p>Archives are supported in BFD in <code>archive.c</code>.
|
||
|
|
||
|
<h4 class="subsection">2.8.1 Archive functions</h4>
|
||
|
|
||
|
<p><a name="index-bfd_005fget_005fnext_005fmapent-73"></a>
|
||
|
|
||
|
<h5 class="subsubsection">2.8.1.1 <code>bfd_get_next_mapent</code></h5>
|
||
|
|
||
|
<p><strong>Synopsis</strong>
|
||
|
<pre class="example"> symindex bfd_get_next_mapent
|
||
|
(bfd *abfd, symindex previous, carsym **sym);
|
||
|
</pre>
|
||
|
<p><strong>Description</strong><br>
|
||
|
Step through archive <var>abfd</var>'s symbol table (if it
|
||
|
has one). Successively update <var>sym</var> with the next symbol's
|
||
|
information, returning that symbol's (internal) index into the
|
||
|
symbol table.
|
||
|
|
||
|
<p>Supply <code>BFD_NO_MORE_SYMBOLS</code> as the <var>previous</var> entry to get
|
||
|
the first one; returns <code>BFD_NO_MORE_SYMBOLS</code> when you've already
|
||
|
got the last one.
|
||
|
|
||
|
<p>A <code>carsym</code> is a canonical archive symbol. The only
|
||
|
user-visible element is its name, a null-terminated string.
|
||
|
|
||
|
<p><a name="index-bfd_005fset_005farchive_005fhead-74"></a>
|
||
|
|
||
|
<h5 class="subsubsection">2.8.1.2 <code>bfd_set_archive_head</code></h5>
|
||
|
|
||
|
<p><strong>Synopsis</strong>
|
||
|
<pre class="example"> bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
|
||
|
</pre>
|
||
|
<p><strong>Description</strong><br>
|
||
|
Set the head of the chain of
|
||
|
BFDs contained in the archive <var>output</var> to <var>new_head</var>.
|
||
|
|
||
|
<p><a name="index-bfd_005fopenr_005fnext_005farchived_005ffile-75"></a>
|
||
|
|
||
|
<h5 class="subsubsection">2.8.1.3 <code>bfd_openr_next_archived_file</code></h5>
|
||
|
|
||
|
<p><strong>Synopsis</strong>
|
||
|
<pre class="example"> bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
|
||
|
</pre>
|
||
|
<p><strong>Description</strong><br>
|
||
|
Provided a BFD, <var>archive</var>, containing an archive and NULL, open
|
||
|
an input BFD on the first contained element and returns that.
|
||
|
Subsequent calls 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.
|
||
|
|
||
|
</body></html>
|
||
|
|