| 1 | /* genlink.h -- interface to the BFD generic linker
|
|---|
| 2 | Copyright 1993, 1994, 1996 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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. */
|
|---|
| 38 |
|
|---|
| 39 | /* Generic linker hash table entries. */
|
|---|
| 40 |
|
|---|
| 41 | struct generic_link_hash_entry
|
|---|
| 42 | {
|
|---|
| 43 | struct bfd_link_hash_entry root;
|
|---|
| 44 | /* Whether this symbol has been written out. */
|
|---|
| 45 | boolean written;
|
|---|
| 46 | /* Symbol from input BFD. */
|
|---|
| 47 | asymbol *sym;
|
|---|
| 48 | };
|
|---|
| 49 |
|
|---|
| 50 | /* Generic linker hash table. */
|
|---|
| 51 |
|
|---|
| 52 | struct generic_link_hash_table
|
|---|
| 53 | {
|
|---|
| 54 | struct bfd_link_hash_table root;
|
|---|
| 55 | };
|
|---|
| 56 |
|
|---|
| 57 | /* Look up an entry in an generic link hash table. */
|
|---|
| 58 |
|
|---|
| 59 | #define _bfd_generic_link_hash_lookup(table, string, create, copy, follow) \
|
|---|
| 60 | ((struct generic_link_hash_entry *) \
|
|---|
| 61 | bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
|
|---|
| 62 |
|
|---|
| 63 | /* Traverse an generic link hash table. */
|
|---|
| 64 |
|
|---|
| 65 | #define _bfd_generic_link_hash_traverse(table, func, info) \
|
|---|
| 66 | (bfd_link_hash_traverse \
|
|---|
| 67 | (&(table)->root, \
|
|---|
| 68 | (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
|---|
| 69 | (info)))
|
|---|
| 70 |
|
|---|
| 71 | /* Get the generic link hash table from the info structure. This is
|
|---|
| 72 | just a cast. */
|
|---|
| 73 |
|
|---|
| 74 | #define _bfd_generic_hash_table(p) \
|
|---|
| 75 | ((struct generic_link_hash_table *) ((p)->hash))
|
|---|
| 76 |
|
|---|
| 77 | /* The generic linker reads in the asymbol structures for an input BFD
|
|---|
| 78 | and keeps them in the outsymbol and symcount fields. */
|
|---|
| 79 |
|
|---|
| 80 | #define _bfd_generic_link_get_symbols(abfd) ((abfd)->outsymbols)
|
|---|
| 81 | #define _bfd_generic_link_get_symcount(abfd) ((abfd)->symcount)
|
|---|
| 82 |
|
|---|
| 83 | /* Add the symbols of input_bfd to the symbols being built for
|
|---|
| 84 | output_bfd. */
|
|---|
| 85 | extern boolean _bfd_generic_link_output_symbols
|
|---|
| 86 | PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *,
|
|---|
| 87 | size_t *psymalloc));
|
|---|
| 88 |
|
|---|
| 89 | /* This structure is used to pass information to
|
|---|
| 90 | _bfd_generic_link_write_global_symbol, which may be called via
|
|---|
| 91 | _bfd_generic_link_hash_traverse. */
|
|---|
| 92 |
|
|---|
| 93 | struct generic_write_global_symbol_info
|
|---|
| 94 | {
|
|---|
| 95 | struct bfd_link_info *info;
|
|---|
| 96 | bfd *output_bfd;
|
|---|
| 97 | size_t *psymalloc;
|
|---|
| 98 | };
|
|---|
| 99 |
|
|---|
| 100 | /* Write out a single global symbol. This is expected to be called
|
|---|
| 101 | via _bfd_generic_link_hash_traverse. The second argument must
|
|---|
| 102 | actually be a struct generic_write_global_symbol_info *. */
|
|---|
| 103 | extern boolean _bfd_generic_link_write_global_symbol
|
|---|
| 104 | PARAMS ((struct generic_link_hash_entry *, PTR));
|
|---|
| 105 |
|
|---|
| 106 | /* Generic link hash table entry creation routine. */
|
|---|
| 107 | struct bfd_hash_entry *_bfd_generic_link_hash_newfunc
|
|---|
| 108 | PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
|
|---|
| 109 | const char *));
|
|---|
| 110 |
|
|---|
| 111 | #endif
|
|---|