1
0
Fork 0

arduino-0018-windows

This commit is contained in:
orange 2010-03-30 21:53:44 +02:00
parent 157fd6f1a1
commit f39fc49523
5182 changed files with 950586 additions and 0 deletions

View file

@ -0,0 +1,77 @@
<html lang="en">
<head>
<title>Adding Symbols to the Hash Table - 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="Linker-Functions.html#Linker-Functions" title="Linker Functions">
<link rel="prev" href="Creating-a-Linker-Hash-Table.html#Creating-a-Linker-Hash-Table" title="Creating a Linker Hash Table">
<link rel="next" href="Performing-the-Final-Link.html#Performing-the-Final-Link" title="Performing the Final Link">
<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="Adding-Symbols-to-the-Hash-Table"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Performing-the-Final-Link.html#Performing-the-Final-Link">Performing the Final Link</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Creating-a-Linker-Hash-Table.html#Creating-a-Linker-Hash-Table">Creating a Linker Hash Table</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Linker-Functions.html#Linker-Functions">Linker Functions</a>
<hr><br>
</div>
<h4 class="subsection">2.17.2 Adding symbols to the hash table</h4>
<p><a name="index-_005fbfd_005flink_005fadd_005fsymbols-in-target-vector-1371"></a><a name="index-target-vector-_0028_005fbfd_005flink_005fadd_005fsymbols_0029-1372"></a>The linker proper will call the <code>_bfd_link_add_symbols</code>
entry point for each object file or archive which is to be
linked (typically these are the files named on the command
line, but some may also come from the linker script). The
entry point is responsible for examining the file. For an
object file, BFD must add any relevant symbol information to
the hash table. For an archive, BFD must determine which
elements of the archive should be used and adding them to the
link.
<p>The a.out version of this entry point is
<code>NAME(aout,link_add_symbols)</code>.
<ul class="menu">
<li><a accesskey="1" href="Differing-file-formats.html#Differing-file-formats">Differing file formats</a>
<li><a accesskey="2" href="Adding-symbols-from-an-object-file.html#Adding-symbols-from-an-object-file">Adding symbols from an object file</a>
<li><a accesskey="3" href="Adding-symbols-from-an-archive.html#Adding-symbols-from-an-archive">Adding symbols from an archive</a>
</ul>
</body></html>

View file

@ -0,0 +1,102 @@
<html lang="en">
<head>
<title>Adding symbols from an archive - 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="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" title="Adding Symbols to the Hash Table">
<link rel="prev" href="Adding-symbols-from-an-object-file.html#Adding-symbols-from-an-object-file" title="Adding symbols from an object file">
<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="Adding-symbols-from-an-archive"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="Adding-symbols-from-an-object-file.html#Adding-symbols-from-an-object-file">Adding symbols from an object file</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table">Adding Symbols to the Hash Table</a>
<hr><br>
</div>
<h5 class="subsubsection">2.17.2.3 Adding symbols from an archive</h5>
<p>When the <code>_bfd_link_add_symbols</code> routine is passed an
archive, it must look through the symbols defined by the
archive and decide which elements of the archive should be
included in the link. For each such element it must call the
<code>add_archive_element</code> linker callback, and it must add the
symbols from the object file to the linker hash table.
<p><a name="index-_005fbfd_005fgeneric_005flink_005fadd_005farchive_005fsymbols-1374"></a>In most cases the work of looking through the symbols in the
archive should be done by the
<code>_bfd_generic_link_add_archive_symbols</code> function. This
function builds a hash table from the archive symbol table and
looks through the list of undefined symbols to see which
elements should be included.
<code>_bfd_generic_link_add_archive_symbols</code> is passed a function
to call to make the final decision about adding an archive
element to the link and to do the actual work of adding the
symbols to the linker hash table.
<p>The function passed to
<code>_bfd_generic_link_add_archive_symbols</code> must read the
symbols of the archive element and decide whether the archive
element should be included in the link. If the element is to
be included, the <code>add_archive_element</code> linker callback
routine must be called with the element as an argument, and
the elements symbols must be added to the linker hash table
just as though the element had itself been passed to the
<code>_bfd_link_add_symbols</code> function.
<p>When the a.out <code>_bfd_link_add_symbols</code> function receives an
archive, it calls <code>_bfd_generic_link_add_archive_symbols</code>
passing <code>aout_link_check_archive_element</code> as the function
argument. <code>aout_link_check_archive_element</code> calls
<code>aout_link_check_ar_symbols</code>. If the latter decides to add
the element (an element is only added if it provides a real,
non-common, definition for a previously undefined or common
symbol) it calls the <code>add_archive_element</code> callback and then
<code>aout_link_check_archive_element</code> calls
<code>aout_link_add_symbols</code> to actually add the symbols to the
linker hash table.
<p>The ECOFF back end is unusual in that it does not normally
call <code>_bfd_generic_link_add_archive_symbols</code>, because ECOFF
archives already contain a hash table of symbols. The ECOFF
back end searches the archive itself to avoid the overhead of
creating a new hash table.
</body></html>

View file

@ -0,0 +1,96 @@
<html lang="en">
<head>
<title>Adding symbols from an object file - 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="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" title="Adding Symbols to the Hash Table">
<link rel="prev" href="Differing-file-formats.html#Differing-file-formats" title="Differing file formats">
<link rel="next" href="Adding-symbols-from-an-archive.html#Adding-symbols-from-an-archive" title="Adding symbols from an archive">
<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="Adding-symbols-from-an-object-file"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Adding-symbols-from-an-archive.html#Adding-symbols-from-an-archive">Adding symbols from an archive</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Differing-file-formats.html#Differing-file-formats">Differing file formats</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table">Adding Symbols to the Hash Table</a>
<hr><br>
</div>
<h5 class="subsubsection">2.17.2.2 Adding symbols from an object file</h5>
<p>When the <code>_bfd_link_add_symbols</code> routine is passed an object
file, it must add all externally visible symbols in that
object file to the hash table. The actual work of adding the
symbol to the hash table is normally handled by the function
<code>_bfd_generic_link_add_one_symbol</code>. The
<code>_bfd_link_add_symbols</code> routine is responsible for reading
all the symbols from the object file and passing the correct
information to <code>_bfd_generic_link_add_one_symbol</code>.
<p>The <code>_bfd_link_add_symbols</code> routine should not use
<code>bfd_canonicalize_symtab</code> to read the symbols. The point of
providing this routine is to avoid the overhead of converting
the symbols into generic <code>asymbol</code> structures.
<p><a name="index-_005fbfd_005fgeneric_005flink_005fadd_005fone_005fsymbol-1373"></a><code>_bfd_generic_link_add_one_symbol</code> handles the details of
combining common symbols, warning about multiple definitions,
and so forth. It takes arguments which describe the symbol to
add, notably symbol flags, a section, and an offset. The
symbol flags include such things as <code>BSF_WEAK</code> or
<code>BSF_INDIRECT</code>. The section is a section in the object
file, or something like <code>bfd_und_section_ptr</code> for an undefined
symbol or <code>bfd_com_section_ptr</code> for a common symbol.
<p>If the <code>_bfd_final_link</code> routine is also going to need to
read the symbol information, the <code>_bfd_link_add_symbols</code>
routine should save it somewhere attached to the object file
BFD. However, the information should only be saved if the
<code>keep_memory</code> field of the <code>info</code> argument is TRUE, so
that the <code>-no-keep-memory</code> linker switch is effective.
<p>The a.out function which adds symbols from an object file is
<code>aout_link_add_object_symbols</code>, and most of the interesting
work is in <code>aout_link_add_symbols</code>. The latter saves
pointers to the hash tables entries created by
<code>_bfd_generic_link_add_one_symbol</code> indexed by symbol number,
so that the <code>_bfd_final_link</code> routine does not have to call
the hash table lookup routine to locate the entry.
</body></html>

View file

