#include "fnmatch.h"
/*
-SECTION
+SECTION
Targets
DESCRIPTION
part of BFD is a structure containing pointers to functions
which perform certain low level operations on files. BFD
translates the applications's requests through a pointer into
- calls to the back end routines.
+ calls to the back end routines.
When a file is opened with <<bfd_openr>>, its format and
target are unknown. BFD uses various mechanisms to determine
o Create a BFD by calling the internal routine
<<_bfd_new_bfd>>, then call <<bfd_find_target>> with the
- target string supplied to <<bfd_openr>> and the new BFD pointer.
+ target string supplied to <<bfd_openr>> and the new BFD pointer.
o If a null target string was provided to <<bfd_find_target>>,
look up the environment variable <<GNUTARGET>> and use
- that as the target string.
+ that as the target string.
o If the target string is still <<NULL>>, or the target string is
<<default>>, then use the first item in the target vector
o Otherwise, inspect the elements in the target vector
one by one, until a match on target name is found. When found,
- use it.
+ use it.
o Otherwise return the error <<bfd_error_invalid_target>> to
<<bfd_openr>>.
Once the BFD has been opened and the target selected, the file
format may be determined. This is done by calling
- <<bfd_check_format>> on the BFD with a suggested format.
+ <<bfd_check_format>> on the BFD with a suggested format.
If <<target_defaulted>> has been set, each possible target
type is tried to see if it recognizes the specified format.
<<bfd_check_format>> returns <<true>> when the caller guesses right.
@end menu
*/
-
/*
INODE
DESCRIPTION
This structure contains everything that BFD knows about a
target. It includes things like its byte order, name, and which
- routines to call to do various operations.
+ routines to call to do various operations.
Every BFD points to a target structure with its <<xvec>>
- member.
+ member.
The macros below are used to dispatch to functions through the
<<bfd_target>> vector. They are used in a number of macros further
down in @file{bfd.h}, and are also used when calling various
routines by hand inside the BFD implementation. The @var{arglist}
argument must be parenthesized; it contains all the arguments
- to the called function.
+ to the called function.
They make the documentation (more) unpleasant to read, so if
someone wants to fix this and not break the above, please do.
For operations which index on the BFD format:
.#define BFD_SEND_FMT(bfd, message, arglist) \
-. (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
+. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
.
.#ifdef DEBUG_BFD_SEND
.#undef BFD_SEND_FMT
.#define BFD_SEND_FMT(bfd, message, arglist) \
. (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-. (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \
+. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
. (bfd_assert (__FILE__,__LINE__), NULL))
.#endif
module that implements access to a different target under BFD,
defines one of these.
-
FIXME, these names should be rationalised with the names of
the entry points which call them. Too bad we can't have one
- macro to define them both!
+ macro to define them both!
.enum bfd_flavour {
. bfd_target_unknown_flavour,
A mask of all the flags which an executable may have set -
from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.
-. flagword object_flags;
+. flagword object_flags;
A mask of all the flags which a section may have set - from
the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.
. flagword section_flags;
-The character normally found at the front of a symbol
+The character normally found at the front of a symbol
(if any), perhaps `_'.
. char symbol_leading_char;
The pad character for file names within an archive header.
-. char ar_pad_char;
+. char ar_pad_char;
The maximum number of characters in an archive header.
Format dependent routines: these are vectors of entry points
within the target vector structure, one for each format to check.
-Check the format of a file being read. Return a <<bfd_target *>> or zero.
+Check the format of a file being read. Return a <<bfd_target *>> or zero.
. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
-Set the format of a file being written.
+Set the format of a file being written.
. boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
-Write cached information into a file being written, at <<bfd_close>>.
+Write cached information into a file being written, at <<bfd_close>>.
. boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
. {* Called when a new section is created. *}
. boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
. {* Read the contents of a section. *}
-. boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
+. boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
. file_ptr, bfd_size_type));
. boolean (*_bfd_get_section_contents_in_window)
. PARAMS ((bfd *, sec_ptr, bfd_window *,
. to another. *}
. boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
. bfd *, sec_ptr));
-. {* Called to copy BFD private symbol data from one symbol
+. {* Called to copy BFD private symbol data from one symbol
. to another. *}
. boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
. bfd *, asymbol *));
. boolean (*_bfd_construct_extended_name_table)
. PARAMS ((bfd *, char **, bfd_size_type *, const char **));
. void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
-. boolean (*write_armap) PARAMS ((bfd *arch,
+. boolean (*write_armap) PARAMS ((bfd *arch,
. unsigned int elength,
. struct orl *map,
-. unsigned int orl_count,
+. unsigned int orl_count,
. int stridx));
. PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
. bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
endianness. The function open_output() in ld/ldlang.c uses this field
to find an alternative output format that is suitable.
-. {* Opposite endian version of this target. *}
+. {* Opposite endian version of this target. *}
. const struct bfd_target * alternative_target;
-.
+.
Data for use by back-end routines, which isn't generic enough to belong
in this structure.
. PTR backend_data;
-.
+.
.} bfd_target;
*/
&riscix_vec,
#endif
#if 0
- /* This has the same magic number as RS/6000. */
+ /* This has the same magic number as RS/6000. */
&pmac_xcoff_vec,
#endif
&rs6000coff_vec,
/* When there is an ambiguous match, bfd_check_format_matches puts the
names of the matching targets in an array. This variable is the maximum
number of entries that the array could possibly need. */
-const size_t _bfd_target_vector_entries = sizeof(bfd_target_vector)/sizeof(*bfd_target_vector);
+const size_t _bfd_target_vector_entries = sizeof (bfd_target_vector)/sizeof (*bfd_target_vector);
\f
/* This array maps configuration triplets onto BFD vectors. */
variable to "default" will cause the first entry in the target
list to be returned, and "target_defaulted" will be set in the
BFD. This causes <<bfd_check_format>> to loop over all the
- targets to find the one that matches the file being read.
+ targets to find the one that matches the file being read.
*/
const bfd_target *
bfd_seach_for_target
SYNOPSIS
- const bfd_target * bfd_search_for_target (int (* search_func)(const bfd_target *, void *), void *);
+ const bfd_target * bfd_search_for_target (int (* search_func) (const bfd_target *, void *), void *);
DESCRIPTION
Return a pointer to the first transfer vector in the list of
Tektronix Hex Format handling
DESCRIPTION
-
+
Tek Hex records can hold symbols and data, but not
relocations. Their main application is communication with
devices like PROM programmers and ICE equipment.
-
+
It seems that the sections are descibed as being really big,
the example I have says that the text section is 0..ffffffff.
BFD would barf with this, many apps would try to alloc 4GB to
Any number of sections may be created for output, we save them
up and output them when it's time to close the bfd.
-
A TekHex record looks like:
EXAMPLE
%<block length><type><checksum><stuff><cr>
-
+
DESCRIPTION
Where
o length
3) symbol record
6) data record
8) termination record
-
The data can come out of order, and may be discontigous. This is a
serial protocol, so big files are unlikely, so we keep a list of 8k chunks
static boolean tekhex_mkobject PARAMS ((bfd *));
static long tekhex_get_symtab_upper_bound PARAMS ((bfd *));
static long tekhex_get_symtab PARAMS ((bfd *, asymbol **));
-static void pass_over PARAMS ((bfd *, void (*)(bfd*, int, char *)));
+static void pass_over PARAMS ((bfd *, void (*) (bfd*, int, char *)));
static void first_phase PARAMS ((bfd *, int, char *));
static void insert_byte PARAMS ((bfd *, int, bfd_vma));
static struct data_struct *find_chunk PARAMS ((bfd *, bfd_vma));
00000000 g T_SEGMENT $
00000010 g T_SEGMENT $
-
RELOCATION RECORDS FOR [D00000000]: (none)
RELOCATION RECORDS FOR [D00008000]: (none)
char *n = bfd_alloc (abfd, len + 1);
if (!n)
- abort(); /* FIXME */
+ abort (); /* FIXME */
memcpy (n, sym, len + 1);
section = bfd_make_section (abfd, n);
}
char type = (*src);
if (!new)
- abort(); /* FIXME */
+ abort (); /* FIXME */
new->symbol.the_bfd = abfd;
src++;
abfd->symcount++;
len = getsym (sym, &src);
new->symbol.name = bfd_alloc (abfd, len + 1);
if (!new->symbol.name)
- abort(); /* FIXME */
+ abort (); /* FIXME */
memcpy ((char *) (new->symbol.name), sym, len + 1);
new->symbol.section = section;
if (type <= '4')
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
(PTR) 0
};
#include TRAD_HEADER
#endif
- struct trad_core_struct
+ struct trad_core_struct
{
asection *data_section;
asection *stack_section;
if (bfd_seek (abfd, TRAD_CORE_USER_OFFSET, SEEK_SET) != 0)
return 0;
#endif
-
+
val = bfd_read ((void *)&u, 1, sizeof u, abfd);
if (val != sizeof u)
{
}
/* Sanity check perhaps??? */
- if (u.u_dsize > 0x1000000) /* Remember, it's in pages... */
+ if (u.u_dsize > 0x1000000) /* Remember, it's in pages... */
{
bfd_set_error (bfd_error_wrong_format);
return 0;
bfd_zmalloc (sizeof (struct trad_core_struct));
if (rawptr == NULL)
return 0;
-
+
abfd->tdata.trad_core_data = rawptr;
rawptr->u = u; /*Copy the uarea into the tdata part of the bfd */
from *u_ar0. The other is that u_ar0 is sometimes an absolute address
in kernel memory, and on other systems it is an offset from the beginning
of the `struct user'.
-
+
As a practical matter, we don't know where the registers actually are,
so we have to pass the whole area to GDB. We encode the value of u_ar0
by setting the .regs section up so that its virtual memory address
0 is at the place pointed to by u_ar0 (by setting the vma of the start
of the section to -u_ar0). GDB uses this info to locate the regs,
- using minor trickery to get around the offset-or-absolute-addr problem. */
+ using minor trickery to get around the offset-or-absolute-addr problem. */
core_regsec (abfd)->vma = - (bfd_vma) u.u_ar0;
core_datasec (abfd)->filepos = NBPG * UPAGES;
\f
/* If somebody calls any byte-swapping routines, shoot them. */
static void
-swap_abort()
+swap_abort ()
{
- abort(); /* This way doesn't require any declaration for ANSI to fuck up */
+ abort (); /* This way doesn't require any declaration for ANSI to fuck up */
}
#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
bfd_false, bfd_false,
bfd_false, bfd_false
},
-
+
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (trad_unix),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
(PTR) 0 /* backend_data */
};