133965Sjdp/* Main header file for the bfd library -- portable access to object files. 2130561Sobrien 3130561Sobrien Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 4218822Sdim 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 5218822Sdim Free Software Foundation, Inc. 6130561Sobrien 733965Sjdp Contributed by Cygnus Support. 833965Sjdp 9104834Sobrien This file is part of BFD, the Binary File Descriptor library. 1033965Sjdp 11104834Sobrien This program is free software; you can redistribute it and/or modify 12104834Sobrien it under the terms of the GNU General Public License as published by 13104834Sobrien the Free Software Foundation; either version 2 of the License, or 14104834Sobrien (at your option) any later version. 1533965Sjdp 16104834Sobrien This program is distributed in the hope that it will be useful, 17104834Sobrien but WITHOUT ANY WARRANTY; without even the implied warranty of 18104834Sobrien MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19104834Sobrien GNU General Public License for more details. 2033965Sjdp 21104834Sobrien You should have received a copy of the GNU General Public License 22104834Sobrien along with this program; if not, write to the Free Software 23218822Sdim Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 2433965Sjdp 2533965Sjdp#ifndef __BFD_H_SEEN__ 2633965Sjdp#define __BFD_H_SEEN__ 2733965Sjdp 2833965Sjdp#ifdef __cplusplus 2933965Sjdpextern "C" { 3033965Sjdp#endif 3133965Sjdp 3233965Sjdp#include "ansidecl.h" 3389857Sobrien#include "symcat.h" 3489857Sobrien#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) 3589857Sobrien#ifndef SABER 3689857Sobrien/* This hack is to avoid a problem with some strict ANSI C preprocessors. 3789857Sobrien The problem is, "32_" is not a valid preprocessing token, and we don't 3889857Sobrien want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will 3989857Sobrien cause the inner CONCAT2 macros to be evaluated first, producing 4089857Sobrien still-valid pp-tokens. Then the final concatenation can be done. */ 4189857Sobrien#undef CONCAT4 4289857Sobrien#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d)) 4389857Sobrien#endif 4489857Sobrien#endif 4533965Sjdp 46218822Sdim/* This is a utility macro to handle the situation where the code 47218822Sdim wants to place a constant string into the code, followed by a 48218822Sdim comma and then the length of the string. Doing this by hand 49218822Sdim is error prone, so using this macro is safer. The macro will 50218822Sdim also safely handle the case where a NULL is passed as the arg. */ 51218822Sdim#define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0) 52218822Sdim/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro 53218822Sdim to create the arguments to another macro, since the preprocessor 54218822Sdim will mis-count the number of arguments to the outer macro (by not 55218822Sdim evaluating STRING_COMMA_LEN and so missing the comma). This is a 56218822Sdim problem for example when trying to use STRING_COMMA_LEN to build 57218822Sdim the arguments to the strncmp() macro. Hence this alternative 58218822Sdim definition of strncmp is provided here. 59218822Sdim 60218822Sdim Note - these macros do NOT work if STR2 is not a constant string. */ 61218822Sdim#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0) 62218822Sdim /* strcpy() can have a similar problem, but since we know we are 63218822Sdim copying a constant string, we can use memcpy which will be faster 64218822Sdim since there is no need to check for a NUL byte inside STR. We 65218822Sdim can also save time if we do not need to copy the terminating NUL. */ 66218822Sdim#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1) 67218822Sdim#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2)) 68218822Sdim 69218822Sdim 7089857Sobrien/* The word size used by BFD on the host. This may be 64 with a 32 7189857Sobrien bit target if the host is 64 bit, or if other 64 bit targets have 7289857Sobrien been selected with --enable-targets, or if --enable-64-bit-bfd. */ 7333965Sjdp#define BFD_ARCH_SIZE @wordsize@ 7489857Sobrien 7589857Sobrien/* The word size of the default bfd target. */ 7689857Sobrien#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@ 7789857Sobrien 7833965Sjdp#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@ 79130561Sobrien#define BFD_HOST_LONG_LONG @BFD_HOST_LONG_LONG@ 8033965Sjdp#if @BFD_HOST_64_BIT_DEFINED@ 8133965Sjdp#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@ 8233965Sjdp#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@ 83130561Sobrientypedef BFD_HOST_64_BIT bfd_int64_t; 84130561Sobrientypedef BFD_HOST_U_64_BIT bfd_uint64_t; 8533965Sjdp#endif 8633965Sjdp 8733965Sjdp#if BFD_ARCH_SIZE >= 64 8833965Sjdp#define BFD64 8933965Sjdp#endif 9033965Sjdp 9133965Sjdp#ifndef INLINE 9233965Sjdp#if __GNUC__ >= 2 9333965Sjdp#define INLINE __inline__ 9433965Sjdp#else 9533965Sjdp#define INLINE 9633965Sjdp#endif 9733965Sjdp#endif 9833965Sjdp 9991041Sobrien/* Forward declaration. */ 100130561Sobrientypedef struct bfd bfd; 10133965Sjdp 102130561Sobrien/* Boolean type used in bfd. Too many systems define their own 103130561Sobrien versions of "boolean" for us to safely typedef a "boolean" of 104130561Sobrien our own. Using an enum for "bfd_boolean" has its own set of 105130561Sobrien problems, with strange looking casts required to avoid warnings 106130561Sobrien on some older compilers. Thus we just use an int. 10733965Sjdp 108130561Sobrien General rule: Functions which are bfd_boolean return TRUE on 109130561Sobrien success and FALSE on failure (unless they're a predicate). */ 11033965Sjdp 111130561Sobrientypedef int bfd_boolean; 112130561Sobrien#undef FALSE 113130561Sobrien#undef TRUE 114130561Sobrien#define FALSE 0 115130561Sobrien#define TRUE 1 11660484Sobrien 11733965Sjdp#ifdef BFD64 11833965Sjdp 11933965Sjdp#ifndef BFD_HOST_64_BIT 12033965Sjdp #error No 64 bit integer type available 12133965Sjdp#endif /* ! defined (BFD_HOST_64_BIT) */ 12233965Sjdp 12333965Sjdptypedef BFD_HOST_U_64_BIT bfd_vma; 12433965Sjdptypedef BFD_HOST_64_BIT bfd_signed_vma; 12533965Sjdptypedef BFD_HOST_U_64_BIT bfd_size_type; 12633965Sjdptypedef BFD_HOST_U_64_BIT symvalue; 12733965Sjdp 12833965Sjdp#ifndef fprintf_vma 12933965Sjdp#if BFD_HOST_64BIT_LONG 13033965Sjdp#define sprintf_vma(s,x) sprintf (s, "%016lx", x) 13133965Sjdp#define fprintf_vma(f,x) fprintf (f, "%016lx", x) 13233965Sjdp#else 13333965Sjdp#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff))) 13433965Sjdp#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff)) 13533965Sjdp#define fprintf_vma(s,x) \ 13633965Sjdp fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x)) 13733965Sjdp#define sprintf_vma(s,x) \ 13833965Sjdp sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x)) 13933965Sjdp#endif 14033965Sjdp#endif 14133965Sjdp 14233965Sjdp#else /* not BFD64 */ 14333965Sjdp 14433965Sjdp/* Represent a target address. Also used as a generic unsigned type 14533965Sjdp which is guaranteed to be big enough to hold any arithmetic types 14633965Sjdp we need to deal with. */ 14733965Sjdptypedef unsigned long bfd_vma; 14833965Sjdp 14933965Sjdp/* A generic signed type which is guaranteed to be big enough to hold any 15033965Sjdp arithmetic types we need to deal with. Can be assumed to be compatible 15133965Sjdp with bfd_vma in the same way that signed and unsigned ints are compatible 15233965Sjdp (as parameters, in assignment, etc). */ 15333965Sjdptypedef long bfd_signed_vma; 15433965Sjdp 15533965Sjdptypedef unsigned long symvalue; 15633965Sjdptypedef unsigned long bfd_size_type; 15733965Sjdp 15833965Sjdp/* Print a bfd_vma x on stream s. */ 15977298Sobrien#define fprintf_vma(s,x) fprintf (s, "%08lx", x) 16077298Sobrien#define sprintf_vma(s,x) sprintf (s, "%08lx", x) 16160484Sobrien 16233965Sjdp#endif /* not BFD64 */ 16360484Sobrien 164218822Sdim#define HALF_BFD_SIZE_TYPE \ 165218822Sdim (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2)) 166218822Sdim 167130561Sobrien#ifndef BFD_HOST_64_BIT 168130561Sobrien/* Fall back on a 32 bit type. The idea is to make these types always 169130561Sobrien available for function return types, but in the case that 170130561Sobrien BFD_HOST_64_BIT is undefined such a function should abort or 171130561Sobrien otherwise signal an error. */ 172130561Sobrientypedef bfd_signed_vma bfd_int64_t; 173130561Sobrientypedef bfd_vma bfd_uint64_t; 174130561Sobrien#endif 17589857Sobrien 176130561Sobrien/* An offset into a file. BFD always uses the largest possible offset 177130561Sobrien based on the build time availability of fseek, fseeko, or fseeko64. */ 178130561Sobrientypedef @bfd_file_ptr@ file_ptr; 179130561Sobrientypedef unsigned @bfd_file_ptr@ ufile_ptr; 18089857Sobrien 181130561Sobrienextern void bfd_sprintf_vma (bfd *, char *, bfd_vma); 182130561Sobrienextern void bfd_fprintf_vma (bfd *, void *, bfd_vma); 183130561Sobrien 18433965Sjdp#define printf_vma(x) fprintf_vma(stdout,x) 18589857Sobrien#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x) 18633965Sjdp 18733965Sjdptypedef unsigned int flagword; /* 32 bits of flags */ 18833965Sjdptypedef unsigned char bfd_byte; 18933965Sjdp 19091041Sobrien/* File formats. */ 19133965Sjdp 19291041Sobrientypedef enum bfd_format 19391041Sobrien{ 19491041Sobrien bfd_unknown = 0, /* File format is unknown. */ 195130561Sobrien bfd_object, /* Linker/assembler/compiler output. */ 19691041Sobrien bfd_archive, /* Object archive file. */ 19791041Sobrien bfd_core, /* Core dump. */ 19891041Sobrien bfd_type_end /* Marks the end; don't use it! */ 19991041Sobrien} 20091041Sobrienbfd_format; 20133965Sjdp 20233965Sjdp/* Values that may appear in the flags field of a BFD. These also 20333965Sjdp appear in the object_flags field of the bfd_target structure, where 20433965Sjdp they indicate the set of flags used by that backend (not all flags 20533965Sjdp are meaningful for all object file formats) (FIXME: at the moment, 20633965Sjdp the object_flags values have mostly just been copied from backend 20733965Sjdp to another, and are not necessarily correct). */ 20833965Sjdp 20933965Sjdp/* No flags. */ 21033965Sjdp#define BFD_NO_FLAGS 0x00 21133965Sjdp 21233965Sjdp/* BFD contains relocation entries. */ 21333965Sjdp#define HAS_RELOC 0x01 21433965Sjdp 21533965Sjdp/* BFD is directly executable. */ 21633965Sjdp#define EXEC_P 0x02 21733965Sjdp 21833965Sjdp/* BFD has line number information (basically used for F_LNNO in a 21933965Sjdp COFF header). */ 22033965Sjdp#define HAS_LINENO 0x04 22133965Sjdp 22233965Sjdp/* BFD has debugging information. */ 22333965Sjdp#define HAS_DEBUG 0x08 22433965Sjdp 22533965Sjdp/* BFD has symbols. */ 22633965Sjdp#define HAS_SYMS 0x10 22733965Sjdp 22833965Sjdp/* BFD has local symbols (basically used for F_LSYMS in a COFF 22933965Sjdp header). */ 23033965Sjdp#define HAS_LOCALS 0x20 23133965Sjdp 23233965Sjdp/* BFD is a dynamic object. */ 23333965Sjdp#define DYNAMIC 0x40 23433965Sjdp 23533965Sjdp/* Text section is write protected (if D_PAGED is not set, this is 23633965Sjdp like an a.out NMAGIC file) (the linker sets this by default, but 23733965Sjdp clears it for -r or -N). */ 23833965Sjdp#define WP_TEXT 0x80 23933965Sjdp 24033965Sjdp/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the 24133965Sjdp linker sets this by default, but clears it for -r or -n or -N). */ 24233965Sjdp#define D_PAGED 0x100 24333965Sjdp 24433965Sjdp/* BFD is relaxable (this means that bfd_relax_section may be able to 24533965Sjdp do something) (sometimes bfd_relax_section can do something even if 24633965Sjdp this is not set). */ 24733965Sjdp#define BFD_IS_RELAXABLE 0x200 24833965Sjdp 24933965Sjdp/* This may be set before writing out a BFD to request using a 25033965Sjdp traditional format. For example, this is used to request that when 25133965Sjdp writing out an a.out object the symbols not be hashed to eliminate 25233965Sjdp duplicates. */ 25333965Sjdp#define BFD_TRADITIONAL_FORMAT 0x400 25433965Sjdp 25533965Sjdp/* This flag indicates that the BFD contents are actually cached in 25633965Sjdp memory. If this is set, iostream points to a bfd_in_memory struct. */ 25733965Sjdp#define BFD_IN_MEMORY 0x800 258130561Sobrien 259130561Sobrien/* The sections in this BFD specify a memory page. */ 260130561Sobrien#define HAS_LOAD_PAGE 0x1000 261218822Sdim 262218822Sdim/* This BFD has been created by the linker and doesn't correspond 263218822Sdim to any input file. */ 264218822Sdim#define BFD_LINKER_CREATED 0x2000 26533965Sjdp 26691041Sobrien/* Symbols and relocation. */ 26733965Sjdp 26833965Sjdp/* A count of carsyms (canonical archive symbols). */ 26933965Sjdptypedef unsigned long symindex; 27033965Sjdp 27133965Sjdp/* How to perform a relocation. */ 27233965Sjdptypedef const struct reloc_howto_struct reloc_howto_type; 27333965Sjdp 27433965Sjdp#define BFD_NO_MORE_SYMBOLS ((symindex) ~0) 27533965Sjdp 27633965Sjdp/* General purpose part of a symbol X; 27733965Sjdp target specific parts are in libcoff.h, libaout.h, etc. */ 27833965Sjdp 27933965Sjdp#define bfd_get_section(x) ((x)->section) 28033965Sjdp#define bfd_get_output_section(x) ((x)->section->output_section) 28133965Sjdp#define bfd_set_section(x,y) ((x)->section) = (y) 28233965Sjdp#define bfd_asymbol_base(x) ((x)->section->vma) 28333965Sjdp#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value) 28433965Sjdp#define bfd_asymbol_name(x) ((x)->name) 28533965Sjdp/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/ 28633965Sjdp#define bfd_asymbol_bfd(x) ((x)->the_bfd) 28733965Sjdp#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour) 28833965Sjdp 28933965Sjdp/* A canonical archive symbol. */ 29091041Sobrien/* This is a type pun with struct ranlib on purpose! */ 29191041Sobrientypedef struct carsym 29291041Sobrien{ 29333965Sjdp char *name; 29491041Sobrien file_ptr file_offset; /* Look here to find the file. */ 29591041Sobrien} 29691041Sobriencarsym; /* To make these you call a carsymogen. */ 29733965Sjdp 29833965Sjdp/* Used in generating armaps (archive tables of contents). 29991041Sobrien Perhaps just a forward definition would do? */ 30091041Sobrienstruct orl /* Output ranlib. */ 30191041Sobrien{ 30291041Sobrien char **name; /* Symbol name. */ 30391041Sobrien union 30491041Sobrien { 30589857Sobrien file_ptr pos; 30689857Sobrien bfd *abfd; 30791041Sobrien } u; /* bfd* or file position. */ 30891041Sobrien int namidx; /* Index into string table. */ 30933965Sjdp}; 31033965Sjdp 31191041Sobrien/* Linenumber stuff. */ 31291041Sobrientypedef struct lineno_cache_entry 31391041Sobrien{ 31491041Sobrien unsigned int line_number; /* Linenumber from start of function. */ 31591041Sobrien union 31691041Sobrien { 317130561Sobrien struct bfd_symbol *sym; /* Function name. */ 31891041Sobrien bfd_vma offset; /* Offset into section. */ 31933965Sjdp } u; 32091041Sobrien} 32191041Sobrienalent; 32233965Sjdp 32391041Sobrien/* Object and core file sections. */ 32433965Sjdp 32533965Sjdp#define align_power(addr, align) \ 326104834Sobrien (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align))) 32733965Sjdp 328130561Sobrientypedef struct bfd_section *sec_ptr; 32933965Sjdp 33033965Sjdp#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0) 33133965Sjdp#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0) 332104834Sobrien#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0) 33333965Sjdp#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0) 33433965Sjdp#define bfd_section_name(bfd, ptr) ((ptr)->name) 335218822Sdim#define bfd_section_size(bfd, ptr) ((ptr)->size) 336218822Sdim#define bfd_get_section_size(ptr) ((ptr)->size) 33733965Sjdp#define bfd_section_vma(bfd, ptr) ((ptr)->vma) 33838889Sjdp#define bfd_section_lma(bfd, ptr) ((ptr)->lma) 33933965Sjdp#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power) 34033965Sjdp#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0) 34133965Sjdp#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata) 34233965Sjdp 34333965Sjdp#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) 34433965Sjdp 345130561Sobrien#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE) 346130561Sobrien#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE) 347130561Sobrien#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE) 348218822Sdim/* Find the address one past the end of SEC. */ 349218822Sdim#define bfd_get_section_limit(bfd, sec) \ 350218822Sdim (((sec)->rawsize ? (sec)->rawsize : (sec)->size) \ 351218822Sdim / bfd_octets_per_byte (bfd)) 35233965Sjdp 353218822Sdim/* Return TRUE if section has been discarded. */ 354218822Sdim#define elf_discarded_section(sec) \ 355218822Sdim (!bfd_is_abs_section (sec) \ 356218822Sdim && bfd_is_abs_section ((sec)->output_section) \ 357218822Sdim && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \ 358218822Sdim && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS) 359218822Sdim 360218822Sdim/* Forward define. */ 361218822Sdimstruct stat; 36233965Sjdp 36333965Sjdptypedef enum bfd_print_symbol 36477298Sobrien{ 36533965Sjdp bfd_print_symbol_name, 36633965Sjdp bfd_print_symbol_more, 36733965Sjdp bfd_print_symbol_all 36833965Sjdp} bfd_print_symbol_type; 36977298Sobrien 37033965Sjdp/* Information about a symbol that nm needs. */ 37133965Sjdp 37233965Sjdptypedef struct _symbol_info 37333965Sjdp{ 37433965Sjdp symvalue value; 37533965Sjdp char type; 37689857Sobrien const char *name; /* Symbol name. */ 37733965Sjdp unsigned char stab_type; /* Stab type. */ 37877298Sobrien char stab_other; /* Stab other. */ 37933965Sjdp short stab_desc; /* Stab desc. */ 38089857Sobrien const char *stab_name; /* String for stab type. */ 38133965Sjdp} symbol_info; 38233965Sjdp 38333965Sjdp/* Get the name of a stabs type code. */ 38433965Sjdp 385130561Sobrienextern const char *bfd_get_stab_name (int); 38633965Sjdp 38733965Sjdp/* Hash table routines. There is no way to free up a hash table. */ 38833965Sjdp 38933965Sjdp/* An element in the hash table. Most uses will actually use a larger 39033965Sjdp structure, and an instance of this will be the first field. */ 39133965Sjdp 39233965Sjdpstruct bfd_hash_entry 39333965Sjdp{ 39433965Sjdp /* Next entry for this hash code. */ 39533965Sjdp struct bfd_hash_entry *next; 39633965Sjdp /* String being hashed. */ 39733965Sjdp const char *string; 39833965Sjdp /* Hash code. This is the full hash code, not the index into the 39933965Sjdp table. */ 40033965Sjdp unsigned long hash; 40133965Sjdp}; 40233965Sjdp 40333965Sjdp/* A hash table. */ 40433965Sjdp 40533965Sjdpstruct bfd_hash_table 40633965Sjdp{ 40733965Sjdp /* The hash array. */ 40833965Sjdp struct bfd_hash_entry **table; 40933965Sjdp /* A function used to create new elements in the hash table. The 41033965Sjdp first entry is itself a pointer to an element. When this 41133965Sjdp function is first invoked, this pointer will be NULL. However, 41233965Sjdp having the pointer permits a hierarchy of method functions to be 41333965Sjdp built each of which calls the function in the superclass. Thus 41433965Sjdp each function should be written to allocate a new block of memory 41533965Sjdp only if the argument is NULL. */ 416130561Sobrien struct bfd_hash_entry *(*newfunc) 417130561Sobrien (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); 41833965Sjdp /* An objalloc for this hash table. This is a struct objalloc *, 419130561Sobrien but we use void * to avoid requiring the inclusion of objalloc.h. */ 420130561Sobrien void *memory; 421218822Sdim /* The number of slots in the hash table. */ 422218822Sdim unsigned int size; 423218822Sdim /* The number of entries in the hash table. */ 424218822Sdim unsigned int count; 425218822Sdim /* The size of elements. */ 426218822Sdim unsigned int entsize; 427218822Sdim /* If non-zero, don't grow the hash table. */ 428218822Sdim unsigned int frozen:1; 42933965Sjdp}; 43033965Sjdp 43133965Sjdp/* Initialize a hash table. */ 432130561Sobrienextern bfd_boolean bfd_hash_table_init 433130561Sobrien (struct bfd_hash_table *, 434130561Sobrien struct bfd_hash_entry *(*) (struct bfd_hash_entry *, 435130561Sobrien struct bfd_hash_table *, 436218822Sdim const char *), 437218822Sdim unsigned int); 43833965Sjdp 43933965Sjdp/* Initialize a hash table specifying a size. */ 440130561Sobrienextern bfd_boolean bfd_hash_table_init_n 441130561Sobrien (struct bfd_hash_table *, 442130561Sobrien struct bfd_hash_entry *(*) (struct bfd_hash_entry *, 443130561Sobrien struct bfd_hash_table *, 444130561Sobrien const char *), 445218822Sdim unsigned int, unsigned int); 44633965Sjdp 44733965Sjdp/* Free up a hash table. */ 448130561Sobrienextern void bfd_hash_table_free 449130561Sobrien (struct bfd_hash_table *); 45033965Sjdp 451130561Sobrien/* Look up a string in a hash table. If CREATE is TRUE, a new entry 45233965Sjdp will be created for this string if one does not already exist. The 453130561Sobrien COPY argument must be TRUE if this routine should copy the string 45433965Sjdp into newly allocated memory when adding an entry. */ 45533965Sjdpextern struct bfd_hash_entry *bfd_hash_lookup 456130561Sobrien (struct bfd_hash_table *, const char *, bfd_boolean create, 457130561Sobrien bfd_boolean copy); 45833965Sjdp 45933965Sjdp/* Replace an entry in a hash table. */ 46033965Sjdpextern void bfd_hash_replace 461130561Sobrien (struct bfd_hash_table *, struct bfd_hash_entry *old, 462130561Sobrien struct bfd_hash_entry *nw); 46333965Sjdp 46433965Sjdp/* Base method for creating a hash table entry. */ 46533965Sjdpextern struct bfd_hash_entry *bfd_hash_newfunc 466130561Sobrien (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); 46733965Sjdp 46833965Sjdp/* Grab some space for a hash table entry. */ 469130561Sobrienextern void *bfd_hash_allocate 470130561Sobrien (struct bfd_hash_table *, unsigned int); 47133965Sjdp 47233965Sjdp/* Traverse a hash table in a random order, calling a function on each 473130561Sobrien element. If the function returns FALSE, the traversal stops. The 47433965Sjdp INFO argument is passed to the function. */ 475130561Sobrienextern void bfd_hash_traverse 476130561Sobrien (struct bfd_hash_table *, 477130561Sobrien bfd_boolean (*) (struct bfd_hash_entry *, void *), 478130561Sobrien void *info); 47933965Sjdp 480218822Sdim/* Allows the default size of a hash table to be configured. New hash 481218822Sdim tables allocated using bfd_hash_table_init will be created with 482218822Sdim this size. */ 483218822Sdimextern void bfd_hash_set_default_size (bfd_size_type); 484218822Sdim 485218822Sdim/* This structure is used to keep track of stabs in sections 486218822Sdim information while linking. */ 487218822Sdim 488218822Sdimstruct stab_info 489218822Sdim{ 490218822Sdim /* A hash table used to hold stabs strings. */ 491218822Sdim struct bfd_strtab_hash *strings; 492218822Sdim /* The header file hash table. */ 493218822Sdim struct bfd_hash_table includes; 494218822Sdim /* The first .stabstr section. */ 495218822Sdim struct bfd_section *stabstr; 496218822Sdim}; 497218822Sdim 498130561Sobrien#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table 49989857Sobrien 50091041Sobrien/* User program access to BFD facilities. */ 50133965Sjdp 50233965Sjdp/* Direct I/O routines, for programs which know more about the object 50333965Sjdp file than BFD does. Use higher level routines if possible. */ 50433965Sjdp 505130561Sobrienextern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *); 506130561Sobrienextern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *); 507130561Sobrienextern int bfd_seek (bfd *, file_ptr, int); 508130561Sobrienextern file_ptr bfd_tell (bfd *); 509130561Sobrienextern int bfd_flush (bfd *); 510130561Sobrienextern int bfd_stat (bfd *, struct stat *); 51133965Sjdp 51289857Sobrien/* Deprecated old routines. */ 51389857Sobrien#if __GNUC__ 51489857Sobrien#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ 51589857Sobrien (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \ 51689857Sobrien bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) 51789857Sobrien#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ 51889857Sobrien (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \ 51989857Sobrien bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) 52089857Sobrien#else 52189857Sobrien#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ 52289857Sobrien (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \ 52389857Sobrien bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) 52489857Sobrien#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ 52589857Sobrien (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\ 52689857Sobrien bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) 52789857Sobrien#endif 528130561Sobrienextern void warn_deprecated (const char *, const char *, int, const char *); 52989857Sobrien 53033965Sjdp/* Cast from const char * to char * so that caller can assign to 53133965Sjdp a char * without a warning. */ 53233965Sjdp#define bfd_get_filename(abfd) ((char *) (abfd)->filename) 53333965Sjdp#define bfd_get_cacheable(abfd) ((abfd)->cacheable) 53433965Sjdp#define bfd_get_format(abfd) ((abfd)->format) 53533965Sjdp#define bfd_get_target(abfd) ((abfd)->xvec->name) 53633965Sjdp#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour) 53777298Sobrien#define bfd_family_coff(abfd) \ 53877298Sobrien (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \ 53977298Sobrien bfd_get_flavour (abfd) == bfd_target_xcoff_flavour) 54033965Sjdp#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG) 54133965Sjdp#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE) 54233965Sjdp#define bfd_header_big_endian(abfd) \ 54333965Sjdp ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG) 54433965Sjdp#define bfd_header_little_endian(abfd) \ 54533965Sjdp ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE) 54633965Sjdp#define bfd_get_file_flags(abfd) ((abfd)->flags) 54733965Sjdp#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags) 54833965Sjdp#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags) 54933965Sjdp#define bfd_my_archive(abfd) ((abfd)->my_archive) 55033965Sjdp#define bfd_has_map(abfd) ((abfd)->has_armap) 55133965Sjdp 55233965Sjdp#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types) 55333965Sjdp#define bfd_usrdata(abfd) ((abfd)->usrdata) 55433965Sjdp 55533965Sjdp#define bfd_get_start_address(abfd) ((abfd)->start_address) 55633965Sjdp#define bfd_get_symcount(abfd) ((abfd)->symcount) 55733965Sjdp#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols) 55833965Sjdp#define bfd_count_sections(abfd) ((abfd)->section_count) 55933965Sjdp 560104834Sobrien#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount) 561104834Sobrien 56233965Sjdp#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) 56333965Sjdp 564130561Sobrien#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE) 56533965Sjdp 566130561Sobrienextern bfd_boolean bfd_cache_close 567130561Sobrien (bfd *abfd); 56889857Sobrien/* NB: This declaration should match the autogenerated one in libbfd.h. */ 56989857Sobrien 570218822Sdimextern bfd_boolean bfd_cache_close_all (void); 571218822Sdim 572130561Sobrienextern bfd_boolean bfd_record_phdr 573130561Sobrien (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, 574130561Sobrien bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); 57533965Sjdp 57633965Sjdp/* Byte swapping routines. */ 57733965Sjdp 578130561Sobrienbfd_uint64_t bfd_getb64 (const void *); 579130561Sobrienbfd_uint64_t bfd_getl64 (const void *); 580130561Sobrienbfd_int64_t bfd_getb_signed_64 (const void *); 581130561Sobrienbfd_int64_t bfd_getl_signed_64 (const void *); 582130561Sobrienbfd_vma bfd_getb32 (const void *); 583130561Sobrienbfd_vma bfd_getl32 (const void *); 584130561Sobrienbfd_signed_vma bfd_getb_signed_32 (const void *); 585130561Sobrienbfd_signed_vma bfd_getl_signed_32 (const void *); 586130561Sobrienbfd_vma bfd_getb16 (const void *); 587130561Sobrienbfd_vma bfd_getl16 (const void *); 588130561Sobrienbfd_signed_vma bfd_getb_signed_16 (const void *); 589130561Sobrienbfd_signed_vma bfd_getl_signed_16 (const void *); 590130561Sobrienvoid bfd_putb64 (bfd_uint64_t, void *); 591130561Sobrienvoid bfd_putl64 (bfd_uint64_t, void *); 592130561Sobrienvoid bfd_putb32 (bfd_vma, void *); 593130561Sobrienvoid bfd_putl32 (bfd_vma, void *); 594130561Sobrienvoid bfd_putb16 (bfd_vma, void *); 595130561Sobrienvoid bfd_putl16 (bfd_vma, void *); 59677298Sobrien 59777298Sobrien/* Byte swapping routines which take size and endiannes as arguments. */ 59877298Sobrien 599130561Sobrienbfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean); 600130561Sobrienvoid bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean); 601218822Sdim 602218822Sdimextern bfd_boolean bfd_section_already_linked_table_init (void); 603218822Sdimextern void bfd_section_already_linked_table_free (void); 60433965Sjdp 60533965Sjdp/* Externally visible ECOFF routines. */ 60633965Sjdp 60733965Sjdp#if defined(__STDC__) || defined(ALMOST_STDC) 60833965Sjdpstruct ecoff_debug_info; 60933965Sjdpstruct ecoff_debug_swap; 61033965Sjdpstruct ecoff_extr; 611130561Sobrienstruct bfd_symbol; 61233965Sjdpstruct bfd_link_info; 61333965Sjdpstruct bfd_link_hash_entry; 61433965Sjdpstruct bfd_elf_version_tree; 61533965Sjdp#endif 616130561Sobrienextern bfd_vma bfd_ecoff_get_gp_value 617130561Sobrien (bfd * abfd); 618130561Sobrienextern bfd_boolean bfd_ecoff_set_gp_value 619130561Sobrien (bfd *abfd, bfd_vma gp_value); 620130561Sobrienextern bfd_boolean bfd_ecoff_set_regmasks 621130561Sobrien (bfd *abfd, unsigned long gprmask, unsigned long fprmask, 622130561Sobrien unsigned long *cprmask); 623130561Sobrienextern void *bfd_ecoff_debug_init 624130561Sobrien (bfd *output_bfd, struct ecoff_debug_info *output_debug, 625130561Sobrien const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); 62633965Sjdpextern void bfd_ecoff_debug_free 627130561Sobrien (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, 628130561Sobrien const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); 629130561Sobrienextern bfd_boolean bfd_ecoff_debug_accumulate 630130561Sobrien (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, 631130561Sobrien const struct ecoff_debug_swap *output_swap, bfd *input_bfd, 632130561Sobrien struct ecoff_debug_info *input_debug, 633130561Sobrien const struct ecoff_debug_swap *input_swap, struct bfd_link_info *); 634130561Sobrienextern bfd_boolean bfd_ecoff_debug_accumulate_other 635130561Sobrien (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, 636130561Sobrien const struct ecoff_debug_swap *output_swap, bfd *input_bfd, 637130561Sobrien struct bfd_link_info *); 638130561Sobrienextern bfd_boolean bfd_ecoff_debug_externals 639130561Sobrien (bfd *abfd, struct ecoff_debug_info *debug, 640130561Sobrien const struct ecoff_debug_swap *swap, bfd_boolean relocatable, 641130561Sobrien bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *), 642130561Sobrien void (*set_index) (struct bfd_symbol *, bfd_size_type)); 643130561Sobrienextern bfd_boolean bfd_ecoff_debug_one_external 644130561Sobrien (bfd *abfd, struct ecoff_debug_info *debug, 645130561Sobrien const struct ecoff_debug_swap *swap, const char *name, 646130561Sobrien struct ecoff_extr *esym); 64733965Sjdpextern bfd_size_type bfd_ecoff_debug_size 648130561Sobrien (bfd *abfd, struct ecoff_debug_info *debug, 649130561Sobrien const struct ecoff_debug_swap *swap); 650130561Sobrienextern bfd_boolean bfd_ecoff_write_debug 651130561Sobrien (bfd *abfd, struct ecoff_debug_info *debug, 652130561Sobrien const struct ecoff_debug_swap *swap, file_ptr where); 653130561Sobrienextern bfd_boolean bfd_ecoff_write_accumulated_debug 654130561Sobrien (void *handle, bfd *abfd, struct ecoff_debug_info *debug, 655130561Sobrien const struct ecoff_debug_swap *swap, 656130561Sobrien struct bfd_link_info *info, file_ptr where); 65733965Sjdp 65833965Sjdp/* Externally visible ELF routines. */ 65933965Sjdp 66033965Sjdpstruct bfd_link_needed_list 66133965Sjdp{ 66233965Sjdp struct bfd_link_needed_list *next; 66333965Sjdp bfd *by; 66433965Sjdp const char *name; 66533965Sjdp}; 66633965Sjdp 667130561Sobrienenum dynamic_lib_link_class { 668130561Sobrien DYN_NORMAL = 0, 669130561Sobrien DYN_AS_NEEDED = 1, 670218822Sdim DYN_DT_NEEDED = 2, 671218822Sdim DYN_NO_ADD_NEEDED = 4, 672218822Sdim DYN_NO_NEEDED = 8 673130561Sobrien}; 674130561Sobrien 675218822Sdimenum notice_asneeded_action { 676218822Sdim notice_as_needed, 677218822Sdim notice_not_needed, 678218822Sdim notice_needed 679218822Sdim}; 680218822Sdim 681130561Sobrienextern bfd_boolean bfd_elf_record_link_assignment 682218822Sdim (bfd *, struct bfd_link_info *, const char *, bfd_boolean, 683218822Sdim bfd_boolean); 68433965Sjdpextern struct bfd_link_needed_list *bfd_elf_get_needed_list 685130561Sobrien (bfd *, struct bfd_link_info *); 686130561Sobrienextern bfd_boolean bfd_elf_get_bfd_needed_list 687130561Sobrien (bfd *, struct bfd_link_needed_list **); 688130561Sobrienextern bfd_boolean bfd_elf_size_dynamic_sections 689130561Sobrien (bfd *, const char *, const char *, const char *, const char * const *, 690218822Sdim struct bfd_link_info *, struct bfd_section **, 691218822Sdim struct bfd_elf_version_tree *); 692218822Sdimextern bfd_boolean bfd_elf_size_dynsym_hash_dynstr 693218822Sdim (bfd *, struct bfd_link_info *); 694130561Sobrienextern void bfd_elf_set_dt_needed_name 695130561Sobrien (bfd *, const char *); 696130561Sobrienextern const char *bfd_elf_get_dt_soname 697130561Sobrien (bfd *); 698130561Sobrienextern void bfd_elf_set_dyn_lib_class 699218822Sdim (bfd *, enum dynamic_lib_link_class); 700218822Sdimextern int bfd_elf_get_dyn_lib_class 701218822Sdim (bfd *); 70277298Sobrienextern struct bfd_link_needed_list *bfd_elf_get_runpath_list 703130561Sobrien (bfd *, struct bfd_link_info *); 704130561Sobrienextern bfd_boolean bfd_elf_discard_info 705130561Sobrien (bfd *, struct bfd_link_info *); 706218822Sdimextern unsigned int _bfd_elf_default_action_discarded 707218822Sdim (struct bfd_section *); 70833965Sjdp 70960484Sobrien/* Return an upper bound on the number of bytes required to store a 71060484Sobrien copy of ABFD's program header table entries. Return -1 if an error 71160484Sobrien occurs; bfd_get_error will return an appropriate code. */ 712130561Sobrienextern long bfd_get_elf_phdr_upper_bound 713130561Sobrien (bfd *abfd); 71460484Sobrien 71560484Sobrien/* Copy ABFD's program header table entries to *PHDRS. The entries 71660484Sobrien will be stored as an array of Elf_Internal_Phdr structures, as 71760484Sobrien defined in include/elf/internal.h. To find out how large the 71860484Sobrien buffer needs to be, call bfd_get_elf_phdr_upper_bound. 71960484Sobrien 72060484Sobrien Return the number of program header table entries read, or -1 if an 72160484Sobrien error occurs; bfd_get_error will return an appropriate code. */ 722130561Sobrienextern int bfd_get_elf_phdrs 723130561Sobrien (bfd *abfd, void *phdrs); 72460484Sobrien 725130561Sobrien/* Create a new BFD as if by bfd_openr. Rather than opening a file, 726130561Sobrien reconstruct an ELF file by reading the segments out of remote memory 727130561Sobrien based on the ELF file header at EHDR_VMA and the ELF program headers it 728130561Sobrien points to. If not null, *LOADBASEP is filled in with the difference 729130561Sobrien between the VMAs from which the segments were read, and the VMAs the 730130561Sobrien file headers (and hence BFD's idea of each section's VMA) put them at. 731130561Sobrien 732130561Sobrien The function TARGET_READ_MEMORY is called to copy LEN bytes from the 733130561Sobrien remote memory at target address VMA into the local buffer at MYADDR; it 734130561Sobrien should return zero on success or an `errno' code on failure. TEMPL must 735130561Sobrien be a BFD for an ELF target with the word size and byte order found in 736130561Sobrien the remote memory. */ 737130561Sobrienextern bfd *bfd_elf_bfd_from_remote_memory 738130561Sobrien (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, 739218822Sdim int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len)); 740130561Sobrien 74177298Sobrien/* Return the arch_size field of an elf bfd, or -1 if not elf. */ 742130561Sobrienextern int bfd_get_arch_size 743130561Sobrien (bfd *); 74477298Sobrien 745130561Sobrien/* Return TRUE if address "naturally" sign extends, or -1 if not elf. */ 746130561Sobrienextern int bfd_get_sign_extend_vma 747130561Sobrien (bfd *); 74877298Sobrien 749130561Sobrienextern struct bfd_section *_bfd_elf_tls_setup 750130561Sobrien (bfd *, struct bfd_link_info *); 75177298Sobrien 752218822Sdimextern void _bfd_fix_excluded_sec_syms 753218822Sdim (bfd *, struct bfd_link_info *); 754218822Sdim 755218822Sdimextern unsigned bfd_m68k_mach_to_features (int); 756218822Sdim 757218822Sdimextern int bfd_m68k_features_to_mach (unsigned); 758218822Sdim 759130561Sobrienextern bfd_boolean bfd_m68k_elf32_create_embedded_relocs 760218822Sdim (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, 761218822Sdim char **); 762130561Sobrien 763218822Sdimextern bfd_boolean bfd_bfin_elf32_create_embedded_relocs 764218822Sdim (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, 765218822Sdim char **); 766218822Sdim 76733965Sjdp/* SunOS shared library support routines for the linker. */ 76833965Sjdp 76933965Sjdpextern struct bfd_link_needed_list *bfd_sunos_get_needed_list 770130561Sobrien (bfd *, struct bfd_link_info *); 771130561Sobrienextern bfd_boolean bfd_sunos_record_link_assignment 772130561Sobrien (bfd *, struct bfd_link_info *, const char *); 773130561Sobrienextern bfd_boolean bfd_sunos_size_dynamic_sections 774218822Sdim (bfd *, struct bfd_link_info *, struct bfd_section **, 775218822Sdim struct bfd_section **, struct bfd_section **); 77633965Sjdp 77733965Sjdp/* Linux shared library support routines for the linker. */ 77833965Sjdp 779130561Sobrienextern bfd_boolean bfd_i386linux_size_dynamic_sections 780130561Sobrien (bfd *, struct bfd_link_info *); 781130561Sobrienextern bfd_boolean bfd_m68klinux_size_dynamic_sections 782130561Sobrien (bfd *, struct bfd_link_info *); 783130561Sobrienextern bfd_boolean bfd_sparclinux_size_dynamic_sections 784130561Sobrien (bfd *, struct bfd_link_info *); 78533965Sjdp 78633965Sjdp/* mmap hacks */ 78733965Sjdp 78833965Sjdpstruct _bfd_window_internal; 78933965Sjdptypedef struct _bfd_window_internal bfd_window_internal; 79033965Sjdp 79191041Sobrientypedef struct _bfd_window 79291041Sobrien{ 79333965Sjdp /* What the user asked for. */ 794130561Sobrien void *data; 79533965Sjdp bfd_size_type size; 79633965Sjdp /* The actual window used by BFD. Small user-requested read-only 79733965Sjdp regions sharing a page may share a single window into the object 79833965Sjdp file. Read-write versions shouldn't until I've fixed things to 79933965Sjdp keep track of which portions have been claimed by the 80033965Sjdp application; don't want to give the same region back when the 80133965Sjdp application wants two writable copies! */ 80233965Sjdp struct _bfd_window_internal *i; 80391041Sobrien} 80491041Sobrienbfd_window; 80533965Sjdp 806130561Sobrienextern void bfd_init_window 807130561Sobrien (bfd_window *); 808130561Sobrienextern void bfd_free_window 809130561Sobrien (bfd_window *); 810130561Sobrienextern bfd_boolean bfd_get_file_window 811130561Sobrien (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean); 81233965Sjdp 81333965Sjdp/* XCOFF support routines for the linker. */ 81433965Sjdp 815130561Sobrienextern bfd_boolean bfd_xcoff_link_record_set 816130561Sobrien (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type); 817130561Sobrienextern bfd_boolean bfd_xcoff_import_symbol 818130561Sobrien (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma, 819130561Sobrien const char *, const char *, const char *, unsigned int); 820130561Sobrienextern bfd_boolean bfd_xcoff_export_symbol 821130561Sobrien (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *); 822130561Sobrienextern bfd_boolean bfd_xcoff_link_count_reloc 823130561Sobrien (bfd *, struct bfd_link_info *, const char *); 824130561Sobrienextern bfd_boolean bfd_xcoff_record_link_assignment 825130561Sobrien (bfd *, struct bfd_link_info *, const char *); 826130561Sobrienextern bfd_boolean bfd_xcoff_size_dynamic_sections 827130561Sobrien (bfd *, struct bfd_link_info *, const char *, const char *, 828130561Sobrien unsigned long, unsigned long, unsigned long, bfd_boolean, 829130561Sobrien int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean); 830130561Sobrienextern bfd_boolean bfd_xcoff_link_generate_rtinit 831130561Sobrien (bfd *, const char *, const char *, bfd_boolean); 83233965Sjdp 833104834Sobrien/* XCOFF support routines for ar. */ 834130561Sobrienextern bfd_boolean bfd_xcoff_ar_archive_set_magic 835130561Sobrien (bfd *, char *); 836104834Sobrien 83733965Sjdp/* Externally visible COFF routines. */ 83833965Sjdp 83933965Sjdp#if defined(__STDC__) || defined(ALMOST_STDC) 84033965Sjdpstruct internal_syment; 84133965Sjdpunion internal_auxent; 84233965Sjdp#endif 84333965Sjdp 844130561Sobrienextern bfd_boolean bfd_coff_get_syment 845130561Sobrien (bfd *, struct bfd_symbol *, struct internal_syment *); 84660484Sobrien 847130561Sobrienextern bfd_boolean bfd_coff_get_auxent 848130561Sobrien (bfd *, struct bfd_symbol *, int, union internal_auxent *); 84933965Sjdp 850130561Sobrienextern bfd_boolean bfd_coff_set_symbol_class 851130561Sobrien (bfd *, struct bfd_symbol *, unsigned int); 85260484Sobrien 853130561Sobrienextern bfd_boolean bfd_m68k_coff_create_embedded_relocs 854130561Sobrien (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); 85577298Sobrien 856218822Sdim/* ARM VFP11 erratum workaround support. */ 857218822Sdimtypedef enum 858218822Sdim{ 859218822Sdim BFD_ARM_VFP11_FIX_DEFAULT, 860218822Sdim BFD_ARM_VFP11_FIX_NONE, 861218822Sdim BFD_ARM_VFP11_FIX_SCALAR, 862218822Sdim BFD_ARM_VFP11_FIX_VECTOR 863218822Sdim} bfd_arm_vfp11_fix; 864218822Sdim 865218822Sdimextern void bfd_elf32_arm_init_maps 866218822Sdim (bfd *); 867218822Sdim 868218822Sdimextern void bfd_elf32_arm_set_vfp11_fix 869218822Sdim (bfd *, struct bfd_link_info *); 870218822Sdim 871218822Sdimextern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan 872218822Sdim (bfd *, struct bfd_link_info *); 873218822Sdim 874218822Sdimextern void bfd_elf32_arm_vfp11_fix_veneer_locations 875218822Sdim (bfd *, struct bfd_link_info *); 876218822Sdim 87760484Sobrien/* ARM Interworking support. Called from linker. */ 878130561Sobrienextern bfd_boolean bfd_arm_allocate_interworking_sections 879130561Sobrien (struct bfd_link_info *); 88060484Sobrien 881130561Sobrienextern bfd_boolean bfd_arm_process_before_allocation 882130561Sobrien (bfd *, struct bfd_link_info *, int); 88360484Sobrien 884130561Sobrienextern bfd_boolean bfd_arm_get_bfd_for_interworking 885130561Sobrien (bfd *, struct bfd_link_info *); 88660484Sobrien 88760484Sobrien/* PE ARM Interworking support. Called from linker. */ 888130561Sobrienextern bfd_boolean bfd_arm_pe_allocate_interworking_sections 889130561Sobrien (struct bfd_link_info *); 89060484Sobrien 891130561Sobrienextern bfd_boolean bfd_arm_pe_process_before_allocation 892130561Sobrien (bfd *, struct bfd_link_info *, int); 89360484Sobrien 894130561Sobrienextern bfd_boolean bfd_arm_pe_get_bfd_for_interworking 895130561Sobrien (bfd *, struct bfd_link_info *); 89660484Sobrien 89760484Sobrien/* ELF ARM Interworking support. Called from linker. */ 898130561Sobrienextern bfd_boolean bfd_elf32_arm_allocate_interworking_sections 899130561Sobrien (struct bfd_link_info *); 90060484Sobrien 901130561Sobrienextern bfd_boolean bfd_elf32_arm_process_before_allocation 902218822Sdim (bfd *, struct bfd_link_info *); 90360484Sobrien 904218822Sdimvoid bfd_elf32_arm_set_target_relocs 905218822Sdim (bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix, 906218822Sdim int, int); 907218822Sdim 908130561Sobrienextern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking 909130561Sobrien (bfd *, struct bfd_link_info *); 91060484Sobrien 911130561Sobrienextern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd 912130561Sobrien (bfd *, struct bfd_link_info *); 913104834Sobrien 914218822Sdim/* ELF ARM mapping symbol support */ 915218822Sdim#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0) 916218822Sdim#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1) 917218822Sdim#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2) 918218822Sdim#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0) 919218822Sdimextern bfd_boolean bfd_is_arm_special_symbol_name 920218822Sdim (const char * name, int type); 921218822Sdim 922218822Sdimextern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int); 923218822Sdim 924130561Sobrien/* ARM Note section processing. */ 925130561Sobrienextern bfd_boolean bfd_arm_merge_machines 926130561Sobrien (bfd *, bfd *); 927130561Sobrien 928130561Sobrienextern bfd_boolean bfd_arm_update_notes 929130561Sobrien (bfd *, const char *); 930130561Sobrien 931130561Sobrienextern unsigned int bfd_arm_get_mach_from_notes 932130561Sobrien (bfd *, const char *); 933130561Sobrien 93477298Sobrien/* TI COFF load page support. */ 93577298Sobrienextern void bfd_ticoff_set_section_load_page 936130561Sobrien (struct bfd_section *, int); 93777298Sobrien 93877298Sobrienextern int bfd_ticoff_get_section_load_page 939130561Sobrien (struct bfd_section *); 94077298Sobrien 941130561Sobrien/* H8/300 functions. */ 942130561Sobrienextern bfd_vma bfd_h8300_pad_address 943130561Sobrien (bfd *, bfd_vma); 944130561Sobrien 945130561Sobrien/* IA64 Itanium code generation. Called from linker. */ 946130561Sobrienextern void bfd_elf32_ia64_after_parse 947130561Sobrien (int); 948130561Sobrien 949130561Sobrienextern void bfd_elf64_ia64_after_parse 950130561Sobrien (int); 951130561Sobrien 952218822Sdim/* This structure is used for a comdat section, as in PE. A comdat 953218822Sdim section is associated with a particular symbol. When the linker 954218822Sdim sees a comdat section, it keeps only one of the sections with a 955218822Sdim given name and associated with a given symbol. */ 956218822Sdim 957218822Sdimstruct coff_comdat_info 958218822Sdim{ 959218822Sdim /* The name of the symbol associated with a comdat section. */ 960218822Sdim const char *name; 961218822Sdim 962218822Sdim /* The local symbol table index of the symbol associated with a 963218822Sdim comdat section. This is only meaningful to the object file format 964218822Sdim specific code; it is not an index into the list returned by 965218822Sdim bfd_canonicalize_symtab. */ 966218822Sdim long symbol; 967218822Sdim}; 968218822Sdim 969218822Sdimextern struct coff_comdat_info *bfd_coff_get_comdat_section 970218822Sdim (bfd *, struct bfd_section *); 971218822Sdim 972