You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
5.8 KiB
HTML
129 lines
5.8 KiB
HTML
<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: <a rel="previous" accesskey="p" href="Relocating-the-section-contents.html#Relocating-the-section-contents">Relocating the section contents</a>,
|
|
Up: <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>
|
|
|