Basically a checkpoint.

Fri Jan  8 15:47:53 1993  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)

	* bfd.c (struct _bfd): Added ecoff_tdata to tdata union.
	* targets.c (enum target_flavour): Added bfd_target_ecoff_flavour.
	* coff-msym.c: Use DEFUN for function definitons.
	* coff-mips.c: Added code to read and print symbols, and to find
	line numbers.
This commit is contained in:
Ian Lance Taylor 1993-01-08 21:46:36 +00:00
parent 06c3865a42
commit 515c429211
5 changed files with 1382 additions and 73 deletions

View file

@ -1,5 +1,11 @@
Fri Jan 8 15:47:53 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* bfd.c (struct _bfd): Added ecoff_tdata to tdata union.
* targets.c (enum target_flavour): Added bfd_target_ecoff_flavour.
* coff-msym.c: Use DEFUN for function definitons.
* coff-mips.c: Added code to read and print symbols, and to find
line numbers.
* coffcode.h: Moved many generic functions into coffgen.c. Moved
swapping functions into coffswap.h for ECOFF use. Moved
relocation functions, only used by h8300 and z8k, into reloc16.c.

View file

@ -146,6 +146,7 @@ CODE_FRAGMENT
. struct _oasys_data *oasys_obj_data;
. struct _oasys_ar_data *oasys_ar_data;
. struct coff_tdata *coff_obj_data;
. struct ecoff_tdata *ecoff_obj_data;
. struct ieee_data_struct *ieee_data;
. struct ieee_ar_data_struct *ieee_ar_data;
. struct srec_data_struct *srec_data;
@ -517,6 +518,53 @@ bfd_get_mtime (abfd)
return buf.st_mtime;
}
/*
FUNCTION
The bfd_get_size function
SYNOPSIS
long bfd_get_size(bfd *);
DESCRIPTION
Return file size (as read from file system) for the file
associated with a bfd.
Note that the initial motivation for, and use of, this routine is not
so we can get the exact size of the object the bfd applies to, since
that might not be generally possible (archive members for example?).
Although it would be ideal if someone could eventually modify
it so that such results were guaranteed.
Instead, we want to ask questions like "is this NNN byte sized
object I'm about to try read from file offset YYY reasonable?"
As as example of where we might want to do this, some object formats
use string tables for which the first sizeof(long) bytes of the table
contain the size of the table itself, including the size bytes.
If an application tries to read what it thinks is one of these
string tables, without some way to validate the size, and for
some reason the size is wrong (byte swapping error, wrong location
for the string table, etc), the only clue is likely to be a read
error when it tries to read the table, or a "virtual memory
exhausted" error when it tries to allocated 15 bazillon bytes
of space for the 15 bazillon byte table it is about to read.
This function at least allows us to answer the quesion, "is the
size reasonable?".
*/
long
bfd_get_size (abfd)
bfd *abfd;
{
FILE *fp;
struct stat buf;
fp = bfd_cache_lookup (abfd);
if (0 != fstat (fileno (fp), &buf))
return 0;
return buf.st_size;
}
/*
FUNCTION
stuff

File diff suppressed because it is too large Load diff

View file

@ -38,10 +38,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "coff/ecoff-ext.h" /* ECOFF external struct defns */
void
ecoff_swap_hdr_in (abfd, ext_copy, intern)
bfd *abfd;
struct hdr_ext *ext_copy;
HDRR *intern;
DEFUN (ecoff_swap_hdr_in, (abfd, ext_copy, intern),
bfd *abfd AND
struct hdr_ext *ext_copy AND
HDRR *intern)
{
struct hdr_ext ext[1];
@ -82,10 +82,10 @@ ecoff_swap_hdr_in (abfd, ext_copy, intern)
/* Swap in the file descriptor record. */
void
ecoff_swap_fdr_in (abfd, ext_copy, intern)
bfd *abfd;
struct fdr_ext *ext_copy;
FDR *intern;
DEFUN (ecoff_swap_fdr_in, (abfd, ext_copy, intern),
bfd *abfd AND
struct fdr_ext *ext_copy AND
FDR *intern)
{
struct fdr_ext ext[1];
@ -143,10 +143,10 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
/* Swap in the procedure descriptor record. */
void
ecoff_swap_pdr_in (abfd, ext_copy, intern)
bfd *abfd;
struct pdr_ext *ext_copy;
PDR *intern;
DEFUN (ecoff_swap_pdr_in, (abfd, ext_copy, intern),
bfd *abfd AND
struct pdr_ext *ext_copy AND
PDR *intern)
{
struct pdr_ext ext[1];
@ -177,10 +177,10 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
/* Swap in a symbol record. */
void
ecoff_swap_sym_in (abfd, ext_copy, intern)
bfd *abfd;
struct sym_ext *ext_copy;
SYMR *intern;
DEFUN (ecoff_swap_sym_in, (abfd, ext_copy, intern),
bfd *abfd AND
struct sym_ext *ext_copy AND
SYMR *intern)
{
struct sym_ext ext[1];
@ -226,10 +226,10 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
/* Swap in an external symbol record. */
void
ecoff_swap_ext_in (abfd, ext_copy, intern)
bfd *abfd;
struct ext_ext *ext_copy;
EXTR *intern;
DEFUN (ecoff_swap_ext_in, (abfd, ext_copy, intern),
bfd *abfd AND
struct ext_ext *ext_copy AND
EXTR *intern)
{
struct ext_ext ext[1];
@ -260,10 +260,10 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
info comes from the file header record (fh-fBigendian). */
void
ecoff_swap_tir_in (bigend, ext_copy, intern)
int bigend;
struct tir_ext *ext_copy;
TIR *intern;
DEFUN (ecoff_swap_tir_in, (bigend, ext_copy, intern),
int bigend AND
struct tir_ext *ext_copy AND
TIR *intern)
{
struct tir_ext ext[1];
@ -316,10 +316,10 @@ ecoff_swap_tir_in (bigend, ext_copy, intern)
big-endian or little-endian format.*/
void
ecoff_swap_rndx_in (bigend, ext_copy, intern)
int bigend;
struct rndx_ext *ext_copy;
RNDXR *intern;
DEFUN (ecoff_swap_rndx_in, (bigend, ext_copy, intern),
int bigend AND
struct rndx_ext *ext_copy AND
RNDXR *intern)
{
struct rndx_ext ext[1];
@ -353,10 +353,10 @@ ecoff_swap_rndx_in (bigend, ext_copy, intern)
/* Swap in a relative file descriptor. */
void
ecoff_swap_rfd_in (abfd, ext, intern)
bfd *abfd;
struct rfd_ext *ext;
RFDT *intern;
DEFUN (ecoff_swap_rfd_in, (abfd, ext, intern),
bfd *abfd AND
struct rfd_ext *ext AND
RFDT *intern)
{
*intern = bfd_h_get_32 (abfd, (bfd_byte *)ext->rfd);

View file

@ -132,6 +132,7 @@ of a file.
. bfd_target_unknown_flavour,
. bfd_target_aout_flavour,
. bfd_target_coff_flavour,
. bfd_target_ecoff_flavour,
. bfd_target_elf_flavour,
. bfd_target_ieee_flavour,
. bfd_target_oasys_flavour,
@ -357,7 +358,7 @@ extern bfd_target rs6000coff_vec;
extern bfd_target h8300coff_vec;
extern bfd_target z8kcoff_vec;
extern bfd_target we32kcoff_vec;
#ifdef hp9000s800
#ifdef HOST_HPPAHPUX
extern bfd_target hppa_vec;
#endif
@ -412,7 +413,7 @@ bfd_target *target_vector[] = {
&m68kcoff_vec,
&a29kcoff_big_vec,
&rs6000coff_vec,
#ifdef hp9000s800
#ifdef HOST_HPPAHPUX
&hppa_vec,
#endif
&we32kcoff_vec,