@ -0,0 +1,678 @@
<html lang="en">
<head>
<title>Architectures - 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="Targets.html#Targets" title="Targets">
<link rel="next" href="Opening-and-Closing.html#Opening-and-Closing" title="Opening and Closing">
<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="Architectures"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Opening-and-Closing.html#Opening-and-Closing">Opening and Closing</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Targets.html#Targets">Targets</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.13 Architectures</h3>
<p>BFD keeps one atom in a BFD describing the
architecture of the data attached to the BFD: a pointer to a
<code>bfd_arch_info_type</code>.
<p>Pointers to structures can be requested independently of a BFD
so that an architecture's information can be interrogated
without access to an open BFD.
<p>The architecture information is provided by each architecture package.
The set of default architectures is selected by the macro
<code>SELECT_ARCHITECTURES</code>. This is normally set up in the
<span class="file">config/</span><var>target</var><span class="file">.mt</span> file of your choice. If the name is not
defined, then all the architectures supported are included.
<p>When BFD starts up, all the architectures are called with an
initialize method. It is up to the architecture back end to
insert as many items into the list of architectures as it wants to;
generally this would be one for each machine and one for the
default case (an item with a machine field of 0).
<p>BFD's idea of an architecture is implemented in <span class="file">archures.c</span>.
<h4 class="subsection">2.13.1 bfd_architecture</h4>
<p><strong>Description</strong><br>
This enum gives the object file's CPU architecture, in a
global sense&mdash;i.e., what processor family does it belong to?
Another field indicates which processor within
the family is in use. The machine gives a number which
distinguishes different versions of the architecture,
containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
and 68020 and 68030 for Motorola 68020 and 68030.
<pre class="example"> enum bfd_architecture
{
bfd_arch_unknown, /* File arch not known. */
bfd_arch_obscure, /* Arch known, not one of these. */
bfd_arch_m68k, /* Motorola 68xxx */
#define bfd_mach_m68000 1
#define bfd_mach_m68008 2
#define bfd_mach_m68010 3
#define bfd_mach_m68020 4
#define bfd_mach_m68030 5
#define bfd_mach_m68040 6
#define bfd_mach_m68060 7
#define bfd_mach_cpu32 8
#define bfd_mach_fido 9
#define bfd_mach_mcf_isa_a_nodiv 10
#define bfd_mach_mcf_isa_a 11
#define bfd_mach_mcf_isa_a_mac 12
#define bfd_mach_mcf_isa_a_emac 13
#define bfd_mach_mcf_isa_aplus 14
#define bfd_mach_mcf_isa_aplus_mac 15
#define bfd_mach_mcf_isa_aplus_emac 16
#define bfd_mach_mcf_isa_b_nousp 17
#define bfd_mach_mcf_isa_b_nousp_mac 18
#define bfd_mach_mcf_isa_b_nousp_emac 19
#define bfd_mach_mcf_isa_b 20
#define bfd_mach_mcf_isa_b_mac 21
#define bfd_mach_mcf_isa_b_emac 22
#define bfd_mach_mcf_isa_b_float 23
#define bfd_mach_mcf_isa_b_float_mac 24
#define bfd_mach_mcf_isa_b_float_emac 25
#define bfd_mach_mcf_isa_c 26
#define bfd_mach_mcf_isa_c_mac 27
#define bfd_mach_mcf_isa_c_emac 28
#define bfd_mach_mcf_isa_c_nodiv 29
#define bfd_mach_mcf_isa_c_nodiv_mac 30
#define bfd_mach_mcf_isa_c_nodiv_emac 31
bfd_arch_vax, /* DEC Vax */
bfd_arch_i960, /* Intel 960 */
/* The order of the following is important.
lower number indicates a machine type that
only accepts a subset of the instructions
available to machines with higher numbers.
The exception is the "ca", which is
incompatible with all other machines except
"core". */
#define bfd_mach_i960_core 1
#define bfd_mach_i960_ka_sa 2
#define bfd_mach_i960_kb_sb 3
#define bfd_mach_i960_mc 4
#define bfd_mach_i960_xa 5
#define bfd_mach_i960_ca 6
#define bfd_mach_i960_jx 7
#define bfd_mach_i960_hx 8
bfd_arch_or32, /* OpenRISC 32 */
bfd_arch_sparc, /* SPARC */
#define bfd_mach_sparc 1
/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
#define bfd_mach_sparc_sparclet 2
#define bfd_mach_sparc_sparclite 3
#define bfd_mach_sparc_v8plus 4
#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */
#define bfd_mach_sparc_sparclite_le 6
#define bfd_mach_sparc_v9 7
#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */
#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */
#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */
/* Nonzero if MACH has the v9 instruction set. */
#define bfd_mach_sparc_v9_p(mach) \
((mach) &gt;= bfd_mach_sparc_v8plus &amp;&amp; (mach) &lt;= bfd_mach_sparc_v9b \
&amp;&amp; (mach) != bfd_mach_sparc_sparclite_le)
/* Nonzero if MACH is a 64 bit sparc architecture. */
#define bfd_mach_sparc_64bit_p(mach) \
((mach) &gt;= bfd_mach_sparc_v9 &amp;&amp; (mach) != bfd_mach_sparc_v8plusb)
bfd_arch_spu, /* PowerPC SPU */
#define bfd_mach_spu 256
bfd_arch_mips, /* MIPS Rxxxx */
#define bfd_mach_mips3000 3000
#define bfd_mach_mips3900 3900
#define bfd_mach_mips4000 4000
#define bfd_mach_mips4010 4010
#define bfd_mach_mips4100 4100
#define bfd_mach_mips4111 4111
#define bfd_mach_mips4120 4120
#define bfd_mach_mips4300 4300
#define bfd_mach_mips4400 4400
#define bfd_mach_mips4600 4600
#define bfd_mach_mips4650 4650
#define bfd_mach_mips5000 5000
#define bfd_mach_mips5400 5400
#define bfd_mach_mips5500 5500
#define bfd_mach_mips6000 6000
#define bfd_mach_mips7000 7000
#define bfd_mach_mips8000 8000
#define bfd_mach_mips9000 9000
#define bfd_mach_mips10000 10000
#define bfd_mach_mips12000 12000
#define bfd_mach_mips16 16
#define bfd_mach_mips5 5
#define bfd_mach_mips_loongson_2e 3001
#define bfd_mach_mips_loongson_2f 3002
#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
#define bfd_mach_mips_octeon 6501
#define bfd_mach_mipsisa32 32
#define bfd_mach_mipsisa32r2 33
#define bfd_mach_mipsisa64 64
#define bfd_mach_mipsisa64r2 65
bfd_arch_i386, /* Intel 386 */
#define bfd_mach_i386_i386 1
#define bfd_mach_i386_i8086 2
#define bfd_mach_i386_i386_intel_syntax 3
#define bfd_mach_x86_64 64
#define bfd_mach_x86_64_intel_syntax 65
bfd_arch_we32k, /* AT&amp;T WE32xxx */
bfd_arch_tahoe, /* CCI/Harris Tahoe */
bfd_arch_i860, /* Intel 860 */
bfd_arch_i370, /* IBM 360/370 Mainframes */
bfd_arch_romp, /* IBM ROMP PC/RT */
bfd_arch_convex, /* Convex */
bfd_arch_m88k, /* Motorola 88xxx */
bfd_arch_m98k, /* Motorola 98xxx */
bfd_arch_pyramid, /* Pyramid Technology */
bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */
#define bfd_mach_h8300 1
#define bfd_mach_h8300h 2
#define bfd_mach_h8300s 3
#define bfd_mach_h8300hn 4
#define bfd_mach_h8300sn 5
#define bfd_mach_h8300sx 6
#define bfd_mach_h8300sxn 7
bfd_arch_pdp11, /* DEC PDP-11 */
bfd_arch_powerpc, /* PowerPC */
#define bfd_mach_ppc 32
#define bfd_mach_ppc64 64
#define bfd_mach_ppc_403 403
#define bfd_mach_ppc_403gc 4030
#define bfd_mach_ppc_505 505
#define bfd_mach_ppc_601 601
#define bfd_mach_ppc_602 602
#define bfd_mach_ppc_603 603
#define bfd_mach_ppc_ec603e 6031
#define bfd_mach_ppc_604 604
#define bfd_mach_ppc_620 620
#define bfd_mach_ppc_630 630
#define bfd_mach_ppc_750 750
#define bfd_mach_ppc_860 860
#define bfd_mach_ppc_a35 35
#define bfd_mach_ppc_rs64ii 642
#define bfd_mach_ppc_rs64iii 643
#define bfd_mach_ppc_7400 7400
#define bfd_mach_ppc_e500 500
#define bfd_mach_ppc_e500mc 5001
bfd_arch_rs6000, /* IBM RS/6000 */
#define bfd_mach_rs6k 6000
#define bfd_mach_rs6k_rs1 6001
#define bfd_mach_rs6k_rsc 6003
#define bfd_mach_rs6k_rs2 6002
bfd_arch_hppa, /* HP PA RISC */
#define bfd_mach_hppa10 10
#define bfd_mach_hppa11 11
#define bfd_mach_hppa20 20
#define bfd_mach_hppa20w 25
bfd_arch_d10v, /* Mitsubishi D10V */
#define bfd_mach_d10v 1
#define bfd_mach_d10v_ts2 2
#define bfd_mach_d10v_ts3 3
bfd_arch_d30v, /* Mitsubishi D30V */
bfd_arch_dlx, /* DLX */
bfd_arch_m68hc11, /* Motorola 68HC11 */
bfd_arch_m68hc12, /* Motorola 68HC12 */
#define bfd_mach_m6812_default 0
#define bfd_mach_m6812 1
#define bfd_mach_m6812s 2
bfd_arch_z8k, /* Zilog Z8000 */
#define bfd_mach_z8001 1
#define bfd_mach_z8002 2
bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */
bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */
#define bfd_mach_sh 1
#define bfd_mach_sh2 0x20
#define bfd_mach_sh_dsp 0x2d
#define bfd_mach_sh2a 0x2a
#define bfd_mach_sh2a_nofpu 0x2b
#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
#define bfd_mach_sh2a_or_sh4 0x2a3
#define bfd_mach_sh2a_or_sh3e 0x2a4
#define bfd_mach_sh2e 0x2e
#define bfd_mach_sh3 0x30
#define bfd_mach_sh3_nommu 0x31
#define bfd_mach_sh3_dsp 0x3d
#define bfd_mach_sh3e 0x3e
#define bfd_mach_sh4 0x40
#define bfd_mach_sh4_nofpu 0x41
#define bfd_mach_sh4_nommu_nofpu 0x42
#define bfd_mach_sh4a 0x4a
#define bfd_mach_sh4a_nofpu 0x4b
#define bfd_mach_sh4al_dsp 0x4d
#define bfd_mach_sh5 0x50
bfd_arch_alpha, /* Dec Alpha */
#define bfd_mach_alpha_ev4 0x10
#define bfd_mach_alpha_ev5 0x20
#define bfd_mach_alpha_ev6 0x30
bfd_arch_arm, /* Advanced Risc Machines ARM. */
#define bfd_mach_arm_unknown 0
#define bfd_mach_arm_2 1
#define bfd_mach_arm_2a 2
#define bfd_mach_arm_3 3
#define bfd_mach_arm_3M 4
#define bfd_mach_arm_4 5
#define bfd_mach_arm_4T 6
#define bfd_mach_arm_5 7
#define bfd_mach_arm_5T 8
#define bfd_mach_arm_5TE 9
#define bfd_mach_arm_XScale 10
#define bfd_mach_arm_ep9312 11
#define bfd_mach_arm_iWMMXt 12
#define bfd_mach_arm_iWMMXt2 13
bfd_arch_ns32k, /* National Semiconductors ns32000 */
bfd_arch_w65, /* WDC 65816 */
bfd_arch_tic30, /* Texas Instruments TMS320C30 */
bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */
#define bfd_mach_tic3x 30
#define bfd_mach_tic4x 40
bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
bfd_arch_tic80, /* TI TMS320c80 (MVP) */
bfd_arch_v850, /* NEC V850 */
#define bfd_mach_v850 1
#define bfd_mach_v850e 'E'
#define bfd_mach_v850e1 '1'
bfd_arch_arc, /* ARC Cores */
#define bfd_mach_arc_5 5
#define bfd_mach_arc_6 6
#define bfd_mach_arc_7 7
#define bfd_mach_arc_8 8
bfd_arch_m32c, /* Renesas M16C/M32C. */
#define bfd_mach_m16c 0x75
#define bfd_mach_m32c 0x78
bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
#define bfd_mach_m32r 1 /* For backwards compatibility. */
#define bfd_mach_m32rx 'x'
#define bfd_mach_m32r2 '2'
bfd_arch_mn10200, /* Matsushita MN10200 */
bfd_arch_mn10300, /* Matsushita MN10300 */
#define bfd_mach_mn10300 300
#define bfd_mach_am33 330
#define bfd_mach_am33_2 332
bfd_arch_fr30,
#define bfd_mach_fr30 0x46523330
bfd_arch_frv,
#define bfd_mach_frv 1
#define bfd_mach_frvsimple 2
#define bfd_mach_fr300 300
#define bfd_mach_fr400 400
#define bfd_mach_fr450 450
#define bfd_mach_frvtomcat 499 /* fr500 prototype */
#define bfd_mach_fr500 500
#define bfd_mach_fr550 550
bfd_arch_mcore,
bfd_arch_mep,
#define bfd_mach_mep 1
#define bfd_mach_mep_h1 0x6831
bfd_arch_ia64, /* HP/Intel ia64 */
#define bfd_mach_ia64_elf64 64
#define bfd_mach_ia64_elf32 32
bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */
#define bfd_mach_ip2022 1
#define bfd_mach_ip2022ext 2
bfd_arch_iq2000, /* Vitesse IQ2000. */
#define bfd_mach_iq2000 1
#define bfd_mach_iq10 2
bfd_arch_mt,
#define bfd_mach_ms1 1
#define bfd_mach_mrisc2 2
#define bfd_mach_ms2 3
bfd_arch_pj,
bfd_arch_avr, /* Atmel AVR microcontrollers. */
#define bfd_mach_avr1 1
#define bfd_mach_avr2 2
#define bfd_mach_avr25 25
#define bfd_mach_avr3 3
#define bfd_mach_avr31 31
#define bfd_mach_avr35 35
#define bfd_mach_avr4 4
#define bfd_mach_avr5 5
#define bfd_mach_avr51 51
#define bfd_mach_avr6 6
bfd_arch_bfin, /* ADI Blackfin */
#define bfd_mach_bfin 1
bfd_arch_cr16, /* National Semiconductor CompactRISC (ie CR16). */
#define bfd_mach_cr16 1
bfd_arch_cr16c, /* National Semiconductor CompactRISC. */
#define bfd_mach_cr16c 1
bfd_arch_crx, /* National Semiconductor CRX. */
#define bfd_mach_crx 1
bfd_arch_cris, /* Axis CRIS */
#define bfd_mach_cris_v0_v10 255
#define bfd_mach_cris_v32 32
#define bfd_mach_cris_v10_v32 1032
bfd_arch_s390, /* IBM s390 */
#define bfd_mach_s390_31 31
#define bfd_mach_s390_64 64
bfd_arch_score, /* Sunplus score */
bfd_arch_openrisc, /* OpenRISC */
bfd_arch_mmix, /* Donald Knuth's educational processor. */
bfd_arch_xstormy16,
#define bfd_mach_xstormy16 1
bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */
#define bfd_mach_msp11 11
#define bfd_mach_msp110 110
#define bfd_mach_msp12 12
#define bfd_mach_msp13 13
#define bfd_mach_msp14 14
#define bfd_mach_msp15 15
#define bfd_mach_msp16 16
#define bfd_mach_msp21 21
#define bfd_mach_msp31 31
#define bfd_mach_msp32 32
#define bfd_mach_msp33 33
#define bfd_mach_msp41 41
#define bfd_mach_msp42 42
#define bfd_mach_msp43 43
#define bfd_mach_msp44 44
bfd_arch_xc16x, /* Infineon's XC16X Series. */
#define bfd_mach_xc16x 1
#define bfd_mach_xc16xl 2
#define bfd_mach_xc16xs 3
bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
#define bfd_mach_xtensa 1
bfd_arch_maxq, /* Dallas MAXQ 10/20 */
#define bfd_mach_maxq10 10
#define bfd_mach_maxq20 20
bfd_arch_z80,
#define bfd_mach_z80strict 1 /* No undocumented opcodes. */
#define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */
#define bfd_mach_z80full 7 /* All undocumented instructions. */
#define bfd_mach_r800 11 /* R800: successor with multiplication. */
bfd_arch_last
};
</pre>
<h4 class="subsection">2.13.2 bfd_arch_info</h4>
<p><strong>Description</strong><br>
This structure contains information on architectures for use
within BFD.
<pre class="example">
typedef struct bfd_arch_info
{
int bits_per_word;
int bits_per_address;
int bits_per_byte;
enum bfd_architecture arch;
unsigned long mach;
const char *arch_name;
const char *printable_name;
unsigned int section_align_power;
/* TRUE if this is the default machine for the architecture.
The default arch should be the first entry for an arch so that
all the entries for that arch can be accessed via <code>next</code>. */
bfd_boolean the_default;
const struct bfd_arch_info * (*compatible)
(const struct bfd_arch_info *a, const struct bfd_arch_info *b);
bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
const struct bfd_arch_info *next;
}
bfd_arch_info_type;
</pre>
<p><a name="index-bfd_005fprintable_005fname-1319"></a>
<h5 class="subsubsection">2.13.2.1 <code>bfd_printable_name</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const char *bfd_printable_name (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Return a printable string representing the architecture and machine
from the pointer to the architecture info structure.
<p><a name="index-bfd_005fscan_005farch-1320"></a>
<h5 class="subsubsection">2.13.2.2 <code>bfd_scan_arch</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const bfd_arch_info_type *bfd_scan_arch (const char *string);
</pre>
<p><strong>Description</strong><br>
Figure out if BFD supports any cpu which could be described with
the name <var>string</var>. Return a pointer to an <code>arch_info</code>
structure if a machine is found, otherwise NULL.
<p><a name="index-bfd_005farch_005flist-1321"></a>
<h5 class="subsubsection">2.13.2.3 <code>bfd_arch_list</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const char **bfd_arch_list (void);
</pre>
<p><strong>Description</strong><br>
Return a freshly malloced NULL-terminated vector of the names
of all the valid BFD architectures. Do not modify the names.
<p><a name="index-bfd_005farch_005fget_005fcompatible-1322"></a>
<h5 class="subsubsection">2.13.2.4 <code>bfd_arch_get_compatible</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const bfd_arch_info_type *bfd_arch_get_compatible
(const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
</pre>
<p><strong>Description</strong><br>
Determine whether two BFDs' architectures and machine types
are compatible. Calculates the lowest common denominator
between the two architectures and machine types implied by
the BFDs and returns a pointer to an <code>arch_info</code> structure
describing the compatible machine.
<p><a name="index-bfd_005fdefault_005farch_005fstruct-1323"></a>
<h5 class="subsubsection">2.13.2.5 <code>bfd_default_arch_struct</code></h5>
<p><strong>Description</strong><br>
The <code>bfd_default_arch_struct</code> is an item of
<code>bfd_arch_info_type</code> which has been initialized to a fairly
generic state. A BFD starts life by pointing to this
structure, until the correct back end has determined the real
architecture of the file.
<pre class="example"> extern const bfd_arch_info_type bfd_default_arch_struct;
</pre>
<p><a name="index-bfd_005fset_005farch_005finfo-1324"></a>
<h5 class="subsubsection">2.13.2.6 <code>bfd_set_arch_info</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
</pre>
<p><strong>Description</strong><br>
Set the architecture info of <var>abfd</var> to <var>arg</var>.
<p><a name="index-bfd_005fdefault_005fset_005farch_005fmach-1325"></a>
<h5 class="subsubsection">2.13.2.7 <code>bfd_default_set_arch_mach</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_default_set_arch_mach
(bfd *abfd, enum bfd_architecture arch, unsigned long mach);
</pre>
<p><strong>Description</strong><br>
Set the architecture and machine type in BFD <var>abfd</var>
to <var>arch</var> and <var>mach</var>. Find the correct
pointer to a structure and insert it into the <code>arch_info</code>
pointer.
<p><a name="index-bfd_005fget_005farch-1326"></a>
<h5 class="subsubsection">2.13.2.8 <code>bfd_get_arch</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> enum bfd_architecture bfd_get_arch (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Return the enumerated type which describes the BFD <var>abfd</var>'s
architecture.
<p><a name="index-bfd_005fget_005fmach-1327"></a>
<h5 class="subsubsection">2.13.2.9 <code>bfd_get_mach</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> unsigned long bfd_get_mach (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Return the long type which describes the BFD <var>abfd</var>'s
machine.
<p><a name="index-bfd_005farch_005fbits_005fper_005fbyte-1328"></a>
<h5 class="subsubsection">2.13.2.10 <code>bfd_arch_bits_per_byte</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> unsigned int bfd_arch_bits_per_byte (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Return the number of bits in one of the BFD <var>abfd</var>'s
architecture's bytes.
<p><a name="index-bfd_005farch_005fbits_005fper_005faddress-1329"></a>
<h5 class="subsubsection">2.13.2.11 <code>bfd_arch_bits_per_address</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> unsigned int bfd_arch_bits_per_address (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Return the number of bits in one of the BFD <var>abfd</var>'s
architecture's addresses.
<p><a name="index-bfd_005fdefault_005fcompatible-1330"></a>
<h5 class="subsubsection">2.13.2.12 <code>bfd_default_compatible</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const bfd_arch_info_type *bfd_default_compatible
(const bfd_arch_info_type *a, const bfd_arch_info_type *b);
</pre>
<p><strong>Description</strong><br>
The default function for testing for compatibility.
<p><a name="index-bfd_005fdefault_005fscan-1331"></a>
<h5 class="subsubsection">2.13.2.13 <code>bfd_default_scan</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_default_scan
(const struct bfd_arch_info *info, const char *string);
</pre>
<p><strong>Description</strong><br>
The default function for working out whether this is an
architecture hit and a machine hit.
<p><a name="index-bfd_005fget_005farch_005finfo-1332"></a>
<h5 class="subsubsection">2.13.2.14 <code>bfd_get_arch_info</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Return the architecture info struct in <var>abfd</var>.
<p><a name="index-bfd_005flookup_005farch-1333"></a>
<h5 class="subsubsection">2.13.2.15 <code>bfd_lookup_arch</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const bfd_arch_info_type *bfd_lookup_arch
(enum bfd_architecture arch, unsigned long machine);
</pre>
<p><strong>Description</strong><br>
Look for the architecture info structure which matches the
arguments <var>arch</var> and <var>machine</var>. A machine of 0 matches the
machine/architecture structure which marks itself as the
default.
<p><a name="index-bfd_005fprintable_005farch_005fmach-1334"></a>
<h5 class="subsubsection">2.13.2.16 <code>bfd_printable_arch_mach</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const char *bfd_printable_arch_mach
(enum bfd_architecture arch, unsigned long machine);
</pre>
<p><strong>Description</strong><br>
Return a printable string representing the architecture and
machine type.
<p>This routine is depreciated.
<p><a name="index-bfd_005foctets_005fper_005fbyte-1335"></a>
<h5 class="subsubsection">2.13.2.17 <code>bfd_octets_per_byte</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> unsigned int bfd_octets_per_byte (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Return the number of octets (8-bit quantities) per target byte
(minimum addressable unit). In most cases, this will be one, but some
DSP targets have 16, 32, or even 48 bits per byte.
<p><a name="index-bfd_005farch_005fmach_005foctets_005fper_005fbyte-1336"></a>
<h5 class="subsubsection">2.13.2.18 <code>bfd_arch_mach_octets_per_byte</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> unsigned int bfd_arch_mach_octets_per_byte
(enum bfd_architecture arch, unsigned long machine);
</pre>
<p><strong>Description</strong><br>
See bfd_octets_per_byte.
<p>This routine is provided for those cases where a bfd * is not
available
</body></html>

View file

@ -0,0 +1,156 @@
<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:&nbsp;<a rel="next" accesskey="n" href="Formats.html#Formats">Formats</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Symbols.html#Symbols">Symbols</a>,
Up:&nbsp;<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>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,65 @@
<html lang="en">
<head>
<title>BFD back ends - 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="prev" href="BFD-front-end.html#BFD-front-end" title="BFD front end">
<link rel="next" href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License" title="GNU Free Documentation License">
<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="BFD-back-ends"></a>Next:&nbsp;<a rel="next" accesskey="n" href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">GNU Free Documentation License</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="BFD-front-end.html#BFD-front-end">BFD front end</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr><br>
</div>
<h2 class="chapter">3 BFD back ends</h2>
<ul class="menu">
<li><a accesskey="1" href="What-to-Put-Where.html#What-to-Put-Where">What to Put Where</a>
<li><a accesskey="2" href="aout.html#aout">aout </a>: a.out backends
<li><a accesskey="3" href="coff.html#coff">coff </a>: coff backends
<li><a accesskey="4" href="elf.html#elf">elf </a>: elf backends
<li><a accesskey="5" href="mmo.html#mmo">mmo </a>: mmo backend
</ul>
</body></html>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,98 @@
<html lang="en">
<head>
<title>BFD information loss - 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="What-BFD-Version-2-Can-Do.html#What-BFD-Version-2-Can-Do" title="What BFD Version 2 Can Do">
<link rel="next" href="Canonical-format.html#Canonical-format" title="Canonical format">
<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="BFD-information-loss"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Canonical-format.html#Canonical-format">Canonical format</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="What-BFD-Version-2-Can-Do.html#What-BFD-Version-2-Can-Do">What BFD Version 2 Can Do</a>
<hr><br>
</div>
<h4 class="subsection">1.3.1 Information Loss</h4>
<p><em>Information can be lost during output.</em> The output formats
supported by BFD do not provide identical facilities, and
information which can be described in one form has nowhere to go in
another format. One example of this is alignment information in
<code>b.out</code>. There is nowhere in an <code>a.out</code> format file to store
alignment information on the contained data, so when a file is linked
from <code>b.out</code> and an <code>a.out</code> image is produced, alignment
information will not propagate to the output file. (The linker will
still use the alignment information internally, so the link is performed
correctly).
<p>Another example is COFF section names. COFF files may contain an
unlimited number of sections, each one with a textual section name. If
the target of the link is a format which does not have many sections (e.g.,
<code>a.out</code>) or has sections without names (e.g., the Oasys format), the
link cannot be done simply. You can circumvent this problem by
describing the desired input-to-output section mapping with the linker command
language.
<p><em>Information can be lost during canonicalization.</em> The BFD
internal canonical form of the external formats is not exhaustive; there
are structures in input formats for which there is no direct
representation internally. This means that the BFD back ends
cannot maintain all possible data richness through the transformation
between external to internal and back to external formats.
<p>This limitation is only a problem when an application reads one
format and writes another. Each BFD back end is responsible for
maintaining as much data as possible, and the internal BFD
canonical 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 the
same time, the back end saves away any information which may otherwise
be lost. If the data is then written back in the same format, the back
end routine will be able to use the canonical form provided by the
BFD core as well as the information it prepared earlier. Since
there is a great deal of commonality between back ends,
there is no information lost when
linking or copying big endian COFF to little endian COFF, or <code>a.out</code> to
<code>b.out</code>. When a mixture of formats is linked, the information is
only lost from the files whose format differs from the destination.
</body></html>

View file

@ -0,0 +1,126 @@
<html lang="en">
<head>
<title>Canonical format - 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="What-BFD-Version-2-Can-Do.html#What-BFD-Version-2-Can-Do" title="What BFD Version 2 Can Do">
<link rel="prev" href="BFD-information-loss.html#BFD-information-loss" title="BFD information loss">
<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="Canonical-format"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="BFD-information-loss.html#BFD-information-loss">BFD information loss</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="What-BFD-Version-2-Can-Do.html#What-BFD-Version-2-Can-Do">What BFD Version 2 Can Do</a>
<hr><br>
</div>
<h4 class="subsection">1.3.2 The BFD canonical object-file format</h4>
<p>The greatest potential for loss of information occurs when there is the least
overlap between the information provided by the source format, that
stored by the canonical format, and that needed by the
destination format. A brief description of the canonical form may help
you understand which kinds of data you can count on preserving across
conversions.
<a name="index-BFD-canonical-format-3"></a><a name="index-internal-object_002dfile-format-4"></a>
<dl>
<dt><em>files</em><dd>Information stored on a per-file basis includes target machine
architecture, particular implementation format type, a demand pageable
bit, and a write protected bit. Information like Unix magic numbers is
not stored here&mdash;only the magic numbers' meaning, so a <code>ZMAGIC</code>
file would have both the demand pageable bit and the write protected
text bit set. The byte order of the target is stored on a per-file
basis, so that big- and little-endian object files may be used with one
another.
<br><dt><em>sections</em><dd>Each section in the input file contains the name of the section, the
section's original address in the object file, size and alignment
information, various flags, and pointers into other BFD data
structures.
<br><dt><em>symbols</em><dd>Each symbol contains a pointer to the information for the object file
which originally defined it, its name, its value, and various flag
bits. When a BFD back end reads in a symbol table, it relocates all
symbols to make them relative to the base of the section where they were
defined. Doing this ensures that each symbol points to its containing
section. Each symbol also has a varying amount of hidden private data
for the BFD back end. Since the symbol points to the original file, the
private data format for that symbol is accessible. <code>ld</code> can
operate on a collection of symbols of wildly different formats without
problems.
<p>Normal global and simple local symbols are maintained on output, so an
output file (no matter its format) will retain symbols pointing to
functions and to global, static, and common variables. Some symbol
information is not worth retaining; in <code>a.out</code>, type information is
stored in the symbol table as long symbol names. This information would
be useless to most COFF debuggers; the linker has command line switches
to allow users to throw it away.
<p>There is one word of type information within the symbol, so if the
format 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.
<br><dt><em>relocation level</em><dd>Each canonical BFD relocation record contains a pointer to the symbol to
relocate to, the offset of the data to relocate, the section the data
is in, and a pointer to a relocation type descriptor. Relocation is
performed by passing messages through the relocation type
descriptor and the symbol pointer. Therefore, relocations can be performed
on output data using a relocation method that is only available in one of the
input formats. For instance, Oasys provides a byte relocation format.
A relocation record requesting this relocation type would point
indirectly to a routine to perform this, so the relocation may be
performed on a byte being written to a 68k COFF file, even though 68k COFF
has no such relocation type.
<br><dt><em>line numbers</em><dd>Object formats can contain, for debugging purposes, some form of mapping
between 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 the
first record of the list. The head of a line number list consists of a
pointer to the symbol, which allows finding out the address of the
function whose line number is being described. The rest of the list is
made up of pairs: offsets into the section and line numbers. Any format
which can simply derive this information can pass it successfully
between formats (COFF, IEEE and Oasys).
</dl>
</body></html>

View file

@ -0,0 +1,118 @@
<html lang="en">
<head>
<title>Core Files - 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="Relocations.html#Relocations" title="Relocations">
<link rel="next" href="Targets.html#Targets" title="Targets">
<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="Core-Files"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Targets.html#Targets">Targets</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Relocations.html#Relocations">Relocations</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.11 Core files</h3>
<h4 class="subsection">2.11.1 Core file functions</h4>
<p><strong>Description</strong><br>
These are functions pertaining to core files.
<p><a name="index-bfd_005fcore_005ffile_005ffailing_005fcommand-1311"></a>
<h5 class="subsubsection">2.11.1.1 <code>bfd_core_file_failing_command</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const char *bfd_core_file_failing_command (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Return a read-only string explaining which program was running
when it failed and produced the core file <var>abfd</var>.
<p><a name="index-bfd_005fcore_005ffile_005ffailing_005fsignal-1312"></a>
<h5 class="subsubsection">2.11.1.2 <code>bfd_core_file_failing_signal</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> int bfd_core_file_failing_signal (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Returns the signal number which caused the core dump which
generated the file the BFD <var>abfd</var> is attached to.
<p><a name="index-core_005ffile_005fmatches_005fexecutable_005fp-1313"></a>
<h5 class="subsubsection">2.11.1.3 <code>core_file_matches_executable_p</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean core_file_matches_executable_p
(bfd *core_bfd, bfd *exec_bfd);
</pre>
<p><strong>Description</strong><br>
Return <code>TRUE</code> if the core file attached to <var>core_bfd</var>
was generated by a run of the executable file attached to
<var>exec_bfd</var>, <code>FALSE</code> otherwise.
<p><a name="index-generic_005fcore_005ffile_005fmatches_005fexecutable_005fp-1314"></a>
<h5 class="subsubsection">2.11.1.4 <code>generic_core_file_matches_executable_p</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean generic_core_file_matches_executable_p
(bfd *core_bfd, bfd *exec_bfd);
</pre>
<p><strong>Description</strong><br>
Return TRUE if the core file attached to <var>core_bfd</var>
was generated by a run of the executable file attached
to <var>exec_bfd</var>. The match is based on executable
basenames only.
<p>Note: When not able to determine the core file failing
command or the executable name, we still return TRUE even
though we're not sure that core file and executable match.
This is to avoid generating a false warning in situations
where we really don't know whether they match or not.
</body></html>

View file

@ -0,0 +1,89 @@
<html lang="en">
<head>
<title>Creating a Linker Hash Table - 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="Linker-Functions.html#Linker-Functions" title="Linker Functions">
<link rel="prev" href="Linker-Functions.html#Linker-Functions" title="Linker Functions">
<link rel="next" href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" title="Adding Symbols to the Hash Table">
<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="Creating-a-Linker-Hash-Table"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table">Adding Symbols to the Hash Table</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Linker-Functions.html#Linker-Functions">Linker Functions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Linker-Functions.html#Linker-Functions">Linker Functions</a>
<hr><br>
</div>
<h4 class="subsection">2.17.1 Creating a linker hash table</h4>
<p><a name="index-_005fbfd_005flink_005fhash_005ftable_005fcreate-in-target-vector-1369"></a><a name="index-target-vector-_0028_005fbfd_005flink_005fhash_005ftable_005fcreate_0029-1370"></a>The linker routines must create a hash table, which must be
derived from <code>struct bfd_link_hash_table</code> described in
<code>bfdlink.c</code>. See <a href="Hash-Tables.html#Hash-Tables">Hash Tables</a>, for information on how to
create a derived hash table. This entry point is called using
the target vector of the linker output file.
<p>The <code>_bfd_link_hash_table_create</code> entry point must allocate
and initialize an instance of the desired hash table. If the
back end does not require any additional information to be
stored with the entries in the hash table, the entry point may
simply create a <code>struct bfd_link_hash_table</code>. Most likely,
however, some additional information will be needed.
<p>For example, with each entry in the hash table the a.out
linker keeps the index the symbol has in the final output file
(this index number is used so that when doing a relocatable
link the symbol index used in the output file can be quickly
filled in when copying over a reloc). The a.out linker code
defines the required structures and functions for a hash table
derived from <code>struct bfd_link_hash_table</code>. The a.out linker
hash table is created by the function
<code>NAME(aout,link_hash_table_create)</code>; it simply allocates
space for the hash table, initializes it, and returns a
pointer to it.
<p>When writing the linker routines for a new back end, you will
generally not know exactly which fields will be required until
you have finished. You should simply create a new hash table
which defines no additional fields, and then simply add fields
as they become necessary.
</body></html>

View file

@ -0,0 +1,82 @@
<html lang="en">
<head>
<title>Creating and Freeing a Hash Table - 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="Hash-Tables.html#Hash-Tables" title="Hash Tables">
<link rel="prev" href="Hash-Tables.html#Hash-Tables" title="Hash Tables">
<link rel="next" href="Looking-Up-or-Entering-a-String.html#Looking-Up-or-Entering-a-String" title="Looking Up or Entering a String">
<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="Creating-and-Freeing-a-Hash-Table"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Looking-Up-or-Entering-a-String.html#Looking-Up-or-Entering-a-String">Looking Up or Entering a String</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Hash-Tables.html#Hash-Tables">Hash Tables</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Hash-Tables.html#Hash-Tables">Hash Tables</a>
<hr><br>
</div>
<h4 class="subsection">2.18.1 Creating and freeing a hash table</h4>
<p><a name="index-bfd_005fhash_005ftable_005finit-1382"></a><a name="index-bfd_005fhash_005ftable_005finit_005fn-1383"></a>To create a hash table, create an instance of a <code>struct
bfd_hash_table</code> (defined in <code>bfd.h</code>) and call
<code>bfd_hash_table_init</code> (if you know approximately how many
entries you will need, the function <code>bfd_hash_table_init_n</code>,
which takes a <var>size</var> argument, may be used).
<code>bfd_hash_table_init</code> returns <code>FALSE</code> if some sort of
error occurs.
<p><a name="index-bfd_005fhash_005fnewfunc-1384"></a>The function <code>bfd_hash_table_init</code> take as an argument a
function to use to create new entries. For a basic hash
table, use the function <code>bfd_hash_newfunc</code>. See <a href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type">Deriving a New Hash Table Type</a>, for why you would want to use a
different value for this argument.
<p><a name="index-bfd_005fhash_005fallocate-1385"></a><code>bfd_hash_table_init</code> will create an objalloc which will be
used to allocate new entries. You may allocate memory on this
objalloc using <code>bfd_hash_allocate</code>.
<p><a name="index-bfd_005fhash_005ftable_005ffree-1386"></a>Use <code>bfd_hash_table_free</code> to free up all the memory that has
been allocated for a hash table. This will not free up the
<code>struct bfd_hash_table</code> itself, which you must provide.
<p><a name="index-bfd_005fhash_005fset_005fdefault_005fsize-1387"></a>Use <code>bfd_hash_set_default_size</code> to set the default size of
hash table to use.
</body></html>

View file

@ -0,0 +1,76 @@
<html lang="en">
<head>
<title>Define the Derived Structures - 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="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type" title="Deriving a New Hash Table Type">
<link rel="prev" href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type" title="Deriving a New Hash Table Type">
<link rel="next" href="Write-the-Derived-Creation-Routine.html#Write-the-Derived-Creation-Routine" title="Write the Derived Creation Routine">
<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="Define-the-Derived-Structures"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Write-the-Derived-Creation-Routine.html#Write-the-Derived-Creation-Routine">Write the Derived Creation Routine</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type">Deriving a New Hash Table Type</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type">Deriving a New Hash Table Type</a>
<hr><br>
</div>
<h5 class="subsubsection">2.18.4.1 Define the derived structures</h5>
<p>You must define a structure for an entry in the hash table,
and a structure for the hash table itself.
<p>The first field in the structure for an entry in the hash
table must be of the type used for an entry in the hash table
you are deriving from. If you are deriving from a basic hash
table this is <code>struct bfd_hash_entry</code>, which is defined in
<code>bfd.h</code>. The first field in the structure for the hash
table itself must be of the type of the hash table you are
deriving from itself. If you are deriving from a basic hash
table, this is <code>struct bfd_hash_table</code>.
<p>For example, the linker hash table defines <code>struct
bfd_link_hash_entry</code> (in <code>bfdlink.h</code>). The first field,
<code>root</code>, is of type <code>struct bfd_hash_entry</code>. Similarly,
the first field in <code>struct bfd_link_hash_table</code>, <code>table</code>,
is of type <code>struct bfd_hash_table</code>.
</body></html>

View file

@ -0,0 +1,80 @@
<html lang="en">
<head>
<title>Deriving a New Hash Table Type - 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="Hash-Tables.html#Hash-Tables" title="Hash Tables">
<link rel="prev" href="Traversing-a-Hash-Table.html#Traversing-a-Hash-Table" title="Traversing a Hash Table">
<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="Deriving-a-New-Hash-Table-Type"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="Traversing-a-Hash-Table.html#Traversing-a-Hash-Table">Traversing a Hash Table</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Hash-Tables.html#Hash-Tables">Hash Tables</a>
<hr><br>
</div>
<h4 class="subsection">2.18.4 Deriving a new hash table type</h4>
<p>Many uses of hash tables want to store additional information
which each entry in the hash table. Some also find it
convenient to store additional information with the hash table
itself. This may be done using a derived hash table.
<p>Since C is not an object oriented language, creating a derived
hash table requires sticking together some boilerplate
routines with a few differences specific to the type of hash
table you want to create.
<p>An example of a derived hash table is the linker hash table.
The structures for this are defined in <code>bfdlink.h</code>. The
functions are in <code>linker.c</code>.
<p>You may also derive a hash table from an already derived hash
table. For example, the a.out linker backend code uses a hash
table derived from the linker hash table.
<ul class="menu">
<li><a accesskey="1" href="Define-the-Derived-Structures.html#Define-the-Derived-Structures">Define the Derived Structures</a>
<li><a accesskey="2" href="Write-the-Derived-Creation-Routine.html#Write-the-Derived-Creation-Routine">Write the Derived Creation Routine</a>
<li><a accesskey="3" href="Write-Other-Derived-Routines.html#Write-Other-Derived-Routines">Write Other Derived Routines</a>
</ul>
</body></html>

View file

@ -0,0 +1,90 @@
<html lang="en">
<head>
<title>Differing file formats - 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="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" title="Adding Symbols to the Hash Table">
<link rel="prev" href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" title="Adding Symbols to the Hash Table">
<link rel="next" href="Adding-symbols-from-an-object-file.html#Adding-symbols-from-an-object-file" title="Adding symbols from an object file">
<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="Differing-file-formats"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Adding-symbols-from-an-object-file.html#Adding-symbols-from-an-object-file">Adding symbols from an object file</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table">Adding Symbols to the Hash Table</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table">Adding Symbols to the Hash Table</a>
<hr><br>
</div>
<h5 class="subsubsection">2.17.2.1 Differing file formats</h5>
<p>Normally all the files involved in a link will be of the same
format, but it is also possible to link together different
format object files, and the back end must support that. The
<code>_bfd_link_add_symbols</code> entry point is called via the target
vector of the file to be added. This has an important
consequence: the function may not assume that the hash table
is the type created by the corresponding
<code>_bfd_link_hash_table_create</code> vector. All the
<code>_bfd_link_add_symbols</code> function can assume about the hash
table is that it is derived from <code>struct
bfd_link_hash_table</code>.
<p>Sometimes the <code>_bfd_link_add_symbols</code> function must store
some information in the hash table entry to be used by the
<code>_bfd_final_link</code> function. In such a case the output bfd
xvec must be checked to make sure that the hash table was
created by an object file of the same format.
<p>The <code>_bfd_final_link</code> routine must be prepared to handle a
hash entry without any extra information added by the
<code>_bfd_link_add_symbols</code> function. A hash entry without
extra information will also occur when the linker script
directs the linker to create a symbol. Note that, regardless
of how a hash table entry is added, all the fields will be
initialized to some sort of null value by the hash table entry
initialization function.
<p>See <code>ecoff_link_add_externals</code> for an example of how to
check the output bfd before saving information (in this
case, the ECOFF external symbol debugging information) in a
hash table entry.
</body></html>

View file

@ -0,0 +1,125 @@
<html lang="en">
<head>
<title>File Caching - 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="Internal.html#Internal" title="Internal">
<link rel="next" href="Linker-Functions.html#Linker-Functions" title="Linker Functions">
<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="File-Caching"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Linker-Functions.html#Linker-Functions">Linker Functions</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Internal.html#Internal">Internal</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.16 File caching</h3>
<p>The file caching mechanism is embedded within BFD and allows
the application to open as many BFDs as it wants without
regard to the underlying operating system's file descriptor
limit (often as low as 20 open files). The module in
<code>cache.c</code> maintains a least recently used list of
<code>BFD_CACHE_MAX_OPEN</code> files, and exports the name
<code>bfd_cache_lookup</code>, which runs around and makes sure that
the required BFD is open. If not, then it chooses a file to
close, closes it and opens the one wanted, returning its file
handle.
<h4 class="subsection">2.16.1 Caching functions</h4>
<p><a name="index-bfd_005fcache_005finit-1364"></a>
<h5 class="subsubsection">2.16.1.1 <code>bfd_cache_init</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_cache_init (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Add a newly opened BFD to the cache.
<p><a name="index-bfd_005fcache_005fclose-1365"></a>
<h5 class="subsubsection">2.16.1.2 <code>bfd_cache_close</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_cache_close (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Remove the BFD <var>abfd</var> from the cache. If the attached file is open,
then close it too.
<p><strong>Returns</strong><br>
<code>FALSE</code> is returned if closing the file fails, <code>TRUE</code> is
returned if all is well.
<p><a name="index-bfd_005fcache_005fclose_005fall-1366"></a>
<h5 class="subsubsection">2.16.1.3 <code>bfd_cache_close_all</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_cache_close_all (void);
</pre>
<p><strong>Description</strong><br>
Remove all BFDs from the cache. If the attached file is open,
then close it too.
<p><strong>Returns</strong><br>
<code>FALSE</code> is returned if closing one of the file fails, <code>TRUE</code> is
returned if all is well.
<p><a name="index-bfd_005fopen_005ffile-1367"></a>
<h5 class="subsubsection">2.16.1.4 <code>bfd_open_file</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> FILE* bfd_open_file (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Call the OS to open a file for <var>abfd</var>. Return the <code>FILE *</code>
(possibly <code>NULL</code>) that results from this operation. Set up the
BFD so that future accesses know the file is open. If the <code>FILE *</code>
returned is <code>NULL</code>, then it won't have been put in the
cache, so it won't have to be removed from it.
</body></html>

View file

@ -0,0 +1,185 @@
<html lang="en">
<head>
<title>File layout - 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="mmo.html#mmo" title="mmo">
<link rel="prev" href="mmo.html#mmo" title="mmo">
<link rel="next" href="Symbol_002dtable.html#Symbol_002dtable" title="Symbol-table">
<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="File-layout"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Symbol_002dtable.html#Symbol_002dtable">Symbol-table</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="mmo.html#mmo">mmo</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="mmo.html#mmo">mmo</a>
<hr><br>
</div>
<h4 class="subsection">3.5.1 File layout</h4>
<p>The mmo file contents is not partitioned into named sections as
with e.g. ELF. Memory areas is formed by specifying the
location of the data that follows. Only the memory area
<span class="samp">0x0000...00</span> to <span class="samp">0x01ff...ff</span> is executable, so
it is used for code (and constants) and the area
<span class="samp">0x2000...00</span> to <span class="samp">0x20ff...ff</span> is used for
writable data. See <a href="mmo-section-mapping.html#mmo-section-mapping">mmo section mapping</a>.
<p>There is provision for specifying &ldquo;special data&rdquo; of 65536
different types. We use type 80 (decimal), arbitrarily chosen the
same as the ELF <code>e_machine</code> number for MMIX, filling it with
section information normally found in ELF objects. See <a href="mmo-section-mapping.html#mmo-section-mapping">mmo section mapping</a>.
<p>Contents is entered as 32-bit words, xor:ed over previous
contents, always zero-initialized. A word that starts with the
byte <span class="samp">0x98</span> forms a command called a <span class="samp">lopcode</span>, where
the next byte distinguished between the thirteen lopcodes. The
two remaining bytes, called the <span class="samp">Y</span> and <span class="samp">Z</span> fields, or
the <span class="samp">YZ</span> field (a 16-bit big-endian number), are used for
various purposes different for each lopcode. As documented in
<a href="http://www-cs-faculty.stanford.edu/~knuth/mmixal-intro.ps.gz">http://www-cs-faculty.stanford.edu/~knuth/mmixal-intro.ps.gz</a>,
the lopcodes are:
<dl>
<dt><code>lop_quote</code><dd>0x98000001. The next word is contents, regardless of whether it
starts with 0x98 or not.
<br><dt><code>lop_loc</code><dd>0x9801YYZZ, where <span class="samp">Z</span> is 1 or 2. This is a location
directive, setting the location for the next data to the next
32-bit word (for Z = 1) or 64-bit word (for Z = 2),
plus Y * 2^56. Normally <span class="samp">Y</span> is 0 for the text segment
and 2 for the data segment.
<br><dt><code>lop_skip</code><dd>0x9802YYZZ. Increase the current location by <span class="samp">YZ</span> bytes.
<br><dt><code>lop_fixo</code><dd>0x9803YYZZ, where <span class="samp">Z</span> is 1 or 2. Store the current location
as 64 bits into the location pointed to by the next 32-bit
(Z = 1) or 64-bit (Z = 2) word, plus Y *
2^56.
<br><dt><code>lop_fixr</code><dd>0x9804YYZZ. <span class="samp">YZ</span> is stored into the current location plus
2 - 4 * YZ.
<br><dt><code>lop_fixrx</code><dd>0x980500ZZ. <span class="samp">Z</span> is 16 or 24. A value <span class="samp">L</span> derived from
the following 32-bit word are used in a manner similar to
<span class="samp">YZ</span> in lop_fixr: it is xor:ed into the current location
minus 4 * L. The first byte of the word is 0 or 1. If it
is 1, then L = (<var>lowest 24 bits of word</var>) - 2^Z, if 0,
then L = (<var>lowest 24 bits of word</var>).
<br><dt><code>lop_file</code><dd>0x9806YYZZ. <span class="samp">Y</span> is the file number, <span class="samp">Z</span> is count of
32-bit words. Set the file number to <span class="samp">Y</span> and the line
counter to 0. The next Z * 4 bytes contain the file name,
padded with zeros if the count is not a multiple of four. The
same <span class="samp">Y</span> may occur multiple times, but <span class="samp">Z</span> must be 0 for
all but the first occurrence.
<br><dt><code>lop_line</code><dd>0x9807YYZZ. <span class="samp">YZ</span> is the line number. Together with
lop_file, it forms the source location for the next 32-bit word.
Note that for each non-lopcode 32-bit word, line numbers are
assumed incremented by one.
<br><dt><code>lop_spec</code><dd>0x9808YYZZ. <span class="samp">YZ</span> is the type number. Data until the next
lopcode other than lop_quote forms special data of type <span class="samp">YZ</span>.
See <a href="mmo-section-mapping.html#mmo-section-mapping">mmo section mapping</a>.
<p>Other types than 80, (or type 80 with a content that does not
parse) is stored in sections named <code>.MMIX.spec_data.</code><var>n</var>
where <var>n</var> is the <span class="samp">YZ</span>-type. The flags for such a
sections say not to allocate or load the data. The vma is 0.
Contents of multiple occurrences of special data <var>n</var> is
concatenated to the data of the previous lop_spec <var>n</var>s. The
location in data or code at which the lop_spec occurred is lost.
<br><dt><code>lop_pre</code><dd>0x980901ZZ. The first lopcode in a file. The <span class="samp">Z</span> field forms the
length of header information in 32-bit words, where the first word
tells the time in seconds since <span class="samp">00:00:00 GMT Jan 1 1970</span>.
<br><dt><code>lop_post</code><dd>0x980a00ZZ. Z &gt; 32. This lopcode follows after all
content-generating lopcodes in a program. The <span class="samp">Z</span> field
denotes the value of <span class="samp">rG</span> at the beginning of the program.
The following 256 - Z big-endian 64-bit words are loaded
into global registers <span class="samp">$G</span> <small class="dots">...</small> <span class="samp">$255</span>.
<br><dt><code>lop_stab</code><dd>0x980b0000. The next-to-last lopcode in a program. Must follow
immediately after the lop_post lopcode and its data. After this
lopcode follows all symbols in a compressed format
(see <a href="Symbol_002dtable.html#Symbol_002dtable">Symbol-table</a>).
<br><dt><code>lop_end</code><dd>0x980cYYZZ. The last lopcode in a program. It must follow the
lop_stab lopcode and its data. The <span class="samp">YZ</span> field contains the
number of 32-bit words of symbol table information after the
preceding lop_stab lopcode.
</dl>
<p>Note that the lopcode "fixups"; <code>lop_fixr</code>, <code>lop_fixrx</code> and
<code>lop_fixo</code> are not generated by BFD, but are handled. They are
generated by <code>mmixal</code>.
<p>This trivial one-label, one-instruction file:
<pre class="example"> :Main TRAP 1,2,3
</pre>
<p>can be represented this way in mmo:
<pre class="example"> 0x98090101 - lop_pre, one 32-bit word with timestamp.
&lt;timestamp&gt;
0x98010002 - lop_loc, text segment, using a 64-bit address.
Note that mmixal does not emit this for the file above.
0x00000000 - Address, high 32 bits.
0x00000000 - Address, low 32 bits.
0x98060002 - lop_file, 2 32-bit words for file-name.
0x74657374 - "test"
0x2e730000 - ".s\0\0"
0x98070001 - lop_line, line 1.
0x00010203 - TRAP 1,2,3
0x980a00ff - lop_post, setting $255 to 0.
0x00000000
0x00000000
0x980b0000 - lop_stab for ":Main" = 0, serial 1.
0x203a4040 See <a href="Symbol_002dtable.html#Symbol_002dtable">Symbol-table</a>.
0x10404020
0x4d206120
0x69016e00
0x81000000
0x980c0005 - lop_end; symbol table contained five 32-bit words.
</pre>
</body></html>

View file

@ -0,0 +1,161 @@
<html lang="en">
<head>
<title>Formats - 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="Archives.html#Archives" title="Archives">
<link rel="next" href="Relocations.html#Relocations" title="Relocations">
<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="Formats"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Relocations.html#Relocations">Relocations</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Archives.html#Archives">Archives</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.9 File formats</h3>
<p>A format is a BFD concept of high level file contents type. The
formats supported by BFD are:
<ul>
<li><code>bfd_object</code>
</ul>
The BFD may contain data, symbols, relocations and debug info.
<ul>
<li><code>bfd_archive</code>
</ul>
The BFD contains other BFDs and an optional index.
<ul>
<li><code>bfd_core</code>
</ul>
The BFD contains the result of an executable core dump.
<h4 class="subsection">2.9.1 File format functions</h4>
<p><a name="index-bfd_005fcheck_005fformat-76"></a>
<h5 class="subsubsection">2.9.1.1 <code>bfd_check_format</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
</pre>
<p><strong>Description</strong><br>
Verify if the file attached to the BFD <var>abfd</var> is compatible
with the format <var>format</var> (i.e., one of <code>bfd_object</code>,
<code>bfd_archive</code> or <code>bfd_core</code>).
<p>If the BFD has been set to a specific target before the
call, only the named target and format combination is
checked. If the target has not been set, or has been set to
<code>default</code>, then all the known target backends is
interrogated to determine a match. If the default target
matches, it is used. If not, exactly one target must recognize
the file, or an error results.
<p>The function returns <code>TRUE</code> on success, otherwise <code>FALSE</code>
with one of the following error codes:
<ul>
<li><code>bfd_error_invalid_operation</code> -
if <code>format</code> is not one of <code>bfd_object</code>, <code>bfd_archive</code> or
<code>bfd_core</code>.
<li><code>bfd_error_system_call</code> -
if an error occured during a read - even some file mismatches
can cause bfd_error_system_calls.
<li><code>file_not_recognised</code> -
none of the backends recognised the file format.
<li><code>bfd_error_file_ambiguously_recognized</code> -
more than one backend recognised the file format.
</ul>
<p><a name="index-bfd_005fcheck_005fformat_005fmatches-77"></a>
<h5 class="subsubsection">2.9.1.2 <code>bfd_check_format_matches</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_check_format_matches
(bfd *abfd, bfd_format format, char ***matching);
</pre>
<p><strong>Description</strong><br>
Like <code>bfd_check_format</code>, except when it returns FALSE with
<code>bfd_errno</code> set to <code>bfd_error_file_ambiguously_recognized</code>. In that
case, if <var>matching</var> is not NULL, it will be filled in with
a NULL-terminated list of the names of the formats that matched,
allocated with <code>malloc</code>.
Then the user may choose a format and try again.
<p>When done with the list that <var>matching</var> points to, the caller
should free it.
<p><a name="index-bfd_005fset_005fformat-78"></a>
<h5 class="subsubsection">2.9.1.3 <code>bfd_set_format</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
</pre>
<p><strong>Description</strong><br>
This function sets the file format of the BFD <var>abfd</var> to the
format <var>format</var>. If the target set in the BFD does not
support the format requested, the format is invalid, or the BFD
is not open for writing, then an error occurs.
<p><a name="index-bfd_005fformat_005fstring-79"></a>
<h5 class="subsubsection">2.9.1.4 <code>bfd_format_string</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const char *bfd_format_string (bfd_format format);
</pre>
<p><strong>Description</strong><br>
Return a pointer to a const string
<code>invalid</code>, <code>object</code>, <code>archive</code>, <code>core</code>, or <code>unknown</code>,
depending upon the value of <var>format</var>.
</body></html>

View file

@ -0,0 +1,431 @@
<html lang="en">
<head>
<title>GNU Free Documentation License - 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="prev" href="BFD-back-ends.html#BFD-back-ends" title="BFD back ends">
<link rel="next" href="BFD-Index.html#BFD-Index" title="BFD Index">
<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="GNU-Free-Documentation-License"></a>Next:&nbsp;<a rel="next" accesskey="n" href="BFD-Index.html#BFD-Index">BFD Index</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="BFD-back-ends.html#BFD-back-ends">BFD back ends</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr><br>
</div>
<!-- *-texinfo-*- -->
<h2 class="appendix">Appendix A GNU Free Documentation License</h2>
<div align="center">Version 1.1, March 2000</div>
<pre class="display"> Copyright (C) 2000, 2003 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
</pre>
<pre class="sp">
</pre>
<ol type=1 start=0>
<li>PREAMBLE
<p>The purpose of this License is to make a manual, textbook, or other
written document &ldquo;free&rdquo; in the sense of freedom: to assure everyone
the effective freedom to copy and redistribute it, with or without
modifying it, either commercially or noncommercially. Secondarily,
this License preserves for the author and publisher a way to get
credit for their work, while not being considered responsible for
modifications made by others.
<p>This License is a kind of &ldquo;copyleft&rdquo;, which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
<p>We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
<pre class="sp">
</pre>
<li>APPLICABILITY AND DEFINITIONS
<p>This License applies to any manual or other work that contains a
notice placed by the copyright holder saying it can be distributed
under the terms of this License. The &ldquo;Document&rdquo;, below, refers to any
such manual or work. Any member of the public is a licensee, and is
addressed as &ldquo;you.&rdquo;
<p>A &ldquo;Modified Version&rdquo; of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
<p>A &ldquo;Secondary Section&rdquo; is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (For example, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
<p>The &ldquo;Invariant Sections&rdquo; are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License.
<p>The &ldquo;Cover Texts&rdquo; are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License.
<p>A &ldquo;Transparent&rdquo; copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, whose contents can be viewed and edited directly and
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup has been designed to thwart or discourage
subsequent modification by readers is not Transparent. A copy that is
not &ldquo;Transparent&rdquo; is called &ldquo;Opaque.&rdquo;
<p>Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML designed for human modification. Opaque formats include
PostScript, PDF, proprietary formats that can be read and edited only
by proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML produced by some word processors for output
purposes only.
<p>The &ldquo;Title Page&rdquo; means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, &ldquo;Title Page&rdquo; means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
<pre class="sp">
</pre>
<li>VERBATIM COPYING
<p>You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
<p>You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
<pre class="sp">
</pre>
<li>COPYING IN QUANTITY
<p>If you publish printed copies of the Document numbering more than 100,
and the Document's license notice requires Cover Texts, you must enclose
the copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
<p>If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
<p>If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a publicly-accessible computer-network location containing a complete
Transparent copy of the Document, free of added material, which the
general network-using public has access to download anonymously at no
charge using public-standard network protocols. If you use the latter
option, you must take reasonably prudent steps, when you begin
distribution of Opaque copies in quantity, to ensure that this
Transparent copy will remain thus accessible at the stated location
until at least one year after the last time you distribute an Opaque
copy (directly or through your agents or retailers) of that edition to
the public.
<p>It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
<pre class="sp">
</pre>
<li>MODIFICATIONS
<p>You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
<p>A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.<br>
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has less than five).<br>
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.<br>
D. Preserve all the copyright notices of the Document.<br>
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.<br>
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.<br>
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.<br>
H. Include an unaltered copy of this License.<br>
I. Preserve the section entitled &ldquo;History&rdquo;, and its title, and add to
it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section entitled &ldquo;History&rdquo; in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.<br>
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the &ldquo;History&rdquo; section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.<br>
K. In any section entitled &ldquo;Acknowledgements&rdquo; or &ldquo;Dedications&rdquo;,
preserve the section's title, and preserve in the section all the
substance and tone of each of the contributor acknowledgements
and/or dedications given therein.<br>
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.<br>
M. Delete any section entitled &ldquo;Endorsements.&rdquo; Such a section
may not be included in the Modified Version.<br>
N. Do not retitle any existing section as &ldquo;Endorsements&rdquo;
or to conflict in title with any Invariant Section.<br>
<pre class="sp">
</pre>
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
<p>You may add a section entitled &ldquo;Endorsements&rdquo;, provided it contains
nothing but endorsements of your Modified Version by various
parties&ndash;for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
<p>You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
<p>The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
<pre class="sp">
</pre>
<li>COMBINING DOCUMENTS
<p>You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice.
<p>The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
<p>In the combination, you must combine any sections entitled &ldquo;History&rdquo;
in the various original documents, forming one section entitled
&ldquo;History&rdquo;; likewise combine any sections entitled &ldquo;Acknowledgements&rdquo;,
and any sections entitled &ldquo;Dedications.&rdquo; You must delete all sections
entitled &ldquo;Endorsements.&rdquo;
<pre class="sp">
</pre>
<li>COLLECTIONS OF DOCUMENTS
<p>You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
<p>You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
<pre class="sp">
</pre>
<li>AGGREGATION WITH INDEPENDENT WORKS
<p>A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, does not as a whole count as a Modified Version
of the Document, provided no compilation copyright is claimed for the
compilation. Such a compilation is called an &ldquo;aggregate&rdquo;, and this
License does not apply to the other self-contained works thus compiled
with the Document, on account of their being thus compiled, if they
are not themselves derivative works of the Document.
<p>If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one quarter
of the entire aggregate, the Document's Cover Texts may be placed on
covers that surround only the Document within the aggregate.
Otherwise they must appear on covers around the whole aggregate.
<pre class="sp">
</pre>
<li>TRANSLATION
<p>Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License provided that you also include the
original English version of this License. In case of a disagreement
between the translation and the original English version of this
License, the original English version will prevail.
<pre class="sp">
</pre>
<li>TERMINATION
<p>You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
<pre class="sp">
</pre>
<li>FUTURE REVISIONS OF THIS LICENSE
<p>The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
<p>Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License &ldquo;or any later version&rdquo; applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
</ol>
<h3 class="unnumberedsec">ADDENDUM: How to use this License for your documents</h3>
<p>To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
<pre class="smallexample"> Copyright (C) <var>year</var> <var>your name</var>.
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 <var>list their titles</var>, with the
Front-Cover Texts being <var>list</var>, and with the Back-Cover Texts being <var>list</var>.
A copy of the license is included in the section entitled "GNU
Free Documentation License."
</pre>
<p>If you have no Invariant Sections, write &ldquo;with no Invariant Sections&rdquo;
instead of saying which ones are invariant. If you have no
Front-Cover Texts, write &ldquo;no Front-Cover Texts&rdquo; instead of
&ldquo;Front-Cover Texts being <var>list</var>&rdquo;; likewise for Back-Cover Texts.
<p>If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
</body></html>

View file

@ -0,0 +1,82 @@
<html lang="en">
<head>
<title>Hash Tables - 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="Linker-Functions.html#Linker-Functions" title="Linker Functions">
<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="Hash-Tables"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="Linker-Functions.html#Linker-Functions">Linker Functions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.18 Hash Tables</h3>
<p><a name="index-Hash-tables-1381"></a>BFD provides a simple set of hash table functions. Routines
are provided to initialize a hash table, to free a hash table,
to look up a string in a hash table and optionally create an
entry for it, and to traverse a hash table. There is
currently no routine to delete an string from a hash table.
<p>The basic hash table does not permit any data to be stored
with a string. However, a hash table is designed to present a
base class from which other types of hash tables may be
derived. These derived types may store additional information
with the string. Hash tables were implemented in this way,
rather than simply providing a data pointer in a hash table
entry, because they were designed for use by the linker back
ends. The linker may create thousands of hash table entries,
and the overhead of allocating private data and storing and
following pointers becomes noticeable.
<p>The basic hash table code is in <code>hash.c</code>.
<ul class="menu">
<li><a accesskey="1" href="Creating-and-Freeing-a-Hash-Table.html#Creating-and-Freeing-a-Hash-Table">Creating and Freeing a Hash Table</a>
<li><a accesskey="2" href="Looking-Up-or-Entering-a-String.html#Looking-Up-or-Entering-a-String">Looking Up or Entering a String</a>
<li><a accesskey="3" href="Traversing-a-Hash-Table.html#Traversing-a-Hash-Table">Traversing a Hash Table</a>
<li><a accesskey="4" href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type">Deriving a New Hash Table Type</a>
</ul>
</body></html>

View file

@ -0,0 +1,76 @@
<html lang="en">
<head>
<title>History - 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="Overview.html#Overview" title="Overview">
<link rel="prev" href="Overview.html#Overview" title="Overview">
<link rel="next" href="How-It-Works.html#How-It-Works" title="How It Works">
<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="History"></a>Next:&nbsp;<a rel="next" accesskey="n" href="How-It-Works.html#How-It-Works">How It Works</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Overview.html#Overview">Overview</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Overview.html#Overview">Overview</a>
<hr><br>
</div>
<h3 class="section">1.1 History</h3>
<p>One spur behind BFD was the desire, on the part of the GNU 960 team at
Intel Oregon, for interoperability of applications on their COFF and
b.out file formats. Cygnus was providing GNU support for the team, and
was contracted to provide the required functionality.
<p>The name came from a conversation David Wallace was having with Richard
Stallman about the library: RMS said that it would be quite hard&mdash;David
said &ldquo;BFD&rdquo;. Stallman was right, but the name stuck.
<p>At the same time, Ready Systems wanted much the same thing, but for
different object file formats: IEEE-695, Oasys, Srecords, a.out and 68k
coff.
<p>BFD was first implemented by members of Cygnus Support; Steve
Chamberlain (<code>sac@cygnus.com</code>), John Gilmore
(<code>gnu@cygnus.com</code>), K. Richard Pixley (<code>rich@cygnus.com</code>)
and David Henkel-Wallace (<code>gumby@cygnus.com</code>).
</body></html>

View file

@ -0,0 +1,99 @@
<html lang="en">
<head>
<title>How It Works - 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="Overview.html#Overview" title="Overview">
<link rel="prev" href="History.html#History" title="History">
<link rel="next" href="What-BFD-Version-2-Can-Do.html#What-BFD-Version-2-Can-Do" title="What BFD Version 2 Can Do">
<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="How-It-Works"></a>Next:&nbsp;<a rel="next" accesskey="n" href="What-BFD-Version-2-Can-Do.html#What-BFD-Version-2-Can-Do">What BFD Version 2 Can Do</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="History.html#History">History</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Overview.html#Overview">Overview</a>
<hr><br>
</div>
<h3 class="section">1.2 How To Use BFD</h3>
<p>To use the library, include <span class="file">bfd.h</span> and link with <span class="file">libbfd.a</span>.
<p>BFD provides a common interface to the parts of an object file
for a calling application.
<p>When an application successfully opens a target file (object, archive, or
whatever), a pointer to an internal structure is returned. This pointer
points to a structure called <code>bfd</code>, described in
<span class="file">bfd.h</span>. Our convention is to call this pointer a BFD, and
instances of it within code <code>abfd</code>. All operations on
the target object file are applied as methods to the BFD. The mapping is
defined within <code>bfd.h</code> in a set of macros, all beginning
with <span class="samp">bfd_</span> to reduce namespace pollution.
<p>For example, this sequence does what you would probably expect:
return the number of sections in an object file attached to a BFD
<code>abfd</code>.
<pre class="example"> <!-- @cartouche -->
#include "bfd.h"
unsigned int number_of_sections (abfd)
bfd *abfd;
{
return bfd_count_sections (abfd);
}
<!-- @end cartouche -->
</pre>
<p>The abstraction used within BFD is that an object file has:
<ul>
<li>a header,
<li>a number of sections containing raw data (see <a href="Sections.html#Sections">Sections</a>),
<li>a set of relocations (see <a href="Relocations.html#Relocations">Relocations</a>), and
<li>some symbol information (see <a href="Symbols.html#Symbols">Symbols</a>).
</ul>
Also, BFDs opened for archives have the additional attribute of an index
and contain subordinate BFDs. This approach is fine for a.out and coff,
but loses efficiency when applied to formats such as S-records and
IEEE-695.
</body></html>

View file

@ -0,0 +1,77 @@
<html lang="en">
<head>
<title>Information provided by the linker - 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="Performing-the-Final-Link.html#Performing-the-Final-Link" title="Performing the Final Link">
<link rel="prev" href="Performing-the-Final-Link.html#Performing-the-Final-Link" title="Performing the Final Link">
<link rel="next" href="Relocating-the-section-contents.html#Relocating-the-section-contents" title="Relocating the section contents">
<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="Information-provided-by-the-linker"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Relocating-the-section-contents.html#Relocating-the-section-contents">Relocating the section contents</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Performing-the-Final-Link.html#Performing-the-Final-Link">Performing the Final Link</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Performing-the-Final-Link.html#Performing-the-Final-Link">Performing the Final Link</a>
<hr><br>
</div>
<h5 class="subsubsection">2.17.3.1 Information provided by the linker</h5>
<p>Before the linker calls the <code>_bfd_final_link</code> entry point,
it sets up some data structures for the function to use.
<p>The <code>input_bfds</code> field of the <code>bfd_link_info</code> structure
will point to a list of all the input files included in the
link. These files are linked through the <code>link_next</code> field
of the <code>bfd</code> structure.
<p>Each section in the output file will have a list of
<code>link_order</code> structures attached to the <code>map_head.link_order</code>
field (the <code>link_order</code> structure is defined in
<code>bfdlink.h</code>). These structures describe how to create the
contents of the output section in terms of the contents of
various input sections, fill constants, and, eventually, other
types of information. They also describe relocs that must be
created by the BFD backend, but do not correspond to any input
file; this is used to support -Ur, which builds constructors
while generating a relocatable object file.
</body></html>

View file

@ -0,0 +1,73 @@
<html lang="en">
<head>
<title>Initialization - 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="Memory-Usage.html#Memory-Usage" title="Memory Usage">
<link rel="next" href="Sections.html#Sections" title="Sections">
<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="Initialization"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Sections.html#Sections">Sections</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Memory-Usage.html#Memory-Usage">Memory Usage</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.5 Initialization</h3>
<h4 class="subsection">2.5.1 Initialization functions</h4>
<p>These are the functions that handle initializing a BFD.
<p><a name="index-bfd_005finit-39"></a>
<h5 class="subsubsection">2.5.1.1 <code>bfd_init</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void bfd_init (void);
</pre>
<p><strong>Description</strong><br>
This routine must be called before any other BFD function to
initialize magical internal data structures.
</body></html>

View file

@ -0,0 +1,237 @@
<html lang="en">
<head>
<title>Internal - 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="Opening-and-Closing.html#Opening-and-Closing" title="Opening and Closing">
<link rel="next" href="File-Caching.html#File-Caching" title="File Caching">
<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="Internal"></a>Next:&nbsp;<a rel="next" accesskey="n" href="File-Caching.html#File-Caching">File Caching</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Opening-and-Closing.html#Opening-and-Closing">Opening and Closing</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.15 Implementation details</h3>
<h4 class="subsection">2.15.1 Internal functions</h4>
<p><strong>Description</strong><br>
These routines are used within BFD.
They are not intended for export, but are documented here for
completeness.
<p><a name="index-bfd_005fwrite_005fbigendian_005f4byte_005fint-1359"></a>
<h5 class="subsubsection">2.15.1.1 <code>bfd_write_bigendian_4byte_int</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
</pre>
<p><strong>Description</strong><br>
Write a 4 byte integer <var>i</var> to the output BFD <var>abfd</var>, in big
endian order regardless of what else is going on. This is useful in
archives.
<p><a name="index-bfd_005fput_005fsize-1360"></a>
<h5 class="subsubsection">2.15.1.2 <code>bfd_put_size</code></h5>
<p><a name="index-bfd_005fget_005fsize-1361"></a>
<h5 class="subsubsection">2.15.1.3 <code>bfd_get_size</code></h5>
<p><strong>Description</strong><br>
These macros as used for reading and writing raw data in
sections; each access (except for bytes) is vectored through
the target format of the BFD and mangled accordingly. The
mangling performs any necessary endian translations and
removes alignment restrictions. Note that types accepted and
returned by these macros are identical so they can be swapped
around in macros&mdash;for example, <span class="file">libaout.h</span> defines <code>GET_WORD</code>
to either <code>bfd_get_32</code> or <code>bfd_get_64</code>.
<p>In the put routines, <var>val</var> must be a <code>bfd_vma</code>. If we are on a
system without prototypes, the caller is responsible for making
sure that is true, with a cast if necessary. We don't cast
them in the macro definitions because that would prevent <code>lint</code>
or <code>gcc -Wall</code> from detecting sins such as passing a pointer.
To detect calling these with less than a <code>bfd_vma</code>, use
<code>gcc -Wconversion</code> on a host with 64 bit <code>bfd_vma</code>'s.
<pre class="example">
/* Byte swapping macros for user section data. */
#define bfd_put_8(abfd, val, ptr) \
((void) (*((unsigned char *) (ptr)) = (val) &amp; 0xff))
#define bfd_put_signed_8 \
bfd_put_8
#define bfd_get_8(abfd, ptr) \
(*(unsigned char *) (ptr) &amp; 0xff)
#define bfd_get_signed_8(abfd, ptr) \
(((*(unsigned char *) (ptr) &amp; 0xff) ^ 0x80) - 0x80)
#define bfd_put_16(abfd, val, ptr) \
BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
#define bfd_put_signed_16 \
bfd_put_16
#define bfd_get_16(abfd, ptr) \
BFD_SEND (abfd, bfd_getx16, (ptr))
#define bfd_get_signed_16(abfd, ptr) \
BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
#define bfd_put_32(abfd, val, ptr) \
BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
#define bfd_put_signed_32 \
bfd_put_32
#define bfd_get_32(abfd, ptr) \
BFD_SEND (abfd, bfd_getx32, (ptr))
#define bfd_get_signed_32(abfd, ptr) \
BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
#define bfd_put_64(abfd, val, ptr) \
BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
#define bfd_put_signed_64 \
bfd_put_64
#define bfd_get_64(abfd, ptr) \
BFD_SEND (abfd, bfd_getx64, (ptr))
#define bfd_get_signed_64(abfd, ptr) \
BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
#define bfd_get(bits, abfd, ptr) \
((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
: (bits) == 16 ? bfd_get_16 (abfd, ptr) \
: (bits) == 32 ? bfd_get_32 (abfd, ptr) \
: (bits) == 64 ? bfd_get_64 (abfd, ptr) \
: (abort (), (bfd_vma) - 1))
#define bfd_put(bits, abfd, val, ptr) \
((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
: (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
: (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
: (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
: (abort (), (void) 0))
</pre>
<p><a name="index-bfd_005fh_005fput_005fsize-1362"></a>
<h5 class="subsubsection">2.15.1.4 <code>bfd_h_put_size</code></h5>
<p><strong>Description</strong><br>
These macros have the same function as their <code>bfd_get_x</code>
brethren, except that they are used for removing information
for the header records of object files. Believe it or not,
some object files keep their header records in big endian
order and their data in little endian order.
<pre class="example">
/* Byte swapping macros for file header data. */
#define bfd_h_put_8(abfd, val, ptr) \
bfd_put_8 (abfd, val, ptr)
#define bfd_h_put_signed_8(abfd, val, ptr) \
bfd_put_8 (abfd, val, ptr)
#define bfd_h_get_8(abfd, ptr) \
bfd_get_8 (abfd, ptr)
#define bfd_h_get_signed_8(abfd, ptr) \
bfd_get_signed_8 (abfd, ptr)
#define bfd_h_put_16(abfd, val, ptr) \
BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
#define bfd_h_put_signed_16 \
bfd_h_put_16
#define bfd_h_get_16(abfd, ptr) \
BFD_SEND (abfd, bfd_h_getx16, (ptr))
#define bfd_h_get_signed_16(abfd, ptr) \
BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
#define bfd_h_put_32(abfd, val, ptr) \
BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
#define bfd_h_put_signed_32 \
bfd_h_put_32
#define bfd_h_get_32(abfd, ptr) \
BFD_SEND (abfd, bfd_h_getx32, (ptr))
#define bfd_h_get_signed_32(abfd, ptr) \
BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
#define bfd_h_put_64(abfd, val, ptr) \
BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
#define bfd_h_put_signed_64 \
bfd_h_put_64
#define bfd_h_get_64(abfd, ptr) \
BFD_SEND (abfd, bfd_h_getx64, (ptr))
#define bfd_h_get_signed_64(abfd, ptr) \
BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
/* Aliases for the above, which should eventually go away. */
#define H_PUT_64 bfd_h_put_64
#define H_PUT_32 bfd_h_put_32
#define H_PUT_16 bfd_h_put_16
#define H_PUT_8 bfd_h_put_8
#define H_PUT_S64 bfd_h_put_signed_64
#define H_PUT_S32 bfd_h_put_signed_32
#define H_PUT_S16 bfd_h_put_signed_16
#define H_PUT_S8 bfd_h_put_signed_8
#define H_GET_64 bfd_h_get_64
#define H_GET_32 bfd_h_get_32
#define H_GET_16 bfd_h_get_16
#define H_GET_8 bfd_h_get_8
#define H_GET_S64 bfd_h_get_signed_64
#define H_GET_S32 bfd_h_get_signed_32
#define H_GET_S16 bfd_h_get_signed_16
#define H_GET_S8 bfd_h_get_signed_8
</pre>
<p><a name="index-bfd_005flog2-1363"></a>
<h5 class="subsubsection">2.15.1.5 <code>bfd_log2</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> unsigned int bfd_log2 (bfd_vma x);
</pre>
<p><strong>Description</strong><br>
Return the log base 2 of the value supplied, rounded up. E.g., an
<var>x</var> of 1025 returns 11. A <var>x</var> of 0 returns 0.
</body></html>

View file

@ -0,0 +1,94 @@
<html lang="en">
<head>
<title>Linker Functions - 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="File-Caching.html#File-Caching" title="File Caching">
<link rel="next" href="Hash-Tables.html#Hash-Tables" title="Hash Tables">
<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="Linker-Functions"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Hash-Tables.html#Hash-Tables">Hash Tables</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="File-Caching.html#File-Caching">File Caching</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.17 Linker Functions</h3>
<p><a name="index-Linker-1368"></a>The linker uses three special entry points in the BFD target
vector. It is not necessary to write special routines for
these entry points when creating a new BFD back end, since
generic versions are provided. However, writing them can
speed up linking and make it use significantly less runtime
memory.
<p>The first routine creates a hash table used by the other
routines. The second routine adds the symbols from an object
file to the hash table. The third routine takes all the
object files and links them together to create the output
file. These routines are designed so that the linker proper
does not need to know anything about the symbols in the object
files that it is linking. The linker merely arranges the
sections as directed by the linker script and lets BFD handle
the details of symbols and relocs.
<p>The second routine and third routines are passed a pointer to
a <code>struct bfd_link_info</code> structure (defined in
<code>bfdlink.h</code>) which holds information relevant to the link,
including the linker hash table (which was created by the
first routine) and a set of callback functions to the linker
proper.
<p>The generic linker routines are in <code>linker.c</code>, and use the
header file <code>genlink.h</code>. As of this writing, the only back
ends which have implemented versions of these routines are
a.out (in <code>aoutx.h</code>) and ECOFF (in <code>ecoff.c</code>). The a.out
routines are used as examples throughout this section.
<ul class="menu">
<li><a accesskey="1" href="Creating-a-Linker-Hash-Table.html#Creating-a-Linker-Hash-Table">Creating a Linker Hash Table</a>
<li><a accesskey="2" href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table">Adding Symbols to the Hash Table</a>
<li><a accesskey="3" href="Performing-the-Final-Link.html#Performing-the-Final-Link">Performing the Final Link</a>
</ul>
</body></html>

View file

@ -0,0 +1,82 @@
<html lang="en">
<head>
<title>Looking Up or Entering a String - 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="Hash-Tables.html#Hash-Tables" title="Hash Tables">
<link rel="prev" href="Creating-and-Freeing-a-Hash-Table.html#Creating-and-Freeing-a-Hash-Table" title="Creating and Freeing a Hash Table">
<link rel="next" href="Traversing-a-Hash-Table.html#Traversing-a-Hash-Table" title="Traversing a Hash Table">
<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="Looking-Up-or-Entering-a-String"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Traversing-a-Hash-Table.html#Traversing-a-Hash-Table">Traversing a Hash Table</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Creating-and-Freeing-a-Hash-Table.html#Creating-and-Freeing-a-Hash-Table">Creating and Freeing a Hash Table</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Hash-Tables.html#Hash-Tables">Hash Tables</a>
<hr><br>
</div>
<h4 class="subsection">2.18.2 Looking up or entering a string</h4>
<p><a name="index-bfd_005fhash_005flookup-1388"></a>The function <code>bfd_hash_lookup</code> is used both to look up a
string in the hash table and to create a new entry.
<p>If the <var>create</var> argument is <code>FALSE</code>, <code>bfd_hash_lookup</code>
will look up a string. If the string is found, it will
returns a pointer to a <code>struct bfd_hash_entry</code>. If the
string is not found in the table <code>bfd_hash_lookup</code> will
return <code>NULL</code>. You should not modify any of the fields in
the returns <code>struct bfd_hash_entry</code>.
<p>If the <var>create</var> argument is <code>TRUE</code>, the string will be
entered into the hash table if it is not already there.
Either way a pointer to a <code>struct bfd_hash_entry</code> will be
returned, either to the existing structure or to a newly
created one. In this case, a <code>NULL</code> return means that an
error occurred.
<p>If the <var>create</var> argument is <code>TRUE</code>, and a new entry is
created, the <var>copy</var> argument is used to decide whether to
copy the string onto the hash table objalloc or not. If
<var>copy</var> is passed as <code>FALSE</code>, you must be careful not to
deallocate or modify the string as long as the hash table
exists.
</body></html>

View file

@ -0,0 +1,79 @@
<html lang="en">
<head>
<title>Memory Usage - 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="BFD-front-end.html#BFD-front-end" title="BFD front end">
<link rel="next" href="Initialization.html#Initialization" title="Initialization">
<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="Memory-Usage"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Initialization.html#Initialization">Initialization</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="BFD-front-end.html#BFD-front-end">BFD front end</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.4 Memory Usage</h3>
<p>BFD keeps all of its internal structures in obstacks. There is one obstack
per open BFD file, into which the current state is stored. When a BFD is
closed, the obstack is deleted, and so everything which has been
allocated by BFD for the closing file is thrown away.
<p>BFD does not free anything created by an application, but pointers into
<code>bfd</code> structures become invalid on a <code>bfd_close</code>; for example,
after a <code>bfd_close</code> the vector passed to
<code>bfd_canonicalize_symtab</code> is still around, since it has been
allocated by the application, but the data that it pointed to are
lost.
<p>The general rule is to not close a BFD until all operations dependent
upon data from the BFD have been completed, or all the data from within
the file has been copied. To help with the management of memory, there
is a function (<code>bfd_alloc_size</code>) which returns the number of bytes
in obstacks associated with the supplied BFD. This could be used to
select the greediest open BFD, close it to reclaim the memory, perform
some operation and reopen the BFD again, to get a fresh copy of the data
structures.
</body></html>

View file

@ -0,0 +1,75 @@
<html lang="en">
<head>
<title>Mini Symbols - 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="Symbols.html#Symbols" title="Symbols">
<link rel="prev" href="Writing-Symbols.html#Writing-Symbols" title="Writing Symbols">
<link rel="next" href="typedef-asymbol.html#typedef-asymbol" title="typedef asymbol">
<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="Mini-Symbols"></a>Next:&nbsp;<a rel="next" accesskey="n" href="typedef-asymbol.html#typedef-asymbol">typedef asymbol</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Writing-Symbols.html#Writing-Symbols">Writing Symbols</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Symbols.html#Symbols">Symbols</a>
<hr><br>
</div>
<h4 class="subsection">2.7.3 Mini Symbols</h4>
<p>Mini symbols provide read-only access to the symbol table.
They use less memory space, but require more time to access.
They can be useful for tools like nm or objdump, which may
have to handle symbol tables of extremely large executables.
<p>The <code>bfd_read_minisymbols</code> function will read the symbols
into memory in an internal form. It will return a <code>void *</code>
pointer to a block of memory, a symbol count, and the size of
each symbol. The pointer is allocated using <code>malloc</code>, and
should be freed by the caller when it is no longer needed.
<p>The function <code>bfd_minisymbol_to_symbol</code> will take a pointer
to a minisymbol, and a pointer to a structure returned by
<code>bfd_make_empty_symbol</code>, and return a <code>asymbol</code> structure.
The return value may or may not be the same as the value from
<code>bfd_make_empty_symbol</code> which was passed in.
</body></html>

View file

@ -0,0 +1,448 @@
<html lang="en">
<head>
<title>Opening and Closing - 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="Architectures.html#Architectures" title="Architectures">
<link rel="next" href="Internal.html#Internal" title="Internal">
<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="Opening-and-Closing"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Internal.html#Internal">Internal</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Architectures.html#Architectures">Architectures</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.14 Opening and closing BFDs</h3>
<h4 class="subsection">2.14.1 Functions for opening and closing</h4>
<p><a name="index-bfd_005ffopen-1337"></a>
<h5 class="subsubsection">2.14.1.1 <code>bfd_fopen</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd *bfd_fopen (const char *filename, const char *target,
const char *mode, int fd);
</pre>
<p><strong>Description</strong><br>
Open the file <var>filename</var> with the target <var>target</var>.
Return a pointer to the created BFD. If <var>fd</var> is not -1,
then <code>fdopen</code> is used to open the file; otherwise, <code>fopen</code>
is used. <var>mode</var> is passed directly to <code>fopen</code> or
<code>fdopen</code>.
<p>Calls <code>bfd_find_target</code>, so <var>target</var> is interpreted as by
that function.
<p>The new BFD is marked as cacheable iff <var>fd</var> is -1.
<p>If <code>NULL</code> is returned then an error has occured. Possible errors
are <code>bfd_error_no_memory</code>, <code>bfd_error_invalid_target</code> or
<code>system_call</code> error.
<p><a name="index-bfd_005fopenr-1338"></a>
<h5 class="subsubsection">2.14.1.2 <code>bfd_openr</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd *bfd_openr (const char *filename, const char *target);
</pre>
<p><strong>Description</strong><br>
Open the file <var>filename</var> (using <code>fopen</code>) with the target
<var>target</var>. Return a pointer to the created BFD.
<p>Calls <code>bfd_find_target</code>, so <var>target</var> is interpreted as by
that function.
<p>If <code>NULL</code> is returned then an error has occured. Possible errors
are <code>bfd_error_no_memory</code>, <code>bfd_error_invalid_target</code> or
<code>system_call</code> error.
<p><a name="index-bfd_005ffdopenr-1339"></a>
<h5 class="subsubsection">2.14.1.3 <code>bfd_fdopenr</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
</pre>
<p><strong>Description</strong><br>
<code>bfd_fdopenr</code> is to <code>bfd_fopenr</code> much like <code>fdopen</code> is to
<code>fopen</code>. It opens a BFD on a file already described by the
<var>fd</var> supplied.
<p>When the file is later <code>bfd_close</code>d, the file descriptor will
be closed. If the caller desires that this file descriptor be
cached by BFD (opened as needed, closed as needed to free
descriptors for other opens), with the supplied <var>fd</var> used as
an initial file descriptor (but subject to closure at any time),
call bfd_set_cacheable(bfd, 1) on the returned BFD. The default
is to assume no caching; the file descriptor will remain open
until <code>bfd_close</code>, and will not be affected by BFD operations
on other files.
<p>Possible errors are <code>bfd_error_no_memory</code>,
<code>bfd_error_invalid_target</code> and <code>bfd_error_system_call</code>.
<p><a name="index-bfd_005fopenstreamr-1340"></a>
<h5 class="subsubsection">2.14.1.4 <code>bfd_openstreamr</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd *bfd_openstreamr (const char *, const char *, void *);
</pre>
<p><strong>Description</strong><br>
Open a BFD for read access on an existing stdio stream. When
the BFD is passed to <code>bfd_close</code>, the stream will be closed.
<p><a name="index-bfd_005fopenr_005fiovec-1341"></a>
<h5 class="subsubsection">2.14.1.5 <code>bfd_openr_iovec</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd *bfd_openr_iovec (const char *filename, const char *target,
void *(*open) (struct bfd *nbfd,
void *open_closure),
void *open_closure,
file_ptr (*pread) (struct bfd *nbfd,
void *stream,
void *buf,
file_ptr nbytes,
file_ptr offset),
int (*close) (struct bfd *nbfd,
void *stream),
int (*stat) (struct bfd *abfd,
void *stream,
struct stat *sb));
</pre>
<p><strong>Description</strong><br>
Create and return a BFD backed by a read-only <var>stream</var>.
The <var>stream</var> is created using <var>open</var>, accessed using
<var>pread</var> and destroyed using <var>close</var>.
<p>Calls <code>bfd_find_target</code>, so <var>target</var> is interpreted as by
that function.
<p>Calls <var>open</var> (which can call <code>bfd_zalloc</code> and
<code>bfd_get_filename</code>) to obtain the read-only stream backing
the BFD. <var>open</var> either succeeds returning the
non-<code>NULL</code> <var>stream</var>, or fails returning <code>NULL</code>
(setting <code>bfd_error</code>).
<p>Calls <var>pread</var> to request <var>nbytes</var> of data from
<var>stream</var> starting at <var>offset</var> (e.g., via a call to
<code>bfd_read</code>). <var>pread</var> either succeeds returning the
number of bytes read (which can be less than <var>nbytes</var> when
end-of-file), or fails returning -1 (setting <code>bfd_error</code>).
<p>Calls <var>close</var> when the BFD is later closed using
<code>bfd_close</code>. <var>close</var> either succeeds returning 0, or
fails returning -1 (setting <code>bfd_error</code>).
<p>Calls <var>stat</var> to fill in a stat structure for bfd_stat,
bfd_get_size, and bfd_get_mtime calls. <var>stat</var> returns 0
on success, or returns -1 on failure (setting <code>bfd_error</code>).
<p>If <code>bfd_openr_iovec</code> returns <code>NULL</code> then an error has
occurred. Possible errors are <code>bfd_error_no_memory</code>,
<code>bfd_error_invalid_target</code> and <code>bfd_error_system_call</code>.
<p><a name="index-bfd_005fopenw-1342"></a>
<h5 class="subsubsection">2.14.1.6 <code>bfd_openw</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd *bfd_openw (const char *filename, const char *target);
</pre>
<p><strong>Description</strong><br>
Create a BFD, associated with file <var>filename</var>, using the
file format <var>target</var>, and return a pointer to it.
<p>Possible errors are <code>bfd_error_system_call</code>, <code>bfd_error_no_memory</code>,
<code>bfd_error_invalid_target</code>.
<p><a name="index-bfd_005fclose-1343"></a>
<h5 class="subsubsection">2.14.1.7 <code>bfd_close</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_close (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Close a BFD. If the BFD was open for writing, then pending
operations are completed and the file written out and closed.
If the created file is executable, then <code>chmod</code> is called
to mark it as such.
<p>All memory attached to the BFD is released.
<p>The file descriptor associated with the BFD is closed (even
if it was passed in to BFD by <code>bfd_fdopenr</code>).
<p><strong>Returns</strong><br>
<code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>.
<p><a name="index-bfd_005fclose_005fall_005fdone-1344"></a>
<h5 class="subsubsection">2.14.1.8 <code>bfd_close_all_done</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_close_all_done (bfd *);
</pre>
<p><strong>Description</strong><br>
Close a BFD. Differs from <code>bfd_close</code> since it does not
complete any pending operations. This routine would be used
if the application had just used BFD for swapping and didn't
want to use any of the writing code.
<p>If the created file is executable, then <code>chmod</code> is called
to mark it as such.
<p>All memory attached to the BFD is released.
<p><strong>Returns</strong><br>
<code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>.
<p><a name="index-bfd_005fcreate-1345"></a>
<h5 class="subsubsection">2.14.1.9 <code>bfd_create</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd *bfd_create (const char *filename, bfd *templ);
</pre>
<p><strong>Description</strong><br>
Create a new BFD in the manner of <code>bfd_openw</code>, but without
opening a file. The new BFD takes the target from the target
used by <var>template</var>. The format is always set to <code>bfd_object</code>.
<p><a name="index-bfd_005fmake_005fwritable-1346"></a>
<h5 class="subsubsection">2.14.1.10 <code>bfd_make_writable</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_make_writable (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Takes a BFD as created by <code>bfd_create</code> and converts it
into one like as returned by <code>bfd_openw</code>. It does this
by converting the BFD to BFD_IN_MEMORY. It's assumed that
you will call <code>bfd_make_readable</code> on this bfd later.
<p><strong>Returns</strong><br>
<code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>.
<p><a name="index-bfd_005fmake_005freadable-1347"></a>
<h5 class="subsubsection">2.14.1.11 <code>bfd_make_readable</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_make_readable (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Takes a BFD as created by <code>bfd_create</code> and
<code>bfd_make_writable</code> and converts it into one like as
returned by <code>bfd_openr</code>. It does this by writing the
contents out to the memory buffer, then reversing the
direction.
<p><strong>Returns</strong><br>
<code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>.
<p><a name="index-bfd_005falloc-1348"></a>
<h5 class="subsubsection">2.14.1.12 <code>bfd_alloc</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void *bfd_alloc (bfd *abfd, bfd_size_type wanted);
</pre>
<p><strong>Description</strong><br>
Allocate a block of <var>wanted</var> bytes of memory attached to
<code>abfd</code> and return a pointer to it.
<p><a name="index-bfd_005falloc2-1349"></a>
<h5 class="subsubsection">2.14.1.13 <code>bfd_alloc2</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
</pre>
<p><strong>Description</strong><br>
Allocate a block of <var>nmemb</var> elements of <var>size</var> bytes each
of memory attached to <code>abfd</code> and return a pointer to it.
<p><a name="index-bfd_005fzalloc-1350"></a>
<h5 class="subsubsection">2.14.1.14 <code>bfd_zalloc</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void *bfd_zalloc (bfd *abfd, bfd_size_type wanted);
</pre>
<p><strong>Description</strong><br>
Allocate a block of <var>wanted</var> bytes of zeroed memory
attached to <code>abfd</code> and return a pointer to it.
<p><a name="index-bfd_005fzalloc2-1351"></a>
<h5 class="subsubsection">2.14.1.15 <code>bfd_zalloc2</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
</pre>
<p><strong>Description</strong><br>
Allocate a block of <var>nmemb</var> elements of <var>size</var> bytes each
of zeroed memory attached to <code>abfd</code> and return a pointer to it.
<p><a name="index-bfd_005fcalc_005fgnu_005fdebuglink_005fcrc32-1352"></a>
<h5 class="subsubsection">2.14.1.16 <code>bfd_calc_gnu_debuglink_crc32</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> unsigned long bfd_calc_gnu_debuglink_crc32
(unsigned long crc, const unsigned char *buf, bfd_size_type len);
</pre>
<p><strong>Description</strong><br>
Computes a CRC value as used in the .gnu_debuglink section.
Advances the previously computed <var>crc</var> value by computing
and adding in the crc32 for <var>len</var> bytes of <var>buf</var>.
<p><strong>Returns</strong><br>
Return the updated CRC32 value.
<p><a name="index-get_005fdebug_005flink_005finfo-1353"></a>
<h5 class="subsubsection">2.14.1.17 <code>get_debug_link_info</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> char *get_debug_link_info (bfd *abfd, unsigned long *crc32_out);
</pre>
<p><strong>Description</strong><br>
fetch the filename and CRC32 value for any separate debuginfo
associated with <var>abfd</var>. Return NULL if no such info found,
otherwise return filename and update <var>crc32_out</var>.
<p><a name="index-separate_005fdebug_005ffile_005fexists-1354"></a>
<h5 class="subsubsection">2.14.1.18 <code>separate_debug_file_exists</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean separate_debug_file_exists
(char *name, unsigned long crc32);
</pre>
<p><strong>Description</strong><br>
Checks to see if <var>name</var> is a file and if its contents
match <var>crc32</var>.
<p><a name="index-find_005fseparate_005fdebug_005ffile-1355"></a>
<h5 class="subsubsection">2.14.1.19 <code>find_separate_debug_file</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> char *find_separate_debug_file (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Searches <var>abfd</var> for a reference to separate debugging
information, scans various locations in the filesystem, including
the file tree rooted at <var>debug_file_directory</var>, and returns a
filename of such debugging information if the file is found and has
matching CRC32. Returns NULL if no reference to debugging file
exists, or file cannot be found.
<p><a name="index-bfd_005ffollow_005fgnu_005fdebuglink-1356"></a>
<h5 class="subsubsection">2.14.1.20 <code>bfd_follow_gnu_debuglink</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
</pre>
<p><strong>Description</strong><br>
Takes a BFD and searches it for a .gnu_debuglink section. If this
section is found, it examines the section for the name and checksum
of a '.debug' file containing auxiliary debugging information. It
then searches the filesystem for this .debug file in some standard
locations, including the directory tree rooted at <var>dir</var>, and if
found returns the full filename.
<p>If <var>dir</var> is NULL, it will search a default path configured into
libbfd at build time. [XXX this feature is not currently
implemented].
<p><strong>Returns</strong><br>
<code>NULL</code> on any errors or failure to locate the .debug file,
otherwise a pointer to a heap-allocated string containing the
filename. The caller is responsible for freeing this string.
<p><a name="index-bfd_005fcreate_005fgnu_005fdebuglink_005fsection-1357"></a>
<h5 class="subsubsection">2.14.1.21 <code>bfd_create_gnu_debuglink_section</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> struct bfd_section *bfd_create_gnu_debuglink_section
(bfd *abfd, const char *filename);
</pre>
<p><strong>Description</strong><br>
Takes a <var>BFD</var> and adds a .gnu_debuglink section to it. The section is sized
to be big enough to contain a link to the specified <var>filename</var>.
<p><strong>Returns</strong><br>
A pointer to the new section is returned if all is ok. Otherwise <code>NULL</code> is
returned and bfd_error is set.
<p><a name="index-bfd_005ffill_005fin_005fgnu_005fdebuglink_005fsection-1358"></a>
<h5 class="subsubsection">2.14.1.22 <code>bfd_fill_in_gnu_debuglink_section</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_fill_in_gnu_debuglink_section
(bfd *abfd, struct bfd_section *sect, const char *filename);
</pre>
<p><strong>Description</strong><br>
Takes a <var>BFD</var> and containing a .gnu_debuglink section <var>SECT</var>
and fills in the contents of the section to contain a link to the
specified <var>filename</var>. The filename should be relative to the
current directory.
<p><strong>Returns</strong><br>
<code>TRUE</code> is returned if all is ok. Otherwise <code>FALSE</code> is returned
and bfd_error is set.
</body></html>

View file

@ -0,0 +1,80 @@
<html lang="en">
<head>
<title>Overview - 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="prev" href="index.html#Top" title="Top">
<link rel="next" href="BFD-front-end.html#BFD-front-end" title="BFD front end">
<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="Overview"></a>Next:&nbsp;<a rel="next" accesskey="n" href="BFD-front-end.html#BFD-front-end">BFD front end</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="index.html#Top">Top</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr><br>
</div>
<h2 class="chapter">1 Introduction</h2>
<p><a name="index-BFD-1"></a><a name="index-what-is-it_003f-2"></a>BFD is a package which allows applications to use the
same routines to operate on object files whatever the object file
format. A new object file format can be supported simply by
creating a new BFD back end and adding it to the library.
<p>BFD is split into two parts: the front end, and the back ends (one for
each object file format).
<ul>
<li>The front end of BFD provides the interface to the user. It manages
memory and various canonical data structures. The front end also
decides which back end to use and when to call back end routines.
<li>The back ends provide BFD its view of the real world. Each back
end provides a set of calls which the BFD front end can use to maintain
its canonical form. The back ends also may keep around information for
their own use, for greater efficiency.
</ul>
<ul class="menu">
<li><a accesskey="1" href="History.html#History">History</a>: History
<li><a accesskey="2" href="How-It-Works.html#How-It-Works">How It Works</a>: How It Works
<li><a accesskey="3" href="What-BFD-Version-2-Can-Do.html#What-BFD-Version-2-Can-Do">What BFD Version 2 Can Do</a>: What BFD Version 2 Can Do
</ul>
</body></html>

View file

@ -0,0 +1,81 @@
<html lang="en">
<head>
<title>Performing the Final Link - 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="Linker-Functions.html#Linker-Functions" title="Linker Functions">
<link rel="prev" href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" title="Adding Symbols to the Hash Table">
<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="Performing-the-Final-Link"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table">Adding Symbols to the Hash Table</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Linker-Functions.html#Linker-Functions">Linker Functions</a>
<hr><br>
</div>
<h4 class="subsection">2.17.3 Performing the final link</h4>
<p><a name="index-_005fbfd_005flink_005ffinal_005flink-in-target-vector-1375"></a><a name="index-target-vector-_0028_005fbfd_005ffinal_005flink_0029-1376"></a>When all the input files have been processed, the linker calls
the <code>_bfd_final_link</code> entry point of the output BFD. This
routine is responsible for producing the final output file,
which has several aspects. It must relocate the contents of
the input sections and copy the data into the output sections.
It must build an output symbol table including any local
symbols from the input files and the global symbols from the
hash table. When producing relocatable output, it must
modify the input relocs and write them into the output file.
There may also be object format dependent work to be done.
<p>The linker will also call the <code>write_object_contents</code> entry
point when the BFD is closed. The two entry points must work
together in order to produce the correct output file.
<p>The details of how this works are inevitably dependent upon
the specific object file format. The a.out
<code>_bfd_final_link</code> routine is <code>NAME(aout,final_link)</code>.
<ul class="menu">
<li><a accesskey="1" href="Information-provided-by-the-linker.html#Information-provided-by-the-linker">Information provided by the linker</a>
<li><a accesskey="2" href="Relocating-the-section-contents.html#Relocating-the-section-contents">Relocating the section contents</a>
<li><a accesskey="3" href="Writing-the-symbol-table.html#Writing-the-symbol-table">Writing the symbol table</a>
</ul>
</body></html>

View file

@ -0,0 +1,89 @@
<html lang="en">
<head>
<title>Reading Symbols - 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="Symbols.html#Symbols" title="Symbols">
<link rel="prev" href="Symbols.html#Symbols" title="Symbols">
<link rel="next" href="Writing-Symbols.html#Writing-Symbols" title="Writing Symbols">
<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="Reading-Symbols"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Writing-Symbols.html#Writing-Symbols">Writing Symbols</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Symbols.html#Symbols">Symbols</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Symbols.html#Symbols">Symbols</a>
<hr><br>
</div>
<h4 class="subsection">2.7.1 Reading symbols</h4>
<p>There are two stages to reading a symbol table from a BFD:
allocating storage, and the actual reading process. This is an
excerpt from an application which reads the symbol table:
<pre class="example"> long storage_needed;
asymbol **symbol_table;
long number_of_symbols;
long i;
storage_needed = bfd_get_symtab_upper_bound (abfd);
if (storage_needed &lt; 0)
FAIL
if (storage_needed == 0)
return;
symbol_table = xmalloc (storage_needed);
...
number_of_symbols =
bfd_canonicalize_symtab (abfd, symbol_table);
if (number_of_symbols &lt; 0)
FAIL
for (i = 0; i &lt; number_of_symbols; i++)
process_symbol (symbol_table[i]);
</pre>
<p>All storage for the symbols themselves is in an objalloc
connected to the BFD; it is freed when the BFD is closed.
</body></html>

View file

@ -0,0 +1,89 @@
<html lang="en">
<head>
<title>Relocating the section contents - 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="Performing-the-Final-Link.html#Performing-the-Final-Link" title="Performing the Final Link">
<link rel="prev" href="Information-provided-by-the-linker.html#Information-provided-by-the-linker" title="Information provided by the linker">
<link rel="next" href="Writing-the-symbol-table.html#Writing-the-symbol-table" title="Writing the symbol table">
<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="Relocating-the-section-contents"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Writing-the-symbol-table.html#Writing-the-symbol-table">Writing the symbol table</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Information-provided-by-the-linker.html#Information-provided-by-the-linker">Information provided by the linker</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Performing-the-Final-Link.html#Performing-the-Final-Link">Performing the Final Link</a>
<hr><br>
</div>
<h5 class="subsubsection">2.17.3.2 Relocating the section contents</h5>
<p>The <code>_bfd_final_link</code> function should look through the
<code>link_order</code> structures attached to each section of the
output file. Each <code>link_order</code> structure should either be
handled specially, or it should be passed to the function
<code>_bfd_default_link_order</code> which will do the right thing
(<code>_bfd_default_link_order</code> is defined in <code>linker.c</code>).
<p>For efficiency, a <code>link_order</code> of type
<code>bfd_indirect_link_order</code> whose associated section belongs
to a BFD of the same format as the output BFD must be handled
specially. This type of <code>link_order</code> describes part of an
output section in terms of a section belonging to one of the
input files. The <code>_bfd_final_link</code> function should read the
contents of the section and any associated relocs, apply the
relocs to the section contents, and write out the modified
section contents. If performing a relocatable link, the
relocs themselves must also be modified and written out.
<p><a name="index-_005fbfd_005frelocate_005fcontents-1377"></a><a name="index-_005fbfd_005ffinal_005flink_005frelocate-1378"></a>The functions <code>_bfd_relocate_contents</code> and
<code>_bfd_final_link_relocate</code> provide some general support for
performing the actual relocations, notably overflow checking.
Their arguments include information about the symbol the
relocation is against and a <code>reloc_howto_type</code> argument
which describes the relocation to perform. These functions
are defined in <code>reloc.c</code>.
<p>The a.out function which handles reading, relocating, and
writing section contents is <code>aout_link_input_section</code>. The
actual relocation is done in <code>aout_link_input_section_std</code>
and <code>aout_link_input_section_ext</code>.
</body></html>

View file

@ -0,0 +1,76 @@
<html lang="en">
<head>
<title>Relocations - 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="Formats.html#Formats" title="Formats">
<link rel="next" href="Core-Files.html#Core-Files" title="Core Files">
<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="Relocations"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Core-Files.html#Core-Files">Core Files</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Formats.html#Formats">Formats</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.10 Relocations</h3>
<p>BFD maintains relocations in much the same way it maintains
symbols: they are left alone until required, then read in
en-masse and translated into an internal form. A common
routine <code>bfd_perform_relocation</code> acts upon the
canonical form to do the fixup.
<p>Relocations are maintained on a per section basis,
while symbols are maintained on a per BFD basis.
<p>All that a back end has to do to fit the BFD interface is to create
a <code>struct reloc_cache_entry</code> for each relocation
in a particular section, and fill in the right bits of the structures.
<ul class="menu">
<li><a accesskey="1" href="typedef-arelent.html#typedef-arelent">typedef arelent</a>
<li><a accesskey="2" href="howto-manager.html#howto-manager">howto manager</a>
</ul>
</body></html>

View file

@ -0,0 +1,86 @@
<html lang="en">
<head>
<title>Section Input - 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="Sections.html#Sections" title="Sections">
<link rel="prev" href="Sections.html#Sections" title="Sections">
<link rel="next" href="Section-Output.html#Section-Output" title="Section Output">
<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="Section-Input"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Section-Output.html#Section-Output">Section Output</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Sections.html#Sections">Sections</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Sections.html#Sections">Sections</a>
<hr><br>
</div>
<h4 class="subsection">2.6.1 Section input</h4>
<p>When a BFD is opened for reading, the section structures are
created and attached to the BFD.
<p>Each section has a name which describes the section in the
outside world&mdash;for example, <code>a.out</code> would contain at least
three sections, called <code>.text</code>, <code>.data</code> and <code>.bss</code>.
<p>Names need not be unique; for example a COFF file may have several
sections named <code>.data</code>.
<p>Sometimes a BFD will contain more than the &ldquo;natural&rdquo; number of
sections. A back end may attach other sections containing
constructor data, or an application may add a section (using
<code>bfd_make_section</code>) to the sections attached to an already open
BFD. For example, the linker creates an extra section
<code>COMMON</code> for each input file's BFD to hold information about
common storage.
<p>The raw data is not necessarily read in when
the section descriptor is created. Some targets may leave the
data in place until a <code>bfd_get_section_contents</code> call is
made. Other back ends may read in all the data at once. For
example, an S-record file has to be read once to determine the
size of the data. An IEEE-695 file doesn't contain raw data in
sections, but data and relocation expressions intermixed, so
the data area has to be parsed to get out the data and
relocations.
</body></html>

View file

@ -0,0 +1,111 @@
<html lang="en">
<head>
<title>Section Output - 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="Sections.html#Sections" title="Sections">
<link rel="prev" href="Section-Input.html#Section-Input" title="Section Input">
<link rel="next" href="typedef-asection.html#typedef-asection" title="typedef asection">
<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="Section-Output"></a>Next:&nbsp;<a rel="next" accesskey="n" href="typedef-asection.html#typedef-asection">typedef asection</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Section-Input.html#Section-Input">Section Input</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Sections.html#Sections">Sections</a>
<hr><br>
</div>
<h4 class="subsection">2.6.2 Section output</h4>
<p>To write a new object style BFD, the various sections to be
written have to be created. They are attached to the BFD in
the same way as input sections; data is written to the
sections using <code>bfd_set_section_contents</code>.
<p>Any program that creates or combines sections (e.g., the assembler
and linker) must use the <code>asection</code> fields <code>output_section</code> and
<code>output_offset</code> to indicate the file sections to which each
section must be written. (If the section is being created from
scratch, <code>output_section</code> should probably point to the section
itself and <code>output_offset</code> should probably be zero.)
<p>The data to be written comes from input sections attached
(via <code>output_section</code> pointers) to
the output sections. The output section structure can be
considered a filter for the input section: the output section
determines the vma of the output data and the name, but the
input section determines the offset into the output section of
the data to be written.
<p>E.g., to create a section "O", starting at 0x100, 0x123 long,
containing two subsections, "A" at offset 0x0 (i.e., at vma
0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the <code>asection</code>
structures would look like:
<pre class="example"> section name "A"
output_offset 0x00
size 0x20
output_section -----------&gt; section name "O"
| vma 0x100
section name "B" | size 0x123
output_offset 0x20 |
size 0x103 |
output_section --------|
</pre>
<h4 class="subsection">2.6.3 Link orders</h4>
<p>The data within a section is stored in a <dfn>link_order</dfn>.
These are much like the fixups in <code>gas</code>. The link_order
abstraction allows a section to grow and shrink within itself.
<p>A link_order knows how big it is, and which is the next
link_order and where the raw data for it is; it also points to
a list of relocations which apply to it.
<p>The link_order is used by the linker to perform relaxing on
final code. The compiler creates code which is as big as
necessary to make it work without relaxing, and the user can
select whether to relax. Sometimes relaxing takes a lot of
time. The linker runs around the relocations to see if any
are attached to data which can be shrunk, if so it does it on
a link_order by link_order basis.
</body></html>

View file

@ -0,0 +1,72 @@
<html lang="en">
<head>
<title>Sections - 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="Initialization.html#Initialization" title="Initialization">
<link rel="next" href="Symbols.html#Symbols" title="Symbols">
<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="Sections"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Symbols.html#Symbols">Symbols</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Initialization.html#Initialization">Initialization</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.6 Sections</h3>
<p>The raw data contained within a BFD is maintained through the
section abstraction. A single BFD may have any number of
sections. It keeps hold of them by pointing to the first;
each one points to the next in the list.
<p>Sections are supported in BFD in <code>section.c</code>.
<ul class="menu">
<li><a accesskey="1" href="Section-Input.html#Section-Input">Section Input</a>
<li><a accesskey="2" href="Section-Output.html#Section-Output">Section Output</a>
<li><a accesskey="3" href="typedef-asection.html#typedef-asection">typedef asection</a>
<li><a accesskey="4" href="section-prototypes.html#section-prototypes">section prototypes</a>
</ul>
</body></html>

View file

@ -0,0 +1,151 @@
<html lang="en">
<head>
<title>Symbol-table - 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="mmo.html#mmo" title="mmo">
<link rel="prev" href="File-layout.html#File-layout" title="File layout">
<link rel="next" href="mmo-section-mapping.html#mmo-section-mapping" title="mmo section mapping">
<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="Symbol_002dtable"></a>Next:&nbsp;<a rel="next" accesskey="n" href="mmo-section-mapping.html#mmo-section-mapping">mmo section mapping</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="File-layout.html#File-layout">File layout</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="mmo.html#mmo">mmo</a>
<hr><br>
</div>
<h4 class="subsection">3.5.2 Symbol table format</h4>
<p>From mmixal.w (or really, the generated mmixal.tex) in
<a href="http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz">http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz</a>):
&ldquo;Symbols are stored and retrieved by means of a <span class="samp">ternary
search trie</span>, following ideas of Bentley and Sedgewick. (See
ACM&ndash;SIAM Symp. on Discrete Algorithms <span class="samp">8</span> (1997), 360&ndash;369;
R.Sedgewick, <span class="samp">Algorithms in C</span> (Reading, Mass.
Addison&ndash;Wesley, 1998), <span class="samp">15.4</span>.) Each trie node stores a
character, and there are branches to subtries for the cases where
a given character is less than, equal to, or greater than the
character in the trie. There also is a pointer to a symbol table
entry if a symbol ends at the current node.&rdquo;
<p>So it's a tree encoded as a stream of bytes. The stream of bytes
acts on a single virtual global symbol, adding and removing
characters and signalling complete symbol points. Here, we read
the stream and create symbols at the completion points.
<p>First, there's a control byte <code>m</code>. If any of the listed bits
in <code>m</code> is nonzero, we execute what stands at the right, in
the listed order:
<pre class="example"> (MMO3_LEFT)
0x40 - Traverse left trie.
(Read a new command byte and recurse.)
(MMO3_SYMBITS)
0x2f - Read the next byte as a character and store it in the
current character position; increment character position.
Test the bits of <code>m</code>:
(MMO3_WCHAR)
0x80 - The character is 16-bit (so read another byte,
merge into current character.
(MMO3_TYPEBITS)
0xf - We have a complete symbol; parse the type, value
and serial number and do what should be done
with a symbol. The type and length information
is in j = (m &amp; 0xf).
(MMO3_REGQUAL_BITS)
j == 0xf: A register variable. The following
byte tells which register.
j &lt;= 8: An absolute symbol. Read j bytes as the
big-endian number the symbol equals.
A j = 2 with two zero bytes denotes an
unknown symbol.
j &gt; 8: As with j &lt;= 8, but add (0x20 &lt;&lt; 56)
to the value in the following j - 8
bytes.
Then comes the serial number, as a variant of
uleb128, but better named ubeb128:
Read bytes and shift the previous value left 7
(multiply by 128). Add in the new byte, repeat
until a byte has bit 7 set. The serial number
is the computed value minus 128.
(MMO3_MIDDLE)
0x20 - Traverse middle trie. (Read a new command byte
and recurse.) Decrement character position.
(MMO3_RIGHT)
0x10 - Traverse right trie. (Read a new command byte and
recurse.)
</pre>
<p>Let's look again at the <code>lop_stab</code> for the trivial file
(see <a href="File-layout.html#File-layout">File layout</a>).
<pre class="example"> 0x980b0000 - lop_stab for ":Main" = 0, serial 1.
0x203a4040
0x10404020
0x4d206120
0x69016e00
0x81000000
</pre>
<p>This forms the trivial trie (note that the path between &ldquo;:&rdquo; and
&ldquo;M&rdquo; is redundant):
<pre class="example"> 203a ":"
40 /
40 /
10 \
40 /
40 /
204d "M"
2061 "a"
2069 "i"
016e "n" is the last character in a full symbol, and
with a value represented in one byte.
00 The value is 0.
81 The serial number is 1.
</pre>
</body></html>

View file

@ -0,0 +1,90 @@
<html lang="en">
<head>
<title>Symbols - 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="Sections.html#Sections" title="Sections">
<link rel="next" href="Archives.html#Archives" title="Archives">
<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="Symbols"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Archives.html#Archives">Archives</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Sections.html#Sections">Sections</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.7 Symbols</h3>
<p>BFD tries to maintain as much symbol information as it can when
it moves information from file to file. BFD passes information
to applications though the <code>asymbol</code> structure. When the
application requests the symbol table, BFD reads the table in
the native form and translates parts of it into the internal
format. To maintain more than the information passed to
applications, some targets keep some information &ldquo;behind the
scenes&rdquo; in a structure only the particular back end knows
about. For example, the coff back end keeps the original
symbol table structure as well as the canonical structure when
a BFD is read in. On output, the coff back end can reconstruct
the output symbol table so that no information is lost, even
information unique to coff which BFD doesn't know or
understand. If a coff symbol table were read, but were written
through an a.out back end, all the coff specific information
would be lost. The symbol table of a BFD
is not necessarily read in until a canonicalize request is
made. Then the BFD back end fills in a table provided by the
application with pointers to the canonical information. To
output symbols, the application provides BFD with a table of
pointers to pointers to <code>asymbol</code>s. This allows applications
like the linker to output a symbol as it was read, since the &ldquo;behind
the scenes&rdquo; information will be still available.
<ul class="menu">
<li><a accesskey="1" href="Reading-Symbols.html#Reading-Symbols">Reading Symbols</a>
<li><a accesskey="2" href="Writing-Symbols.html#Writing-Symbols">Writing Symbols</a>
<li><a accesskey="3" href="Mini-Symbols.html#Mini-Symbols">Mini Symbols</a>
<li><a accesskey="4" href="typedef-asymbol.html#typedef-asymbol">typedef asymbol</a>
<li><a accesskey="5" href="symbol-handling-functions.html#symbol-handling-functions">symbol handling functions</a>
</ul>
</body></html>

View file

@ -0,0 +1,106 @@
<html lang="en">
<head>
<title>Targets - 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="Core-Files.html#Core-Files" title="Core Files">
<link rel="next" href="Architectures.html#Architectures" title="Architectures">
<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="Targets"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Architectures.html#Architectures">Architectures</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Core-Files.html#Core-Files">Core Files</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-front-end.html#BFD-front-end">BFD front end</a>
<hr><br>
</div>
<h3 class="section">2.12 Targets</h3>
<p><strong>Description</strong><br>
Each port of BFD to a different machine requires the creation
of a target back end. All the back end provides to the root
part of BFD is a structure containing pointers to functions
which perform certain low level operations on files. BFD
translates the applications's requests through a pointer into
calls to the back end routines.
<p>When a file is opened with <code>bfd_openr</code>, its format and
target are unknown. BFD uses various mechanisms to determine
how to interpret the file. The operations performed are:
<ul>
<li>Create a BFD by calling the internal routine
<code>_bfd_new_bfd</code>, then call <code>bfd_find_target</code> with the
target string supplied to <code>bfd_openr</code> and the new BFD pointer.
<li>If a null target string was provided to <code>bfd_find_target</code>,
look up the environment variable <code>GNUTARGET</code> and use
that as the target string.
<li>If the target string is still <code>NULL</code>, or the target string is
<code>default</code>, then use the first item in the target vector
as the target type, and set <code>target_defaulted</code> in the BFD to
cause <code>bfd_check_format</code> to loop through all the targets.
See <a href="bfd_005ftarget.html#bfd_005ftarget">bfd_target</a>. See <a href="Formats.html#Formats">Formats</a>.
<li>Otherwise, inspect the elements in the target vector
one by one, until a match on target name is found. When found,
use it.
<li>Otherwise return the error <code>bfd_error_invalid_target</code> to
<code>bfd_openr</code>.
<li><code>bfd_openr</code> attempts to open the file using
<code>bfd_open_file</code>, and returns the BFD.
</ul>
Once the BFD has been opened and the target selected, the file
format may be determined. This is done by calling
<code>bfd_check_format</code> on the BFD with a suggested format.
If <code>target_defaulted</code> has been set, each possible target
type is tried to see if it recognizes the specified format.
<code>bfd_check_format</code> returns <code>TRUE</code> when the caller guesses right.
<ul class="menu">
<li><a accesskey="1" href="bfd_005ftarget.html#bfd_005ftarget">bfd_target</a>
</ul>
</body></html>

View file

@ -0,0 +1,71 @@
<html lang="en">
<head>
<title>Traversing a Hash Table - 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="Hash-Tables.html#Hash-Tables" title="Hash Tables">
<link rel="prev" href="Looking-Up-or-Entering-a-String.html#Looking-Up-or-Entering-a-String" title="Looking Up or Entering a String">
<link rel="next" href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type" title="Deriving a New Hash Table Type">
<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="Traversing-a-Hash-Table"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type">Deriving a New Hash Table Type</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Looking-Up-or-Entering-a-String.html#Looking-Up-or-Entering-a-String">Looking Up or Entering a String</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Hash-Tables.html#Hash-Tables">Hash Tables</a>
<hr><br>
</div>
<h4 class="subsection">2.18.3 Traversing a hash table</h4>
<p><a name="index-bfd_005fhash_005ftraverse-1389"></a>The function <code>bfd_hash_traverse</code> may be used to traverse a
hash table, calling a function on each element. The traversal
is done in a random order.
<p><code>bfd_hash_traverse</code> takes as arguments a function and a
generic <code>void *</code> pointer. The function is called with a
hash table entry (a <code>struct bfd_hash_entry *</code>) and the
generic pointer passed to <code>bfd_hash_traverse</code>. The function
must return a <code>boolean</code> value, which indicates whether to
continue traversing the hash table. If the function returns
<code>FALSE</code>, <code>bfd_hash_traverse</code> will stop the traversal and
return immediately.
</body></html>

View file

@ -0,0 +1,80 @@
<html lang="en">
<head>
<title>What BFD Version 2 Can Do - 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="Overview.html#Overview" title="Overview">
<link rel="prev" href="How-It-Works.html#How-It-Works" title="How It Works">
<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="What-BFD-Version-2-Can-Do"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="How-It-Works.html#How-It-Works">How It Works</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Overview.html#Overview">Overview</a>
<hr><br>
</div>
<h3 class="section">1.3 What BFD Version 2 Can Do</h3>
<!-- This summary of BFD is shared by the BFD and LD docs. -->
<p>When an object file is opened, BFD subroutines automatically determine
the format of the input object file. They then build a descriptor in
memory with pointers to routines that will be used to access elements of
the object file's data structures.
<p>As different information from the object files is required,
BFD reads from different sections of the file and processes them.
For example, a very common operation for the linker is processing symbol
tables. Each BFD back end provides a routine for converting
between the object file's representation of symbols and an internal
canonical format. When the linker asks for the symbol table of an object
file, it calls through a memory pointer to the routine from the
relevant BFD back end which reads and converts the table into a canonical
form. The linker then operates upon the canonical form. When the link is
finished and the linker writes the output file's symbol table,
another BFD back end routine is called to take the newly
created symbol table and convert it into the chosen output format.
<ul class="menu">
<li><a accesskey="1" href="BFD-information-loss.html#BFD-information-loss">BFD information loss</a>: Information Loss
<li><a accesskey="2" href="Canonical-format.html#Canonical-format">Canonical format</a>: The BFD canonical object-file format
</ul>
</body></html>

View file

@ -0,0 +1,60 @@
<html lang="en">
<head>
<title>What to Put Where - 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-back-ends.html#BFD-back-ends" title="BFD back ends">
<link rel="prev" href="BFD-back-ends.html#BFD-back-ends" title="BFD back ends">
<link rel="next" href="aout.html#aout" title="aout">
<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="What-to-Put-Where"></a>Next:&nbsp;<a rel="next" accesskey="n" href="aout.html#aout">aout</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="BFD-back-ends.html#BFD-back-ends">BFD back ends</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-back-ends.html#BFD-back-ends">BFD back ends</a>
<hr><br>
</div>
<h3 class="section">3.1 What to Put Where</h3>
<p>All of BFD lives in one directory.
</body></html>

View file

@ -0,0 +1,81 @@
<html lang="en">
<head>
<title>Write Other Derived Routines - 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="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type" title="Deriving a New Hash Table Type">
<link rel="prev" href="Write-the-Derived-Creation-Routine.html#Write-the-Derived-Creation-Routine" title="Write the Derived Creation Routine">
<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="Write-Other-Derived-Routines"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="Write-the-Derived-Creation-Routine.html#Write-the-Derived-Creation-Routine">Write the Derived Creation Routine</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type">Deriving a New Hash Table Type</a>
<hr><br>
</div>
<h5 class="subsubsection">2.18.4.3 Write other derived routines</h5>
<p>You will want to write other routines for your new hash table,
as well.
<p>You will want an initialization routine which calls the
initialization routine of the hash table you are deriving from
and initializes any other local fields. For the linker hash
table, this is <code>_bfd_link_hash_table_init</code> in <code>linker.c</code>.
<p>You will want a lookup routine which calls the lookup routine
of the hash table you are deriving from and casts the result.
The linker hash table uses <code>bfd_link_hash_lookup</code> in
<code>linker.c</code> (this actually takes an additional argument which
it uses to decide how to return the looked up value).
<p>You may want a traversal routine. This should just call the
traversal routine of the hash table you are deriving from with
appropriate casts. The linker hash table uses
<code>bfd_link_hash_traverse</code> in <code>linker.c</code>.
<p>These routines may simply be defined as macros. For example,
the a.out backend linker hash table, which is derived from the
linker hash table, uses macros for the lookup and traversal
routines. These are <code>aout_link_hash_lookup</code> and
<code>aout_link_hash_traverse</code> in aoutx.h.
</body></html>

View file

@ -0,0 +1,124 @@
<html lang="en">
<head>
<title>Write the Derived Creation Routine - 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="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type" title="Deriving a New Hash Table Type">
<link rel="prev" href="Define-the-Derived-Structures.html#Define-the-Derived-Structures" title="Define the Derived Structures">
<link rel="next" href="Write-Other-Derived-Routines.html#Write-Other-Derived-Routines" title="Write Other Derived Routines">
<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="Write-the-Derived-Creation-Routine"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Write-Other-Derived-Routines.html#Write-Other-Derived-Routines">Write Other Derived Routines</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Define-the-Derived-Structures.html#Define-the-Derived-Structures">Define the Derived Structures</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type">Deriving a New Hash Table Type</a>
<hr><br>
</div>
<h5 class="subsubsection">2.18.4.2 Write the derived creation routine</h5>
<p>You must write a routine which will create and initialize an
entry in the hash table. This routine is passed as the
function argument to <code>bfd_hash_table_init</code>.
<p>In order to permit other hash tables to be derived from the
hash table you are creating, this routine must be written in a
standard way.
<p>The first argument to the creation routine is a pointer to a
hash table entry. This may be <code>NULL</code>, in which case the
routine should allocate the right amount of space. Otherwise
the space has already been allocated by a hash table type
derived from this one.
<p>After allocating space, the creation routine must call the
creation routine of the hash table type it is derived from,
passing in a pointer to the space it just allocated. This
will initialize any fields used by the base hash table.
<p>Finally the creation routine must initialize any local fields
for the new hash table type.
<p>Here is a boilerplate example of a creation routine.
<var>function_name</var> is the name of the routine.
<var>entry_type</var> is the type of an entry in the hash table you
are creating. <var>base_newfunc</var> is the name of the creation
routine of the hash table type your hash table is derived
from.
<pre class="example"> struct bfd_hash_entry *
<var>function_name</var> (struct bfd_hash_entry *entry,
struct bfd_hash_table *table,
const char *string)
{
struct <var>entry_type</var> *ret = (<var>entry_type</var> *) entry;
/* Allocate the structure if it has not already been allocated by a
derived class. */
if (ret == NULL)
{
ret = bfd_hash_allocate (table, sizeof (* ret));
if (ret == NULL)
return NULL;
}
/* Call the allocation method of the base class. */
ret = ((<var>entry_type</var> *)
<var>base_newfunc</var> ((struct bfd_hash_entry *) ret, table, string));
/* Initialize the local fields here. */
return (struct bfd_hash_entry *) ret;
}
</pre>
<p><strong>Description</strong><br>
The creation routine for the linker hash table, which is in
<code>linker.c</code>, looks just like this example.
<var>function_name</var> is <code>_bfd_link_hash_newfunc</code>.
<var>entry_type</var> is <code>struct bfd_link_hash_entry</code>.
<var>base_newfunc</var> is <code>bfd_hash_newfunc</code>, the creation
routine for a basic hash table.
<p><code>_bfd_link_hash_newfunc</code> also initializes the local fields
in a linker hash table entry: <code>type</code>, <code>written</code> and
<code>next</code>.
</body></html>

View file

@ -0,0 +1,101 @@
<html lang="en">
<head>
<title>Writing Symbols - 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="Symbols.html#Symbols" title="Symbols">
<link rel="prev" href="Reading-Symbols.html#Reading-Symbols" title="Reading Symbols">
<link rel="next" href="Mini-Symbols.html#Mini-Symbols" title="Mini Symbols">
<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="Writing-Symbols"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Mini-Symbols.html#Mini-Symbols">Mini Symbols</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Reading-Symbols.html#Reading-Symbols">Reading Symbols</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Symbols.html#Symbols">Symbols</a>
<hr><br>
</div>
<h4 class="subsection">2.7.2 Writing symbols</h4>
<p>Writing of a symbol table is automatic when a BFD open for
writing is closed. The application attaches a vector of
pointers to pointers to symbols to the BFD being written, and
fills in the symbol count. The close and cleanup code reads
through the table provided and performs all the necessary
operations. The BFD output code must always be provided with an
&ldquo;owned&rdquo; symbol: one which has come from another BFD, or one
which has been created using <code>bfd_make_empty_symbol</code>. Here is an
example showing the creation of a symbol table with only one element:
<pre class="example"> #include "bfd.h"
int main (void)
{
bfd *abfd;
asymbol *ptrs[2];
asymbol *new;
abfd = bfd_openw ("foo","a.out-sunos-big");
bfd_set_format (abfd, bfd_object);
new = bfd_make_empty_symbol (abfd);
new-&gt;name = "dummy_symbol";
new-&gt;section = bfd_make_section_old_way (abfd, ".text");
new-&gt;flags = BSF_GLOBAL;
new-&gt;value = 0x12345;
ptrs[0] = new;
ptrs[1] = 0;
bfd_set_symtab (abfd, ptrs, 1);
bfd_close (abfd);
return 0;
}
./makesym
nm foo
00012345 A dummy_symbol
</pre>
<p>Many formats cannot represent arbitrary symbol information; for
instance, the <code>a.out</code> object format does not allow an
arbitrary number of sections. A symbol pointing to a section
which is not one of <code>.text</code>, <code>.data</code> or <code>.bss</code> cannot
be described.
</body></html>

View file

@ -0,0 +1,128 @@
<html lang="en">
<head>
<title>Writing the symbol table - 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="Performing-the-Final-Link.html#Performing-the-Final-Link" title="Performing the Final Link">
<link rel="prev" href="Relocating-the-section-contents.html#Relocating-the-section-contents" title="Relocating the section contents">
<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="Writing-the-symbol-table"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="Relocating-the-section-contents.html#Relocating-the-section-contents">Relocating the section contents</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Performing-the-Final-Link.html#Performing-the-Final-Link">Performing the Final Link</a>
<hr><br>
</div>
<h5 class="subsubsection">2.17.3.3 Writing the symbol table</h5>
<p>The <code>_bfd_final_link</code> function must gather all the symbols
in the input files and write them out. It must also write out
all the symbols in the global hash table. This must be
controlled by the <code>strip</code> and <code>discard</code> fields of the
<code>bfd_link_info</code> structure.
<p>The local symbols of the input files will not have been
entered into the linker hash table. The <code>_bfd_final_link</code>
routine must consider each input file and include the symbols
in the output file. It may be convenient to do this when
looking through the <code>link_order</code> structures, or it may be
done by stepping through the <code>input_bfds</code> list.
<p>The <code>_bfd_final_link</code> routine must also traverse the global
hash table to gather all the externally visible symbols. It
is possible that most of the externally visible symbols may be
written out when considering the symbols of each input file,
but it is still necessary to traverse the hash table since the
linker script may have defined some symbols that are not in
any of the input files.
<p>The <code>strip</code> field of the <code>bfd_link_info</code> structure
controls which symbols are written out. The possible values
are listed in <code>bfdlink.h</code>. If the value is <code>strip_some</code>,
then the <code>keep_hash</code> field of the <code>bfd_link_info</code>
structure is a hash table of symbols to keep; each symbol
should be looked up in this hash table, and only symbols which
are present should be included in the output file.
<p>If the <code>strip</code> field of the <code>bfd_link_info</code> structure
permits local symbols to be written out, the <code>discard</code> field
is used to further controls which local symbols are included
in the output file. If the value is <code>discard_l</code>, then all
local symbols which begin with a certain prefix are discarded;
this is controlled by the <code>bfd_is_local_label_name</code> entry point.
<p>The a.out backend handles symbols by calling
<code>aout_link_write_symbols</code> on each input BFD and then
traversing the global hash table with the function
<code>aout_link_write_other_symbol</code>. It builds a string table
while writing out the symbols, which is written to the output
file at the end of <code>NAME(aout,final_link)</code>.
<p><a name="index-bfd_005flink_005fsplit_005fsection-1379"></a>
<h5 class="subsubsection">2.17.3.4 <code>bfd_link_split_section</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
</pre>
<p><strong>Description</strong><br>
Return nonzero if <var>sec</var> should be split during a
reloceatable or final link.
<pre class="example"> #define bfd_link_split_section(abfd, sec) \
BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
</pre>
<p><a name="index-bfd_005fsection_005falready_005flinked-1380"></a>
<h5 class="subsubsection">2.17.3.5 <code>bfd_section_already_linked</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void bfd_section_already_linked (bfd *abfd, asection *sec,
struct bfd_link_info *info);
</pre>
<p><strong>Description</strong><br>
Check if <var>sec</var> has been already linked during a reloceatable
or final link.
<pre class="example"> #define bfd_section_already_linked(abfd, sec, info) \
BFD_SEND (abfd, _section_already_linked, (abfd, sec, info))
</pre>
</body></html>

View file

@ -0,0 +1,261 @@
<html lang="en">
<head>
<title>aout - 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-back-ends.html#BFD-back-ends" title="BFD back ends">
<link rel="prev" href="What-to-Put-Where.html#What-to-Put-Where" title="What to Put Where">
<link rel="next" href="coff.html#coff" title="coff">
<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="aout"></a>Next:&nbsp;<a rel="next" accesskey="n" href="coff.html#coff">coff</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="What-to-Put-Where.html#What-to-Put-Where">What to Put Where</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-back-ends.html#BFD-back-ends">BFD back ends</a>
<hr><br>
</div>
<h3 class="section">3.2 a.out backends</h3>
<p><strong>Description</strong><br>
BFD supports a number of different flavours of a.out format,
though the major differences are only the sizes of the
structures on disk, and the shape of the relocation
information.
<p>The support is split into a basic support file <span class="file">aoutx.h</span>
and other files which derive functions from the base. One
derivation file is <span class="file">aoutf1.h</span> (for a.out flavour 1), and
adds to the basic a.out functions support for sun3, sun4, 386
and 29k a.out files, to create a target jump vector for a
specific target.
<p>This information is further split out into more specific files
for each machine, including <span class="file">sunos.c</span> for sun3 and sun4,
<span class="file">newsos3.c</span> for the Sony NEWS, and <span class="file">demo64.c</span> for a
demonstration of a 64 bit a.out format.
<p>The base file <span class="file">aoutx.h</span> defines general mechanisms for
reading and writing records to and from disk and various
other methods which BFD requires. It is included by
<span class="file">aout32.c</span> and <span class="file">aout64.c</span> to form the names
<code>aout_32_swap_exec_header_in</code>, <code>aout_64_swap_exec_header_in</code>, etc.
<p>As an example, this is what goes on to make the back end for a
sun4, from <span class="file">aout32.c</span>:
<pre class="example"> #define ARCH_SIZE 32
#include "aoutx.h"
</pre>
<p>Which exports names:
<pre class="example"> ...
aout_32_canonicalize_reloc
aout_32_find_nearest_line
aout_32_get_lineno
aout_32_get_reloc_upper_bound
...
</pre>
<p>from <span class="file">sunos.c</span>:
<pre class="example"> #define TARGET_NAME "a.out-sunos-big"
#define VECNAME sunos_big_vec
#include "aoutf1.h"
</pre>
<p>requires all the names from <span class="file">aout32.c</span>, and produces the jump vector
<pre class="example"> sunos_big_vec
</pre>
<p>The file <span class="file">host-aout.c</span> is a special case. It is for a large set
of hosts that use &ldquo;more or less standard&rdquo; a.out files, and
for which cross-debugging is not interesting. It uses the
standard 32-bit a.out support routines, but determines the
file offsets and addresses of the text, data, and BSS
sections, the machine architecture and machine type, and the
entry point address, in a host-dependent manner. Once these
values have been determined, generic code is used to handle
the object file.
<p>When porting it to run on a new system, you must supply:
<pre class="example"> HOST_PAGE_SIZE
HOST_SEGMENT_SIZE
HOST_MACHINE_ARCH (optional)
HOST_MACHINE_MACHINE (optional)
HOST_TEXT_START_ADDR
HOST_STACK_END_ADDR
</pre>
<p>in the file <span class="file">../include/sys/h-</span><var>XXX</var><span class="file">.h</span> (for your host). These
values, plus the structures and macros defined in <span class="file">a.out.h</span> on
your host system, will produce a BFD target that will access
ordinary a.out files on your host. To configure a new machine
to use <span class="file">host-aout.c</span>, specify:
<pre class="example"> TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec
TDEPFILES= host-aout.o trad-core.o
</pre>
<p>in the <span class="file">config/</span><var>XXX</var><span class="file">.mt</span> file, and modify <span class="file">configure.in</span>
to use the
<var>XXX</var><span class="file">.mt</span> file (by setting "<code>bfd_target=XXX</code>") when your
configuration is selected.
<h4 class="subsection">3.2.1 Relocations</h4>
<p><strong>Description</strong><br>
The file <span class="file">aoutx.h</span> provides for both the <em>standard</em>
and <em>extended</em> forms of a.out relocation records.
<p>The standard records contain only an
address, a symbol index, and a type field. The extended records
(used on 29ks and sparcs) also have a full integer for an
addend.
<h4 class="subsection">3.2.2 Internal entry points</h4>
<p><strong>Description</strong><br>
<span class="file">aoutx.h</span> exports several routines for accessing the
contents of an a.out file, which are gathered and exported in
turn by various format specific files (eg sunos.c).
<p><a name="index-aout_005f_0040var_007bsize_007d_005fswap_005fexec_005fheader_005fin-1390"></a>
<h5 class="subsubsection">3.2.2.1 <code>aout_</code><var>size</var><code>_swap_exec_header_in</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void aout_<var>size</var>_swap_exec_header_in,
(bfd *abfd,
struct external_exec *bytes,
struct internal_exec *execp);
</pre>
<p><strong>Description</strong><br>
Swap the information in an executable header <var>raw_bytes</var> taken
from a raw byte stream memory image into the internal exec header
structure <var>execp</var>.
<p><a name="index-aout_005f_0040var_007bsize_007d_005fswap_005fexec_005fheader_005fout-1391"></a>
<h5 class="subsubsection">3.2.2.2 <code>aout_</code><var>size</var><code>_swap_exec_header_out</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void aout_<var>size</var>_swap_exec_header_out
(bfd *abfd,
struct internal_exec *execp,
struct external_exec *raw_bytes);
</pre>
<p><strong>Description</strong><br>
Swap the information in an internal exec header structure
<var>execp</var> into the buffer <var>raw_bytes</var> ready for writing to disk.
<p><a name="index-aout_005f_0040var_007bsize_007d_005fsome_005faout_005fobject_005fp-1392"></a>
<h5 class="subsubsection">3.2.2.3 <code>aout_</code><var>size</var><code>_some_aout_object_p</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const bfd_target *aout_<var>size</var>_some_aout_object_p
(bfd *abfd,
struct internal_exec *execp,
const bfd_target *(*callback_to_real_object_p) (bfd *));
</pre>
<p><strong>Description</strong><br>
Some a.out variant thinks that the file open in <var>abfd</var>
checking is an a.out file. Do some more checking, and set up
for access if it really is. Call back to the calling
environment's "finish up" function just before returning, to
handle any last-minute setup.
<p><a name="index-aout_005f_0040var_007bsize_007d_005fmkobject-1393"></a>
<h5 class="subsubsection">3.2.2.4 <code>aout_</code><var>size</var><code>_mkobject</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean aout_<var>size</var>_mkobject, (bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Initialize BFD <var>abfd</var> for use with a.out files.
<p><a name="index-aout_005f_0040var_007bsize_007d_005fmachine_005ftype-1394"></a>
<h5 class="subsubsection">3.2.2.5 <code>aout_</code><var>size</var><code>_machine_type</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> enum machine_type aout_<var>size</var>_machine_type
(enum bfd_architecture arch,
unsigned long machine,
bfd_boolean *unknown);
</pre>
<p><strong>Description</strong><br>
Keep track of machine architecture and machine type for
a.out's. Return the <code>machine_type</code> for a particular
architecture and machine, or <code>M_UNKNOWN</code> if that exact architecture
and machine can't be represented in a.out format.
<p>If the architecture is understood, machine type 0 (default)
is always understood.
<p><a name="index-aout_005f_0040var_007bsize_007d_005fset_005farch_005fmach-1395"></a>
<h5 class="subsubsection">3.2.2.6 <code>aout_</code><var>size</var><code>_set_arch_mach</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean aout_<var>size</var>_set_arch_mach,
(bfd *,
enum bfd_architecture arch,
unsigned long machine);
</pre>
<p><strong>Description</strong><br>
Set the architecture and the machine of the BFD <var>abfd</var> to the
values <var>arch</var> and <var>machine</var>. Verify that <var>abfd</var>'s format
can support the architecture required.
<p><a name="index-aout_005f_0040var_007bsize_007d_005fnew_005fsection_005fhook-1396"></a>
<h5 class="subsubsection">3.2.2.7 <code>aout_</code><var>size</var><code>_new_section_hook</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean aout_<var>size</var>_new_section_hook,
(bfd *abfd,
asection *newsect);
</pre>
<p><strong>Description</strong><br>
Called by the BFD in response to a <code>bfd_make_section</code>
request.
</body></html>

View file

@ -0,0 +1,549 @@
<html lang="en">
<head>
<title>bfd_target - 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="Targets.html#Targets" title="Targets">
<link rel="prev" href="Targets.html#Targets" title="Targets">
<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="bfd_005ftarget"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="Targets.html#Targets">Targets</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Targets.html#Targets">Targets</a>
<hr><br>
</div>
<h4 class="subsection">2.12.1 bfd_target</h4>
<p><strong>Description</strong><br>
This structure contains everything that BFD knows about a
target. It includes things like its byte order, name, and which
routines to call to do various operations.
<p>Every BFD points to a target structure with its <code>xvec</code>
member.
<p>The macros below are used to dispatch to functions through the
<code>bfd_target</code> vector. They are used in a number of macros further
down in <span class="file">bfd.h</span>, and are also used when calling various
routines by hand inside the BFD implementation. The <var>arglist</var>
argument must be parenthesized; it contains all the arguments
to the called function.
<p>They make the documentation (more) unpleasant to read, so if
someone wants to fix this and not break the above, please do.
<pre class="example"> #define BFD_SEND(bfd, message, arglist) \
((*((bfd)-&gt;xvec-&gt;message)) arglist)
#ifdef DEBUG_BFD_SEND
#undef BFD_SEND
#define BFD_SEND(bfd, message, arglist) \
(((bfd) &amp;&amp; (bfd)-&gt;xvec &amp;&amp; (bfd)-&gt;xvec-&gt;message) ? \
((*((bfd)-&gt;xvec-&gt;message)) arglist) : \
(bfd_assert (__FILE__,__LINE__), NULL))
#endif
</pre>
<p>For operations which index on the BFD format:
<pre class="example"> #define BFD_SEND_FMT(bfd, message, arglist) \
(((bfd)-&gt;xvec-&gt;message[(int) ((bfd)-&gt;format)]) arglist)
#ifdef DEBUG_BFD_SEND
#undef BFD_SEND_FMT
#define BFD_SEND_FMT(bfd, message, arglist) \
(((bfd) &amp;&amp; (bfd)-&gt;xvec &amp;&amp; (bfd)-&gt;xvec-&gt;message) ? \
(((bfd)-&gt;xvec-&gt;message[(int) ((bfd)-&gt;format)]) arglist) : \
(bfd_assert (__FILE__,__LINE__), NULL))
#endif
</pre>
<p>This is the structure which defines the type of BFD this is. The
<code>xvec</code> member of the struct <code>bfd</code> itself points here. Each
module that implements access to a different target under BFD,
defines one of these.
<p>FIXME, these names should be rationalised with the names of
the entry points which call them. Too bad we can't have one
macro to define them both!
<pre class="example"> enum bfd_flavour
{
bfd_target_unknown_flavour,
bfd_target_aout_flavour,
bfd_target_coff_flavour,
bfd_target_ecoff_flavour,
bfd_target_xcoff_flavour,
bfd_target_elf_flavour,
bfd_target_ieee_flavour,
bfd_target_nlm_flavour,
bfd_target_oasys_flavour,
bfd_target_tekhex_flavour,
bfd_target_srec_flavour,
bfd_target_ihex_flavour,
bfd_target_som_flavour,
bfd_target_os9k_flavour,
bfd_target_versados_flavour,
bfd_target_msdos_flavour,
bfd_target_ovax_flavour,
bfd_target_evax_flavour,
bfd_target_mmo_flavour,
bfd_target_mach_o_flavour,
bfd_target_pef_flavour,
bfd_target_pef_xlib_flavour,
bfd_target_sym_flavour
};
enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
/* Forward declaration. */
typedef struct bfd_link_info _bfd_link_info;
typedef struct bfd_target
{
/* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
char *name;
/* The "flavour" of a back end is a general indication about
the contents of a file. */
enum bfd_flavour flavour;
/* The order of bytes within the data area of a file. */
enum bfd_endian byteorder;
/* The order of bytes within the header parts of a file. */
enum bfd_endian header_byteorder;
/* A mask of all the flags which an executable may have set -
from the set <code>BFD_NO_FLAGS</code>, <code>HAS_RELOC</code>, ...<code>D_PAGED</code>. */
flagword object_flags;
/* A mask of all the flags which a section may have set - from
the set <code>SEC_NO_FLAGS</code>, <code>SEC_ALLOC</code>, ...<code>SET_NEVER_LOAD</code>. */
flagword section_flags;
/* The character normally found at the front of a symbol.
(if any), perhaps `_'. */
char symbol_leading_char;
/* The pad character for file names within an archive header. */
char ar_pad_char;
/* The maximum number of characters in an archive header. */
unsigned short ar_max_namelen;
/* Entries for byte swapping for data. These are different from the
other entry points, since they don't take a BFD as the first argument.
Certain other handlers could do the same. */
bfd_uint64_t (*bfd_getx64) (const void *);
bfd_int64_t (*bfd_getx_signed_64) (const void *);
void (*bfd_putx64) (bfd_uint64_t, void *);
bfd_vma (*bfd_getx32) (const void *);
bfd_signed_vma (*bfd_getx_signed_32) (const void *);
void (*bfd_putx32) (bfd_vma, void *);
bfd_vma (*bfd_getx16) (const void *);
bfd_signed_vma (*bfd_getx_signed_16) (const void *);
void (*bfd_putx16) (bfd_vma, void *);
/* Byte swapping for the headers. */
bfd_uint64_t (*bfd_h_getx64) (const void *);
bfd_int64_t (*bfd_h_getx_signed_64) (const void *);
void (*bfd_h_putx64) (bfd_uint64_t, void *);
bfd_vma (*bfd_h_getx32) (const void *);
bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
void (*bfd_h_putx32) (bfd_vma, void *);
bfd_vma (*bfd_h_getx16) (const void *);
bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
void (*bfd_h_putx16) (bfd_vma, void *);
/* Format dependent routines: these are vectors of entry points
within the target vector structure, one for each format to check. */
/* Check the format of a file being read. Return a <code>bfd_target *</code> or zero. */
const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
/* Set the format of a file being written. */
bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
/* Write cached information into a file being written, at <code>bfd_close</code>. */
bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
</pre>
<p>The general target vector. These vectors are initialized using the
BFD_JUMP_TABLE macros.
<pre class="example">
/* Generic entry points. */
#define BFD_JUMP_TABLE_GENERIC(NAME) \
NAME##_close_and_cleanup, \
NAME##_bfd_free_cached_info, \
NAME##_new_section_hook, \
NAME##_get_section_contents, \
NAME##_get_section_contents_in_window
/* Called when the BFD is being closed to do any necessary cleanup. */
bfd_boolean (*_close_and_cleanup) (bfd *);
/* Ask the BFD to free all cached information. */
bfd_boolean (*_bfd_free_cached_info) (bfd *);
/* Called when a new section is created. */
bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
/* Read the contents of a section. */
bfd_boolean (*_bfd_get_section_contents)
(bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
bfd_boolean (*_bfd_get_section_contents_in_window)
(bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
/* Entry points to copy private data. */
#define BFD_JUMP_TABLE_COPY(NAME) \
NAME##_bfd_copy_private_bfd_data, \
NAME##_bfd_merge_private_bfd_data, \
_bfd_generic_init_private_section_data, \
NAME##_bfd_copy_private_section_data, \
NAME##_bfd_copy_private_symbol_data, \
NAME##_bfd_copy_private_header_data, \
NAME##_bfd_set_private_flags, \
NAME##_bfd_print_private_bfd_data
/* Called to copy BFD general private data from one object file
to another. */
bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
/* Called to merge BFD general private data from one object file
to a common output file when linking. */
bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
/* Called to initialize BFD private section data from one object file
to another. */
#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info))
bfd_boolean (*_bfd_init_private_section_data)
(bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *);
/* Called to copy BFD private section data from one object file
to another. */
bfd_boolean (*_bfd_copy_private_section_data)
(bfd *, sec_ptr, bfd *, sec_ptr);
/* Called to copy BFD private symbol data from one symbol
to another. */
bfd_boolean (*_bfd_copy_private_symbol_data)
(bfd *, asymbol *, bfd *, asymbol *);
/* Called to copy BFD private header data from one object file
to another. */
bfd_boolean (*_bfd_copy_private_header_data)
(bfd *, bfd *);
/* Called to set private backend flags. */
bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
/* Called to print private BFD data. */
bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
/* Core file entry points. */
#define BFD_JUMP_TABLE_CORE(NAME) \
NAME##_core_file_failing_command, \
NAME##_core_file_failing_signal, \
NAME##_core_file_matches_executable_p
char * (*_core_file_failing_command) (bfd *);
int (*_core_file_failing_signal) (bfd *);
bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
/* Archive entry points. */
#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
NAME##_slurp_armap, \
NAME##_slurp_extended_name_table, \
NAME##_construct_extended_name_table, \
NAME##_truncate_arname, \
NAME##_write_armap, \
NAME##_read_ar_hdr, \
NAME##_openr_next_archived_file, \
NAME##_get_elt_at_index, \
NAME##_generic_stat_arch_elt, \
NAME##_update_armap_timestamp
bfd_boolean (*_bfd_slurp_armap) (bfd *);
bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
bfd_boolean (*_bfd_construct_extended_name_table)
(bfd *, char **, bfd_size_type *, const char **);
void (*_bfd_truncate_arname) (bfd *, const char *, char *);
bfd_boolean (*write_armap)
(bfd *, unsigned int, struct orl *, unsigned int, int);
void * (*_bfd_read_ar_hdr_fn) (bfd *);
bfd * (*openr_next_archived_file) (bfd *, bfd *);
#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
bfd * (*_bfd_get_elt_at_index) (bfd *, symindex);
int (*_bfd_stat_arch_elt) (bfd *, struct stat *);
bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
/* Entry points used for symbols. */
#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
NAME##_get_symtab_upper_bound, \
NAME##_canonicalize_symtab, \
NAME##_make_empty_symbol, \
NAME##_print_symbol, \
NAME##_get_symbol_info, \
NAME##_bfd_is_local_label_name, \
NAME##_bfd_is_target_special_symbol, \
NAME##_get_lineno, \
NAME##_find_nearest_line, \
_bfd_generic_find_line, \
NAME##_find_inliner_info, \
NAME##_bfd_make_debug_symbol, \
NAME##_read_minisymbols, \
NAME##_minisymbol_to_symbol
long (*_bfd_get_symtab_upper_bound) (bfd *);
long (*_bfd_canonicalize_symtab)
(bfd *, struct bfd_symbol **);
struct bfd_symbol *
(*_bfd_make_empty_symbol) (bfd *);
void (*_bfd_print_symbol)
(bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type);
#define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e))
void (*_bfd_get_symbol_info)
(bfd *, struct bfd_symbol *, symbol_info *);
#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
bfd_boolean (*_bfd_find_nearest_line)
(bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
const char **, const char **, unsigned int *);
bfd_boolean (*_bfd_find_line)
(bfd *, struct bfd_symbol **, struct bfd_symbol *,
const char **, unsigned int *);
bfd_boolean (*_bfd_find_inliner_info)
(bfd *, const char **, const char **, unsigned int *);
/* Back-door to allow format-aware applications to create debug symbols
while using BFD for everything else. Currently used by the assembler
when creating COFF files. */
asymbol * (*_bfd_make_debug_symbol)
(bfd *, void *, unsigned long size);
#define bfd_read_minisymbols(b, d, m, s) \
BFD_SEND (b, _read_minisymbols, (b, d, m, s))
long (*_read_minisymbols)
(bfd *, bfd_boolean, void **, unsigned int *);
#define bfd_minisymbol_to_symbol(b, d, m, f) \
BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
asymbol * (*_minisymbol_to_symbol)
(bfd *, bfd_boolean, const void *, asymbol *);
/* Routines for relocs. */
#define BFD_JUMP_TABLE_RELOCS(NAME) \
NAME##_get_reloc_upper_bound, \
NAME##_canonicalize_reloc, \
NAME##_bfd_reloc_type_lookup, \
NAME##_bfd_reloc_name_lookup
long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
long (*_bfd_canonicalize_reloc)
(bfd *, sec_ptr, arelent **, struct bfd_symbol **);
/* See documentation on reloc types. */
reloc_howto_type *
(*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
reloc_howto_type *
(*reloc_name_lookup) (bfd *, const char *);
/* Routines used when writing an object file. */
#define BFD_JUMP_TABLE_WRITE(NAME) \
NAME##_set_arch_mach, \
NAME##_set_section_contents
bfd_boolean (*_bfd_set_arch_mach)
(bfd *, enum bfd_architecture, unsigned long);
bfd_boolean (*_bfd_set_section_contents)
(bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
/* Routines used by the linker. */
#define BFD_JUMP_TABLE_LINK(NAME) \
NAME##_sizeof_headers, \
NAME##_bfd_get_relocated_section_contents, \
NAME##_bfd_relax_section, \
NAME##_bfd_link_hash_table_create, \
NAME##_bfd_link_hash_table_free, \
NAME##_bfd_link_add_symbols, \
NAME##_bfd_link_just_syms, \
NAME##_bfd_final_link, \
NAME##_bfd_link_split_section, \
NAME##_bfd_gc_sections, \
NAME##_bfd_merge_sections, \
NAME##_bfd_is_group_section, \
NAME##_bfd_discard_group, \
NAME##_section_already_linked \
int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
bfd_byte * (*_bfd_get_relocated_section_contents)
(bfd *, struct bfd_link_info *, struct bfd_link_order *,
bfd_byte *, bfd_boolean, struct bfd_symbol **);
bfd_boolean (*_bfd_relax_section)
(bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
/* Create a hash table for the linker. Different backends store
different information in this table. */
struct bfd_link_hash_table *
(*_bfd_link_hash_table_create) (bfd *);
/* Release the memory associated with the linker hash table. */
void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
/* Add symbols from this object file into the hash table. */
bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
/* Indicate that we are only retrieving symbol values from this section. */
void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
/* Do a link based on the link_order structures attached to each
section of the BFD. */
bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
/* Should this section be split up into smaller pieces during linking. */
bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
/* Remove sections that are not referenced from the output. */
bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
/* Attempt to merge SEC_MERGE sections. */
bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
/* Is this section a member of a group? */
bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
/* Discard members of a group. */
bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
/* Check if SEC has been already linked during a reloceatable or
final link. */
void (*_section_already_linked) (bfd *, struct bfd_section *,
struct bfd_link_info *);
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
NAME##_get_dynamic_symtab_upper_bound, \
NAME##_canonicalize_dynamic_symtab, \
NAME##_get_synthetic_symtab, \
NAME##_get_dynamic_reloc_upper_bound, \
NAME##_canonicalize_dynamic_reloc
/* Get the amount of memory required to hold the dynamic symbols. */
long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
/* Read in the dynamic symbols. */
long (*_bfd_canonicalize_dynamic_symtab)
(bfd *, struct bfd_symbol **);
/* Create synthetized symbols. */
long (*_bfd_get_synthetic_symtab)
(bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
struct bfd_symbol **);
/* Get the amount of memory required to hold the dynamic relocs. */
long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
/* Read in the dynamic relocs. */
long (*_bfd_canonicalize_dynamic_reloc)
(bfd *, arelent **, struct bfd_symbol **);
</pre>
<p>A pointer to an alternative bfd_target in case the current one is not
satisfactory. This can happen when the target cpu supports both big
and little endian code, and target chosen by the linker has the wrong
endianness. The function open_output() in ld/ldlang.c uses this field
to find an alternative output format that is suitable.
<pre class="example"> /* Opposite endian version of this target. */
const struct bfd_target * alternative_target;
/* Data for use by back-end routines, which isn't
generic enough to belong in this structure. */
const void *backend_data;
} bfd_target;
</pre>
<p><a name="index-bfd_005fset_005fdefault_005ftarget-1315"></a>
<h5 class="subsubsection">2.12.1.1 <code>bfd_set_default_target</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_set_default_target (const char *name);
</pre>
<p><strong>Description</strong><br>
Set the default target vector to use when recognizing a BFD.
This takes the name of the target, which may be a BFD target
name or a configuration triplet.
<p><a name="index-bfd_005ffind_005ftarget-1316"></a>
<h5 class="subsubsection">2.12.1.2 <code>bfd_find_target</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
</pre>
<p><strong>Description</strong><br>
Return a pointer to the transfer vector for the object target
named <var>target_name</var>. If <var>target_name</var> is <code>NULL</code>,
choose the one in the environment variable <code>GNUTARGET</code>; if
that is null or not defined, then choose the first entry in the
target list. Passing in the string "default" or setting the
environment variable to "default" will cause the first entry in
the target list to be returned, and "target_defaulted" will be
set in the BFD if <var>abfd</var> isn't <code>NULL</code>. This causes
<code>bfd_check_format</code> to loop over all the targets to find the
one that matches the file being read.
<p><a name="index-bfd_005ftarget_005flist-1317"></a>
<h5 class="subsubsection">2.12.1.3 <code>bfd_target_list</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const char ** bfd_target_list (void);
</pre>
<p><strong>Description</strong><br>
Return a freshly malloced NULL-terminated
vector of the names of all the valid BFD targets. Do not
modify the names.
<p><a name="index-bfd_005fseach_005ffor_005ftarget-1318"></a>
<h5 class="subsubsection">2.12.1.4 <code>bfd_seach_for_target</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> const bfd_target *bfd_search_for_target
(int (*search_func) (const bfd_target *, void *),
void *);
</pre>
<p><strong>Description</strong><br>
Return a pointer to the first transfer vector in the list of
transfer vectors maintained by BFD that produces a non-zero
result when passed to the function <var>search_func</var>. The
parameter <var>data</var> is passed, unexamined, to the search
function.
</body></html>

View file

@ -0,0 +1,670 @@
<html lang="en">
<head>
<title>coff - 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-back-ends.html#BFD-back-ends" title="BFD back ends">
<link rel="prev" href="aout.html#aout" title="aout">
<link rel="next" href="elf.html#elf" title="elf">
<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="coff"></a>Next:&nbsp;<a rel="next" accesskey="n" href="elf.html#elf">elf</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="aout.html#aout">aout</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-back-ends.html#BFD-back-ends">BFD back ends</a>
<hr><br>
</div>
<h3 class="section">3.3 coff backends</h3>
<p>BFD supports a number of different flavours of coff format.
The major differences between formats are the sizes and
alignments of fields in structures on disk, and the occasional
extra field.
<p>Coff in all its varieties is implemented with a few common
files and a number of implementation specific files. For
example, The 88k bcs coff format is implemented in the file
<span class="file">coff-m88k.c</span>. This file <code>#include</code>s
<span class="file">coff/m88k.h</span> which defines the external structure of the
coff format for the 88k, and <span class="file">coff/internal.h</span> which
defines the internal structure. <span class="file">coff-m88k.c</span> also
defines the relocations used by the 88k format
See <a href="Relocations.html#Relocations">Relocations</a>.
<p>The Intel i960 processor version of coff is implemented in
<span class="file">coff-i960.c</span>. This file has the same structure as
<span class="file">coff-m88k.c</span>, except that it includes <span class="file">coff/i960.h</span>
rather than <span class="file">coff-m88k.h</span>.
<h4 class="subsection">3.3.1 Porting to a new version of coff</h4>
<p>The recommended method is to select from the existing
implementations the version of coff which is most like the one
you want to use. For example, we'll say that i386 coff is
the one you select, and that your coff flavour is called foo.
Copy <span class="file">i386coff.c</span> to <span class="file">foocoff.c</span>, copy
<span class="file">../include/coff/i386.h</span> to <span class="file">../include/coff/foo.h</span>,
and add the lines to <span class="file">targets.c</span> and <span class="file">Makefile.in</span>
so that your new back end is used. Alter the shapes of the
structures in <span class="file">../include/coff/foo.h</span> so that they match
what you need. You will probably also have to add
<code>#ifdef</code>s to the code in <span class="file">coff/internal.h</span> and
<span class="file">coffcode.h</span> if your version of coff is too wild.
<p>You can verify that your new BFD backend works quite simply by
building <span class="file">objdump</span> from the <span class="file">binutils</span> directory,
and making sure that its version of what's going on and your
host system's idea (assuming it has the pretty standard coff
dump utility, usually called <code>att-dump</code> or just
<code>dump</code>) are the same. Then clean up your code, and send
what you've done to Cygnus. Then your stuff will be in the
next release, and you won't have to keep integrating it.
<h4 class="subsection">3.3.2 How the coff backend works</h4>
<h5 class="subsubsection">3.3.2.1 File layout</h5>
<p>The Coff backend is split into generic routines that are
applicable to any Coff target and routines that are specific
to a particular target. The target-specific routines are
further split into ones which are basically the same for all
Coff targets except that they use the external symbol format
or use different values for certain constants.
<p>The generic routines are in <span class="file">coffgen.c</span>. These routines
work for any Coff target. They use some hooks into the target
specific code; the hooks are in a <code>bfd_coff_backend_data</code>
structure, one of which exists for each target.
<p>The essentially similar target-specific routines are in
<span class="file">coffcode.h</span>. This header file includes executable C code.
The various Coff targets first include the appropriate Coff
header file, make any special defines that are needed, and
then include <span class="file">coffcode.h</span>.
<p>Some of the Coff targets then also have additional routines in
the target source file itself.
<p>For example, <span class="file">coff-i960.c</span> includes
<span class="file">coff/internal.h</span> and <span class="file">coff/i960.h</span>. It then
defines a few constants, such as <code>I960</code>, and includes
<span class="file">coffcode.h</span>. Since the i960 has complex relocation
types, <span class="file">coff-i960.c</span> also includes some code to
manipulate the i960 relocs. This code is not in
<span class="file">coffcode.h</span> because it would not be used by any other
target.
<h5 class="subsubsection">3.3.2.2 Bit twiddling</h5>
<p>Each flavour of coff supported in BFD has its own header file
describing the external layout of the structures. There is also
an internal description of the coff layout, in
<span class="file">coff/internal.h</span>. A major function of the
coff backend is swapping the bytes and twiddling the bits to
translate the external form of the structures into the normal
internal form. This is all performed in the
<code>bfd_swap</code>_<i>thing</i>_<i>direction</i> routines. Some
elements are different sizes between different versions of
coff; it is the duty of the coff version specific include file
to override the definitions of various packing routines in
<span class="file">coffcode.h</span>. E.g., the size of line number entry in coff is
sometimes 16 bits, and sometimes 32 bits. <code>#define</code>ing
<code>PUT_LNSZ_LNNO</code> and <code>GET_LNSZ_LNNO</code> will select the
correct one. No doubt, some day someone will find a version of
coff which has a varying field size not catered to at the
moment. To port BFD, that person will have to add more <code>#defines</code>.
Three of the bit twiddling routines are exported to
<code>gdb</code>; <code>coff_swap_aux_in</code>, <code>coff_swap_sym_in</code>
and <code>coff_swap_lineno_in</code>. <code>GDB</code> reads the symbol
table on its own, but uses BFD to fix things up. More of the
bit twiddlers are exported for <code>gas</code>;
<code>coff_swap_aux_out</code>, <code>coff_swap_sym_out</code>,
<code>coff_swap_lineno_out</code>, <code>coff_swap_reloc_out</code>,
<code>coff_swap_filehdr_out</code>, <code>coff_swap_aouthdr_out</code>,
<code>coff_swap_scnhdr_out</code>. <code>Gas</code> currently keeps track
of all the symbol table and reloc drudgery itself, thereby
saving the internal BFD overhead, but uses BFD to swap things
on the way out, making cross ports much safer. Doing so also
allows BFD (and thus the linker) to use the same header files
as <code>gas</code>, which makes one avenue to disaster disappear.
<h5 class="subsubsection">3.3.2.3 Symbol reading</h5>
<p>The simple canonical form for symbols used by BFD is not rich
enough to keep all the information available in a coff symbol
table. The back end gets around this problem by keeping the original
symbol table around, "behind the scenes".
<p>When a symbol table is requested (through a call to
<code>bfd_canonicalize_symtab</code>), a request gets through to
<code>coff_get_normalized_symtab</code>. This reads the symbol table from
the coff file and swaps all the structures inside into the
internal form. It also fixes up all the pointers in the table
(represented in the file by offsets from the first symbol in
the table) into physical pointers to elements in the new
internal table. This involves some work since the meanings of
fields change depending upon context: a field that is a
pointer to another structure in the symbol table at one moment
may be the size in bytes of a structure at the next. Another
pass is made over the table. All symbols which mark file names
(<code>C_FILE</code> symbols) are modified so that the internal
string points to the value in the auxent (the real filename)
rather than the normal text associated with the symbol
(<code>".file"</code>).
<p>At this time the symbol names are moved around. Coff stores
all symbols less than nine characters long physically
within the symbol table; longer strings are kept at the end of
the file in the string table. This pass moves all strings
into memory and replaces them with pointers to the strings.
<p>The symbol table is massaged once again, this time to create
the canonical table used by the BFD application. Each symbol
is inspected in turn, and a decision made (using the
<code>sclass</code> field) about the various flags to set in the
<code>asymbol</code>. See <a href="Symbols.html#Symbols">Symbols</a>. The generated canonical table
shares strings with the hidden internal symbol table.
<p>Any linenumbers are read from the coff file too, and attached
to the symbols which own the functions the linenumbers belong to.
<h5 class="subsubsection">3.3.2.4 Symbol writing</h5>
<p>Writing a symbol to a coff file which didn't come from a coff
file will lose any debugging information. The <code>asymbol</code>
structure remembers the BFD from which the symbol was taken, and on
output the back end makes sure that the same destination target as
source target is present.
<p>When the symbols have come from a coff file then all the
debugging information is preserved.
<p>Symbol tables are provided for writing to the back end in a
vector of pointers to pointers. This allows applications like
the linker to accumulate and output large symbol tables
without having to do too much byte copying.
<p>This function runs through the provided symbol table and
patches each symbol marked as a file place holder
(<code>C_FILE</code>) to point to the next file place holder in the
list. It also marks each <code>offset</code> field in the list with
the offset from the first symbol of the current symbol.
<p>Another function of this procedure is to turn the canonical
value form of BFD into the form used by coff. Internally, BFD
expects symbol values to be offsets from a section base; so a
symbol physically at 0x120, but in a section starting at
0x100, would have the value 0x20. Coff expects symbols to
contain their final value, so symbols have their values
changed at this point to reflect their sum with their owning
section. This transformation uses the
<code>output_section</code> field of the <code>asymbol</code>'s
<code>asection</code> See <a href="Sections.html#Sections">Sections</a>.
<ul>
<li><code>coff_mangle_symbols</code>
</ul>
This routine runs though the provided symbol table and uses
the offsets generated by the previous pass and the pointers
generated when the symbol table was read in to create the
structured hierarchy required by coff. It changes each pointer
to a symbol into the index into the symbol table of the asymbol.
<ul>
<li><code>coff_write_symbols</code>
</ul>
This routine runs through the symbol table and patches up the
symbols from their internal form into the coff way, calls the
bit twiddlers, and writes out the table to the file.
<p><a name="index-coff_005fsymbol_005ftype-1397"></a>
<h5 class="subsubsection">3.3.2.5 <code>coff_symbol_type</code></h5>
<p><strong>Description</strong><br>
The hidden information for an <code>asymbol</code> is described in a
<code>combined_entry_type</code>:
<pre class="example">
typedef struct coff_ptr_struct
{
/* Remembers the offset from the first symbol in the file for
this symbol. Generated by coff_renumber_symbols. */
unsigned int offset;
/* Should the value of this symbol be renumbered. Used for
XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */
unsigned int fix_value : 1;
/* Should the tag field of this symbol be renumbered.
Created by coff_pointerize_aux. */
unsigned int fix_tag : 1;
/* Should the endidx field of this symbol be renumbered.
Created by coff_pointerize_aux. */
unsigned int fix_end : 1;
/* Should the x_csect.x_scnlen field be renumbered.
Created by coff_pointerize_aux. */
unsigned int fix_scnlen : 1;
/* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
index into the line number entries. Set by coff_slurp_symbol_table. */
unsigned int fix_line : 1;
/* The container for the symbol structure as read and translated
from the file. */
union
{
union internal_auxent auxent;
struct internal_syment syment;
} u;
} combined_entry_type;
/* Each canonical asymbol really looks like this: */
typedef struct coff_symbol_struct
{
/* The actual symbol which the rest of BFD works with */
asymbol symbol;
/* A pointer to the hidden information for this symbol */
combined_entry_type *native;
/* A pointer to the linenumber information for this symbol */
struct lineno_cache_entry *lineno;
/* Have the line numbers been relocated yet ? */
bfd_boolean done_lineno;
} coff_symbol_type;
</pre>
<p><a name="index-bfd_005fcoff_005fbackend_005fdata-1398"></a>
<h5 class="subsubsection">3.3.2.6 <code>bfd_coff_backend_data</code></h5>
<pre class="example"> /* COFF symbol classifications. */
enum coff_symbol_classification
{
/* Global symbol. */
COFF_SYMBOL_GLOBAL,
/* Common symbol. */
COFF_SYMBOL_COMMON,
/* Undefined symbol. */
COFF_SYMBOL_UNDEFINED,
/* Local symbol. */
COFF_SYMBOL_LOCAL,
/* PE section symbol. */
COFF_SYMBOL_PE_SECTION
};
</pre>
<p>Special entry points for gdb to swap in coff symbol table parts:
<pre class="example"> typedef struct
{
void (*_bfd_coff_swap_aux_in)
(bfd *, void *, int, int, int, int, void *);
void (*_bfd_coff_swap_sym_in)
(bfd *, void *, void *);
void (*_bfd_coff_swap_lineno_in)
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_aux_out)
(bfd *, void *, int, int, int, int, void *);
unsigned int (*_bfd_coff_swap_sym_out)
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_lineno_out)
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_reloc_out)
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_filehdr_out)
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_aouthdr_out)
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_scnhdr_out)
(bfd *, void *, void *);
unsigned int _bfd_filhsz;
unsigned int _bfd_aoutsz;
unsigned int _bfd_scnhsz;
unsigned int _bfd_symesz;
unsigned int _bfd_auxesz;
unsigned int _bfd_relsz;
unsigned int _bfd_linesz;
unsigned int _bfd_filnmlen;
bfd_boolean _bfd_coff_long_filenames;
bfd_boolean _bfd_coff_long_section_names;
unsigned int _bfd_coff_default_section_alignment_power;
bfd_boolean _bfd_coff_force_symnames_in_strings;
unsigned int _bfd_coff_debug_string_prefix_length;
void (*_bfd_coff_swap_filehdr_in)
(bfd *, void *, void *);
void (*_bfd_coff_swap_aouthdr_in)
(bfd *, void *, void *);
void (*_bfd_coff_swap_scnhdr_in)
(bfd *, void *, void *);
void (*_bfd_coff_swap_reloc_in)
(bfd *abfd, void *, void *);
bfd_boolean (*_bfd_coff_bad_format_hook)
(bfd *, void *);
bfd_boolean (*_bfd_coff_set_arch_mach_hook)
(bfd *, void *);
void * (*_bfd_coff_mkobject_hook)
(bfd *, void *, void *);
bfd_boolean (*_bfd_styp_to_sec_flags_hook)
(bfd *, void *, const char *, asection *, flagword *);
void (*_bfd_set_alignment_hook)
(bfd *, asection *, void *);
bfd_boolean (*_bfd_coff_slurp_symbol_table)
(bfd *);
bfd_boolean (*_bfd_coff_symname_in_debug)
(bfd *, struct internal_syment *);
bfd_boolean (*_bfd_coff_pointerize_aux_hook)
(bfd *, combined_entry_type *, combined_entry_type *,
unsigned int, combined_entry_type *);
bfd_boolean (*_bfd_coff_print_aux)
(bfd *, FILE *, combined_entry_type *, combined_entry_type *,
combined_entry_type *, unsigned int);
void (*_bfd_coff_reloc16_extra_cases)
(bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
bfd_byte *, unsigned int *, unsigned int *);
int (*_bfd_coff_reloc16_estimate)
(bfd *, asection *, arelent *, unsigned int,
struct bfd_link_info *);
enum coff_symbol_classification (*_bfd_coff_classify_symbol)
(bfd *, struct internal_syment *);
bfd_boolean (*_bfd_coff_compute_section_file_positions)
(bfd *);
bfd_boolean (*_bfd_coff_start_final_link)
(bfd *, struct bfd_link_info *);
bfd_boolean (*_bfd_coff_relocate_section)
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **);
reloc_howto_type *(*_bfd_coff_rtype_to_howto)
(bfd *, asection *, struct internal_reloc *,
struct coff_link_hash_entry *, struct internal_syment *,
bfd_vma *);
bfd_boolean (*_bfd_coff_adjust_symndx)
(bfd *, struct bfd_link_info *, bfd *, asection *,
struct internal_reloc *, bfd_boolean *);
bfd_boolean (*_bfd_coff_link_add_one_symbol)
(struct bfd_link_info *, bfd *, const char *, flagword,
asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
struct bfd_link_hash_entry **);
bfd_boolean (*_bfd_coff_link_output_has_begun)
(bfd *, struct coff_final_link_info *);
bfd_boolean (*_bfd_coff_final_link_postscript)
(bfd *, struct coff_final_link_info *);
bfd_boolean (*_bfd_coff_print_pdata)
(bfd *, void *);
} bfd_coff_backend_data;
#define coff_backend_info(abfd) \
((bfd_coff_backend_data *) (abfd)-&gt;xvec-&gt;backend_data)
#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
((coff_backend_info (a)-&gt;_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
#define bfd_coff_swap_sym_in(a,e,i) \
((coff_backend_info (a)-&gt;_bfd_coff_swap_sym_in) (a,e,i))
#define bfd_coff_swap_lineno_in(a,e,i) \
((coff_backend_info ( a)-&gt;_bfd_coff_swap_lineno_in) (a,e,i))
#define bfd_coff_swap_reloc_out(abfd, i, o) \
((coff_backend_info (abfd)-&gt;_bfd_coff_swap_reloc_out) (abfd, i, o))
#define bfd_coff_swap_lineno_out(abfd, i, o) \
((coff_backend_info (abfd)-&gt;_bfd_coff_swap_lineno_out) (abfd, i, o))
#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
((coff_backend_info (a)-&gt;_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
#define bfd_coff_swap_sym_out(abfd, i,o) \
((coff_backend_info (abfd)-&gt;_bfd_coff_swap_sym_out) (abfd, i, o))
#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
((coff_backend_info (abfd)-&gt;_bfd_coff_swap_scnhdr_out) (abfd, i, o))
#define bfd_coff_swap_filehdr_out(abfd, i,o) \
((coff_backend_info (abfd)-&gt;_bfd_coff_swap_filehdr_out) (abfd, i, o))
#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
((coff_backend_info (abfd)-&gt;_bfd_coff_swap_aouthdr_out) (abfd, i, o))
#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)-&gt;_bfd_filhsz)
#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)-&gt;_bfd_aoutsz)
#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)-&gt;_bfd_scnhsz)
#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)-&gt;_bfd_symesz)
#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)-&gt;_bfd_auxesz)
#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)-&gt;_bfd_relsz)
#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)-&gt;_bfd_linesz)
#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)-&gt;_bfd_filnmlen)
#define bfd_coff_long_filenames(abfd) \
(coff_backend_info (abfd)-&gt;_bfd_coff_long_filenames)
#define bfd_coff_long_section_names(abfd) \
(coff_backend_info (abfd)-&gt;_bfd_coff_long_section_names)
#define bfd_coff_default_section_alignment_power(abfd) \
(coff_backend_info (abfd)-&gt;_bfd_coff_default_section_alignment_power)
#define bfd_coff_swap_filehdr_in(abfd, i,o) \
((coff_backend_info (abfd)-&gt;_bfd_coff_swap_filehdr_in) (abfd, i, o))
#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
((coff_backend_info (abfd)-&gt;_bfd_coff_swap_aouthdr_in) (abfd, i, o))
#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
((coff_backend_info (abfd)-&gt;_bfd_coff_swap_scnhdr_in) (abfd, i, o))
#define bfd_coff_swap_reloc_in(abfd, i, o) \
((coff_backend_info (abfd)-&gt;_bfd_coff_swap_reloc_in) (abfd, i, o))
#define bfd_coff_bad_format_hook(abfd, filehdr) \
((coff_backend_info (abfd)-&gt;_bfd_coff_bad_format_hook) (abfd, filehdr))
#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
((coff_backend_info (abfd)-&gt;_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
((coff_backend_info (abfd)-&gt;_bfd_coff_mkobject_hook)\
(abfd, filehdr, aouthdr))
#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\
((coff_backend_info (abfd)-&gt;_bfd_styp_to_sec_flags_hook)\
(abfd, scnhdr, name, section, flags_ptr))
#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
((coff_backend_info (abfd)-&gt;_bfd_set_alignment_hook) (abfd, sec, scnhdr))
#define bfd_coff_slurp_symbol_table(abfd)\
((coff_backend_info (abfd)-&gt;_bfd_coff_slurp_symbol_table) (abfd))
#define bfd_coff_symname_in_debug(abfd, sym)\
((coff_backend_info (abfd)-&gt;_bfd_coff_symname_in_debug) (abfd, sym))
#define bfd_coff_force_symnames_in_strings(abfd)\
(coff_backend_info (abfd)-&gt;_bfd_coff_force_symnames_in_strings)
#define bfd_coff_debug_string_prefix_length(abfd)\
(coff_backend_info (abfd)-&gt;_bfd_coff_debug_string_prefix_length)
#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
((coff_backend_info (abfd)-&gt;_bfd_coff_print_aux)\
(abfd, file, base, symbol, aux, indaux))
#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\
reloc, data, src_ptr, dst_ptr)\
((coff_backend_info (abfd)-&gt;_bfd_coff_reloc16_extra_cases)\
(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
((coff_backend_info (abfd)-&gt;_bfd_coff_reloc16_estimate)\
(abfd, section, reloc, shrink, link_info))
#define bfd_coff_classify_symbol(abfd, sym)\
((coff_backend_info (abfd)-&gt;_bfd_coff_classify_symbol)\
(abfd, sym))
#define bfd_coff_compute_section_file_positions(abfd)\
((coff_backend_info (abfd)-&gt;_bfd_coff_compute_section_file_positions)\
(abfd))
#define bfd_coff_start_final_link(obfd, info)\
((coff_backend_info (obfd)-&gt;_bfd_coff_start_final_link)\
(obfd, info))
#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
((coff_backend_info (ibfd)-&gt;_bfd_coff_relocate_section)\
(obfd, info, ibfd, o, con, rel, isyms, secs))
#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
((coff_backend_info (abfd)-&gt;_bfd_coff_rtype_to_howto)\
(abfd, sec, rel, h, sym, addendp))
#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
((coff_backend_info (abfd)-&gt;_bfd_coff_adjust_symndx)\
(obfd, info, ibfd, sec, rel, adjustedp))
#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
value, string, cp, coll, hashp)\
((coff_backend_info (abfd)-&gt;_bfd_coff_link_add_one_symbol)\
(info, abfd, name, flags, section, value, string, cp, coll, hashp))
#define bfd_coff_link_output_has_begun(a,p) \
((coff_backend_info (a)-&gt;_bfd_coff_link_output_has_begun) (a, p))
#define bfd_coff_final_link_postscript(a,p) \
((coff_backend_info (a)-&gt;_bfd_coff_final_link_postscript) (a, p))
#define bfd_coff_have_print_pdata(a) \
(coff_backend_info (a)-&gt;_bfd_coff_print_pdata)
#define bfd_coff_print_pdata(a,p) \
((coff_backend_info (a)-&gt;_bfd_coff_print_pdata) (a, p))
</pre>
<h5 class="subsubsection">3.3.2.7 Writing relocations</h5>
<p>To write relocations, the back end steps though the
canonical relocation table and create an
<code>internal_reloc</code>. The symbol index to use is removed from
the <code>offset</code> field in the symbol table supplied. The
address comes directly from the sum of the section base
address and the relocation offset; the type is dug directly
from the howto field. Then the <code>internal_reloc</code> is
swapped into the shape of an <code>external_reloc</code> and written
out to disk.
<h5 class="subsubsection">3.3.2.8 Reading linenumbers</h5>
<p>Creating the linenumber table is done by reading in the entire
coff linenumber table, and creating another table for internal use.
<p>A coff linenumber table is structured so that each function
is marked as having a line number of 0. Each line within the
function is an offset from the first line in the function. The
base of the line number information for the table is stored in
the symbol associated with the function.
<p>Note: The PE format uses line number 0 for a flag indicating a
new source file.
<p>The information is copied from the external to the internal
table, and each symbol which marks a function is marked by
pointing its...
<p>How does this work ?
<h5 class="subsubsection">3.3.2.9 Reading relocations</h5>
<p>Coff relocations are easily transformed into the internal BFD form
(<code>arelent</code>).
<p>Reading a coff relocation table is done in the following stages:
<ul>
<li>Read the entire coff relocation table into memory.
<li>Process each relocation in turn; first swap it from the
external to the internal form.
<li>Turn the symbol referenced in the relocation's symbol index
into a pointer into the canonical symbol table.
This table is the same as the one returned by a call to
<code>bfd_canonicalize_symtab</code>. The back end will call that
routine and save the result if a canonicalization hasn't been done.
<li>The reloc index is turned into a pointer to a howto
structure, in a back end specific way. For instance, the 386
and 960 use the <code>r_type</code> to directly produce an index
into a howto table vector; the 88k subtracts a number from the
<code>r_type</code> field and creates an addend field.
</ul>
</body></html>

View file

@ -0,0 +1,82 @@
<html lang="en">
<head>
<title>elf - 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-back-ends.html#BFD-back-ends" title="BFD back ends">
<link rel="prev" href="coff.html#coff" title="coff">
<link rel="next" href="mmo.html#mmo" title="mmo">
<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="elf"></a>Next:&nbsp;<a rel="next" accesskey="n" href="mmo.html#mmo">mmo</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="coff.html#coff">coff</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-back-ends.html#BFD-back-ends">BFD back ends</a>
<hr><br>
</div>
<h3 class="section">3.4 ELF backends</h3>
<p>BFD support for ELF formats is being worked on.
Currently, the best supported back ends are for sparc and i386
(running svr4 or Solaris 2).
<p>Documentation of the internals of the support code still needs
to be written. The code is changing quickly enough that we
haven't bothered yet.
<p><a name="index-bfd_005felf_005ffind_005fsection-1399"></a>
<h5 class="subsubsection">3.4.0.1 <code>bfd_elf_find_section</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
</pre>
<p><strong>Description</strong><br>
Helper functions for GDB to locate the string tables.
Since BFD hides string tables from callers, GDB needs to use an
internal hook to find them. Sun's .stabstr, in particular,
isn't even pointed to by the .stab section, so ordinary
mechanisms wouldn't work to find it, even if we had some.
<!-- Leave this out until the file has some actual contents... -->
<!-- @include elfcode.texi -->
</body></html>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,412 @@
<html lang="en">
<head>
<title>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="#Top">
<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="contents">
<h2>Table of Contents</h2>
<ul>
<li><a name="toc_Overview" href="Overview.html#Overview">1 Introduction</a>
<ul>
<li><a href="History.html#History">1.1 History</a>
<li><a href="How-It-Works.html#How-It-Works">1.2 How To Use BFD</a>
<li><a href="What-BFD-Version-2-Can-Do.html#What-BFD-Version-2-Can-Do">1.3 What BFD Version 2 Can Do</a>
<ul>
<li><a href="BFD-information-loss.html#BFD-information-loss">1.3.1 Information Loss</a>
<li><a href="Canonical-format.html#Canonical-format">1.3.2 The BFD canonical object-file format</a>
</li></ul>
</li></ul>
<li><a name="toc_BFD-front-end" href="BFD-front-end.html#BFD-front-end">2 BFD Front End</a>
<ul>
<li><a href="BFD-front-end.html#BFD-front-end">2.1 <code>typedef bfd</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.2 Error reporting</a>
<ul>
<li><a href="BFD-front-end.html#BFD-front-end">2.2.1 Type <code>bfd_error_type</code></a>
<ul>
<li><a href="BFD-front-end.html#BFD-front-end">2.2.1.1 <code>bfd_get_error</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.2.1.2 <code>bfd_set_error</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.2.1.3 <code>bfd_errmsg</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.2.1.4 <code>bfd_perror</code></a>
</li></ul>
<li><a href="BFD-front-end.html#BFD-front-end">2.2.2 BFD error handler</a>
<ul>
<li><a href="BFD-front-end.html#BFD-front-end">2.2.2.1 <code>bfd_set_error_handler</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.2.2.2 <code>bfd_set_error_program_name</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.2.2.3 <code>bfd_get_error_handler</code></a>
</li></ul>
</li></ul>
<li><a href="BFD-front-end.html#BFD-front-end">2.3 Miscellaneous</a>
<ul>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1 Miscellaneous functions</a>
<ul>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.1 <code>bfd_get_reloc_upper_bound</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.2 <code>bfd_canonicalize_reloc</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.3 <code>bfd_set_reloc</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.4 <code>bfd_set_file_flags</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.5 <code>bfd_get_arch_size</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.6 <code>bfd_get_sign_extend_vma</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.7 <code>bfd_set_start_address</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.8 <code>bfd_get_gp_size</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.9 <code>bfd_set_gp_size</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.10 <code>bfd_scan_vma</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.11 <code>bfd_copy_private_header_data</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.12 <code>bfd_copy_private_bfd_data</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.13 <code>bfd_merge_private_bfd_data</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.14 <code>bfd_set_private_flags</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.15 <code>Other functions</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.16 <code>bfd_alt_mach_code</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.17 <code>bfd_preserve_save</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.18 <code>bfd_preserve_restore</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.19 <code>bfd_preserve_finish</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.20 <code>bfd_emul_get_maxpagesize</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.21 <code>bfd_emul_set_maxpagesize</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.22 <code>bfd_emul_get_commonpagesize</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.23 <code>bfd_emul_set_commonpagesize</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.24 <code>bfd_demangle</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.25 <code>struct bfd_iovec</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.26 <code>bfd_get_mtime</code></a>
<li><a href="BFD-front-end.html#BFD-front-end">2.3.1.27 <code>bfd_get_size</code></a>
</li></ul>
</li></ul>
<li><a href="Memory-Usage.html#Memory-Usage">2.4 Memory Usage</a>
<li><a href="Initialization.html#Initialization">2.5 Initialization</a>
<ul>
<li><a href="Initialization.html#Initialization">2.5.1 Initialization functions</a>
<ul>
<li><a href="Initialization.html#Initialization">2.5.1.1 <code>bfd_init</code></a>
</li></ul>
</li></ul>
<li><a href="Sections.html#Sections">2.6 Sections</a>
<ul>
<li><a href="Section-Input.html#Section-Input">2.6.1 Section input</a>
<li><a href="Section-Output.html#Section-Output">2.6.2 Section output</a>
<li><a href="Section-Output.html#Section-Output">2.6.3 Link orders</a>
<li><a href="typedef-asection.html#typedef-asection">2.6.4 typedef asection</a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5 Section prototypes</a>
<ul>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.1 <code>bfd_section_list_clear</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.2 <code>bfd_get_section_by_name</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.3 <code>bfd_get_section_by_name_if</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.4 <code>bfd_get_unique_section_name</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.5 <code>bfd_make_section_old_way</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.6 <code>bfd_make_section_anyway_with_flags</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.7 <code>bfd_make_section_anyway</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.8 <code>bfd_make_section_with_flags</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.9 <code>bfd_make_section</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.10 <code>bfd_set_section_flags</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.11 <code>bfd_map_over_sections</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.12 <code>bfd_sections_find_if</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.13 <code>bfd_set_section_size</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.14 <code>bfd_set_section_contents</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.15 <code>bfd_get_section_contents</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.16 <code>bfd_malloc_and_get_section</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.17 <code>bfd_copy_private_section_data</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.18 <code>bfd_generic_is_group_section</code></a>
<li><a href="section-prototypes.html#section-prototypes">2.6.5.19 <code>bfd_generic_discard_group</code></a>
</li></ul>
</li></ul>
<li><a href="Symbols.html#Symbols">2.7 Symbols</a>
<ul>
<li><a href="Reading-Symbols.html#Reading-Symbols">2.7.1 Reading symbols</a>
<li><a href="Writing-Symbols.html#Writing-Symbols">2.7.2 Writing symbols</a>
<li><a href="Mini-Symbols.html#Mini-Symbols">2.7.3 Mini Symbols</a>
<li><a href="typedef-asymbol.html#typedef-asymbol">2.7.4 typedef asymbol</a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5 Symbol handling functions</a>
<ul>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.1 <code>bfd_get_symtab_upper_bound</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.2 <code>bfd_is_local_label</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.3 <code>bfd_is_local_label_name</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.4 <code>bfd_is_target_special_symbol</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.5 <code>bfd_canonicalize_symtab</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.6 <code>bfd_set_symtab</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.7 <code>bfd_print_symbol_vandf</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.8 <code>bfd_make_empty_symbol</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.9 <code>_bfd_generic_make_empty_symbol</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.10 <code>bfd_make_debug_symbol</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.11 <code>bfd_decode_symclass</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.12 <code>bfd_is_undefined_symclass</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.13 <code>bfd_symbol_info</code></a>
<li><a href="symbol-handling-functions.html#symbol-handling-functions">2.7.5.14 <code>bfd_copy_private_symbol_data</code></a>
</li></ul>
</li></ul>
<li><a href="Archives.html#Archives">2.8 Archives</a>
<ul>
<li><a href="Archives.html#Archives">2.8.1 Archive functions</a>
<ul>
<li><a href="Archives.html#Archives">2.8.1.1 <code>bfd_get_next_mapent</code></a>
<li><a href="Archives.html#Archives">2.8.1.2 <code>bfd_set_archive_head</code></a>
<li><a href="Archives.html#Archives">2.8.1.3 <code>bfd_openr_next_archived_file</code></a>
</li></ul>
</li></ul>
<li><a href="Formats.html#Formats">2.9 File formats</a>
<ul>
<li><a href="Formats.html#Formats">2.9.1 File format functions</a>
<ul>
<li><a href="Formats.html#Formats">2.9.1.1 <code>bfd_check_format</code></a>
<li><a href="Formats.html#Formats">2.9.1.2 <code>bfd_check_format_matches</code></a>
<li><a href="Formats.html#Formats">2.9.1.3 <code>bfd_set_format</code></a>
<li><a href="Formats.html#Formats">2.9.1.4 <code>bfd_format_string</code></a>
</li></ul>
</li></ul>
<li><a href="Relocations.html#Relocations">2.10 Relocations</a>
<ul>
<li><a href="typedef-arelent.html#typedef-arelent">2.10.1 typedef arelent</a>
<ul>
<li><a href="typedef-arelent.html#typedef-arelent">2.10.1.1 <code>enum complain_overflow</code></a>
<li><a href="typedef-arelent.html#typedef-arelent">2.10.1.2 <code>reloc_howto_type</code></a>
<li><a href="typedef-arelent.html#typedef-arelent">2.10.1.3 <code>The HOWTO Macro</code></a>
<li><a href="typedef-arelent.html#typedef-arelent">2.10.1.4 <code>bfd_get_reloc_size</code></a>
<li><a href="typedef-arelent.html#typedef-arelent">2.10.1.5 <code>arelent_chain</code></a>
<li><a href="typedef-arelent.html#typedef-arelent">2.10.1.6 <code>bfd_check_overflow</code></a>
<li><a href="typedef-arelent.html#typedef-arelent">2.10.1.7 <code>bfd_perform_relocation</code></a>
<li><a href="typedef-arelent.html#typedef-arelent">2.10.1.8 <code>bfd_install_relocation</code></a>
</li></ul>
<li><a href="howto-manager.html#howto-manager">2.10.2 The howto manager</a>
<ul>
<li><a href="howto-manager.html#howto-manager">2.10.2.1 <code>bfd_reloc_code_type</code></a>
<li><a href="howto-manager.html#howto-manager">2.10.2.2 <code>bfd_reloc_type_lookup</code></a>
<li><a href="howto-manager.html#howto-manager">2.10.2.3 <code>bfd_default_reloc_type_lookup</code></a>
<li><a href="howto-manager.html#howto-manager">2.10.2.4 <code>bfd_get_reloc_code_name</code></a>
<li><a href="howto-manager.html#howto-manager">2.10.2.5 <code>bfd_generic_relax_section</code></a>
<li><a href="howto-manager.html#howto-manager">2.10.2.6 <code>bfd_generic_gc_sections</code></a>
<li><a href="howto-manager.html#howto-manager">2.10.2.7 <code>bfd_generic_merge_sections</code></a>
<li><a href="howto-manager.html#howto-manager">2.10.2.8 <code>bfd_generic_get_relocated_section_contents</code></a>
</li></ul>
</li></ul>
<li><a href="Core-Files.html#Core-Files">2.11 Core files</a>
<ul>
<li><a href="Core-Files.html#Core-Files">2.11.1 Core file functions</a>
<ul>
<li><a href="Core-Files.html#Core-Files">2.11.1.1 <code>bfd_core_file_failing_command</code></a>
<li><a href="Core-Files.html#Core-Files">2.11.1.2 <code>bfd_core_file_failing_signal</code></a>
<li><a href="Core-Files.html#Core-Files">2.11.1.3 <code>core_file_matches_executable_p</code></a>
<li><a href="Core-Files.html#Core-Files">2.11.1.4 <code>generic_core_file_matches_executable_p</code></a>
</li></ul>
</li></ul>
<li><a href="Targets.html#Targets">2.12 Targets</a>
<ul>
<li><a href="bfd_005ftarget.html#bfd_005ftarget">2.12.1 bfd_target</a>
<ul>
<li><a href="bfd_005ftarget.html#bfd_005ftarget">2.12.1.1 <code>bfd_set_default_target</code></a>
<li><a href="bfd_005ftarget.html#bfd_005ftarget">2.12.1.2 <code>bfd_find_target</code></a>
<li><a href="bfd_005ftarget.html#bfd_005ftarget">2.12.1.3 <code>bfd_target_list</code></a>
<li><a href="bfd_005ftarget.html#bfd_005ftarget">2.12.1.4 <code>bfd_seach_for_target</code></a>
</li></ul>
</li></ul>
<li><a href="Architectures.html#Architectures">2.13 Architectures</a>
<ul>
<li><a href="Architectures.html#Architectures">2.13.1 bfd_architecture</a>
<li><a href="Architectures.html#Architectures">2.13.2 bfd_arch_info</a>
<ul>
<li><a href="Architectures.html#Architectures">2.13.2.1 <code>bfd_printable_name</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.2 <code>bfd_scan_arch</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.3 <code>bfd_arch_list</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.4 <code>bfd_arch_get_compatible</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.5 <code>bfd_default_arch_struct</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.6 <code>bfd_set_arch_info</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.7 <code>bfd_default_set_arch_mach</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.8 <code>bfd_get_arch</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.9 <code>bfd_get_mach</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.10 <code>bfd_arch_bits_per_byte</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.11 <code>bfd_arch_bits_per_address</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.12 <code>bfd_default_compatible</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.13 <code>bfd_default_scan</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.14 <code>bfd_get_arch_info</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.15 <code>bfd_lookup_arch</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.16 <code>bfd_printable_arch_mach</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.17 <code>bfd_octets_per_byte</code></a>
<li><a href="Architectures.html#Architectures">2.13.2.18 <code>bfd_arch_mach_octets_per_byte</code></a>
</li></ul>
</li></ul>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14 Opening and closing BFDs</a>
<ul>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1 Functions for opening and closing</a>
<ul>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.1 <code>bfd_fopen</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.2 <code>bfd_openr</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.3 <code>bfd_fdopenr</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.4 <code>bfd_openstreamr</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.5 <code>bfd_openr_iovec</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.6 <code>bfd_openw</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.7 <code>bfd_close</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.8 <code>bfd_close_all_done</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.9 <code>bfd_create</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.10 <code>bfd_make_writable</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.11 <code>bfd_make_readable</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.12 <code>bfd_alloc</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.13 <code>bfd_alloc2</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.14 <code>bfd_zalloc</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.15 <code>bfd_zalloc2</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.16 <code>bfd_calc_gnu_debuglink_crc32</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.17 <code>get_debug_link_info</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.18 <code>separate_debug_file_exists</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.19 <code>find_separate_debug_file</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.20 <code>bfd_follow_gnu_debuglink</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.21 <code>bfd_create_gnu_debuglink_section</code></a>
<li><a href="Opening-and-Closing.html#Opening-and-Closing">2.14.1.22 <code>bfd_fill_in_gnu_debuglink_section</code></a>
</li></ul>
</li></ul>
<li><a href="Internal.html#Internal">2.15 Implementation details</a>
<ul>
<li><a href="Internal.html#Internal">2.15.1 Internal functions</a>
<ul>
<li><a href="Internal.html#Internal">2.15.1.1 <code>bfd_write_bigendian_4byte_int</code></a>
<li><a href="Internal.html#Internal">2.15.1.2 <code>bfd_put_size</code></a>
<li><a href="Internal.html#Internal">2.15.1.3 <code>bfd_get_size</code></a>
<li><a href="Internal.html#Internal">2.15.1.4 <code>bfd_h_put_size</code></a>
<li><a href="Internal.html#Internal">2.15.1.5 <code>bfd_log2</code></a>
</li></ul>
</li></ul>
<li><a href="File-Caching.html#File-Caching">2.16 File caching</a>
<ul>
<li><a href="File-Caching.html#File-Caching">2.16.1 Caching functions</a>
<ul>
<li><a href="File-Caching.html#File-Caching">2.16.1.1 <code>bfd_cache_init</code></a>
<li><a href="File-Caching.html#File-Caching">2.16.1.2 <code>bfd_cache_close</code></a>
<li><a href="File-Caching.html#File-Caching">2.16.1.3 <code>bfd_cache_close_all</code></a>
<li><a href="File-Caching.html#File-Caching">2.16.1.4 <code>bfd_open_file</code></a>
</li></ul>
</li></ul>
<li><a href="Linker-Functions.html#Linker-Functions">2.17 Linker Functions</a>
<ul>
<li><a href="Creating-a-Linker-Hash-Table.html#Creating-a-Linker-Hash-Table">2.17.1 Creating a linker hash table</a>
<li><a href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table">2.17.2 Adding symbols to the hash table</a>
<ul>
<li><a href="Differing-file-formats.html#Differing-file-formats">2.17.2.1 Differing file formats</a>
<li><a href="Adding-symbols-from-an-object-file.html#Adding-symbols-from-an-object-file">2.17.2.2 Adding symbols from an object file</a>
<li><a href="Adding-symbols-from-an-archive.html#Adding-symbols-from-an-archive">2.17.2.3 Adding symbols from an archive</a>
</li></ul>
<li><a href="Performing-the-Final-Link.html#Performing-the-Final-Link">2.17.3 Performing the final link</a>
<ul>
<li><a href="Information-provided-by-the-linker.html#Information-provided-by-the-linker">2.17.3.1 Information provided by the linker</a>
<li><a href="Relocating-the-section-contents.html#Relocating-the-section-contents">2.17.3.2 Relocating the section contents</a>
<li><a href="Writing-the-symbol-table.html#Writing-the-symbol-table">2.17.3.3 Writing the symbol table</a>
<li><a href="Writing-the-symbol-table.html#Writing-the-symbol-table">2.17.3.4 <code>bfd_link_split_section</code></a>
<li><a href="Writing-the-symbol-table.html#Writing-the-symbol-table">2.17.3.5 <code>bfd_section_already_linked</code></a>
</li></ul>
</li></ul>
<li><a href="Hash-Tables.html#Hash-Tables">2.18 Hash Tables</a>
<ul>
<li><a href="Creating-and-Freeing-a-Hash-Table.html#Creating-and-Freeing-a-Hash-Table">2.18.1 Creating and freeing a hash table</a>
<li><a href="Looking-Up-or-Entering-a-String.html#Looking-Up-or-Entering-a-String">2.18.2 Looking up or entering a string</a>
<li><a href="Traversing-a-Hash-Table.html#Traversing-a-Hash-Table">2.18.3 Traversing a hash table</a>
<li><a href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type">2.18.4 Deriving a new hash table type</a>
<ul>
<li><a href="Define-the-Derived-Structures.html#Define-the-Derived-Structures">2.18.4.1 Define the derived structures</a>
<li><a href="Write-the-Derived-Creation-Routine.html#Write-the-Derived-Creation-Routine">2.18.4.2 Write the derived creation routine</a>
<li><a href="Write-Other-Derived-Routines.html#Write-Other-Derived-Routines">2.18.4.3 Write other derived routines</a>
</li></ul>
</li></ul>
</li></ul>
<li><a name="toc_BFD-back-ends" href="BFD-back-ends.html#BFD-back-ends">3 BFD back ends</a>
<ul>
<li><a href="What-to-Put-Where.html#What-to-Put-Where">3.1 What to Put Where</a>
<li><a href="aout.html#aout">3.2 a.out backends</a>
<ul>
<li><a href="aout.html#aout">3.2.1 Relocations</a>
<li><a href="aout.html#aout">3.2.2 Internal entry points</a>
<ul>
<li><a href="aout.html#aout">3.2.2.1 <code>aout_</code><var>size</var><code>_swap_exec_header_in</code></a>
<li><a href="aout.html#aout">3.2.2.2 <code>aout_</code><var>size</var><code>_swap_exec_header_out</code></a>
<li><a href="aout.html#aout">3.2.2.3 <code>aout_</code><var>size</var><code>_some_aout_object_p</code></a>
<li><a href="aout.html#aout">3.2.2.4 <code>aout_</code><var>size</var><code>_mkobject</code></a>
<li><a href="aout.html#aout">3.2.2.5 <code>aout_</code><var>size</var><code>_machine_type</code></a>
<li><a href="aout.html#aout">3.2.2.6 <code>aout_</code><var>size</var><code>_set_arch_mach</code></a>
<li><a href="aout.html#aout">3.2.2.7 <code>aout_</code><var>size</var><code>_new_section_hook</code></a>
</li></ul>
</li></ul>
<li><a href="coff.html#coff">3.3 coff backends</a>
<ul>
<li><a href="coff.html#coff">3.3.1 Porting to a new version of coff</a>
<li><a href="coff.html#coff">3.3.2 How the coff backend works</a>
<ul>
<li><a href="coff.html#coff">3.3.2.1 File layout</a>
<li><a href="coff.html#coff">3.3.2.2 Bit twiddling</a>
<li><a href="coff.html#coff">3.3.2.3 Symbol reading</a>
<li><a href="coff.html#coff">3.3.2.4 Symbol writing</a>
<li><a href="coff.html#coff">3.3.2.5 <code>coff_symbol_type</code></a>
<li><a href="coff.html#coff">3.3.2.6 <code>bfd_coff_backend_data</code></a>
<li><a href="coff.html#coff">3.3.2.7 Writing relocations</a>
<li><a href="coff.html#coff">3.3.2.8 Reading linenumbers</a>
<li><a href="coff.html#coff">3.3.2.9 Reading relocations</a>
</li></ul>
</li></ul>
<li><a href="elf.html#elf">3.4 ELF backends</a>
<ul>
<ul>
<li><a href="elf.html#elf">3.4.0.1 <code>bfd_elf_find_section</code></a>
</li></ul>
</li></ul>
<li><a href="mmo.html#mmo">3.5 mmo backend</a>
<ul>
<li><a href="File-layout.html#File-layout">3.5.1 File layout</a>
<li><a href="Symbol_002dtable.html#Symbol_002dtable">3.5.2 Symbol table format</a>
<li><a href="mmo-section-mapping.html#mmo-section-mapping">3.5.3 mmo section mapping</a>
</li></ul>
</li></ul>
<li><a name="toc_GNU-Free-Documentation-License" href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">Appendix A GNU Free Documentation License</a>
<ul>
<li><a href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">ADDENDUM: How to use this License for your documents</a>
</li></ul>
<li><a name="toc_BFD-Index" href="BFD-Index.html#BFD-Index">BFD Index</a>
</li></ul>
</div>
<div class="node">
<p>
<a name="Top"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Overview.html#Overview">Overview</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="../index.html#dir">(dir)</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="../index.html#dir">(dir)</a>
<hr><br>
</div>
<ul class="menu">
<li><a accesskey="1" href="Overview.html#Overview">Overview</a>: Overview of BFD
<li><a accesskey="2" href="BFD-front-end.html#BFD-front-end">BFD front end</a>: BFD front end
<li><a accesskey="3" href="BFD-back-ends.html#BFD-back-ends">BFD back ends</a>: BFD back ends
<li><a accesskey="4" href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">GNU Free Documentation License</a>: GNU Free Documentation License
<li><a accesskey="5" href="BFD-Index.html#BFD-Index">BFD Index</a>: BFD Index
</ul>
</body></html>

View file

@ -0,0 +1,141 @@
<html lang="en">
<head>
<title>mmo section mapping - 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="mmo.html#mmo" title="mmo">
<link rel="prev" href="Symbol_002dtable.html#Symbol_002dtable" title="Symbol-table">
<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="mmo-section-mapping"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="Symbol_002dtable.html#Symbol_002dtable">Symbol-table</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="mmo.html#mmo">mmo</a>
<hr><br>
</div>
<h4 class="subsection">3.5.3 mmo section mapping</h4>
<p>The implementation in BFD uses special data type 80 (decimal) to
encapsulate and describe named sections, containing e.g. debug
information. If needed, any datum in the encapsulation will be
quoted using lop_quote. First comes a 32-bit word holding the
number of 32-bit words containing the zero-terminated zero-padded
segment name. After the name there's a 32-bit word holding flags
describing the section type. Then comes a 64-bit big-endian word
with the section length (in bytes), then another with the section
start address. Depending on the type of section, the contents
might follow, zero-padded to 32-bit boundary. For a loadable
section (such as data or code), the contents might follow at some
later point, not necessarily immediately, as a lop_loc with the
same start address as in the section description, followed by the
contents. This in effect forms a descriptor that must be emitted
before the actual contents. Sections described this way must not
overlap.
<p>For areas that don't have such descriptors, synthetic sections are
formed by BFD. Consecutive contents in the two memory areas
<span class="samp">0x0000...00</span> to <span class="samp">0x01ff...ff</span> and
<span class="samp">0x2000...00</span> to <span class="samp">0x20ff...ff</span> are entered in
sections named <code>.text</code> and <code>.data</code> respectively. If an area
is not otherwise described, but would together with a neighboring
lower area be less than <span class="samp">0x40000000</span> bytes long, it is joined
with the lower area and the gap is zero-filled. For other cases,
a new section is formed, named <code>.MMIX.sec.</code><var>n</var>. Here,
<var>n</var> is a number, a running count through the mmo file,
starting at 0.
<p>A loadable section specified as:
<pre class="example"> .section secname,"ax"
TETRA 1,2,3,4,-1,-2009
BYTE 80
</pre>
<p>and linked to address <span class="samp">0x4</span>, is represented by the sequence:
<pre class="example"> 0x98080050 - lop_spec 80
0x00000002 - two 32-bit words for the section name
0x7365636e - "secn"
0x616d6500 - "ame\0"
0x00000033 - flags CODE, READONLY, LOAD, ALLOC
0x00000000 - high 32 bits of section length
0x0000001c - section length is 28 bytes; 6 * 4 + 1 + alignment to 32 bits
0x00000000 - high 32 bits of section address
0x00000004 - section address is 4
0x98010002 - 64 bits with address of following data
0x00000000 - high 32 bits of address
0x00000004 - low 32 bits: data starts at address 4
0x00000001 - 1
0x00000002 - 2
0x00000003 - 3
0x00000004 - 4
0xffffffff - -1
0xfffff827 - -2009
0x50000000 - 80 as a byte, padded with zeros.
</pre>
<p>Note that the lop_spec wrapping does not include the section
contents. Compare this to a non-loaded section specified as:
<pre class="example"> .section thirdsec
TETRA 200001,100002
BYTE 38,40
</pre>
<p>This, when linked to address <span class="samp">0x200000000000001c</span>, is
represented by:
<pre class="example"> 0x98080050 - lop_spec 80
0x00000002 - two 32-bit words for the section name
0x7365636e - "thir"
0x616d6500 - "dsec"
0x00000010 - flag READONLY
0x00000000 - high 32 bits of section length
0x0000000c - section length is 12 bytes; 2 * 4 + 2 + alignment to 32 bits
0x20000000 - high 32 bits of address
0x0000001c - low 32 bits of address 0x200000000000001c
0x00030d41 - 200001
0x000186a2 - 100002
0x26280000 - 38, 40 as bytes, padded with zeros
</pre>
<p>For the latter example, the section contents must not be
loaded in memory, and is therefore specified as part of the
special data. The address is usually unimportant but might
provide information for e.g. the DWARF 2 debugging format.
</body></html>

View file

@ -0,0 +1,79 @@
<html lang="en">
<head>
<title>mmo - 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-back-ends.html#BFD-back-ends" title="BFD back ends">
<link rel="prev" href="elf.html#elf" title="elf">
<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="mmo"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="elf.html#elf">elf</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="BFD-back-ends.html#BFD-back-ends">BFD back ends</a>
<hr><br>
</div>
<h3 class="section">3.5 mmo backend</h3>
<p>The mmo object format is used exclusively together with Professor
Donald E. Knuth's educational 64-bit processor MMIX. The simulator
<span class="command">mmix</span> which is available at
<a href="http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz">http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz</a>
understands this format. That package also includes a combined
assembler and linker called <span class="command">mmixal</span>. The mmo format has
no advantages feature-wise compared to e.g. ELF. It is a simple
non-relocatable object format with no support for archives or
debugging information, except for symbol value information and
line numbers (which is not yet implemented in BFD). See
<a href="http://www-cs-faculty.stanford.edu/~knuth/mmix.html">http://www-cs-faculty.stanford.edu/~knuth/mmix.html</a> for more
information about MMIX. The ELF format is used for intermediate
object files in the BFD implementation.
<!-- We want to xref the symbol table node. A feature in "chew" -->
<!-- requires that "commands" do not contain spaces in the -->
<!-- arguments. Hence the hyphen in "Symbol-table". -->
<ul class="menu">
<li><a accesskey="1" href="File-layout.html#File-layout">File layout</a>
<li><a accesskey="2" href="Symbol_002dtable.html#Symbol_002dtable">Symbol-table</a>
<li><a accesskey="3" href="mmo-section-mapping.html#mmo-section-mapping">mmo section mapping</a>
</ul>
</body></html>

View file

@ -0,0 +1,397 @@
<html lang="en">
<head>
<title>section prototypes - 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="Sections.html#Sections" title="Sections">
<link rel="prev" href="typedef-asection.html#typedef-asection" title="typedef asection">
<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="section-prototypes"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="typedef-asection.html#typedef-asection">typedef asection</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Sections.html#Sections">Sections</a>
<hr><br>
</div>
<h4 class="subsection">2.6.5 Section prototypes</h4>
<p>These are the functions exported by the section handling part of BFD.
<p><a name="index-bfd_005fsection_005flist_005fclear-40"></a>
<h5 class="subsubsection">2.6.5.1 <code>bfd_section_list_clear</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void bfd_section_list_clear (bfd *);
</pre>
<p><strong>Description</strong><br>
Clears the section list, and also resets the section count and
hash table entries.
<p><a name="index-bfd_005fget_005fsection_005fby_005fname-41"></a>
<h5 class="subsubsection">2.6.5.2 <code>bfd_get_section_by_name</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> asection *bfd_get_section_by_name (bfd *abfd, const char *name);
</pre>
<p><strong>Description</strong><br>
Run through <var>abfd</var> and return the one of the
<code>asection</code>s whose name matches <var>name</var>, otherwise <code>NULL</code>.
See <a href="Sections.html#Sections">Sections</a>, for more information.
<p>This should only be used in special cases; the normal way to process
all sections of a given name is to use <code>bfd_map_over_sections</code> and
<code>strcmp</code> on the name (or better yet, base it on the section flags
or something else) for each section.
<p><a name="index-bfd_005fget_005fsection_005fby_005fname_005fif-42"></a>
<h5 class="subsubsection">2.6.5.3 <code>bfd_get_section_by_name_if</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> asection *bfd_get_section_by_name_if
(bfd *abfd,
const char *name,
bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
void *obj);
</pre>
<p><strong>Description</strong><br>
Call the provided function <var>func</var> for each section
attached to the BFD <var>abfd</var> whose name matches <var>name</var>,
passing <var>obj</var> as an argument. The function will be called
as if by
<pre class="example"> func (abfd, the_section, obj);
</pre>
<p>It returns the first section for which <var>func</var> returns true,
otherwise <code>NULL</code>.
<p><a name="index-bfd_005fget_005funique_005fsection_005fname-43"></a>
<h5 class="subsubsection">2.6.5.4 <code>bfd_get_unique_section_name</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> char *bfd_get_unique_section_name
(bfd *abfd, const char *templat, int *count);
</pre>
<p><strong>Description</strong><br>
Invent a section name that is unique in <var>abfd</var> by tacking
a dot and a digit suffix onto the original <var>templat</var>. If
<var>count</var> is non-NULL, then it specifies the first number
tried as a suffix to generate a unique name. The value
pointed to by <var>count</var> will be incremented in this case.
<p><a name="index-bfd_005fmake_005fsection_005fold_005fway-44"></a>
<h5 class="subsubsection">2.6.5.5 <code>bfd_make_section_old_way</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> asection *bfd_make_section_old_way (bfd *abfd, const char *name);
</pre>
<p><strong>Description</strong><br>
Create a new empty section called <var>name</var>
and attach it to the end of the chain of sections for the
BFD <var>abfd</var>. An attempt to create a section with a name which
is already in use returns its pointer without changing the
section chain.
<p>It has the funny name since this is the way it used to be
before it was rewritten....
<p>Possible errors are:
<ul>
<li><code>bfd_error_invalid_operation</code> -
If output has already started for this BFD.
<li><code>bfd_error_no_memory</code> -
If memory allocation fails.
</ul>
<p><a name="index-bfd_005fmake_005fsection_005fanyway_005fwith_005fflags-45"></a>
<h5 class="subsubsection">2.6.5.6 <code>bfd_make_section_anyway_with_flags</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> asection *bfd_make_section_anyway_with_flags
(bfd *abfd, const char *name, flagword flags);
</pre>
<p><strong>Description</strong><br>
Create a new empty section called <var>name</var> and attach it to the end of
the chain of sections for <var>abfd</var>. Create a new section even if there
is already a section with that name. Also set the attributes of the
new section to the value <var>flags</var>.
<p>Return <code>NULL</code> and set <code>bfd_error</code> on error; possible errors are:
<ul>
<li><code>bfd_error_invalid_operation</code> - If output has already started for <var>abfd</var>.
<li><code>bfd_error_no_memory</code> - If memory allocation fails.
</ul>
<p><a name="index-bfd_005fmake_005fsection_005fanyway-46"></a>
<h5 class="subsubsection">2.6.5.7 <code>bfd_make_section_anyway</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> asection *bfd_make_section_anyway (bfd *abfd, const char *name);
</pre>
<p><strong>Description</strong><br>
Create a new empty section called <var>name</var> and attach it to the end of
the chain of sections for <var>abfd</var>. Create a new section even if there
is already a section with that name.
<p>Return <code>NULL</code> and set <code>bfd_error</code> on error; possible errors are:
<ul>
<li><code>bfd_error_invalid_operation</code> - If output has already started for <var>abfd</var>.
<li><code>bfd_error_no_memory</code> - If memory allocation fails.
</ul>
<p><a name="index-bfd_005fmake_005fsection_005fwith_005fflags-47"></a>
<h5 class="subsubsection">2.6.5.8 <code>bfd_make_section_with_flags</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> asection *bfd_make_section_with_flags
(bfd *, const char *name, flagword flags);
</pre>
<p><strong>Description</strong><br>
Like <code>bfd_make_section_anyway</code>, but return <code>NULL</code> (without calling
bfd_set_error ()) without changing the section chain if there is already a
section named <var>name</var>. Also set the attributes of the new section to
the value <var>flags</var>. If there is an error, return <code>NULL</code> and set
<code>bfd_error</code>.
<p><a name="index-bfd_005fmake_005fsection-48"></a>
<h5 class="subsubsection">2.6.5.9 <code>bfd_make_section</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> asection *bfd_make_section (bfd *, const char *name);
</pre>
<p><strong>Description</strong><br>
Like <code>bfd_make_section_anyway</code>, but return <code>NULL</code> (without calling
bfd_set_error ()) without changing the section chain if there is already a
section named <var>name</var>. If there is an error, return <code>NULL</code> and set
<code>bfd_error</code>.
<p><a name="index-bfd_005fset_005fsection_005fflags-49"></a>
<h5 class="subsubsection">2.6.5.10 <code>bfd_set_section_flags</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_set_section_flags
(bfd *abfd, asection *sec, flagword flags);
</pre>
<p><strong>Description</strong><br>
Set the attributes of the section <var>sec</var> in the BFD
<var>abfd</var> to the value <var>flags</var>. Return <code>TRUE</code> on success,
<code>FALSE</code> on error. Possible error returns are:
<ul>
<li><code>bfd_error_invalid_operation</code> -
The section cannot have one or more of the attributes
requested. For example, a .bss section in <code>a.out</code> may not
have the <code>SEC_HAS_CONTENTS</code> field set.
</ul>
<p><a name="index-bfd_005fmap_005fover_005fsections-50"></a>
<h5 class="subsubsection">2.6.5.11 <code>bfd_map_over_sections</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void bfd_map_over_sections
(bfd *abfd,
void (*func) (bfd *abfd, asection *sect, void *obj),
void *obj);
</pre>
<p><strong>Description</strong><br>
Call the provided function <var>func</var> for each section
attached to the BFD <var>abfd</var>, passing <var>obj</var> as an
argument. The function will be called as if by
<pre class="example"> func (abfd, the_section, obj);
</pre>
<p>This is the preferred method for iterating over sections; an
alternative would be to use a loop:
<pre class="example"> section *p;
for (p = abfd-&gt;sections; p != NULL; p = p-&gt;next)
func (abfd, p, ...)
</pre>
<p><a name="index-bfd_005fsections_005ffind_005fif-51"></a>
<h5 class="subsubsection">2.6.5.12 <code>bfd_sections_find_if</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> asection *bfd_sections_find_if
(bfd *abfd,
bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
void *obj);
</pre>
<p><strong>Description</strong><br>
Call the provided function <var>operation</var> for each section
attached to the BFD <var>abfd</var>, passing <var>obj</var> as an
argument. The function will be called as if by
<pre class="example"> operation (abfd, the_section, obj);
</pre>
<p>It returns the first section for which <var>operation</var> returns true.
<p><a name="index-bfd_005fset_005fsection_005fsize-52"></a>
<h5 class="subsubsection">2.6.5.13 <code>bfd_set_section_size</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_set_section_size
(bfd *abfd, asection *sec, bfd_size_type val);
</pre>
<p><strong>Description</strong><br>
Set <var>sec</var> to the size <var>val</var>. If the operation is
ok, then <code>TRUE</code> is returned, else <code>FALSE</code>.
<p>Possible error returns:
<ul>
<li><code>bfd_error_invalid_operation</code> -
Writing has started to the BFD, so setting the size is invalid.
</ul>
<p><a name="index-bfd_005fset_005fsection_005fcontents-53"></a>
<h5 class="subsubsection">2.6.5.14 <code>bfd_set_section_contents</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_set_section_contents
(bfd *abfd, asection *section, const void *data,
file_ptr offset, bfd_size_type count);
</pre>
<p><strong>Description</strong><br>
Sets the contents of the section <var>section</var> in BFD
<var>abfd</var> to the data starting in memory at <var>data</var>. The
data is written to the output section starting at offset
<var>offset</var> for <var>count</var> octets.
<p>Normally <code>TRUE</code> is returned, else <code>FALSE</code>. Possible error
returns are:
<ul>
<li><code>bfd_error_no_contents</code> -
The output section does not have the <code>SEC_HAS_CONTENTS</code>
attribute, so nothing can be written to it.
<li>and some more too
</ul>
This routine is front end to the back end function
<code>_bfd_set_section_contents</code>.
<p><a name="index-bfd_005fget_005fsection_005fcontents-54"></a>
<h5 class="subsubsection">2.6.5.15 <code>bfd_get_section_contents</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_get_section_contents
(bfd *abfd, asection *section, void *location, file_ptr offset,
bfd_size_type count);
</pre>
<p><strong>Description</strong><br>
Read data from <var>section</var> in BFD <var>abfd</var>
into memory starting at <var>location</var>. The data is read at an
offset of <var>offset</var> from the start of the input section,
and is read for <var>count</var> bytes.
<p>If the contents of a constructor with the <code>SEC_CONSTRUCTOR</code>
flag set are requested or if the section does not have the
<code>SEC_HAS_CONTENTS</code> flag set, then the <var>location</var> is filled
with zeroes. If no errors occur, <code>TRUE</code> is returned, else
<code>FALSE</code>.
<p><a name="index-bfd_005fmalloc_005fand_005fget_005fsection-55"></a>
<h5 class="subsubsection">2.6.5.16 <code>bfd_malloc_and_get_section</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_malloc_and_get_section
(bfd *abfd, asection *section, bfd_byte **buf);
</pre>
<p><strong>Description</strong><br>
Read all data from <var>section</var> in BFD <var>abfd</var>
into a buffer, *<var>buf</var>, malloc'd by this function.
<p><a name="index-bfd_005fcopy_005fprivate_005fsection_005fdata-56"></a>
<h5 class="subsubsection">2.6.5.17 <code>bfd_copy_private_section_data</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_copy_private_section_data
(bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
</pre>
<p><strong>Description</strong><br>
Copy private section information from <var>isec</var> in the BFD
<var>ibfd</var> to the section <var>osec</var> in the BFD <var>obfd</var>.
Return <code>TRUE</code> on success, <code>FALSE</code> on error. Possible error
returns are:
<ul>
<li><code>bfd_error_no_memory</code> -
Not enough memory exists to create private data for <var>osec</var>.
</ul>
<pre class="example"> #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
BFD_SEND (obfd, _bfd_copy_private_section_data, \
(ibfd, isection, obfd, osection))
</pre>
<p><a name="index-bfd_005fgeneric_005fis_005fgroup_005fsection-57"></a>
<h5 class="subsubsection">2.6.5.18 <code>bfd_generic_is_group_section</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec);
</pre>
<p><strong>Description</strong><br>
Returns TRUE if <var>sec</var> is a member of a group.
<p><a name="index-bfd_005fgeneric_005fdiscard_005fgroup-58"></a>
<h5 class="subsubsection">2.6.5.19 <code>bfd_generic_discard_group</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
</pre>
<p><strong>Description</strong><br>
Remove all members of <var>group</var> from the output.
</body></html>

View file

@ -0,0 +1,249 @@
<html lang="en">
<head>
<title>symbol handling functions - 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="Symbols.html#Symbols" title="Symbols">
<link rel="prev" href="typedef-asymbol.html#typedef-asymbol" title="typedef asymbol">
<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="symbol-handling-functions"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="typedef-asymbol.html#typedef-asymbol">typedef asymbol</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Symbols.html#Symbols">Symbols</a>
<hr><br>
</div>
<h4 class="subsection">2.7.5 Symbol handling functions</h4>
<p><a name="index-bfd_005fget_005fsymtab_005fupper_005fbound-59"></a>
<h5 class="subsubsection">2.7.5.1 <code>bfd_get_symtab_upper_bound</code></h5>
<p><strong>Description</strong><br>
Return the number of bytes required to store a vector of pointers
to <code>asymbols</code> for all the symbols in the BFD <var>abfd</var>,
including a terminal NULL pointer. If there are no symbols in
the BFD, then return 0. If an error occurs, return -1.
<pre class="example"> #define bfd_get_symtab_upper_bound(abfd) \
BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
</pre>
<p><a name="index-bfd_005fis_005flocal_005flabel-60"></a>
<h5 class="subsubsection">2.7.5.2 <code>bfd_is_local_label</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
</pre>
<p><strong>Description</strong><br>
Return TRUE if the given symbol <var>sym</var> in the BFD <var>abfd</var> is
a compiler generated local label, else return FALSE.
<p><a name="index-bfd_005fis_005flocal_005flabel_005fname-61"></a>
<h5 class="subsubsection">2.7.5.3 <code>bfd_is_local_label_name</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
</pre>
<p><strong>Description</strong><br>
Return TRUE if a symbol with the name <var>name</var> in the BFD
<var>abfd</var> is a compiler generated local label, else return
FALSE. This just checks whether the name has the form of a
local label.
<pre class="example"> #define bfd_is_local_label_name(abfd, name) \
BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
</pre>
<p><a name="index-bfd_005fis_005ftarget_005fspecial_005fsymbol-62"></a>
<h5 class="subsubsection">2.7.5.4 <code>bfd_is_target_special_symbol</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
</pre>
<p><strong>Description</strong><br>
Return TRUE iff a symbol <var>sym</var> in the BFD <var>abfd</var> is something
special to the particular target represented by the BFD. Such symbols
should normally not be mentioned to the user.
<pre class="example"> #define bfd_is_target_special_symbol(abfd, sym) \
BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
</pre>
<p><a name="index-bfd_005fcanonicalize_005fsymtab-63"></a>
<h5 class="subsubsection">2.7.5.5 <code>bfd_canonicalize_symtab</code></h5>
<p><strong>Description</strong><br>
Read the symbols from the BFD <var>abfd</var>, and fills in
the vector <var>location</var> with pointers to the symbols and
a trailing NULL.
Return the actual number of symbol pointers, not
including the NULL.
<pre class="example"> #define bfd_canonicalize_symtab(abfd, location) \
BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
</pre>
<p><a name="index-bfd_005fset_005fsymtab-64"></a>
<h5 class="subsubsection">2.7.5.6 <code>bfd_set_symtab</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_set_symtab
(bfd *abfd, asymbol **location, unsigned int count);
</pre>
<p><strong>Description</strong><br>
Arrange that when the output BFD <var>abfd</var> is closed,
the table <var>location</var> of <var>count</var> pointers to symbols
will be written.
<p><a name="index-bfd_005fprint_005fsymbol_005fvandf-65"></a>
<h5 class="subsubsection">2.7.5.7 <code>bfd_print_symbol_vandf</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
</pre>
<p><strong>Description</strong><br>
Print the value and flags of the <var>symbol</var> supplied to the
stream <var>file</var>.
<p><a name="index-bfd_005fmake_005fempty_005fsymbol-66"></a>
<h5 class="subsubsection">2.7.5.8 <code>bfd_make_empty_symbol</code></h5>
<p><strong>Description</strong><br>
Create a new <code>asymbol</code> structure for the BFD <var>abfd</var>
and return a pointer to it.
<p>This routine is necessary because each back end has private
information surrounding the <code>asymbol</code>. Building your own
<code>asymbol</code> and pointing to it will not create the private
information, and will cause problems later on.
<pre class="example"> #define bfd_make_empty_symbol(abfd) \
BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
</pre>
<p><a name="index-_005fbfd_005fgeneric_005fmake_005fempty_005fsymbol-67"></a>
<h5 class="subsubsection">2.7.5.9 <code>_bfd_generic_make_empty_symbol</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> asymbol *_bfd_generic_make_empty_symbol (bfd *);
</pre>
<p><strong>Description</strong><br>
Create a new <code>asymbol</code> structure for the BFD <var>abfd</var>
and return a pointer to it. Used by core file routines,
binary back-end and anywhere else where no private info
is needed.
<p><a name="index-bfd_005fmake_005fdebug_005fsymbol-68"></a>
<h5 class="subsubsection">2.7.5.10 <code>bfd_make_debug_symbol</code></h5>
<p><strong>Description</strong><br>
Create a new <code>asymbol</code> structure for the BFD <var>abfd</var>,
to be used as a debugging symbol. Further details of its use have
yet to be worked out.
<pre class="example"> #define bfd_make_debug_symbol(abfd,ptr,size) \
BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
</pre>
<p><a name="index-bfd_005fdecode_005fsymclass-69"></a>
<h5 class="subsubsection">2.7.5.11 <code>bfd_decode_symclass</code></h5>
<p><strong>Description</strong><br>
Return a character corresponding to the symbol
class of <var>symbol</var>, or '?' for an unknown class.
<p><strong>Synopsis</strong>
<pre class="example"> int bfd_decode_symclass (asymbol *symbol);
</pre>
<p><a name="index-bfd_005fis_005fundefined_005fsymclass-70"></a>
<h5 class="subsubsection">2.7.5.12 <code>bfd_is_undefined_symclass</code></h5>
<p><strong>Description</strong><br>
Returns non-zero if the class symbol returned by
bfd_decode_symclass represents an undefined symbol.
Returns zero otherwise.
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_is_undefined_symclass (int symclass);
</pre>
<p><a name="index-bfd_005fsymbol_005finfo-71"></a>
<h5 class="subsubsection">2.7.5.13 <code>bfd_symbol_info</code></h5>
<p><strong>Description</strong><br>
Fill in the basic info about symbol that nm needs.
Additional info may be added by the back-ends after
calling this function.
<p><strong>Synopsis</strong>
<pre class="example"> void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
</pre>
<p><a name="index-bfd_005fcopy_005fprivate_005fsymbol_005fdata-72"></a>
<h5 class="subsubsection">2.7.5.14 <code>bfd_copy_private_symbol_data</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_boolean bfd_copy_private_symbol_data
(bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
</pre>
<p><strong>Description</strong><br>
Copy private symbol information from <var>isym</var> in the BFD
<var>ibfd</var> to the symbol <var>osym</var> in the BFD <var>obfd</var>.
Return <code>TRUE</code> on success, <code>FALSE</code> on error. Possible error
returns are:
<ul>
<li><code>bfd_error_no_memory</code> -
Not enough memory exists to create private data for <var>osec</var>.
</ul>
<pre class="example"> #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
(ibfd, isymbol, obfd, osymbol))
</pre>
</body></html>

View file

@ -0,0 +1,495 @@
<html lang="en">
<head>
<title>typedef arelent - 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="Relocations.html#Relocations" title="Relocations">
<link rel="prev" href="Relocations.html#Relocations" title="Relocations">
<link rel="next" href="howto-manager.html#howto-manager" title="howto manager">
<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="typedef-arelent"></a>Next:&nbsp;<a rel="next" accesskey="n" href="howto-manager.html#howto-manager">howto manager</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Relocations.html#Relocations">Relocations</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Relocations.html#Relocations">Relocations</a>
<hr><br>
</div>
<h4 class="subsection">2.10.1 typedef arelent</h4>
<p>This is the structure of a relocation entry:
<pre class="example">
typedef enum bfd_reloc_status
{
/* No errors detected. */
bfd_reloc_ok,
/* The relocation was performed, but there was an overflow. */
bfd_reloc_overflow,
/* The address to relocate was not within the section supplied. */
bfd_reloc_outofrange,
/* Used by special functions. */
bfd_reloc_continue,
/* Unsupported relocation size requested. */
bfd_reloc_notsupported,
/* Unused. */
bfd_reloc_other,
/* The symbol to relocate against was undefined. */
bfd_reloc_undefined,
/* The relocation was performed, but may not be ok - presently
generated only when linking i960 coff files with i960 b.out
symbols. If this type is returned, the error_message argument
to bfd_perform_relocation will be set. */
bfd_reloc_dangerous
}
bfd_reloc_status_type;
typedef struct reloc_cache_entry
{
/* A pointer into the canonical table of pointers. */
struct bfd_symbol **sym_ptr_ptr;
/* offset in section. */
bfd_size_type address;
/* addend for relocation value. */
bfd_vma addend;
/* Pointer to how to perform the required relocation. */
reloc_howto_type *howto;
}
arelent;
</pre>
<p><strong>Description</strong><br>
Here is a description of each of the fields within an <code>arelent</code>:
<ul>
<li><code>sym_ptr_ptr</code>
</ul>
The symbol table pointer points to a pointer to the symbol
associated with the relocation request. It is the pointer
into the table returned by the back end's
<code>canonicalize_symtab</code> action. See <a href="Symbols.html#Symbols">Symbols</a>. The symbol is
referenced through a pointer to a pointer so that tools like
the linker can fix up all the symbols of the same name by
modifying only one pointer. The relocation routine looks in
the symbol and uses the base of the section the symbol is
attached to and the value of the symbol as the initial
relocation offset. If the symbol pointer is zero, then the
section provided is looked up.
<ul>
<li><code>address</code>
</ul>
The <code>address</code> field gives the offset in bytes from the base of
the section data which owns the relocation record to the first
byte of relocatable information. The actual data relocated
will be relative to this point; for example, a relocation
type which modifies the bottom two bytes of a four byte word
would not touch the first byte pointed to in a big endian
world.
<ul>
<li><code>addend</code>
</ul>
The <code>addend</code> is a value provided by the back end to be added (!)
to the relocation offset. Its interpretation is dependent upon
the howto. For example, on the 68k the code:
<pre class="example"> char foo[];
main()
{
return foo[0x12345678];
}
</pre>
<p>Could be compiled into:
<pre class="example"> linkw fp,#-4
moveb @#12345678,d0
extbl d0
unlk fp
rts
</pre>
<p>This could create a reloc pointing to <code>foo</code>, but leave the
offset in the data, something like:
<pre class="example"> RELOCATION RECORDS FOR [.text]:
offset type value
00000006 32 _foo
00000000 4e56 fffc ; linkw fp,#-4
00000004 1039 1234 5678 ; moveb @#12345678,d0
0000000a 49c0 ; extbl d0
0000000c 4e5e ; unlk fp
0000000e 4e75 ; rts
</pre>
<p>Using coff and an 88k, some instructions don't have enough
space in them to represent the full address range, and
pointers have to be loaded in two parts. So you'd get something like:
<pre class="example"> or.u r13,r0,hi16(_foo+0x12345678)
ld.b r2,r13,lo16(_foo+0x12345678)
jmp r1
</pre>
<p>This should create two relocs, both pointing to <code>_foo</code>, and with
0x12340000 in their addend field. The data would consist of:
<pre class="example"> RELOCATION RECORDS FOR [.text]:
offset type value
00000002 HVRT16 _foo+0x12340000
00000006 LVRT16 _foo+0x12340000
00000000 5da05678 ; or.u r13,r0,0x5678
00000004 1c4d5678 ; ld.b r2,r13,0x5678
00000008 f400c001 ; jmp r1
</pre>
<p>The relocation routine digs out the value from the data, adds
it to the addend to get the original offset, and then adds the
value of <code>_foo</code>. Note that all 32 bits have to be kept around
somewhere, to cope with carry from bit 15 to bit 16.
<p>One further example is the sparc and the a.out format. The
sparc has a similar problem to the 88k, in that some
instructions don't have room for an entire offset, but on the
sparc the parts are created in odd sized lumps. The designers of
the a.out format chose to not use the data within the section
for storing part of the offset; all the offset is kept within
the reloc. Anything in the data should be ignored.
<pre class="example"> save %sp,-112,%sp
sethi %hi(_foo+0x12345678),%g2
ldsb [%g2+%lo(_foo+0x12345678)],%i0
ret
restore
</pre>
<p>Both relocs contain a pointer to <code>foo</code>, and the offsets
contain junk.
<pre class="example"> RELOCATION RECORDS FOR [.text]:
offset type value
00000004 HI22 _foo+0x12345678
00000008 LO10 _foo+0x12345678
00000000 9de3bf90 ; save %sp,-112,%sp
00000004 05000000 ; sethi %hi(_foo+0),%g2
00000008 f048a000 ; ldsb [%g2+%lo(_foo+0)],%i0
0000000c 81c7e008 ; ret
00000010 81e80000 ; restore
</pre>
<ul>
<li><code>howto</code>
</ul>
The <code>howto</code> field can be imagined as a
relocation instruction. It is a pointer to a structure which
contains information on what to do with all of the other
information in the reloc record and data section. A back end
would normally have a relocation instruction set and turn
relocations into pointers to the correct structure on input -
but it would be possible to create each howto field on demand.
<h5 class="subsubsection">2.10.1.1 <code>enum complain_overflow</code></h5>
<p>Indicates what sort of overflow checking should be done when
performing a relocation.
<pre class="example">
enum complain_overflow
{
/* Do not complain on overflow. */
complain_overflow_dont,
/* Complain if the value overflows when considered as a signed
number one bit larger than the field. ie. A bitfield of N bits
is allowed to represent -2**n to 2**n-1. */
complain_overflow_bitfield,
/* Complain if the value overflows when considered as a signed
number. */
complain_overflow_signed,
/* Complain if the value overflows when considered as an
unsigned number. */
complain_overflow_unsigned
};
</pre>
<h5 class="subsubsection">2.10.1.2 <code>reloc_howto_type</code></h5>
<p>The <code>reloc_howto_type</code> is a structure which contains all the
information that libbfd needs to know to tie up a back end's data.
<pre class="example"> struct bfd_symbol; /* Forward declaration. */
struct reloc_howto_struct
{
/* The type field has mainly a documentary use - the back end can
do what it wants with it, though normally the back end's
external idea of what a reloc number is stored
in this field. For example, a PC relative word relocation
in a coff environment has the type 023 - because that's
what the outside world calls a R_PCRWORD reloc. */
unsigned int type;
/* The value the final relocation is shifted right by. This drops
unwanted data from the relocation. */
unsigned int rightshift;
/* The size of the item to be relocated. This is *not* a
power-of-two measure. To get the number of bytes operated
on by a type of relocation, use bfd_get_reloc_size. */
int size;
/* The number of bits in the item to be relocated. This is used
when doing overflow checking. */
unsigned int bitsize;
/* Notes that the relocation is relative to the location in the
data section of the addend. The relocation function will
subtract from the relocation value the address of the location
being relocated. */
bfd_boolean pc_relative;
/* The bit position of the reloc value in the destination.
The relocated value is left shifted by this amount. */
unsigned int bitpos;
/* What type of overflow error should be checked for when
relocating. */
enum complain_overflow complain_on_overflow;
/* If this field is non null, then the supplied function is
called rather than the normal function. This allows really
strange relocation methods to be accommodated (e.g., i960 callj
instructions). */
bfd_reloc_status_type (*special_function)
(bfd *, arelent *, struct bfd_symbol *, void *, asection *,
bfd *, char **);
/* The textual name of the relocation type. */
char *name;
/* Some formats record a relocation addend in the section contents
rather than with the relocation. For ELF formats this is the
distinction between USE_REL and USE_RELA (though the code checks
for USE_REL == 1/0). The value of this field is TRUE if the
addend is recorded with the section contents; when performing a
partial link (ld -r) the section contents (the data) will be
modified. The value of this field is FALSE if addends are
recorded with the relocation (in arelent.addend); when performing
a partial link the relocation will be modified.
All relocations for all ELF USE_RELA targets should set this field
to FALSE (values of TRUE should be looked on with suspicion).
However, the converse is not true: not all relocations of all ELF
USE_REL targets set this field to TRUE. Why this is so is peculiar
to each particular target. For relocs that aren't used in partial
links (e.g. GOT stuff) it doesn't matter what this is set to. */
bfd_boolean partial_inplace;
/* src_mask selects the part of the instruction (or data) to be used
in the relocation sum. If the target relocations don't have an
addend in the reloc, eg. ELF USE_REL, src_mask will normally equal
dst_mask to extract the addend from the section contents. If
relocations do have an addend in the reloc, eg. ELF USE_RELA, this
field should be zero. Non-zero values for ELF USE_RELA targets are
bogus as in those cases the value in the dst_mask part of the
section contents should be treated as garbage. */
bfd_vma src_mask;
/* dst_mask selects which parts of the instruction (or data) are
replaced with a relocated value. */
bfd_vma dst_mask;
/* When some formats create PC relative instructions, they leave
the value of the pc of the place being relocated in the offset
slot of the instruction, so that a PC relative relocation can
be made just by adding in an ordinary offset (e.g., sun3 a.out).
Some formats leave the displacement part of an instruction
empty (e.g., m88k bcs); this flag signals the fact. */
bfd_boolean pcrel_offset;
};
</pre>
<p><a name="index-The-HOWTO-Macro-80"></a>
<h5 class="subsubsection">2.10.1.3 <code>The HOWTO Macro</code></h5>
<p><strong>Description</strong><br>
The HOWTO define is horrible and will go away.
<pre class="example"> #define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
{ (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
</pre>
<p><strong>Description</strong><br>
And will be replaced with the totally magic way. But for the
moment, we are compatible, so do it this way.
<pre class="example"> #define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
NAME, FALSE, 0, 0, IN)
</pre>
<p><strong>Description</strong><br>
This is used to fill in an empty howto entry in an array.
<pre class="example"> #define EMPTY_HOWTO(C) \
HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
NULL, FALSE, 0, 0, FALSE)
</pre>
<p><strong>Description</strong><br>
Helper routine to turn a symbol into a relocation value.
<pre class="example"> #define HOWTO_PREPARE(relocation, symbol) \
{ \
if (symbol != NULL) \
{ \
if (bfd_is_com_section (symbol-&gt;section)) \
{ \
relocation = 0; \
} \
else \
{ \
relocation = symbol-&gt;value; \
} \
} \
}
</pre>
<p><a name="index-bfd_005fget_005freloc_005fsize-81"></a>
<h5 class="subsubsection">2.10.1.4 <code>bfd_get_reloc_size</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> unsigned int bfd_get_reloc_size (reloc_howto_type *);
</pre>
<p><strong>Description</strong><br>
For a reloc_howto_type that operates on a fixed number of bytes,
this returns the number of bytes operated on.
<p><a name="index-arelent_005fchain-82"></a>
<h5 class="subsubsection">2.10.1.5 <code>arelent_chain</code></h5>
<p><strong>Description</strong><br>
How relocs are tied together in an <code>asection</code>:
<pre class="example"> typedef struct relent_chain
{
arelent relent;
struct relent_chain *next;
}
arelent_chain;
</pre>
<p><a name="index-bfd_005fcheck_005foverflow-83"></a>
<h5 class="subsubsection">2.10.1.6 <code>bfd_check_overflow</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_reloc_status_type bfd_check_overflow
(enum complain_overflow how,
unsigned int bitsize,
unsigned int rightshift,
unsigned int addrsize,
bfd_vma relocation);
</pre>
<p><strong>Description</strong><br>
Perform overflow checking on <var>relocation</var> which has
<var>bitsize</var> significant bits and will be shifted right by
<var>rightshift</var> bits, on a machine with addresses containing
<var>addrsize</var> significant bits. The result is either of
<code>bfd_reloc_ok</code> or <code>bfd_reloc_overflow</code>.
<p><a name="index-bfd_005fperform_005frelocation-84"></a>
<h5 class="subsubsection">2.10.1.7 <code>bfd_perform_relocation</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_reloc_status_type bfd_perform_relocation
(bfd *abfd,
arelent *reloc_entry,
void *data,
asection *input_section,
bfd *output_bfd,
char **error_message);
</pre>
<p><strong>Description</strong><br>
If <var>output_bfd</var> is supplied to this function, the
generated image will be relocatable; the relocations are
copied to the output file after they have been changed to
reflect the new state of the world. There are two ways of
reflecting the results of partial linkage in an output file:
by modifying the output data in place, and by modifying the
relocation record. Some native formats (e.g., basic a.out and
basic coff) have no way of specifying an addend in the
relocation type, so the addend has to go in the output data.
This is no big deal since in these formats the output data
slot will always be big enough for the addend. Complex reloc
types with addends were invented to solve just this problem.
The <var>error_message</var> argument is set to an error message if
this return <code>bfd_reloc_dangerous</code>.
<p><a name="index-bfd_005finstall_005frelocation-85"></a>
<h5 class="subsubsection">2.10.1.8 <code>bfd_install_relocation</code></h5>
<p><strong>Synopsis</strong>
<pre class="example"> bfd_reloc_status_type bfd_install_relocation
(bfd *abfd,
arelent *reloc_entry,
void *data, bfd_vma data_start,
asection *input_section,
char **error_message);
</pre>
<p><strong>Description</strong><br>
This looks remarkably like <code>bfd_perform_relocation</code>, except it
does not expect that the section contents have been filled in.
I.e., it's suitable for use when creating, rather than applying
a relocation.
<p>For now, this function should be considered reserved for the
assembler.
</body></html>

View file

@ -0,0 +1,582 @@
<html lang="en">
<head>
<title>typedef asection - 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="Sections.html#Sections" title="Sections">
<link rel="prev" href="Section-Output.html#Section-Output" title="Section Output">
<link rel="next" href="section-prototypes.html#section-prototypes" title="section prototypes">
<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="typedef-asection"></a>Next:&nbsp;<a rel="next" accesskey="n" href="section-prototypes.html#section-prototypes">section prototypes</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Section-Output.html#Section-Output">Section Output</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Sections.html#Sections">Sections</a>
<hr><br>
</div>
<h4 class="subsection">2.6.4 typedef asection</h4>
<p>Here is the section structure:
<pre class="example">
typedef struct bfd_section
{
/* The name of the section; the name isn't a copy, the pointer is
the same as that passed to bfd_make_section. */
const char *name;
/* A unique sequence number. */
int id;
/* Which section in the bfd; 0..n-1 as sections are created in a bfd. */
int index;
/* The next section in the list belonging to the BFD, or NULL. */
struct bfd_section *next;
/* The previous section in the list belonging to the BFD, or NULL. */
struct bfd_section *prev;
/* The field flags contains attributes of the section. Some
flags are read in from the object file, and some are
synthesized from other information. */
flagword flags;
#define SEC_NO_FLAGS 0x000
/* Tells the OS to allocate space for this section when loading.
This is clear for a section containing debug information only. */
#define SEC_ALLOC 0x001
/* Tells the OS to load the section from the file when loading.
This is clear for a .bss section. */
#define SEC_LOAD 0x002
/* The section contains data still to be relocated, so there is
some relocation information too. */
#define SEC_RELOC 0x004
/* A signal to the OS that the section contains read only data. */
#define SEC_READONLY 0x008
/* The section contains code only. */
#define SEC_CODE 0x010
/* The section contains data only. */
#define SEC_DATA 0x020
/* The section will reside in ROM. */
#define SEC_ROM 0x040
/* The section contains constructor information. This section
type is used by the linker to create lists of constructors and
destructors used by <code>g++</code>. When a back end sees a symbol
which should be used in a constructor list, it creates a new
section for the type of name (e.g., <code>__CTOR_LIST__</code>), attaches
the symbol to it, and builds a relocation. To build the lists
of constructors, all the linker has to do is catenate all the
sections called <code>__CTOR_LIST__</code> and relocate the data
contained within - exactly the operations it would peform on
standard data. */
#define SEC_CONSTRUCTOR 0x080
/* The section has contents - a data section could be
<code>SEC_ALLOC</code> | <code>SEC_HAS_CONTENTS</code>; a debug section could be
<code>SEC_HAS_CONTENTS</code> */
#define SEC_HAS_CONTENTS 0x100
/* An instruction to the linker to not output the section
even if it has information which would normally be written. */
#define SEC_NEVER_LOAD 0x200
/* The section contains thread local data. */
#define SEC_THREAD_LOCAL 0x400
/* The section has GOT references. This flag is only for the
linker, and is currently only used by the elf32-hppa back end.
It will be set if global offset table references were detected
in this section, which indicate to the linker that the section
contains PIC code, and must be handled specially when doing a
static link. */
#define SEC_HAS_GOT_REF 0x800
/* The section contains common symbols (symbols may be defined
multiple times, the value of a symbol is the amount of
space it requires, and the largest symbol value is the one
used). Most targets have exactly one of these (which we
translate to bfd_com_section_ptr), but ECOFF has two. */
#define SEC_IS_COMMON 0x1000
/* The section contains only debugging information. For
example, this is set for ELF .debug and .stab sections.
strip tests this flag to see if a section can be
discarded. */
#define SEC_DEBUGGING 0x2000
/* The contents of this section are held in memory pointed to
by the contents field. This is checked by bfd_get_section_contents,
and the data is retrieved from memory if appropriate. */
#define SEC_IN_MEMORY 0x4000
/* The contents of this section are to be excluded by the
linker for executable and shared objects unless those
objects are to be further relocated. */
#define SEC_EXCLUDE 0x8000
/* The contents of this section are to be sorted based on the sum of
the symbol and addend values specified by the associated relocation
entries. Entries without associated relocation entries will be
appended to the end of the section in an unspecified order. */
#define SEC_SORT_ENTRIES 0x10000
/* When linking, duplicate sections of the same name should be
discarded, rather than being combined into a single section as
is usually done. This is similar to how common symbols are
handled. See SEC_LINK_DUPLICATES below. */
#define SEC_LINK_ONCE 0x20000
/* If SEC_LINK_ONCE is set, this bitfield describes how the linker
should handle duplicate sections. */
#define SEC_LINK_DUPLICATES 0xc0000
/* This value for SEC_LINK_DUPLICATES means that duplicate
sections with the same name should simply be discarded. */
#define SEC_LINK_DUPLICATES_DISCARD 0x0
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if there are any duplicate sections, although
it should still only link one copy. */
#define SEC_LINK_DUPLICATES_ONE_ONLY 0x40000
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if any duplicate sections are a different size. */
#define SEC_LINK_DUPLICATES_SAME_SIZE 0x80000
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if any duplicate sections contain different
contents. */
#define SEC_LINK_DUPLICATES_SAME_CONTENTS \
(SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE)
/* This section was created by the linker as part of dynamic
relocation or other arcane processing. It is skipped when
going through the first-pass output, trusting that someone
else up the line will take care of it later. */
#define SEC_LINKER_CREATED 0x100000
/* This section should not be subject to garbage collection.
Also set to inform the linker that this section should not be
listed in the link map as discarded. */
#define SEC_KEEP 0x200000
/* This section contains "short" data, and should be placed
"near" the GP. */
#define SEC_SMALL_DATA 0x400000
/* Attempt to merge identical entities in the section.
Entity size is given in the entsize field. */
#define SEC_MERGE 0x800000
/* If given with SEC_MERGE, entities to merge are zero terminated
strings where entsize specifies character size instead of fixed
size entries. */
#define SEC_STRINGS 0x1000000
/* This section contains data about section groups. */
#define SEC_GROUP 0x2000000
/* The section is a COFF shared library section. This flag is
only for the linker. If this type of section appears in
the input file, the linker must copy it to the output file
without changing the vma or size. FIXME: Although this
was originally intended to be general, it really is COFF
specific (and the flag was renamed to indicate this). It
might be cleaner to have some more general mechanism to
allow the back end to control what the linker does with
sections. */
#define SEC_COFF_SHARED_LIBRARY 0x4000000
/* This section contains data which may be shared with other
executables or shared objects. This is for COFF only. */
#define SEC_COFF_SHARED 0x8000000
/* When a section with this flag is being linked, then if the size of
the input section is less than a page, it should not cross a page
boundary. If the size of the input section is one page or more,
it should be aligned on a page boundary. This is for TI
TMS320C54X only. */
#define SEC_TIC54X_BLOCK 0x10000000
/* Conditionally link this section; do not link if there are no
references found to any symbol in the section. This is for TI
TMS320C54X only. */
#define SEC_TIC54X_CLINK 0x20000000
/* End of section flags. */
/* Some internal packed boolean fields. */
/* See the vma field. */
unsigned int user_set_vma : 1;
/* A mark flag used by some of the linker backends. */
unsigned int linker_mark : 1;
/* Another mark flag used by some of the linker backends. Set for
output sections that have an input section. */
unsigned int linker_has_input : 1;
/* Mark flag used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
/* The following flags are used by the ELF linker. */
/* Mark sections which have been allocated to segments. */
unsigned int segment_mark : 1;
/* Type of sec_info information. */
unsigned int sec_info_type:3;
#define ELF_INFO_TYPE_NONE 0
#define ELF_INFO_TYPE_STABS 1
#define ELF_INFO_TYPE_MERGE 2
#define ELF_INFO_TYPE_EH_FRAME 3
#define ELF_INFO_TYPE_JUST_SYMS 4
/* Nonzero if this section uses RELA relocations, rather than REL. */
unsigned int use_rela_p:1;
/* Bits used by various backends. The generic code doesn't touch
these fields. */
/* Nonzero if this section has TLS related relocations. */
unsigned int has_tls_reloc:1;
/* Nonzero if this section has a gp reloc. */
unsigned int has_gp_reloc:1;
/* Nonzero if this section needs the relax finalize pass. */
unsigned int need_finalize_relax:1;
/* Whether relocations have been processed. */
unsigned int reloc_done : 1;
/* End of internal packed boolean fields. */
/* The virtual memory address of the section - where it will be
at run time. The symbols are relocated against this. The
user_set_vma flag is maintained by bfd; if it's not set, the
backend can assign addresses (for example, in <code>a.out</code>, where
the default address for <code>.data</code> is dependent on the specific
target and various flags). */
bfd_vma vma;
/* The load address of the section - where it would be in a
rom image; really only used for writing section header
information. */
bfd_vma lma;
/* The size of the section in octets, as it will be output.
Contains a value even if the section has no contents (e.g., the
size of <code>.bss</code>). */
bfd_size_type size;
/* For input sections, the original size on disk of the section, in
octets. This field should be set for any section whose size is
changed by linker relaxation. It is required for sections where
the linker relaxation scheme doesn't cache altered section and
reloc contents (stabs, eh_frame, SEC_MERGE, some coff relaxing
targets), and thus the original size needs to be kept to read the
section multiple times. For output sections, rawsize holds the
section size calculated on a previous linker relaxation pass. */
bfd_size_type rawsize;
/* If this section is going to be output, then this value is the
offset in *bytes* into the output section of the first byte in the
input section (byte ==&gt; smallest addressable unit on the
target). In most cases, if this was going to start at the
100th octet (8-bit quantity) in the output section, this value
would be 100. However, if the target byte size is 16 bits
(bfd_octets_per_byte is "2"), this value would be 50. */
bfd_vma output_offset;
/* The output section through which to map on output. */
struct bfd_section *output_section;
/* The alignment requirement of the section, as an exponent of 2 -
e.g., 3 aligns to 2^3 (or 8). */
unsigned int alignment_power;
/* If an input section, a pointer to a vector of relocation
records for the data in this section. */
struct reloc_cache_entry *relocation;
/* If an output section, a pointer to a vector of pointers to
relocation records for the data in this section. */
struct reloc_cache_entry **orelocation;
/* The number of relocation records in one of the above. */
unsigned reloc_count;
/* Information below is back end specific - and not always used
or updated. */
/* File position of section data. */
file_ptr filepos;
/* File position of relocation info. */
file_ptr rel_filepos;
/* File position of line data. */
file_ptr line_filepos;
/* Pointer to data for applications. */
void *userdata;
/* If the SEC_IN_MEMORY flag is set, this points to the actual
contents. */
unsigned char *contents;
/* Attached line number information. */
alent *lineno;
/* Number of line number records. */
unsigned int lineno_count;
/* Entity size for merging purposes. */
unsigned int entsize;
/* Points to the kept section if this section is a link-once section,
and is discarded. */
struct bfd_section *kept_section;
/* When a section is being output, this value changes as more
linenumbers are written out. */
file_ptr moving_line_filepos;
/* What the section number is in the target world. */
int target_index;
void *used_by_bfd;
/* If this is a constructor section then here is a list of the
relocations created to relocate items within it. */
struct relent_chain *constructor_chain;
/* The BFD which owns the section. */
bfd *owner;
/* A symbol which points at this section only. */
struct bfd_symbol *symbol;
struct bfd_symbol **symbol_ptr_ptr;
/* Early in the link process, map_head and map_tail are used to build
a list of input sections attached to an output section. Later,
output sections use these fields for a list of bfd_link_order
structs. */
union {
struct bfd_link_order *link_order;
struct bfd_section *s;
} map_head, map_tail;
} asection;
/* These sections are global, and are managed by BFD. The application
and target back end are not permitted to change the values in
these sections. New code should use the section_ptr macros rather
than referring directly to the const sections. The const sections
may eventually vanish. */
#define BFD_ABS_SECTION_NAME "*ABS*"
#define BFD_UND_SECTION_NAME "*UND*"
#define BFD_COM_SECTION_NAME "*COM*"
#define BFD_IND_SECTION_NAME "*IND*"
/* The absolute section. */
extern asection bfd_abs_section;
#define bfd_abs_section_ptr ((asection *) &amp;bfd_abs_section)
#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
/* Pointer to the undefined section. */
extern asection bfd_und_section;
#define bfd_und_section_ptr ((asection *) &amp;bfd_und_section)
#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
/* Pointer to the common section. */
extern asection bfd_com_section;
#define bfd_com_section_ptr ((asection *) &amp;bfd_com_section)
/* Pointer to the indirect section. */
extern asection bfd_ind_section;
#define bfd_ind_section_ptr ((asection *) &amp;bfd_ind_section)
#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
#define bfd_is_const_section(SEC) \
( ((SEC) == bfd_abs_section_ptr) \
|| ((SEC) == bfd_und_section_ptr) \
|| ((SEC) == bfd_com_section_ptr) \
|| ((SEC) == bfd_ind_section_ptr))
/* Macros to handle insertion and deletion of a bfd's sections. These
only handle the list pointers, ie. do not adjust section_count,
target_index etc. */
#define bfd_section_list_remove(ABFD, S) \
do \
{ \
asection *_s = S; \
asection *_next = _s-&gt;next; \
asection *_prev = _s-&gt;prev; \
if (_prev) \
_prev-&gt;next = _next; \
else \
(ABFD)-&gt;sections = _next; \
if (_next) \
_next-&gt;prev = _prev; \
else \
(ABFD)-&gt;section_last = _prev; \
} \
while (0)
#define bfd_section_list_append(ABFD, S) \
do \
{ \
asection *_s = S; \
bfd *_abfd = ABFD; \
_s-&gt;next = NULL; \
if (_abfd-&gt;section_last) \
{ \
_s-&gt;prev = _abfd-&gt;section_last; \
_abfd-&gt;section_last-&gt;next = _s; \
} \
else \
{ \
_s-&gt;prev = NULL; \
_abfd-&gt;sections = _s; \
} \
_abfd-&gt;section_last = _s; \
} \
while (0)
#define bfd_section_list_prepend(ABFD, S) \
do \
{ \
asection *_s = S; \
bfd *_abfd = ABFD; \
_s-&gt;prev = NULL; \
if (_abfd-&gt;sections) \
{ \
_s-&gt;next = _abfd-&gt;sections; \
_abfd-&gt;sections-&gt;prev = _s; \
} \
else \
{ \
_s-&gt;next = NULL; \
_abfd-&gt;section_last = _s; \
} \
_abfd-&gt;sections = _s; \
} \
while (0)
#define bfd_section_list_insert_after(ABFD, A, S) \
do \
{ \
asection *_a = A; \
asection *_s = S; \
asection *_next = _a-&gt;next; \
_s-&gt;next = _next; \
_s-&gt;prev = _a; \
_a-&gt;next = _s; \
if (_next) \
_next-&gt;prev = _s; \
else \
(ABFD)-&gt;section_last = _s; \
} \
while (0)
#define bfd_section_list_insert_before(ABFD, B, S) \
do \
{ \
asection *_b = B; \
asection *_s = S; \
asection *_prev = _b-&gt;prev; \
_s-&gt;prev = _prev; \
_s-&gt;next = _b; \
_b-&gt;prev = _s; \
if (_prev) \
_prev-&gt;next = _s; \
else \
(ABFD)-&gt;sections = _s; \
} \
while (0)
#define bfd_section_removed_from_list(ABFD, S) \
((S)-&gt;next == NULL ? (ABFD)-&gt;section_last != (S) : (S)-&gt;next-&gt;prev != (S))
#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
/* name, id, index, next, prev, flags, user_set_vma, */ \
{ NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
\
/* linker_mark, linker_has_input, gc_mark, */ \
0, 0, 1, \
\
/* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ \
0, 0, 0, 0, \
\
/* has_gp_reloc, need_finalize_relax, reloc_done, */ \
0, 0, 0, \
\
/* vma, lma, size, rawsize */ \
0, 0, 0, 0, \
\
/* output_offset, output_section, alignment_power, */ \
0, (struct bfd_section *) &amp;SEC, 0, \
\
/* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \
NULL, NULL, 0, 0, 0, \
\
/* line_filepos, userdata, contents, lineno, lineno_count, */ \
0, NULL, NULL, NULL, 0, \
\
/* entsize, kept_section, moving_line_filepos, */ \
0, NULL, 0, \
\
/* target_index, used_by_bfd, constructor_chain, owner, */ \
0, NULL, NULL, NULL, \
\
/* symbol, symbol_ptr_ptr, */ \
(struct bfd_symbol *) SYM, &amp;SEC.symbol, \
\
/* map_head, map_tail */ \
{ NULL }, { NULL } \
}
</pre>
</body></html>

View file

@ -0,0 +1,197 @@
<html lang="en">
<head>
<title>typedef asymbol - 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="Symbols.html#Symbols" title="Symbols">
<link rel="prev" href="Mini-Symbols.html#Mini-Symbols" title="Mini Symbols">
<link rel="next" href="symbol-handling-functions.html#symbol-handling-functions" title="symbol handling functions">
<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="typedef-asymbol"></a>Next:&nbsp;<a rel="next" accesskey="n" href="symbol-handling-functions.html#symbol-handling-functions">symbol handling functions</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Mini-Symbols.html#Mini-Symbols">Mini Symbols</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Symbols.html#Symbols">Symbols</a>
<hr><br>
</div>
<h4 class="subsection">2.7.4 typedef asymbol</h4>
<p>An <code>asymbol</code> has the form:
<pre class="example">
typedef struct bfd_symbol
{
/* A pointer to the BFD which owns the symbol. This information
is necessary so that a back end can work out what additional
information (invisible to the application writer) is carried
with the symbol.
This field is *almost* redundant, since you can use section-&gt;owner
instead, except that some symbols point to the global sections
bfd_{abs,com,und}_section. This could be fixed by making
these globals be per-bfd (or per-target-flavor). FIXME. */
struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
/* The text of the symbol. The name is left alone, and not copied; the
application may not alter it. */
const char *name;
/* The value of the symbol. This really should be a union of a
numeric value with a pointer, since some flags indicate that
a pointer to another symbol is stored here. */
symvalue value;
/* Attributes of a symbol. */
#define BSF_NO_FLAGS 0x00
/* The symbol has local scope; <code>static</code> in <code>C</code>. The value
is the offset into the section of the data. */
#define BSF_LOCAL 0x01
/* The symbol has global scope; initialized data in <code>C</code>. The
value is the offset into the section of the data. */
#define BSF_GLOBAL 0x02
/* The symbol has global scope and is exported. The value is
the offset into the section of the data. */
#define BSF_EXPORT BSF_GLOBAL /* No real difference. */
/* A normal C symbol would be one of:
<code>BSF_LOCAL</code>, <code>BSF_FORT_COMM</code>, <code>BSF_UNDEFINED</code> or
<code>BSF_GLOBAL</code>. */
/* The symbol is a debugging record. The value has an arbitrary
meaning, unless BSF_DEBUGGING_RELOC is also set. */
#define BSF_DEBUGGING 0x08
/* The symbol denotes a function entry point. Used in ELF,
perhaps others someday. */
#define BSF_FUNCTION 0x10
/* Used by the linker. */
#define BSF_KEEP 0x20
#define BSF_KEEP_G 0x40
/* A weak global symbol, overridable without warnings by
a regular global symbol of the same name. */
#define BSF_WEAK 0x80
/* This symbol was created to point to a section, e.g. ELF's
STT_SECTION symbols. */
#define BSF_SECTION_SYM 0x100
/* The symbol used to be a common symbol, but now it is
allocated. */
#define BSF_OLD_COMMON 0x200
/* The default value for common data. */
#define BFD_FORT_COMM_DEFAULT_VALUE 0
/* In some files the type of a symbol sometimes alters its
location in an output file - ie in coff a <code>ISFCN</code> symbol
which is also <code>C_EXT</code> symbol appears where it was
declared and not at the end of a section. This bit is set
by the target BFD part to convey this information. */
#define BSF_NOT_AT_END 0x400
/* Signal that the symbol is the label of constructor section. */
#define BSF_CONSTRUCTOR 0x800
/* Signal that the symbol is a warning symbol. The name is a
warning. The name of the next symbol is the one to warn about;
if a reference is made to a symbol with the same name as the next
symbol, a warning is issued by the linker. */
#define BSF_WARNING 0x1000
/* Signal that the symbol is indirect. This symbol is an indirect
pointer to the symbol with the same name as the next symbol. */
#define BSF_INDIRECT 0x2000
/* BSF_FILE marks symbols that contain a file name. This is used
for ELF STT_FILE symbols. */
#define BSF_FILE 0x4000
/* Symbol is from dynamic linking information. */
#define BSF_DYNAMIC 0x8000
/* The symbol denotes a data object. Used in ELF, and perhaps
others someday. */
#define BSF_OBJECT 0x10000
/* This symbol is a debugging symbol. The value is the offset
into the section of the data. BSF_DEBUGGING should be set
as well. */
#define BSF_DEBUGGING_RELOC 0x20000
/* This symbol is thread local. Used in ELF. */
#define BSF_THREAD_LOCAL 0x40000
/* This symbol represents a complex relocation expression,
with the expression tree serialized in the symbol name. */
#define BSF_RELC 0x80000
/* This symbol represents a signed complex relocation expression,
with the expression tree serialized in the symbol name. */
#define BSF_SRELC 0x100000
/* This symbol was created by bfd_get_synthetic_symtab. */
#define BSF_SYNTHETIC 0x200000
flagword flags;
/* A pointer to the section to which this symbol is
relative. This will always be non NULL, there are special
sections for undefined and absolute symbols. */
struct bfd_section *section;
/* Back end special data. */
union
{
void *p;
bfd_vma i;
}
udata;
}
asymbol;
</pre>
</body></html>