This commit was generated by cvs2svn to track changes on a CVS vendor
[external/binutils.git] / bfd / genlink.h
1 /* genlink.h -- interface to the BFD generic linker
2    Copyright 1993 Free Software Foundation, Inc.
3    Written by Ian Lance Taylor, Cygnus Support.
4
5 This file is part of BFD, the Binary File Descriptor library.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
20
21 #ifndef GENLINK_H
22 #define GENLINK_H
23
24 /* This header file is internal to BFD.  It describes the internal
25    structures and functions used by the BFD generic linker, in case
26    any of the more specific linkers want to use or call them.  Note
27    that some functions, such as _bfd_generic_link_hash_table_create,
28    are declared in libbfd.h, because they are expected to be widely
29    used.  The functions and structures in this file will probably only
30    be used by a few files besides linker.c itself.  In fact, this file
31    is not particularly complete; I have only put in the interfaces I
32    actually needed.  */
33
34 /* The generic linker uses a hash table which is a derived class of
35    the standard linker hash table, just as the other backend specific
36    linkers do.  Do not confuse the generic linker hash table with the
37    standard BFD linker hash table it is built upon.  The generic
38    linker hash table is onl referred to in this file.  */
39
40 /* Generic linker hash table entries.  */
41
42 struct generic_link_hash_entry
43 {
44   struct bfd_link_hash_entry root;
45   /* Symbol from input BFD.  */
46   asymbol *sym;
47 };
48
49 /* Generic linker hash table.  */
50
51 struct generic_link_hash_table
52 {
53   struct bfd_link_hash_table root;
54 };
55
56 /* Look up an entry in an generic link hash table.  */
57
58 #define _bfd_generic_link_hash_lookup(table, string, create, copy, follow) \
59   ((struct generic_link_hash_entry *) \
60    bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
61
62 /* Traverse an generic link hash table.  */
63
64 #define _bfd_generic_link_hash_traverse(table, func, info)              \
65   (bfd_link_hash_traverse                                               \
66    (&(table)->root,                                                     \
67     (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func),  \
68     (info)))
69
70 /* Get the generic link hash table from the info structure.  This is
71    just a cast.  */
72
73 #define _bfd_generic_hash_table(p) \
74   ((struct generic_link_hash_table *) ((p)->hash))
75
76 /* Add the symbols of input_bfd to the symbols being built for
77    output_bfd.  */
78 extern boolean _bfd_generic_link_output_symbols
79   PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *,
80            size_t *psymalloc));
81
82 /* This structure is used to pass information to
83    _bfd_generic_link_write_global_symbol, which may be called via
84    _bfd_generic_link_hash_traverse.  */
85
86 struct generic_write_global_symbol_info
87 {
88   bfd *output_bfd;
89   size_t *psymalloc;
90 };
91
92 /* Write out a single global symbol.  This is expected to be called
93    via _bfd_generic_link_hash_traverse.  The second argument must
94    actually be a struct generic_write_global_symbol_info *.  */
95 extern boolean _bfd_generic_link_write_global_symbol
96   PARAMS ((struct generic_link_hash_entry *, PTR));
97
98 /* Handle a bfd_indirect_link_order.  */
99 extern boolean _bfd_generic_indirect_link_order
100   PARAMS ((bfd *, struct bfd_link_info *, asection *,
101            struct bfd_link_order *));
102
103 #endif