You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* bfd.h -- The only header file required by users of the bfd library
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "ansidecl.h"
#include "obstack.h"
/* These two lines get substitutions done by commands in Makefile.in. */
-#define BFD_VERSION "@VERSION@"
+#define BFD_VERSION "@VERSION@"
#define BFD_ARCH_SIZE @WORDSIZE@
+#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
#if BFD_ARCH_SIZE >= 64
#define BFD64
#endif
#endif
-/* 64-bit type definition (if any) from bfd's sysdep.h goes here */
-
-
/* forward declaration */
typedef struct _bfd bfd;
#if defined (__GNUG__) && (__GNUC_MINOR__ > 5)
#define TRUE_FALSE_ALREADY_DEFINED
#endif
+#ifdef MPW
+/* Pre-emptive strike - get the file with the enum. */
+#include <Types.h>
+#define TRUE_FALSE_ALREADY_DEFINED
+#endif /* MPW */
#ifndef TRUE_FALSE_ALREADY_DEFINED
typedef enum bfd_boolean {false, true} boolean;
#define BFD_TRUE_FALSE
typedef long int file_ptr;
/* Support for different sizes of target format ints and addresses.
- If the host implements 64-bit values, it defines BFD_HOST_64_BIT to
- be the appropriate type. Otherwise, this code will fall back on
- gcc's "long long" type if gcc is being used. BFD_HOST_64_BIT must
- be defined in such a way as to be a valid type name by itself or
- with "unsigned" prefixed. It should be a signed type by itself.
+ If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
+ set to 1 above. Otherwise, if gcc is being used, this code will
+ use gcc's "long long" type. Otherwise, the compilation will fail
+ if 64-bit targets are requested. */
- If neither is the case, then compilation will fail if 64-bit
- targets are requested. If you don't request any 64-bit targets,
- you should be safe. */
+#ifdef BFD64
-#ifdef BFD64
-
-#if defined (__GNUC__) && !defined (BFD_HOST_64_BIT)
+#ifndef BFD_HOST_64_BIT
+#if BFD_HOST_64BIT_LONG
+#define BFD_HOST_64_BIT long
+#else
+#ifdef __GNUC__
#define BFD_HOST_64_BIT long long
-typedef BFD_HOST_64_BIT int64_type;
-typedef unsigned BFD_HOST_64_BIT uint64_type;
-#endif
-
-#if !defined (uint64_type) && defined (__GNUC__)
-#define uint64_type unsigned long long
-#define int64_type long long
-#endif
-#ifndef uint64_typeLOW
-#define uint64_typeLOW(x) ((unsigned long)(((x) & 0xffffffff)))
-#define uint64_typeHIGH(x) ((unsigned long)(((x) >> 32) & 0xffffffff))
-#endif
+#endif /* defined (__GNUC__) */
+#endif /* ! BFD_HOST_64BIT_LONG */
+#endif /* ! defined (BFD_HOST_64_BIT) */
typedef unsigned BFD_HOST_64_BIT bfd_vma;
typedef BFD_HOST_64_BIT bfd_signed_vma;
typedef unsigned BFD_HOST_64_BIT bfd_size_type;
typedef unsigned BFD_HOST_64_BIT symvalue;
+
#ifndef fprintf_vma
+#if BFD_HOST_64BIT_LONG
+#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
+#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
+#else
+#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
+#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
#define fprintf_vma(s,x) \
- fprintf(s,"%08lx%08lx", uint64_typeHIGH(x), uint64_typeLOW(x))
+ fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
#define sprintf_vma(s,x) \
- sprintf(s,"%08lx%08lx", uint64_typeHIGH(x), uint64_typeLOW(x))
+ sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
+#endif
#endif
+
#else /* not BFD64 */
/* Represent a target address. Also used as a generic unsigned type
PARAMS ((struct bfd_hash_table *, const char *, boolean create,
boolean copy));
+/* Replace an entry in a hash table. */
+extern void bfd_hash_replace
+ PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old,
+ struct bfd_hash_entry *nw));
+
/* Base method for creating a hash table entry. */
extern struct bfd_hash_entry *bfd_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
extern int bfd_flush PARAMS ((bfd *abfd));
extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
-/* PE STUFF */
-/* Also define some types which are used within bfdlink.h for the
- bfd_link_info struct. These are not defined in bfdlink.h for a reason.
- When the link_info data is passed to bfd from ld, it is copied into
- extern variables defined in internal.h. The type class for these must
- be available to any thing that includes internal.h. When internal.h is
- included, it is always preceeded by an include on this file. If I leave the
- type definitions in bfdlink.h, then I must include that file when ever
- I include internal.h, and this is not always a good thing */
-
-/* These are the different types of subsystems to be used when linking for
- Windows NT. This information is passed in as an input parameter (default
- is console) and ultimately ends up in the optional header data */
-enum bfd_link_subsystem
-{
- native, /* image doesn't require a subsystem */
- windows, /* image runs in the Windows GUI subsystem */
- console, /* image runs in the Windows CUI (character) subsystem */
- os2, /* image runs in the OS/2 character subsystem */
- posix /* image runs in the posix character subsystem */
-};
-/* The NT optional header file allows input of the stack and heap reserve
- and commit size. This data may be input on the command line and will
- end up in the optional header. Default sizes are provided. */
-struct _bfd_link_stack_heap
-{
- boolean stack_defined;
- boolean heap_defined;
- bfd_vma stack_reserve;
- bfd_vma stack_commit;
- bfd_vma heap_reserve;
- bfd_vma heap_commit;
-};
-typedef struct _bfd_link_stack_heap bfd_link_stack_heap;
-
-/* END OF PE STUFF */
-
-extern enum bfd_link_subsystem NT_subsystem;
-extern bfd_link_stack_heap NT_stack_heap;
/* Cast from const char * to char * so that caller can assign to
a char * without a warning. */
bfd_arch_a29k, /* AMD 29000 */
bfd_arch_sparc, /* SPARC */
+#define bfd_mach_sparc 1
+#define bfd_mach_sparc64 2
bfd_arch_mips, /* MIPS Rxxxx */
bfd_arch_i386, /* Intel 386 */
bfd_arch_we32k, /* AT&T WE32xxx */
int bits_per_address;
int bits_per_byte;
enum bfd_architecture arch;
- long mach;
- char *arch_name;
- CONST char *printable_name;
+ unsigned long mach;
+ const char *arch_name;
+ const char *printable_name;
unsigned int section_align_power;
/* true if this is the default machine for the architecture */
boolean the_default;
- CONST struct bfd_arch_info * (*compatible)
- PARAMS ((CONST struct bfd_arch_info *a,
- CONST struct bfd_arch_info *b));
-
- boolean (*scan) PARAMS ((CONST struct bfd_arch_info *, CONST char *));
- /* How to disassemble an instruction, producing a printable
- representation on a specified stdio stream. This isn't
- defined for most processors at present, because of the size
- of the additional tables it would drag in, and because gdb
- wants to use a different interface. */
- unsigned int (*disassemble) PARAMS ((bfd_vma addr, CONST char *data,
- PTR stream));
-
- struct bfd_arch_info *next;
+ const struct bfd_arch_info * (*compatible)
+ PARAMS ((const struct bfd_arch_info *a,
+ const struct bfd_arch_info *b));
+
+ boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
+
+ const struct bfd_arch_info *next;
} bfd_arch_info_type;
-CONST char *
+const char *
bfd_printable_name PARAMS ((bfd *abfd));
-bfd_arch_info_type *
-bfd_scan_arch PARAMS ((CONST char *string));
+const bfd_arch_info_type *
+bfd_scan_arch PARAMS ((const char *string));
-CONST bfd_arch_info_type *
+const bfd_arch_info_type *
bfd_arch_get_compatible PARAMS ((
- CONST bfd *abfd,
- CONST bfd *bbfd));
+ const bfd *abfd,
+ const bfd *bbfd));
void
-bfd_set_arch_info PARAMS ((bfd *abfd, bfd_arch_info_type *arg));
+bfd_set_arch_info PARAMS ((bfd *abfd, const bfd_arch_info_type *arg));
enum bfd_architecture
bfd_get_arch PARAMS ((bfd *abfd));
unsigned int
bfd_arch_bits_per_address PARAMS ((bfd *abfd));
-bfd_arch_info_type *
+const bfd_arch_info_type *
bfd_get_arch_info PARAMS ((bfd *abfd));
-bfd_arch_info_type *
+const bfd_arch_info_type *
bfd_lookup_arch
PARAMS ((enum bfd_architecture
arch,
- long machine));
+ unsigned long machine));
-CONST char *
+const char *
bfd_printable_arch_mach
PARAMS ((enum bfd_architecture arch, unsigned long machine));
BFD_RELOC_8_GOT_PCREL,
BFD_RELOC_32_GOTOFF,
BFD_RELOC_16_GOTOFF,
+ BFD_RELOC_LO16_GOTOFF,
+ BFD_RELOC_HI16_GOTOFF,
+ BFD_RELOC_HI16_S_GOTOFF,
BFD_RELOC_8_GOTOFF,
BFD_RELOC_32_PLT_PCREL,
+ BFD_RELOC_24_PLT_PCREL,
BFD_RELOC_16_PLT_PCREL,
BFD_RELOC_8_PLT_PCREL,
BFD_RELOC_32_PLTOFF,
BFD_RELOC_16_PLTOFF,
+ BFD_RELOC_LO16_PLTOFF,
+ BFD_RELOC_HI16_PLTOFF,
+ BFD_RELOC_HI16_S_PLTOFF,
BFD_RELOC_8_PLTOFF,
/* Relocations used by 68K ELF. */
/* Linkage-table relative. */
BFD_RELOC_32_BASEREL,
BFD_RELOC_16_BASEREL,
+ BFD_RELOC_LO16_BASEREL,
+ BFD_RELOC_HI16_BASEREL,
+ BFD_RELOC_HI16_S_BASEREL,
BFD_RELOC_8_BASEREL,
+ BFD_RELOC_RVA,
/* Absolute 8-bit relocation, but used to form an address like 0xFFnn. */
BFD_RELOC_8_FFnn,
BFD_RELOC_NS32K_DISP_16_PCREL,
BFD_RELOC_NS32K_DISP_32_PCREL,
-/* PowerPC/POWER (RS/6000) relocs.
-26 bit relative branch. Low two bits must be zero. High 24
-bits installed in bits 6 through 29 of instruction. */
+/* Power(rs6000) and PowerPC relocations. */
BFD_RELOC_PPC_B26,
-
-/* 26 bit absolute branch, like BFD_RELOC_PPC_B26 but absolute. */
BFD_RELOC_PPC_BA26,
-
-/* 16 bit TOC relative reference. */
BFD_RELOC_PPC_TOC16,
+ BFD_RELOC_PPC_B16,
+ BFD_RELOC_PPC_B16_BRTAKEN,
+ BFD_RELOC_PPC_B16_BRNTAKEN,
+ BFD_RELOC_PPC_BA16,
+ BFD_RELOC_PPC_BA16_BRTAKEN,
+ BFD_RELOC_PPC_BA16_BRNTAKEN,
+ BFD_RELOC_PPC_COPY,
+ BFD_RELOC_PPC_GLOB_DAT,
+ BFD_RELOC_PPC_JMP_SLOT,
+ BFD_RELOC_PPC_RELATIVE,
+ BFD_RELOC_PPC_LOCAL24PC,
/* The type of reloc used to build a contructor table - at the moment
probably a 32 bit wide absolute relocation, but the target can choose.
through 0. */
BFD_RELOC_ARC_B26,
/* end-sanitize-arc */
-
BFD_RELOC_UNUSED };
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
reloc_howto_type *
/* Signal that the symbol is the label of constructor section. */
#define BSF_CONSTRUCTOR 0x800
- /* Signal that the symbol is a warning symbol. If the symbol
- is a warning symbol, then the value field (I know this is
- tacky) will point to the asymbol which when referenced will
- cause the warning. */
+ /* Signal that the symbol is a warning symbol. The name is a
+ warning. The name of the next symbol is the one to warn about;
+ if a reference is made to a symbol with the same name as the next
+ symbol, a warning is issued by the linker. */
#define BSF_WARNING 0x1000
- /* Signal that the symbol is indirect. The value of the symbol
- is a pointer to an undefined asymbol which contains the
- name to use instead. */
+ /* Signal that the symbol is indirect. This symbol is an indirect
+ pointer to the symbol with the same name as the next symbol. */
#define BSF_INDIRECT 0x2000
/* BSF_FILE marks symbols that contain a file name. This is used
struct symbol_cache_entry **outsymbols;
/* Pointer to structure which contains architecture information*/
- struct bfd_arch_info *arch_info;
+ const struct bfd_arch_info *arch_info;
/* Stuff only useful for archives:*/
PTR arelt_data;
struct _oasys_data *oasys_obj_data;
struct _oasys_ar_data *oasys_ar_data;
struct coff_tdata *coff_obj_data;
+ struct pe_tdata *pe_obj_data;
struct ecoff_tdata *ecoff_obj_data;
struct ieee_data_struct *ieee_data;
struct ieee_ar_data_struct *ieee_ar_data;
#define bfd_get_dynamic_symtab_upper_bound(abfd) \
BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
+#define bfd_print_private_bfd_data(abfd, file)\
+ BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
+
#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
char symbol_leading_char;
char ar_pad_char;
unsigned short ar_max_namelen;
- unsigned int align_power_min;
bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
CAT(NAME,_bfd_merge_private_bfd_data),\
CAT(NAME,_bfd_copy_private_section_data),\
CAT(NAME,_bfd_copy_private_symbol_data),\
-CAT(NAME,_bfd_set_private_flags)
+CAT(NAME,_bfd_set_private_flags),\
+CAT(NAME,_bfd_print_private_bfd_data)\
/* Called to copy BFD general private data from one object file
to another. */
boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
/* Called to set private backend flags */
boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
+ /* Called to print private BFD data */
+ boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, void *));
+
/* Core file entry points. */
#define BFD_JUMP_TABLE_CORE(NAME)\
CAT(NAME,_core_file_failing_command),\
CAT(NAME,_construct_extended_name_table),\
CAT(NAME,_truncate_arname),\
CAT(NAME,_write_armap),\
+CAT(NAME,_read_ar_hdr),\
CAT(NAME,_openr_next_archived_file),\
CAT(NAME,_generic_stat_arch_elt),\
CAT(NAME,_update_armap_timestamp)
struct orl *map,
unsigned int orl_count,
int stridx));
+ PTR (*_bfd_read_ar_hdr) PARAMS ((bfd *));
bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
CAT(NAME,_bfd_is_local_label),\
CAT(NAME,_get_lineno),\
CAT(NAME,_find_nearest_line),\
-CAT(NAME,_bfd_make_debug_symbol)
+CAT(NAME,_bfd_make_debug_symbol),\
+CAT(NAME,_read_minisymbols),\
+CAT(NAME,_minisymbol_to_symbol)
long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
struct symbol_cache_entry **));
/* Back-door to allow format-aware applications to create debug symbols
while using BFD for everything else. Currently used by the assembler
when creating COFF files. */
- asymbol * (*_bfd_make_debug_symbol) PARAMS ((
+ asymbol * (*_bfd_make_debug_symbol) PARAMS ((
bfd *abfd,
void *ptr,
unsigned long size));
+#define bfd_read_minisymbols(b, d, m, s) \
+ BFD_SEND (b, _read_minisymbols, (b, d, m, s))
+ long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
+ unsigned int *));
+#define bfd_minisymbol_to_symbol(b, d, m, f) \
+ BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
+ asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
+ asymbol *));
/* Routines for relocs. */
#define BFD_JUMP_TABLE_RELOCS(NAME)\
CONST char *
bfd_format_string PARAMS ((bfd_format format));
+#ifdef __cplusplus
+}
+#endif
#endif