00001 /* genlink.h -- interface to the BFD generic linker 00002 Copyright 1993, 1994, 1996, 2002 Free Software Foundation, Inc. 00003 Written by Ian Lance Taylor, Cygnus Support. 00004 00005 This file is part of BFD, the Binary File Descriptor library. 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 00020 00021 #ifndef GENLINK_H 00022 #define GENLINK_H 00023 00024 /* This header file is internal to BFD. It describes the internal 00025 structures and functions used by the BFD generic linker, in case 00026 any of the more specific linkers want to use or call them. Note 00027 that some functions, such as _bfd_generic_link_hash_table_create, 00028 are declared in libbfd.h, because they are expected to be widely 00029 used. The functions and structures in this file will probably only 00030 be used by a few files besides linker.c itself. In fact, this file 00031 is not particularly complete; I have only put in the interfaces I 00032 actually needed. */ 00033 00034 /* The generic linker uses a hash table which is a derived class of 00035 the standard linker hash table, just as the other backend specific 00036 linkers do. Do not confuse the generic linker hash table with the 00037 standard BFD linker hash table it is built upon. */ 00038 00039 /* Generic linker hash table entries. */ 00040 00041 struct generic_link_hash_entry 00042 { 00043 struct bfd_link_hash_entry root; 00044 /* Whether this symbol has been written out. */ 00045 bfd_boolean written; 00046 /* Symbol from input BFD. */ 00047 asymbol *sym; 00048 }; 00049 00050 /* Generic linker hash table. */ 00051 00052 struct generic_link_hash_table 00053 { 00054 struct bfd_link_hash_table root; 00055 }; 00056 00057 /* Look up an entry in a generic link hash table. */ 00058 00059 #define _bfd_generic_link_hash_lookup(table, string, create, copy, follow) \ 00060 ((struct generic_link_hash_entry *) \ 00061 bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow))) 00062 00063 /* Traverse a generic link hash table. */ 00064 00065 #define _bfd_generic_link_hash_traverse(table, func, info) \ 00066 (bfd_link_hash_traverse \ 00067 (&(table)->root, \ 00068 (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ 00069 (info))) 00070 00071 /* Get the generic link hash table from the info structure. This is 00072 just a cast. */ 00073 00074 #define _bfd_generic_hash_table(p) \ 00075 ((struct generic_link_hash_table *) ((p)->hash)) 00076 00077 /* The generic linker reads in the asymbol structures for an input BFD 00078 and keeps them in the outsymbol and symcount fields. */ 00079 00080 #define _bfd_generic_link_get_symbols(abfd) ((abfd)->outsymbols) 00081 #define _bfd_generic_link_get_symcount(abfd) ((abfd)->symcount) 00082 00083 /* Add the symbols of input_bfd to the symbols being built for 00084 output_bfd. */ 00085 extern bfd_boolean _bfd_generic_link_output_symbols 00086 PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *, 00087 size_t *psymalloc)); 00088 00089 /* This structure is used to pass information to 00090 _bfd_generic_link_write_global_symbol, which may be called via 00091 _bfd_generic_link_hash_traverse. */ 00092 00093 struct generic_write_global_symbol_info 00094 { 00095 struct bfd_link_info *info; 00096 bfd *output_bfd; 00097 size_t *psymalloc; 00098 }; 00099 00100 /* Write out a single global symbol. This is expected to be called 00101 via _bfd_generic_link_hash_traverse. The second argument must 00102 actually be a struct generic_write_global_symbol_info *. */ 00103 extern bfd_boolean _bfd_generic_link_write_global_symbol 00104 PARAMS ((struct generic_link_hash_entry *, PTR)); 00105 00106 /* Generic link hash table entry creation routine. */ 00107 struct bfd_hash_entry *_bfd_generic_link_hash_newfunc 00108 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, 00109 const char *)); 00110 00111 #endif
1.5.6