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.
123 lines
6.0 KiB
HTML
123 lines
6.0 KiB
HTML
4 years ago
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
|
<html>
|
||
|
<!-- This file documents the BFD library.
|
||
|
|
||
|
Copyright (C) 1991-2019 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.3 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. -->
|
||
|
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
|
||
|
<head>
|
||
|
<title>Creating a Linker Hash Table (Untitled Document)</title>
|
||
|
|
||
|
<meta name="description" content="Creating a Linker Hash Table (Untitled Document)">
|
||
|
<meta name="keywords" content="Creating a Linker Hash Table (Untitled Document)">
|
||
|
<meta name="resource-type" content="document">
|
||
|
<meta name="distribution" content="global">
|
||
|
<meta name="Generator" content="makeinfo">
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<link href="index.html#Top" rel="start" title="Top">
|
||
|
<link href="BFD-Index.html#BFD-Index" rel="index" title="BFD Index">
|
||
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||
|
<link href="Linker-Functions.html#Linker-Functions" rel="up" title="Linker Functions">
|
||
|
<link href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" rel="next" title="Adding Symbols to the Hash Table">
|
||
|
<link href="Linker-Functions.html#Linker-Functions" rel="prev" title="Linker Functions">
|
||
|
<style type="text/css">
|
||
|
<!--
|
||
|
a.summary-letter {text-decoration: none}
|
||
|
blockquote.indentedblock {margin-right: 0em}
|
||
|
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||
|
blockquote.smallquotation {font-size: smaller}
|
||
|
div.display {margin-left: 3.2em}
|
||
|
div.example {margin-left: 3.2em}
|
||
|
div.lisp {margin-left: 3.2em}
|
||
|
div.smalldisplay {margin-left: 3.2em}
|
||
|
div.smallexample {margin-left: 3.2em}
|
||
|
div.smalllisp {margin-left: 3.2em}
|
||
|
kbd {font-style: oblique}
|
||
|
pre.display {font-family: inherit}
|
||
|
pre.format {font-family: inherit}
|
||
|
pre.menu-comment {font-family: serif}
|
||
|
pre.menu-preformatted {font-family: serif}
|
||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||
|
pre.smallexample {font-size: smaller}
|
||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||
|
pre.smalllisp {font-size: smaller}
|
||
|
span.nolinebreak {white-space: nowrap}
|
||
|
span.roman {font-family: initial; font-weight: normal}
|
||
|
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||
|
ul.no-bullet {list-style: none}
|
||
|
-->
|
||
|
</style>
|
||
|
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body lang="en">
|
||
|
<a name="Creating-a-Linker-Hash-Table"></a>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
Next: <a href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" accesskey="n" rel="next">Adding Symbols to the Hash Table</a>, Previous: <a href="Linker-Functions.html#Linker-Functions" accesskey="p" rel="prev">Linker Functions</a>, Up: <a href="Linker-Functions.html#Linker-Functions" accesskey="u" rel="up">Linker Functions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="BFD-Index.html#BFD-Index" title="Index" rel="index">Index</a>]</p>
|
||
|
</div>
|
||
|
<hr>
|
||
|
<a name="Creating-a-linker-hash-table"></a>
|
||
|
<h4 class="subsection">2.17.1 Creating a linker hash table</h4>
|
||
|
<a name="index-_005fbfd_005flink_005fhash_005ftable_005fcreate-in-target-vector"></a>
|
||
|
<a name="index-target-vector-_0028_005fbfd_005flink_005fhash_005ftable_005fcreate_0029"></a>
|
||
|
<p>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>
|
||
|
<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>
|
||
|
<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>
|
||
|
<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.
|
||
|
</p>
|
||
|
<hr>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
Next: <a href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" accesskey="n" rel="next">Adding Symbols to the Hash Table</a>, Previous: <a href="Linker-Functions.html#Linker-Functions" accesskey="p" rel="prev">Linker Functions</a>, Up: <a href="Linker-Functions.html#Linker-Functions" accesskey="u" rel="up">Linker Functions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="BFD-Index.html#BFD-Index" title="Index" rel="index">Index</a>]</p>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|