* aoutf1.h archive.c bfd.c coffcode.h core.c ecoff.c ieee.c

bfd.texinfo oasys.c opncls.c reloc.c srec.c: More documentation on
lint fixes.

* amdcoff.c bfd.texinfo Makefile.in : Folded in changes for amd
29k coff by David Wood (wood@lab.ultra.nyu.edu).
This commit is contained in:
Steve Chamberlain
1991-07-15 23:30:28 +00:00
parent 36b9d39cf4
commit 41f50af07b
7 changed files with 292 additions and 158 deletions

View File

@ -41,7 +41,7 @@ BFD_LIBS = libbfd.o opncls.o bfd.o archive.o targets.o cache.o \
archures.o core.o section.o format.o syms.o reloc.o archures.o core.o section.o format.o syms.o reloc.o
BFD_BACKENDS = oasys.o ieee.o srec.o aout64.o aout32.o sunos.o icoff.o \ BFD_BACKENDS = oasys.o ieee.o srec.o aout64.o aout32.o sunos.o icoff.o \
demo64.o \ demo64.o amdcoff.o \
m68kcoff.o i386coff.o m88k-bcs.o ecoff.o newsos3.o # trad-core.o bout.o m68kcoff.o i386coff.o m88k-bcs.o ecoff.o newsos3.o # trad-core.o bout.o
BFD_H=$(INCDIR)/bfd.h BFD_H=$(INCDIR)/bfd.h
@ -50,7 +50,7 @@ SYSDEP_H=$(INCDIR)/sysdep.h
# C source files that correspond to .o's. # C source files that correspond to .o's.
CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c archures.c \ CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c archures.c \
i386coff.c aout64.c aout32.c sunos.c demo64.c icoff.c srec.c \ i386coff.c aout64.c aout32.c sunos.c demo64.c icoff.c srec.c \
oasys.c ieee.c m68kcoff.c \ oasys.c ieee.c m68kcoff.c amdcoff.c \
format.c section.c core.c syms.c reloc.c \ format.c section.c core.c syms.c reloc.c \
m88k-bcs.c ecoff.c trad-core.c newsos3.c #bout.c m88k-bcs.c ecoff.c trad-core.c newsos3.c #bout.c

View File

@ -374,7 +374,7 @@ Return cached file modification time (e.g. as read from archive header
for archive members, or from file system if we have been called for archive members, or from file system if we have been called
before); else determine modify time, cache it, and return it. before); else determine modify time, cache it, and return it.
*;PROTO(long, bfd_get_mtime, (bfd *)); *; PROTO(long, bfd_get_mtime, (bfd *));
*/ */

View File

