Add target_defaulted to bfd struct. Fix formatting in various places.

Fix some obsolete comments.  Remove macros for obsolete bfd_symbol_value,
bfd_symbol_name, bfd_get_first_symbol, bfd_get_next_symbol,
bfd_classify_symbol, bfd_symbol_hasclass.
This commit is contained in:
John Gilmore 1991-05-21 03:08:37 +00:00
parent 7ed4093abc
commit 9b9c5c39bb

View file

@ -1,8 +1,6 @@
/* A -*- C -*- header file for the bfd library */
/*** bfd.h -- The only header file required by users of the bfd library */
/* bfd.h -- The only header file required by users of the bfd library */
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
@ -22,9 +20,6 @@ You should have received a copy of the GNU General Public License
along with BFD; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* executable_object_p is gone -- you can check the bfd flags and call
access() yourself */
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
@ -54,7 +49,7 @@ typedef enum boolean {false, true} boolean;
/* Try to avoid breaking stuff */
typedef long int file_ptr;
/* Support for different sizes of target format ints */
/* Support for different sizes of target format ints and addresses */
#ifdef HOST_64_BIT
typedef HOST_64_BIT rawdata_offset;
@ -64,19 +59,21 @@ typedef HOST_64_BIT bfd_offset;
typedef HOST_64_BIT bfd_size_type;
typedef HOST_64_BIT symvalue;
typedef HOST_64_BIT bfd_64_type;
#define printf_vma(x) printf("%08x%08x",uint64_typeHIGH(x), uint64_typeLOW(x))
#define fprintf_vma(s,x) fprintf(s,"%08x%08x",uint64_typeHIGH(x), uint64_typeLOW(x))
#define fprintf_vma(s,x) \
fprintf(s,"%08x%08x", uint64_typeHIGH(x), uint64_typeLOW(x))
#define printf_vma(x) \
printf( "%08x%08x", uint64_typeHIGH(x), uint64_typeLOW(x))
#else
typedef struct { int a,b;} bfd_64_type;
typedef unsigned long int rawdata_offset;
typedef struct {int a,b;} bfd_64_type;
typedef unsigned long rawdata_offset;
typedef unsigned long bfd_vma;
typedef unsigned long bfd_offset;
typedef unsigned long bfd_word;
typedef unsigned long bfd_size;
typedef unsigned long symvalue;
typedef unsigned long bfd_size_type;
#define printf_vma(x) printf("%08x",x)
#define fprintf_vma(s,x) fprintf(s,"%08x",x)
#define printf_vma(x) printf( "%08x", x)
#define fprintf_vma(s,x) fprintf(s, "%08x", x)
#endif
typedef unsigned int flagword; /* 32 bits of flags */
@ -130,7 +127,6 @@ enum bfd_architecture {
#define bfd_mach_i960_xa 5
#define bfd_mach_i960_ca 6
bfd_arch_a29k, /* AMD 29000 */
bfd_arch_sparc, /* Sun (SPARC International) SPARC */
bfd_arch_mips, /* MIPS Rxxxx */
@ -178,24 +174,22 @@ typedef int symtype; /* Who knows, yet? */
#define BSF_KEEP_G 0x80000
#define BSF_WEAK 0x100000
#define BSF_CTOR 0x200000 /* Symbol is a con/destructor */
#define BSF_FAKE 0x400000 /* SYmbol doesn't really exist */
#define BSF_FAKE 0x400000 /* Symbol doesn't really exist */
#define BSF_OLD_COMMON 0x800000 /* Symbol used to be common,
but now is allocated */
/* If symbol is fort_comm, then value is size, and this is the */
/* contents */
/* If symbol is fort_comm, then value is size, and this is the contents */
#define BFD_FORT_COMM_DEFAULT_VALUE 0
/* in some files the type of a symbol sometimes alters its location
* in an output file - ie in coff a ISFCN symbol which is also C_EXT
* symbol appears where it was declared and not at the end of a section.
* This bit is set by the target bfd part to convey this information.
*/
in an output file - ie in coff a ISFCN symbol which is also C_EXT
symbol appears where it was declared and not at the end of a section.
This bit is set by the target bfd part to convey this information. */
#define BSF_NOT_AT_END 0x40000
/* general purpose part of a symbol
* target specific parts will be found in libcoff.h, liba.out.h etc
*/
/* general purpose part of a symbol;
target specific parts will be found in libcoff.h, liba.out.h etc */
typedef struct symbol_cache_entry
{
struct _bfd *the_bfd; /* Just a way to find out host type */
@ -213,7 +207,6 @@ typedef struct symbol_cache_entry
#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + x->value)
#define bfd_asymbol_name(x) ((x)->name)
/* This is a type pun with struct ranlib on purpose! */
typedef struct carsym {
char *name;
@ -343,8 +336,7 @@ typedef struct sec
/* The output_offset is the indent into the output section of
this section. If this is the first section to go into
an output section, this value will be 0...
*/
an output section, this value will be 0... */
bfd_vma output_offset;
struct sec *output_section;
unsigned int alignment_power; /* eg 4 aligns to 2^4*/
@ -378,8 +370,6 @@ typedef struct sec
#define align_power(addr, align) \
( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
typedef struct sec *sec_ptr;
#define bfd_section_name(bfd, ptr) ((ptr)->name)
@ -417,7 +407,7 @@ PROTO (char *, bfd_errmsg, ());
PROTO (void, bfd_perror, (CONST char *message));
typedef enum
typedef enum bfd_print_symbol
{
bfd_print_symbol_name_enum,
bfd_print_symbol_type_enum,
@ -484,7 +474,7 @@ typedef struct bfd_target
/* Byte swapping for data */
/* Note that these don't take bfd as first arg. Certain other handlers
could do the same. */
SDEF (bfd_64_type,bfd_getx64, (bfd_byte *));
SDEF (bfd_64_type, bfd_getx64, (bfd_byte *));
SDEF (void, bfd_putx64, (bfd_64_type, bfd_byte *));
SDEF (unsigned int, bfd_getx32, (bfd_byte *));
SDEF (void, bfd_putx32, (unsigned long, bfd_byte *));
@ -500,9 +490,12 @@ typedef struct bfd_target
SDEF (void, bfd_h_putx16, (int, bfd_byte *));
/* Format-dependent */
SDEF_FMT (struct bfd_target *, _bfd_check_format, (bfd *));/* file fmt or 0 */
SDEF_FMT (boolean, _bfd_set_format, (bfd *)); /* make it an object file */
SDEF_FMT (boolean, _bfd_write_contents, (bfd *)); /* write it out at close */
/* Check the format of a file being read. Return bfd_target * or zero. */
SDEF_FMT (struct bfd_target *, _bfd_check_format, (bfd *));
/* Set the format of a file being written. */
SDEF_FMT (boolean, _bfd_set_format, (bfd *));
/* Write cached information into a file being written, at bfd_close. */
SDEF_FMT (boolean, _bfd_write_contents, (bfd *));
/* All these are defined in JUMP_TABLE */
/* Core files */
@ -533,7 +526,7 @@ typedef struct bfd_target
SDEF (unsigned int, _bfd_canonicalize_reloc, (bfd *, sec_ptr, arelent **,
asymbol**));
/* FIXME: For steve -- clean up later */
SDEF (asymbol *, _bfd_make_empty_symbol, (bfd *));
SDEF (void, _bfd_print_symbol, (bfd *, PTR, asymbol *,
bfd_print_symbol_enum_type));
@ -547,6 +540,7 @@ typedef struct bfd_target
(bfd *abfd, asection *section, asymbol **symbols,bfd_vma offset,
CONST char **file, CONST char **func, unsigned int *line));
SDEF (int, _bfd_stat_arch_elt, (bfd *, struct stat *));
SDEF (int, _bfd_sizeof_headers, (bfd *, boolean));
} bfd_target;
@ -626,17 +620,17 @@ extern CONST short _bfd_host_big_endian;
To avoid dragging too many header files into every file that
includes bfd.h, IOSTREAM has been declared as a "char *", and MTIME
as a "long". Their correct types, to which they are cast when used,
are "FILE *" and "time_t". If these had been declared as structs
rather than typedefs, we wouldn't have this problem. */
are "FILE *" and "time_t". */
struct _bfd
{
CONST char *filename; /* could be null; filename user opened with */
bfd_target *xvec; /* operation jump table */
char *iostream; /* stdio FILE *, unless an archive element */
boolean cacheable; /* iostream can be closed if desired */
boolean target_defaulted; /* Target type was default, not specific,
so we can try all the targets if needed. */
struct _bfd *lru_prev; /* Used for file caching */
struct _bfd *lru_next; /* Used for file caching */
file_ptr where; /* Where the file was when closed */
@ -651,12 +645,10 @@ struct _bfd
both_direction = 3} direction;
flagword flags; /* format_specific */
/*
Currently my_archive is tested before adding origin to anything. I
believe that this can become always an add of origin, with origin set
to 0 for non archive files
*/
/* Currently my_archive is tested before adding origin to anything. I
believe that this can become always an add of origin, with origin set
to 0 for non archive files. FIXME-soon. */
file_ptr origin; /* for archive contents */
boolean output_has_begun; /* cf bfd_set_section_size */
asection *sections; /* Pointer to linked list of sections */
@ -692,13 +684,13 @@ struct _bfd
};
/* The various callable routines */
PROTO(bfd_size_type, bfd_alloc_size,(bfd *abfd));
PROTO (bfd_size_type, bfd_alloc_size,(bfd *abfd));
PROTO (char *, bfd_printable_arch_mach,(enum bfd_architecture, unsigned long));
PROTO (char *, bfd_format_string, (bfd_format format));
PROTO (char**, bfd_target_list, ());
PROTO (bfd *, bfd_openr, (CONST char *filename, CONST char *target));
PROTO (bfd *, bfd_fdopenr, (CONST char *filename, CONST char *target, int fd));
PROTO (bfd *, bfd_fdopenr,(CONST char *filename, CONST char *target, int fd));
PROTO (bfd *, bfd_openw, (CONST char *filename, CONST char *target));
PROTO (bfd *, bfd_create, (CONST char *filename, CONST bfd *abfd));
PROTO (boolean, bfd_close, (bfd *abfd));
@ -724,13 +716,14 @@ PROTO (boolean, bfd_arch_compatible, (bfd *abfd, bfd *bbfd,
PROTO (boolean, bfd_set_section_size, (bfd *abfd, sec_ptr ptr,
unsigned long val));
PROTO (boolean, bfd_get_section_contents, (bfd *abfd, sec_ptr section,
PTR location,
file_ptr offset, bfd_size_type count));
PTR location, file_ptr offset,
bfd_size_type count));
PROTO (boolean, bfd_set_section_contents, (bfd *abfd, sec_ptr section,
PTR location,
file_ptr offset, bfd_size_type count));
PTR location, file_ptr offset,
bfd_size_type count));
PROTO (unsigned long, bfd_get_next_mapent, (bfd *abfd, symindex prev, carsym **entry));
PROTO (unsigned long, bfd_get_next_mapent, (bfd *abfd, symindex prev,
carsym **entry));
PROTO (bfd *, bfd_get_elt_at_index, (bfd *abfd, int index));
PROTO (boolean, bfd_set_symtab, (bfd *abfd, asymbol **location,
unsigned int symcount));
@ -753,14 +746,8 @@ PROTO (bfd_vma, bfd_log2, (bfd_vma));
PROTO(boolean, bfd_scan_arch_mach,(CONST char *, enum bfd_architecture *,
unsigned long *));
/* For speed we turn calls to these interface routines directly into
jumps through the transfer vector. This makes error-checking somewhat
confusing; the user basically has to read the documentation since there
are no longer prototypes, only declarations in the xfer vector (which
should be enough for some compilers).
To bad the preprocessor is too dumb to allow us to clean this up with
a macro. */
/* For speed and simplicity, we turn calls to these interface routines
directly into jumps through the transfer vector. */
#define bfd_set_arch_mach(abfd, arch, mach) \
BFD_SEND (abfd, _bfd_set_arch_mach, (abfd, arch, mach))
@ -768,24 +755,6 @@ PROTO(boolean, bfd_scan_arch_mach,(CONST char *, enum bfd_architecture *,
#define bfd_sizeof_headers(abfd, reloc) \
BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
#define bfd_symbol_value(abfd, idx) \
BFD_SEND (abfd, _bfd_symbol_value, (abfd, idx))
#define bfd_symbol_name(abfd, idx) \
BFD_SEND (abfd, _bfd_symbol_name, (abfd, idx))
#define bfd_get_first_symbol(abfd) \
BFD_SEND (abfd, _bfd_get_first_symbol, (abfd))
#define bfd_get_next_symbol(abfd, oidx) \
BFD_SEND (abfd, _bfd_get_next_symbol, (abfd, oidx))
#define bfd_classify_symbol(abfd, idx) \
BFD_SEND (abfd, _bfd_classify_symbol, (abfd, idx))
#define bfd_symbol_hasclass(abfd, idx, class) \
BFD_SEND (abfd, _bfd_symbol_hasclass, (abfd, idx, class))
#define get_symtab_upper_bound(abfd) \
BFD_SEND (abfd, _get_symtab_upper_bound, (abfd))
@ -804,17 +773,18 @@ PROTO(boolean, bfd_scan_arch_mach,(CONST char *, enum bfd_architecture *,
BFD_SEND (abfd, _get_lineno, (abfd, symbol))
#define bfd_stat_arch_elt(abfd, buf) \
BFD_SEND(abfd, _bfd_stat_arch_elt, (abfd, buf))
#define bfd_find_nearest_line(abfd, section, symbols, offset,filename_ptr, func, line_ptr) \
BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, section,symbols, offset, filename_ptr, func, line_ptr))
BFD_SEND (abfd, _bfd_stat_arch_elt, (abfd, buf))
#define bfd_find_nearest_line(abfd, section, symbols, offset, filename_ptr, func, line_ptr) \
BFD_SEND (abfd, _bfd_find_nearest_line, \
(abfd, section,symbols, offset, filename_ptr, func, line_ptr))
/* Some byte-swapping i/o operations */
#define LONGLONG_SIZE 8
#define LONG_SIZE 4
#define SHORT_SIZE 2
#define BYTE_SIZE 1
#define bfd_put_8(abfd, val, ptr) (*((char *)ptr) = (char)val)
#define bfd_get_8(abfd, ptr) (*((char *)ptr))
@ -830,14 +800,20 @@ BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, section,symbols, offset, filename
#define bfd_h_put_8(abfd, val, ptr) bfd_put_8 (abfd, val, ptr)
#define bfd_h_get_8(abfd, ptr) bfd_get_8 (abfd, ptr)
#define bfd_h_put_32(abfd, val, ptr) BFD_SEND(abfd, bfd_h_putx32, (val, (bfd_byte *) ptr))
#define bfd_h_get_32(abfd, ptr) BFD_SEND(abfd, bfd_h_getx32, ((bfd_byte *) ptr))
#define bfd_h_put_32(abfd, val, ptr) BFD_SEND(abfd, bfd_h_putx32, \
(val, (bfd_byte *) ptr))
#define bfd_h_get_32(abfd, ptr) BFD_SEND(abfd, bfd_h_getx32, \
((bfd_byte *) ptr))
#define bfd_h_put_64(abfd, val, ptr) BFD_SEND(abfd, bfd_h_putx64, (val, (bfd_byte *) ptr))
#define bfd_h_get_64(abfd, ptr) BFD_SEND(abfd, bfd_h_getx64, ((bfd_byte *) ptr))
#define bfd_h_put_64(abfd, val, ptr) BFD_SEND(abfd, bfd_h_putx64, \
(val, (bfd_byte *) ptr))
#define bfd_h_get_64(abfd, ptr) BFD_SEND(abfd, bfd_h_getx64, \
((bfd_byte *) ptr))
#define bfd_h_put_16(abfd, val, ptr) BFD_SEND(abfd, bfd_h_putx16,(val,ptr))
#define bfd_h_get_16(abfd, ptr) BFD_SEND(abfd, bfd_h_getx16,(ptr))
#define bfd_h_put_16(abfd, val, ptr) BFD_SEND(abfd, bfd_h_putx16, \
(val, (bfd_byte *) ptr))
#define bfd_h_get_16(abfd, ptr) BFD_SEND(abfd, bfd_h_getx16, \
((bfd_byte *) ptr))
/* General purpose one fits all. The do { } while (0) makes a single
statement out of it, for use in things like nested if-statements.
@ -896,6 +872,4 @@ extern PROTO (char *, bfd_make_targ_name,( enum target_flavour_enum format, int
#endif /* GNU960 */
#endif /* __BFD_H_SEEN__ */