133965Sjdp/* genlink.h -- interface to the BFD generic linker 2218822Sdim Copyright 1993, 1994, 1996, 2002, 2005 Free Software Foundation, Inc. 333965Sjdp Written by Ian Lance Taylor, Cygnus Support. 433965Sjdp 5218822Sdim This file is part of BFD, the Binary File Descriptor library. 633965Sjdp 7218822Sdim This program is free software; you can redistribute it and/or modify 8218822Sdim it under the terms of the GNU General Public License as published by 9218822Sdim the Free Software Foundation; either version 2 of the License, or 10218822Sdim (at your option) any later version. 1133965Sjdp 12218822Sdim This program is distributed in the hope that it will be useful, 13218822Sdim but WITHOUT ANY WARRANTY; without even the implied warranty of 14218822Sdim MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15218822Sdim GNU General Public License for more details. 1633965Sjdp 17218822Sdim You should have received a copy of the GNU General Public License 18218822Sdim along with this program; if not, write to the Free Software 19218822Sdim Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 2033965Sjdp 2133965Sjdp#ifndef GENLINK_H 2233965Sjdp#define GENLINK_H 2333965Sjdp 2433965Sjdp/* This header file is internal to BFD. It describes the internal 2533965Sjdp structures and functions used by the BFD generic linker, in case 2633965Sjdp any of the more specific linkers want to use or call them. Note 2733965Sjdp that some functions, such as _bfd_generic_link_hash_table_create, 2833965Sjdp are declared in libbfd.h, because they are expected to be widely 2933965Sjdp used. The functions and structures in this file will probably only 3033965Sjdp be used by a few files besides linker.c itself. In fact, this file 3133965Sjdp is not particularly complete; I have only put in the interfaces I 3233965Sjdp actually needed. */ 3333965Sjdp 3433965Sjdp/* The generic linker uses a hash table which is a derived class of 3533965Sjdp the standard linker hash table, just as the other backend specific 3633965Sjdp linkers do. Do not confuse the generic linker hash table with the 3733965Sjdp standard BFD linker hash table it is built upon. */ 3833965Sjdp 3933965Sjdp/* Generic linker hash table entries. */ 4033965Sjdp 4133965Sjdpstruct generic_link_hash_entry 4233965Sjdp{ 4333965Sjdp struct bfd_link_hash_entry root; 4433965Sjdp /* Whether this symbol has been written out. */ 45130561Sobrien bfd_boolean written; 4633965Sjdp /* Symbol from input BFD. */ 4733965Sjdp asymbol *sym; 4833965Sjdp}; 4933965Sjdp 5033965Sjdp/* Generic linker hash table. */ 5133965Sjdp 5233965Sjdpstruct generic_link_hash_table 5333965Sjdp{ 5433965Sjdp struct bfd_link_hash_table root; 5533965Sjdp}; 5633965Sjdp 57130561Sobrien/* Look up an entry in a generic link hash table. */ 5833965Sjdp 5933965Sjdp#define _bfd_generic_link_hash_lookup(table, string, create, copy, follow) \ 6033965Sjdp ((struct generic_link_hash_entry *) \ 6133965Sjdp bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow))) 6233965Sjdp 63130561Sobrien/* Traverse a generic link hash table. */ 6433965Sjdp 6533965Sjdp#define _bfd_generic_link_hash_traverse(table, func, info) \ 6633965Sjdp (bfd_link_hash_traverse \ 6733965Sjdp (&(table)->root, \ 68218822Sdim (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \ 6933965Sjdp (info))) 7033965Sjdp 7133965Sjdp/* Get the generic link hash table from the info structure. This is 7233965Sjdp just a cast. */ 7333965Sjdp 7433965Sjdp#define _bfd_generic_hash_table(p) \ 7533965Sjdp ((struct generic_link_hash_table *) ((p)->hash)) 7633965Sjdp 7733965Sjdp/* The generic linker reads in the asymbol structures for an input BFD 7833965Sjdp and keeps them in the outsymbol and symcount fields. */ 7933965Sjdp 80218822Sdim#define _bfd_generic_link_get_symbols(abfd) ((abfd)->outsymbols) 8133965Sjdp#define _bfd_generic_link_get_symcount(abfd) ((abfd)->symcount) 8233965Sjdp 8333965Sjdp/* Add the symbols of input_bfd to the symbols being built for 8433965Sjdp output_bfd. */ 85130561Sobrienextern bfd_boolean _bfd_generic_link_output_symbols 86218822Sdim (bfd *, bfd *, struct bfd_link_info *, size_t *); 8733965Sjdp 8833965Sjdp/* This structure is used to pass information to 8933965Sjdp _bfd_generic_link_write_global_symbol, which may be called via 9033965Sjdp _bfd_generic_link_hash_traverse. */ 9133965Sjdp 9233965Sjdpstruct generic_write_global_symbol_info 9333965Sjdp{ 9433965Sjdp struct bfd_link_info *info; 9533965Sjdp bfd *output_bfd; 9633965Sjdp size_t *psymalloc; 9733965Sjdp}; 9833965Sjdp 9933965Sjdp/* Write out a single global symbol. This is expected to be called 10033965Sjdp via _bfd_generic_link_hash_traverse. The second argument must 10133965Sjdp actually be a struct generic_write_global_symbol_info *. */ 102130561Sobrienextern bfd_boolean _bfd_generic_link_write_global_symbol 103218822Sdim (struct generic_link_hash_entry *, void *); 10433965Sjdp 10533965Sjdp/* Generic link hash table entry creation routine. */ 10633965Sjdpstruct bfd_hash_entry *_bfd_generic_link_hash_newfunc 107218822Sdim (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); 10833965Sjdp 10933965Sjdp#endif 110