@ -25,16 +25,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sysdep.h> #include <sysdep.h>
#define MIPS 1 #define MIPS 1
#if 0
#include <stdio.h>
#include <string.h>
#endif
#include "bfd.h" #include "bfd.h"
#include "libbfd.h" #include "libbfd.h"
#include "intel-coff.h" #include "ecoff.h"
#include "internalcoff.h"
#include "libcoff.h" /* to allow easier abstraction-breaking */ #include "libcoff.h" /* to allow easier abstraction-breaking */
#define BADMAG(x) ECOFFBADMAG(x) #define BADMAG(x) ECOFFBADMAG(x)
@ -53,6 +49,7 @@ bfd_target ecoff_little_vec =
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */
'/', /* ar_pad_char */ '/', /* ar_pad_char */
15, /* ar_max_namelen */ 15, /* ar_max_namelen */
3, /* minimum alignment power */
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */ _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */ _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */
@ -77,6 +74,7 @@ bfd_target ecoff_big_vec =
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */
' ', /* ar_pad_char */ ' ', /* ar_pad_char */
16, /* ar_max_namelen */ 16, /* ar_max_namelen */
3, /* minimum alignment power */
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */ _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */ _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */ {_bfd_dummy_target, coff_object_p, /* bfd_check_format */

View File

@ -255,54 +255,115 @@ $ } coff_symbol_type;
#define PUTHALF bfd_h_put_16 #define PUTHALF bfd_h_put_16
#ifndef GET_FCN_LNNOPTR #ifndef GET_FCN_LNNOPTR
#define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) #define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
#endif #endif
#ifndef GET_FCN_ENDNDX #ifndef GET_FCN_ENDNDX
#define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx) #define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
#endif #endif
#ifndef PUT_FCN_LNNOPTR #ifndef PUT_FCN_LNNOPTR
#define PUT_FCN_LNNOPTR(abfd, in, ext) PUTWORD(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) #define PUT_FCN_LNNOPTR(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
#endif #endif
#ifndef PUT_FCN_ENDNDX #ifndef PUT_FCN_ENDNDX
#define PUT_FCN_ENDNDX(abfd, in, ext) PUTWORD(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx) #define PUT_FCN_ENDNDX(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
#endif #endif
#ifndef GET_LNSZ_LNNO #ifndef GET_LNSZ_LNNO
#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, ext->x_sym.x_misc.x_lnsz.x_lnno) #define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
#endif #endif
#ifndef GET_LNSZ_SIZE #ifndef GET_LNSZ_SIZE
#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, ext->x_sym.x_misc.x_lnsz.x_size) #define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
#endif #endif
#ifndef PUT_LNSZ_LNNO #ifndef PUT_LNSZ_LNNO
#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno) #define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno)
#endif #endif
#ifndef PUT_LNSZ_SIZE #ifndef PUT_LNSZ_SIZE
#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_size) #define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size)
#endif #endif
#ifndef GET_SCN_SCNLEN #ifndef GET_SCN_SCNLEN
#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, ext->x_scn.x_scnlen) #define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen)
#endif #endif
#ifndef GET_SCN_NRELOC #ifndef GET_SCN_NRELOC
#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_16(abfd, ext->x_scn.x_nreloc) #define GET_SCN_NRELOC(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc)
#endif #endif
#ifndef GET_SCN_NLINNO #ifndef GET_SCN_NLINNO
#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_16(abfd, ext->x_scn.x_nlinno) #define GET_SCN_NLINNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno)
#endif #endif
#ifndef PUT_SCN_SCNLEN #ifndef PUT_SCN_SCNLEN
#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, ext->x_scn.x_scnlen) #define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen)
#endif #endif
#ifndef PUT_SCN_NRELOC #ifndef PUT_SCN_NRELOC
#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in,ext->x_scn.x_nreloc) #define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc)
#endif #endif
#ifndef PUT_SCN_NLINNO #ifndef PUT_SCN_NLINNO
#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_16(abfd,in, ext->x_scn.x_nlinno) #define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_16(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno)
#endif #endif
/* void warning(); */ /* void warning(); */
/*
* Return a word with STYP_* (scnhdr.s_flags) flags set to represent the
* incoming SEC_* flags. The inverse of this function is styp_to_sec_flags().
* NOTE: If you add to/change this routine, you should mirror the changes
* in styp_to_sec_flags().
*/
static long
DEFUN(sec_to_styp_flags, (sec_name, sec_flags),
CONST char * sec_name AND
flagword sec_flags)
{
long styp_flags = 0;
if (!strcmp(sec_name, _TEXT)) {
return((long)STYP_TEXT);
} else if (!strcmp(sec_name, _DATA)) {
return((long)STYP_DATA);
} else if (!strcmp(sec_name, _BSS)) {
return((long)STYP_BSS);
}
/* Try and figure out what it should be */
if (sec_flags & SEC_CODE) styp_flags = STYP_TEXT;
if (sec_flags & SEC_DATA) styp_flags = STYP_DATA;
else if (sec_flags & SEC_READONLY)
#ifdef STYP_LIT /* 29k readonly text/data section */
styp_flags = STYP_LIT;
#else
styp_flags = STYP_TEXT;
#endif /* STYP_LIT */
else if (sec_flags & SEC_LOAD) styp_flags = STYP_TEXT;
if (styp_flags == 0) styp_flags = STYP_BSS;
return(styp_flags);
}
/*
* Return a word with SEC_* flags set to represent the incoming
* STYP_* flags (from scnhdr.s_flags). The inverse of this
* function is sec_to_styp_flags().
* NOTE: If you add to/change this routine, you should mirror the changes
* in sec_to_styp_flags().
*/
static flagword
DEFUN(styp_to_sec_flags, (styp_flags),
long styp_flags)
{
flagword sec_flags=0;
if ((styp_flags & STYP_TEXT) || (styp_flags & STYP_DATA))
sec_flags = (SEC_LOAD | SEC_ALLOC);
else if (styp_flags & STYP_BSS)
sec_flags = SEC_ALLOC;
#ifdef STYP_LIT /* A29k readonly text/data section type */
if ((styp_flags & STYP_LIT) == STYP_LIT)
sec_flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY);
#endif /* STYP_LIT */
return(sec_flags);
}
static int static int
DEFUN(get_index,(symbol), DEFUN(get_index,(symbol),
@ -332,11 +393,11 @@ DEFUN(bfd_swap_reloc_in,(abfd, reloc_src, reloc_dst),
RELOC *reloc_src AND RELOC *reloc_src AND
struct internal_reloc *reloc_dst) struct internal_reloc *reloc_dst)
{ {
reloc_dst->r_vaddr = bfd_h_get_32(abfd, reloc_src->r_vaddr); reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr);
reloc_dst->r_symndx = bfd_h_get_32(abfd, reloc_src->r_symndx); reloc_dst->r_symndx = bfd_h_get_32(abfd, (bfd_byte *) reloc_src->r_symndx);
reloc_dst->r_type = bfd_h_get_16(abfd, reloc_src->r_type); reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type);
#if M88 #if M88
reloc_dst->r_offset = bfd_h_get_16(abfd, reloc_src->r_offset); reloc_dst->r_offset = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_offset);
#endif #endif
} }
@ -347,11 +408,11 @@ DEFUN(bfd_swap_reloc_out,(abfd, reloc_src, reloc_dst),
struct internal_reloc *reloc_src AND struct internal_reloc *reloc_src AND
struct external_reloc *reloc_dst) struct external_reloc *reloc_dst)
{ {
bfd_h_put_32(abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr); bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr);
bfd_h_put_32(abfd, reloc_src->r_symndx, reloc_dst->r_symndx); bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx);
bfd_h_put_16(abfd, reloc_src->r_type, reloc_dst->r_type); bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *) reloc_dst->r_type);
#if M88 #if M88
bfd_h_put_16(abfd, reloc_src->r_offset, reloc_dst->r_offset); bfd_h_put_16(abfd, reloc_src->r_offset, (bfd_byte *) reloc_dst->r_offset);
#endif #endif
} }
@ -362,13 +423,13 @@ DEFUN(bfd_swap_filehdr_in,(abfd, filehdr_src, filehdr_dst),
FILHDR *filehdr_src AND FILHDR *filehdr_src AND
struct internal_filehdr *filehdr_dst) struct internal_filehdr *filehdr_dst)
{ {
filehdr_dst->f_magic = bfd_h_get_16(abfd, filehdr_src->f_magic); filehdr_dst->f_magic = bfd_h_get_16(abfd, (bfd_byte *) filehdr_src->f_magic);
filehdr_dst->f_nscns = bfd_h_get_16(abfd,filehdr_src-> f_nscns); filehdr_dst->f_nscns = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_nscns);
filehdr_dst->f_timdat = bfd_h_get_32(abfd,filehdr_src-> f_timdat); filehdr_dst->f_timdat = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_timdat);
filehdr_dst->f_symptr = bfd_h_get_32(abfd,filehdr_src-> f_symptr); filehdr_dst->f_symptr = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_symptr);
filehdr_dst->f_nsyms = bfd_h_get_32(abfd,filehdr_src-> f_nsyms); filehdr_dst->f_nsyms = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_nsyms);
filehdr_dst->f_opthdr = bfd_h_get_16(abfd,filehdr_src-> f_opthdr); filehdr_dst->f_opthdr = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_opthdr);
filehdr_dst->f_flags = bfd_h_get_16(abfd,filehdr_src-> f_flags); filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags);
} }
static void static void
@ -377,13 +438,13 @@ DEFUN(bfd_swap_filehdr_out,(abfd, filehdr_in, filehdr_out),
struct internal_filehdr *filehdr_in AND struct internal_filehdr *filehdr_in AND
FILHDR *filehdr_out) FILHDR *filehdr_out)
{ {
bfd_h_put_16(abfd, filehdr_in->f_magic, filehdr_out->f_magic); bfd_h_put_16(abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic);
bfd_h_put_16(abfd, filehdr_in->f_nscns, filehdr_out->f_nscns); bfd_h_put_16(abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns);
bfd_h_put_32(abfd, filehdr_in->f_timdat, filehdr_out->f_timdat); bfd_h_put_32(abfd, filehdr_in->f_timdat, (bfd_byte *) filehdr_out->f_timdat);
bfd_h_put_32(abfd, filehdr_in->f_symptr, filehdr_out->f_symptr); bfd_h_put_32(abfd, filehdr_in->f_symptr, (bfd_byte *) filehdr_out->f_symptr);
bfd_h_put_32(abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms); bfd_h_put_32(abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms);
bfd_h_put_16(abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr); bfd_h_put_16(abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr);
bfd_h_put_16(abfd, filehdr_in->f_flags, filehdr_out->f_flags); bfd_h_put_16(abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags);
} }
@ -399,18 +460,18 @@ DEFUN(coff_swap_sym_in,(abfd, ext1, in1),
if( ext->e.e_name[0] == 0) { if( ext->e.e_name[0] == 0) {
in->_n._n_n._n_zeroes = 0; in->_n._n_n._n_zeroes = 0;
in->_n._n_n._n_offset = bfd_h_get_32(abfd, ext->e.e.e_offset); in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset);
} }
else { else {
memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN); memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN);
} }
in->n_value = bfd_h_get_32(abfd, ext->e_value); in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value);
in->n_scnum = bfd_h_get_16(abfd, ext->e_scnum); in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
if (sizeof(ext->e_type) == 2){ if (sizeof(ext->e_type) == 2){
in->n_type = bfd_h_get_16(abfd, ext->e_type); in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
} }
else { else {
in->n_type = bfd_h_get_32(abfd, ext->e_type); in->n_type = bfd_h_get_32(abfd, (bfd_byte *) ext->e_type);
} }
in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass); in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux); in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux);
@ -423,21 +484,21 @@ DEFUN(coff_swap_sym_out,(abfd,in, ext),
SYMENT *ext) SYMENT *ext)
{ {
if(in->_n._n_name[0] == 0) { if(in->_n._n_name[0] == 0) {
bfd_h_put_32(abfd, 0, ext->e.e.e_zeroes); bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
bfd_h_put_32(abfd, in->_n._n_n._n_offset, ext->e.e.e_offset); bfd_h_put_32(abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e.e.e_offset);
} }
else { else {
memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN); memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
} }
bfd_h_put_32(abfd, in->n_value , ext->e_value); bfd_h_put_32(abfd, in->n_value , (bfd_byte *) ext->e_value);
bfd_h_put_16(abfd, in->n_scnum , ext->e_scnum); bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum);
if (sizeof(ext->e_type) == 2) if (sizeof(ext->e_type) == 2)
{ {
bfd_h_put_16(abfd, in->n_type , ext->e_type); bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type);
} }
else else
{ {
bfd_h_put_32(abfd, in->n_type , ext->e_type); bfd_h_put_32(abfd, in->n_type , (bfd_byte *) ext->e_type);
} }
bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass); bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass);
bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux); bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux);
@ -457,7 +518,7 @@ DEFUN(coff_swap_aux_in,(abfd, ext1, type, class, in1),
case C_FILE: case C_FILE:
if (ext->x_file.x_fname[0] == 0) { if (ext->x_file.x_fname[0] == 0) {
in->x_file.x_n.x_zeroes = 0; in->x_file.x_n.x_zeroes = 0;
in->x_file.x_n.x_offset = bfd_h_get_32(abfd, ext->x_file.x_n.x_offset); in->x_file.x_n.x_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
} else { } else {
memcpy (in->x_file.x_fname, ext->x_file.x_fname, memcpy (in->x_file.x_fname, ext->x_file.x_fname,
sizeof (in->x_file.x_fname)); sizeof (in->x_file.x_fname));
@ -476,22 +537,22 @@ DEFUN(coff_swap_aux_in,(abfd, ext1, type, class, in1),
break; break;
} }
default: default:
in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, ext->x_sym.x_tagndx); in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx);
#ifndef NO_TVNDX #ifndef NO_TVNDX
in->x_sym.x_tvndx = bfd_h_get_16(abfd, ext->x_sym.x_tvndx); in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx);
#endif #endif
if (ISARY(type) || class == C_BLOCK) { if (ISARY(type) || class == C_BLOCK) {
in->x_sym.x_fcnary.x_ary.x_dimen[0] = bfd_h_get_16(abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]); in->x_sym.x_fcnary.x_ary.x_dimen[0] = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
in->x_sym.x_fcnary.x_ary.x_dimen[1] = bfd_h_get_16(abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]); in->x_sym.x_fcnary.x_ary.x_dimen[1] = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
in->x_sym.x_fcnary.x_ary.x_dimen[2] = bfd_h_get_16(abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]); in->x_sym.x_fcnary.x_ary.x_dimen[2] = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
in->x_sym.x_fcnary.x_ary.x_dimen[3] = bfd_h_get_16(abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]); in->x_sym.x_fcnary.x_ary.x_dimen[3] = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
} }
in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR(abfd, ext); in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR(abfd, ext);
in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX(abfd, ext); in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX(abfd, ext);
if (ISFCN(type)) { if (ISFCN(type)) {
in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, ext->x_sym.x_misc.x_fsize); in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize);
} }
else { else {
in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO(abfd, ext); in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO(abfd, ext);
@ -511,8 +572,8 @@ DEFUN(coff_swap_aux_out,(abfd, in, type, class, ext),
switch (class) { switch (class) {
case C_FILE: case C_FILE:
if (in->x_file.x_fname[0] == 0) { if (in->x_file.x_fname[0] == 0) {
PUTWORD(abfd, 0, ext->x_file.x_n.x_zeroes ); PUTWORD(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes );
PUTWORD(abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset); PUTWORD(abfd, in->x_file.x_n.x_offset, (bfd_byte *) ext->x_file.x_n.x_offset);
} }
else { else {
memcpy ( ext->x_file.x_fname,in->x_file.x_fname, memcpy ( ext->x_file.x_fname,in->x_file.x_fname,
@ -532,23 +593,23 @@ DEFUN(coff_swap_aux_out,(abfd, in, type, class, ext),
break; break;
} }
default: default:
PUTWORD(abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx); PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx);
#ifndef NO_TVNDX #ifndef NO_TVNDX
PUTWORD(abfd, in->x_sym.x_tvndx , ext->x_sym.x_tvndx); PUTWORD(abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx);
#endif #endif
if (ISFCN(type)) { if (ISFCN(type)) {
PUTWORD(abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize); PUTWORD(abfd, in->x_sym.x_misc.x_fsize, (bfd_byte *) ext->x_sym.x_misc.x_fsize);
PUT_FCN_LNNOPTR(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext); PUT_FCN_LNNOPTR(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext);
PUT_FCN_ENDNDX(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext); PUT_FCN_ENDNDX(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext);
} }
else { else {
if (ISARY(type) || class == C_BLOCK) { if (ISARY(type) || class == C_BLOCK) {
bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],ext->x_sym.x_fcnary.x_ary.x_dimen[0]); bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0], (bfd_byte *)ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],ext->x_sym.x_fcnary.x_ary.x_dimen[1]); bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1], (bfd_byte *)ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],ext->x_sym.x_fcnary.x_ary.x_dimen[2]); bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2], (bfd_byte *)ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],ext->x_sym.x_fcnary.x_ary.x_dimen[3]); bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3], (bfd_byte *)ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
} }
PUT_LNSZ_LNNO(abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext); PUT_LNSZ_LNNO(abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext);
@ -571,11 +632,11 @@ DEFUN(coff_swap_lineno_in,(abfd, ext1, in1),
LINENO *ext = (LINENO *)ext1; LINENO *ext = (LINENO *)ext1;
struct internal_lineno *in = (struct internal_lineno *)in1; struct internal_lineno *in = (struct internal_lineno *)in1;
in->l_addr.l_symndx = bfd_h_get_32(abfd, ext->l_addr.l_symndx); in->l_addr.l_symndx = bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx);
#if defined(M88) #if defined(M88)
in->l_lnno = bfd_h_get_32(abfd, ext->l_lnno); in->l_lnno = bfd_h_get_32(abfd, (bfd_byte *) ext->l_lnno);
#else #else
in->l_lnno = bfd_h_get_16(abfd, ext->l_lnno); in->l_lnno = bfd_h_get_16(abfd, (bfd_byte *) ext->l_lnno);
#endif #endif
} }
@ -585,11 +646,11 @@ DEFUN(coff_swap_lineno_out,(abfd, in, ext),
struct internal_lineno *in AND struct internal_lineno *in AND
struct external_lineno *ext) struct external_lineno *ext)
{ {
PUTWORD(abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx); PUTWORD(abfd, in->l_addr.l_symndx, (bfd_byte *) ext->l_addr.l_symndx);
#if defined(M88) #if defined(M88)
PUTWORD(abfd, in->l_lnno, ext->l_lnno); PUTWORD(abfd, in->l_lnno, (bfd_byte *) ext->l_lnno);
#else #else
PUTHALF(abfd, in->l_lnno, ext->l_lnno); PUTHALF(abfd, in->l_lnno, (bfd_byte *) ext->l_lnno);
#endif #endif
} }
@ -605,16 +666,16 @@ DEFUN(bfd_swap_aouthdr_in,(abfd, aouthdr_ext1, aouthdr_int1),
AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1; AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1; struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1;
aouthdr_int->magic = bfd_h_get_16(abfd, aouthdr_ext->magic); aouthdr_int->magic = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->magic);
aouthdr_int->vstamp = bfd_h_get_16(abfd, aouthdr_ext->vstamp); aouthdr_int->vstamp = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->vstamp);
aouthdr_int->tsize = bfd_h_get_32(abfd, aouthdr_ext->tsize); aouthdr_int->tsize = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->tsize);
aouthdr_int->dsize = bfd_h_get_32(abfd, aouthdr_ext->dsize); aouthdr_int->dsize = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->dsize);
aouthdr_int->bsize = bfd_h_get_32(abfd, aouthdr_ext->bsize); aouthdr_int->bsize = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->bsize);
aouthdr_int->entry = bfd_h_get_32(abfd, aouthdr_ext->entry); aouthdr_int->entry = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->entry);
aouthdr_int->text_start = bfd_h_get_32(abfd, aouthdr_ext->text_start); aouthdr_int->text_start = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->text_start);
aouthdr_int->data_start = bfd_h_get_32(abfd, aouthdr_ext->data_start); aouthdr_int->data_start = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->data_start);
#ifdef I960 #ifdef I960
aouthdr_int->tagentries = bfd_h_get_32(abfd, aouthdr_ext->tagentries); aouthdr_int->tagentries = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->tagentries);
#endif #endif
} }
@ -624,16 +685,16 @@ DEFUN(bfd_swap_aouthdr_out,(abfd, aouthdr_in, aouthdr_out),
struct internal_aouthdr *aouthdr_in AND struct internal_aouthdr *aouthdr_in AND
AOUTHDR *aouthdr_out) AOUTHDR *aouthdr_out)
{ {
bfd_h_put_16(abfd, aouthdr_in->magic, aouthdr_out->magic); bfd_h_put_16(abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->magic);
bfd_h_put_16(abfd, aouthdr_in->vstamp, aouthdr_out->vstamp); bfd_h_put_16(abfd, aouthdr_in->vstamp, (bfd_byte *) aouthdr_out->vstamp);
bfd_h_put_32(abfd, aouthdr_in->tsize, aouthdr_out->tsize); bfd_h_put_32(abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->tsize);
bfd_h_put_32(abfd, aouthdr_in->dsize, aouthdr_out->dsize); bfd_h_put_32(abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->dsize);
bfd_h_put_32(abfd, aouthdr_in->bsize, aouthdr_out->bsize); bfd_h_put_32(abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->bsize);
bfd_h_put_32(abfd, aouthdr_in->entry, aouthdr_out->entry); bfd_h_put_32(abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->entry);
bfd_h_put_32(abfd, aouthdr_in->text_start, aouthdr_out->text_start); bfd_h_put_32(abfd, aouthdr_in->text_start, (bfd_byte *) aouthdr_out->text_start);
bfd_h_put_32(abfd, aouthdr_in->data_start, aouthdr_out->data_start); bfd_h_put_32(abfd, aouthdr_in->data_start, (bfd_byte *) aouthdr_out->data_start);
#ifdef I960 #ifdef I960
bfd_h_put_32(abfd, aouthdr_in->tagentries, aouthdr_out->tagentries); bfd_h_put_32(abfd, aouthdr_in->tagentries, (bfd_byte *) aouthdr_out->tagentries);
#endif #endif
} }
@ -644,22 +705,22 @@ DEFUN(coff_swap_scnhdr_in,(abfd, scnhdr_ext, scnhdr_int),
struct internal_scnhdr *scnhdr_int) struct internal_scnhdr *scnhdr_int)
{ {
memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof(scnhdr_int->s_name)); memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof(scnhdr_int->s_name));
scnhdr_int->s_vaddr = bfd_h_get_32(abfd, scnhdr_ext->s_vaddr); scnhdr_int->s_vaddr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_vaddr);
scnhdr_int->s_paddr = bfd_h_get_32(abfd, scnhdr_ext->s_paddr); scnhdr_int->s_paddr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_paddr);
scnhdr_int->s_size = bfd_h_get_32(abfd, scnhdr_ext->s_size); scnhdr_int->s_size = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_size);
scnhdr_int->s_scnptr = bfd_h_get_32(abfd, scnhdr_ext->s_scnptr); scnhdr_int->s_scnptr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_scnptr);
scnhdr_int->s_relptr = bfd_h_get_32(abfd, scnhdr_ext->s_relptr); scnhdr_int->s_relptr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_relptr);
scnhdr_int->s_lnnoptr = bfd_h_get_32(abfd, scnhdr_ext->s_lnnoptr); scnhdr_int->s_lnnoptr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr);
scnhdr_int->s_flags = bfd_h_get_32(abfd, scnhdr_ext->s_flags); scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags);
#if defined(M88) #if defined(M88)
scnhdr_int->s_nreloc = bfd_h_get_32(abfd, scnhdr_ext->s_nreloc); scnhdr_int->s_nreloc = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nreloc);
scnhdr_int->s_nlnno = bfd_h_get_32(abfd, scnhdr_ext->s_nlnno); scnhdr_int->s_nlnno = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nlnno);
#else #else
scnhdr_int->s_nreloc = bfd_h_get_16(abfd, scnhdr_ext->s_nreloc); scnhdr_int->s_nreloc = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nreloc);
scnhdr_int->s_nlnno = bfd_h_get_16(abfd, scnhdr_ext->s_nlnno); scnhdr_int->s_nlnno = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nlnno);
#endif #endif
#ifdef I960 #ifdef I960
scnhdr_int->s_align = bfd_h_get_32(abfd, scnhdr_ext->s_align); scnhdr_int->s_align = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_align);
#endif #endif
} }
@ -670,23 +731,25 @@ DEFUN(swap_scnhdr_out,(abfd, scnhdr_int, scnhdr_ext),
SCNHDR *scnhdr_ext) SCNHDR *scnhdr_ext)
{ {
memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name)); memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name));
PUTWORD(abfd, scnhdr_int->s_vaddr, scnhdr_ext->s_vaddr); PUTWORD(abfd, scnhdr_int->s_vaddr, (bfd_byte *) scnhdr_ext->s_vaddr);
PUTWORD(abfd, scnhdr_int->s_paddr, scnhdr_ext->s_paddr); PUTWORD(abfd, scnhdr_int->s_paddr, (bfd_byte *) scnhdr_ext->s_paddr);
PUTWORD(abfd, scnhdr_int->s_size, scnhdr_ext->s_size); PUTWORD(abfd, scnhdr_int->s_size, (bfd_byte *) scnhdr_ext->s_size);
PUTWORD(abfd, scnhdr_int->s_scnptr, scnhdr_ext->s_scnptr); PUTWORD(abfd, scnhdr_int->s_scnptr, (bfd_byte *) scnhdr_ext->s_scnptr);
PUTWORD(abfd, scnhdr_int->s_relptr, scnhdr_ext->s_relptr); PUTWORD(abfd, scnhdr_int->s_relptr, (bfd_byte *) scnhdr_ext->s_relptr);
PUTWORD(abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr); PUTWORD(abfd, scnhdr_int->s_lnnoptr, (bfd_byte *) scnhdr_ext->s_lnnoptr);
PUTWORD(abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
#if defined(M88) #if defined(M88)
PUTWORD(abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno); PUTWORD(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno);
PUTWORD(abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags); PUTWORD(abfd, scnhdr_int->s_flags, (bfd_byte *) scnhdr_ext->s_flags);
PUTWORD(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc);
#else #else
PUTHALF(abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno); PUTHALF(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno);
PUTHALF(abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags); PUTHALF(abfd, scnhdr_int->s_flags, (bfd_byte *) scnhdr_ext->s_flags);
PUTHALF(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc);
#endif #endif
#if defined(I960) #if defined(I960)
PUTWORD(abfd, scnhdr_int->s_align, scnhdr_ext->s_align); PUTWORD(abfd, scnhdr_int->s_align, (bfd_byte *) scnhdr_ext->s_align);
#endif #endif
} }
@ -784,18 +847,15 @@ DEFUN(make_a_section_from_file,(abfd, hdr),
return_section->linesize = hdr->s_nlnno * sizeof (struct lineno); return_section->linesize = hdr->s_nlnno * sizeof (struct lineno);
*/ */
#undef assign
return_section->lineno_count = hdr->s_nlnno; return_section->lineno_count = hdr->s_nlnno;
return_section->userdata = NULL; return_section->userdata = NULL;
return_section->next = (asection *) NULL; return_section->next = (asection *) NULL;
return_section->flags = 0; return_section->flags = styp_to_sec_flags(hdr->s_flags);
if ((hdr->s_flags & STYP_TEXT) || (hdr->s_flags & STYP_DATA))
return_section->flags = (SEC_LOAD | SEC_ALLOC);
else if (hdr->s_flags & STYP_BSS)
return_section->flags = SEC_ALLOC;
if (hdr->s_nreloc != 0) if (hdr->s_nreloc != 0)
return_section->flags |= SEC_RELOC; return_section->flags |= SEC_RELOC;
/* FIXME: should this check 'hdr->s_size > 0' */
if (hdr->s_scnptr != 0) if (hdr->s_scnptr != 0)
return_section->flags |= SEC_HAS_CONTENTS; return_section->flags |= SEC_HAS_CONTENTS;
return true; return true;
@ -864,6 +924,15 @@ DEFUN(coff_real_object_p,(abfd, nscns, internal_f, internal_a),
abfd->obj_machine = 0; abfd->obj_machine = 0;
break; break;
#endif #endif
#ifdef A29K_MAGIC_BIG
case A29K_MAGIC_BIG:
case A29K_MAGIC_LITTLE:
abfd->obj_arch = bfd_arch_a29k;
abfd->obj_machine = 0;
break;
#endif
#ifdef MIPS #ifdef MIPS
case MIPS_MAGIC_1: case MIPS_MAGIC_1:
case MIPS_MAGIC_2: case MIPS_MAGIC_2:
@ -1152,7 +1221,7 @@ DEFUN(coff_renumber_symbols,(bfd_ptr),
} }
/*doc* /*
Run thorough the symbol table again, and fix it so that all pointers to Run thorough the symbol table again, and fix it so that all pointers to
entries are changed to the entries' index in the output symbol table. entries are changed to the entries' index in the output symbol table.
@ -1163,7 +1232,7 @@ DEFUN(coff_mangle_symbols,(bfd_ptr),
{ {
unsigned int symbol_count = bfd_get_symcount(bfd_ptr); unsigned int symbol_count = bfd_get_symcount(bfd_ptr);
asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols; asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols;
unsigned int native_index = 0;
unsigned int symbol_index; unsigned int symbol_index;
@ -1371,13 +1440,14 @@ DEFUN(coff_fix_symbol_name,(abfd, symbol, native),
{ {
unsigned int name_length; unsigned int name_length;
union internal_auxent *auxent; union internal_auxent *auxent;
CONST char * name = symbol->name; char * name = ( char *)(symbol->name);
if (name == (char *) NULL) { if (name == (char *) NULL) {
/* /*
coff symbols always have names, so we'll make one up coff symbols always have names, so we'll make one up
*/ */
name = symbol->name = "strange"; symbol->name = "strange";
name = (char *)symbol->name;
} }
name_length = strlen(name); name_length = strlen(name);
@ -1726,10 +1796,11 @@ bfd *abfd;
static void static void
DEFUN(coff_print_symbol,(ignore_abfd, file, symbol, how), DEFUN(coff_print_symbol,(ignore_abfd, file, symbol, how),
bfd *ignore_abfd AND bfd *ignore_abfd AND
FILE *file AND PTR filep AND
asymbol *symbol AND asymbol *symbol AND
bfd_print_symbol_enum_type how) bfd_print_symbol_enum_type how)
{ {
FILE *file = (FILE *)filep;
switch (how) { switch (how) {
case bfd_print_symbol_name_enum: case bfd_print_symbol_name_enum:
fprintf(file, "%s", symbol->name); fprintf(file, "%s", symbol->name);
@ -1838,6 +1909,16 @@ DEFUN(coff_set_flags,(abfd, magicp, flagsp),
return true; return true;
break; break;
#endif #endif
#ifdef A29K_MAGIC_BIG
case bfd_arch_a29k:
if (abfd->xvec->byteorder_big_p)
*magicp = A29K_MAGIC_BIG;
else
*magicp = A29K_MAGIC_LITTLE;
return true;
break;
#endif
default: /* Unknown architecture */ default: /* Unknown architecture */
/* return false; -- fall through to "return false" below, to avoid /* return false; -- fall through to "return false" below, to avoid
@ -1856,7 +1937,7 @@ DEFUN(coff_set_arch_mach,(abfd, arch, machine),
unsigned long machine) unsigned long machine)
{ {
unsigned dummy1; unsigned dummy1;
unsigned short dummy2; unsigned short dummy2;
abfd->obj_arch = arch; abfd->obj_arch = arch;
abfd->obj_machine = machine; abfd->obj_machine = machine;
if (arch != bfd_arch_unknown && if (arch != bfd_arch_unknown &&
@ -1937,8 +2018,6 @@ DEFUN(coff_write_object_contents,(abfd),
struct internal_filehdr internal_f; struct internal_filehdr internal_f;
struct internal_aouthdr internal_a; struct internal_aouthdr internal_a;
struct icofdata *coff = obj_icof(abfd);
bfd_error = system_call_error; bfd_error = system_call_error;
@ -2033,19 +2112,15 @@ DEFUN(coff_write_object_contents,(abfd),
if (current->lineno_count != 0) if (current->lineno_count != 0)
haslinno = true; haslinno = true;
section.s_flags = sec_to_styp_flags(current->name,current->flags);
if (!strcmp(current->name, _TEXT)) { if (!strcmp(current->name, _TEXT)) {
text_sec = current; text_sec = current;
section.s_flags = STYP_TEXT; /* kinda stupid */ } else if (!strcmp(current->name, _DATA)) {
}
else if (!strcmp(current->name, _DATA)) {
data_sec = current; data_sec = current;
section.s_flags = STYP_DATA; /* kinda stupid */ } else if (!strcmp(current->name, _BSS)) {
}
else if (!strcmp(current->name, _BSS)) {
bss_sec = current; bss_sec = current;
section.s_flags = STYP_BSS; /* kinda stupid */ }
}
#ifdef I960 #ifdef I960
section.s_align = (current->alignment_power section.s_align = (current->alignment_power
@ -2115,17 +2190,44 @@ DEFUN(coff_write_object_contents,(abfd),
/* Set up architecture-dependent stuff */ /* Set up architecture-dependent stuff */
{ int magic = 0; { unsigned int magic = 0;
int flags = 0; unsigned short flags = 0;
coff_set_flags(abfd, &magic, &internal_f.f_flags); coff_set_flags(abfd, &magic, &flags);
internal_f.f_magic = magic; internal_f.f_magic = magic;
internal_f.f_flags = flags;
/* ...and the "opt"hdr... */ /* ...and the "opt"hdr... */
#ifdef A29K
# ifdef ULTRA3 /* NYU's machine */
/* FIXME: This is a bogus check. I really want to see if there
* is a .shbss or a .shdata section, if so then set the magic
* number to indicate a shared data executable.
*/
if (internal_f.f_nscns >= 7)
internal_a.magic = SHMAGIC; /* Shared magic */
else
# endif /* ULTRA3 */
internal_a.magic = NMAGIC; /* Assume separate i/d */
#define __A_MAGIC_SET__
#endif /* A29K */
#ifdef I960 #ifdef I960
internal_a.magic = (magic == I960ROMAGIC ? NMAGIC : OMAGIC); internal_a.magic = (magic == I960ROMAGIC ? NMAGIC : OMAGIC);
#endif #define __A_MAGIC_SET__
#endif /* I960 */
#if M88 #if M88
#define __A_MAGIC_SET__
internal_a.magic = PAGEMAGICBCS; internal_a.magic = PAGEMAGICBCS;
#endif /* M88 */
#if M68 || I386 || MIPS
#define __A_MAGIC_SET__
/* Never was anything here for the 68k */
#endif /* M88 */
#ifndef __A_MAGIC_SET__
# include "Your aouthdr magic number is not being set!"
#else
# undef __A_MAGIC_SET__
#endif #endif
} }
/* Now should write relocs, strings, syms */ /* Now should write relocs, strings, syms */
@ -2208,7 +2310,7 @@ DEFUN(coff_set_section_contents,(abfd, section, location, offset, count),
sec_ptr section AND sec_ptr section AND
PTR location AND PTR location AND
file_ptr offset AND file_ptr offset AND
size_t count) bfd_size_type count)
{ {
if (abfd->output_has_begun == false) /* set by bfd.c handler */ if (abfd->output_has_begun == false) /* set by bfd.c handler */
coff_compute_section_file_positions(abfd); coff_compute_section_file_positions(abfd);
@ -2287,7 +2389,7 @@ bfd *abfd)
return (NULL); return (NULL);
} /* on error */ } /* on error */
string_table_size = bfd_h_get_32(abfd, string_table_size_buffer); string_table_size = bfd_h_get_32(abfd, (bfd_byte *) string_table_size_buffer);
if ((string_table = (PTR) bfd_alloc(abfd, string_table_size -= 4)) == NULL) { if ((string_table = (PTR) bfd_alloc(abfd, string_table_size -= 4)) == NULL) {
bfd_error = no_memory; bfd_error = no_memory;
@ -2322,7 +2424,7 @@ bfd *abfd)
char *string_table = NULL; char *string_table = NULL;
unsigned long size; unsigned long size;
unsigned long string_table_size = 0;
unsigned int raw_size; unsigned int raw_size;
if (obj_raw_syments(abfd) != (combined_entry_type *)NULL) { if (obj_raw_syments(abfd) != (combined_entry_type *)NULL) {
return obj_raw_syments(abfd); return obj_raw_syments(abfd);
@ -2646,6 +2748,11 @@ DEFUN(coff_slurp_symbol_table,(abfd),
case C_MOS: /* member of structure */ case C_MOS: /* member of structure */
case C_EOS: /* end of structure */ case C_EOS: /* end of structure */
#ifdef NOTDEF /* C_AUTOARG has the same value */
#ifdef C_GLBLREG
case C_GLBLREG: /* A29k-specific storage class */
#endif
#endif
case C_REGPARM: /* register parameter */ case C_REGPARM: /* register parameter */
case C_REG: /* register variable */ case C_REG: /* register variable */
#ifdef C_AUTOARG #ifdef C_AUTOARG
@ -2673,6 +2780,7 @@ DEFUN(coff_slurp_symbol_table,(abfd),
break; break;
case C_BLOCK: /* ".bb" or ".eb" */ case C_BLOCK: /* ".bb" or ".eb" */
case C_FCN: /* ".bf" or ".ef" */ case C_FCN: /* ".bf" or ".ef" */
case C_EFCN: /* physical end of function */
dst->symbol.flags = BSF_LOCAL; dst->symbol.flags = BSF_LOCAL;
/* /*
Base the value as an index from the base of the section Base the value as an index from the base of the section
@ -2680,7 +2788,6 @@ DEFUN(coff_slurp_symbol_table,(abfd),
dst->symbol.value = (src->u.syment.n_value) - dst->symbol.section->vma; dst->symbol.value = (src->u.syment.n_value) - dst->symbol.section->vma;
break; break;
case C_EFCN: /* physical end of function */
case C_NULL: case C_NULL:
case C_EXTDEF: /* external definition */ case C_EXTDEF: /* external definition */
case C_ULABEL: /* undefined label */ case C_ULABEL: /* undefined label */
@ -2691,6 +2798,8 @@ DEFUN(coff_slurp_symbol_table,(abfd),
default: default:
fprintf(stderr,"Unrecognized storage class %d\n",
src->u.syment.n_sclass);
abort(); abort();
dst->symbol.flags = BSF_DEBUGGING; dst->symbol.flags = BSF_DEBUGGING;
dst->symbol.value = (src->u.syment.n_value); dst->symbol.value = (src->u.syment.n_value);
@ -2831,9 +2940,20 @@ DEFUN(coff_slurp_reloc_table,(abfd, asect, symbols),
struct internal_reloc dst; struct internal_reloc dst;
asymbol *ptr; asymbol *ptr;
bfd_swap_reloc_in(abfd, src, &dst); bfd_swap_reloc_in(abfd, src, &dst);
dst.r_symndx += obj_symbol_slew(abfd); dst.r_symndx += obj_symbol_slew(abfd);
cache_ptr->sym_ptr_ptr = symbols + obj_convert(abfd)[dst.r_symndx]; cache_ptr->sym_ptr_ptr = symbols + obj_convert(abfd)[dst.r_symndx];
#ifdef A29K
/* AMD has two relocation entries for the 'consth' instruction.
* The first is R_IHIHALF (part 1), the second is R_IHCONST
* (part 2). The second entry's r_symndx does not contain
* an index to a symbol but rather a value (apparently).
* Also, see the ifdef below for saving the r_symndx value in addend.
*/
if (dst.r_type == R_IHCONST) {
ptr = NULL;
} else
#endif
ptr = *(cache_ptr->sym_ptr_ptr); ptr = *(cache_ptr->sym_ptr_ptr);
cache_ptr->address = dst.r_vaddr; cache_ptr->address = dst.r_vaddr;
/* /*
@ -2845,7 +2965,7 @@ DEFUN(coff_slurp_reloc_table,(abfd, asect, symbols),
Note that symbols which used to be common must be left alone Note that symbols which used to be common must be left alone
*/ */
if (ptr->the_bfd == abfd if (ptr && ptr->the_bfd == abfd
&& ptr->section != (asection *) NULL && ptr->section != (asection *) NULL
&& ((ptr->flags & BSF_OLD_COMMON)== 0)) && ((ptr->flags & BSF_OLD_COMMON)== 0))
{ {
@ -2864,6 +2984,16 @@ DEFUN(coff_slurp_reloc_table,(abfd, asect, symbols),
cache_ptr->section = (asection *) NULL; cache_ptr->section = (asection *) NULL;
#ifdef A29K
if (dst.r_type == R_IHCONST) {
/* Add in the value which was stored in the symbol index */
/* See above comment */
cache_ptr->addend += dst.r_symndx;
/* Throw away the bogus symbol pointer */
cache_ptr->sym_ptr_ptr = 0;
}
cache_ptr->howto = howto_table + dst.r_type;
#endif
#if I386 #if I386
cache_ptr->howto = howto_table + dst.r_type; cache_ptr->howto = howto_table + dst.r_type;
#endif #endif
@ -3070,4 +3200,5 @@ DEFUN(coff_sizeof_headers,(abfd, reloc),
#define coff_bfd_debug_info_start bfd_void #define coff_bfd_debug_info_start bfd_void
#define coff_bfd_debug_info_end bfd_void #define coff_bfd_debug_info_end bfd_void
#define coff_bfd_debug_info_accumulate bfd_void #define coff_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void

View File

@ -9,7 +9,7 @@ Buff output this facinating topic
/** Some core file info commands */ /** Some core file info commands */
/*proto*i bfd_core_file_failing_command /*proto* bfd_core_file_failing_command
Returns a read-only string explaining what program was running when Returns a read-only string explaining what program was running when
it failed and produced the core file being read it failed and produced the core file being read

View File

@ -100,7 +100,7 @@ $ struct sec *section;
Pointer to how to perform the required relocation Pointer to how to perform the required relocation
$ struct reloc_howto_struct *howto; $ CONST struct reloc_howto_struct *howto;
$} arelent; $} arelent;
*--- *---

View File

@ -289,7 +289,7 @@ extern bfd_target oasys_vec;
extern bfd_target m88k_bcs_vec; extern bfd_target m88k_bcs_vec;
extern bfd_target m68kcoff_vec; extern bfd_target m68kcoff_vec;
extern bfd_target i386coff_vec; extern bfd_target i386coff_vec;
extern bfd_target a29kcoff_big_vec;
#ifdef DEFAULT_VECTOR #ifdef DEFAULT_VECTOR
extern bfd_target DEFAULT_VECTOR; extern bfd_target DEFAULT_VECTOR;
#endif #endif
@ -316,6 +316,7 @@ extern bfd_target DEFAULT_VECTOR;
#define SREC_VEC srec_vec #define SREC_VEC srec_vec
#define M68KCOFF_VEC m68kcoff_vec #define M68KCOFF_VEC m68kcoff_vec
#define I386COFF_VEC i386coff_vec #define I386COFF_VEC i386coff_vec
#define A29KCOFF_BIG_VEC a29kcoff_big_vec
#endif #endif
bfd_target *target_vector[] = { bfd_target *target_vector[] = {
@ -381,6 +382,10 @@ bfd_target *target_vector[] = {
&M68KCOFF_VEC, &M68KCOFF_VEC,
#endif /* M68KCOFF_VEC */ #endif /* M68KCOFF_VEC */
#ifdef A29KCOFF_BIG_VEC
&A29KCOFF_BIG_VEC,
#endif /* A29KCOFF_BIG_VEC */
NULL, /* end of list marker */ NULL, /* end of list marker */
}; };