* Makefile.in: added coff-h8300

* configure.in: now h8 is a coff target
	* cpu-h8300.c: fix various disassembly problems
	* libcoff.h: took out some code which has been #0ed for a long
	time.
	* targets.c: added h8 coff
	* coff-a29k.c, coff-i386.c, coff-i960.c, coff-m68k.c, coff-m88k.c
	added new macro RTYPE2HOWTO to take a load of #ifdefs out of
	coffcode.h
	* coffcode.h: Started to change the way machine dependencies are
	handled, from the nest of #ifdefs to macros defined in the
	including coff-<foo>.c
This commit is contained in:
Steve Chamberlain 1991-11-27 16:56:08 +00:00
parent a33336a38e
commit 3b4f1a5d05
12 changed files with 397 additions and 291 deletions

View File

@ -1,3 +1,21 @@
Tue Nov 26 09:10:55 1991 Steve Chamberlain (sac at cygnus.com)
* Makefile.in: added coff-h8300
* configure.in: now h8 is a coff target
* cpu-h8300.c: fix various disassembly problems
* libcoff.h: took out some code which has been #0ed for a long
time.
* targets.c: added h8 coff
* coff-a29k.c, coff-i386.c, coff-i960.c, coff-m68k.c, coff-m88k.c
added new macro RTYPE2HOWTO to take a load of #ifdefs out of
coffcode.h
* coffcode.h: Started to change the way machine dependencies are
handled, from the nest of #ifdefs to macros defined in the
including coff-<foo>.c
Fri Nov 22 08:11:42 1991 John Gilmore (gnu at cygnus.com) Fri Nov 22 08:11:42 1991 John Gilmore (gnu at cygnus.com)
* aoutx.h (some_aout_object_p): Set the `executable' bit * aoutx.h (some_aout_object_p): Set the `executable' bit

View File

@ -55,7 +55,7 @@ BFD_MACHINES = cpu-h8300.o cpu-i960.o cpu-sparc.o cpu-m68k.o cpu-m88k.o \
BFD_BACKENDS = oasys.o ieee.o srec.o elf.o stab-syms.o\ BFD_BACKENDS = oasys.o ieee.o srec.o elf.o stab-syms.o\
aout64.o aout32.o demo64.o sunos.o newsos3.o i386aout.o bout.o \ aout64.o aout32.o demo64.o sunos.o newsos3.o i386aout.o bout.o \
coff-i960.o coff-a29k.o coff-m68k.o coff-i386.o coff-m88k.o \ coff-i960.o coff-a29k.o coff-m68k.o coff-i386.o coff-m88k.o \
coff-mips.o coff-rs6000.o coff-mips.o coff-rs6000.o coff-h8300.o
OPTIONAL_BACKENDS = trad-core.o OPTIONAL_BACKENDS = trad-core.o
@ -68,7 +68,7 @@ CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c archures.c \
format.c section.c core.c syms.c stabs-syms.c reloc.c init.c ctor.c \ format.c section.c core.c syms.c stabs-syms.c reloc.c init.c ctor.c \
coff-m88k.c coff-mips.c trad-core.c newsos3.c i386aout.c bout.c elf.c \ coff-m88k.c coff-mips.c trad-core.c newsos3.c i386aout.c bout.c elf.c \
cpu-h8300.c cpu-i960.c cpu-sparc.c cpu-m68k.c cpu-m88k.c \ cpu-h8300.c cpu-i960.c cpu-sparc.c cpu-m68k.c cpu-m88k.c \
cpu-vax.c cpu-mips.c cpu-a29k.c cpu-i386.c cpu-rs6000.c cpu-vax.c cpu-mips.c cpu-a29k.c cpu-i386.c cpu-rs6000.c coff-h8300.c
STAGESTUFF = $(TARGETLIB) $(OFILES) STAGESTUFF = $(TARGETLIB) $(OFILES)
@ -281,8 +281,6 @@ archive.o : archive.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
targets.o : targets.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h targets.o : targets.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h
cache.o : cache.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h cache.o : cache.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h
archures.o : archures.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h archures.o : archures.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h
coff-i386.o : coff-i386.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/coff-i386.h $(INCDIR)/internalcoff.h libcoff.h coffcode.h
aout64.o : aout64.c aout64.o : aout64.c
aout32.o : aout32.c aoutx.h $(INCDIR)/bfd.h $(INCDIR)/ansidecl.h \ aout32.o : aout32.c aoutx.h $(INCDIR)/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/obstack.h libaout.h libbfd.h $(INCDIR)/aout64.h \ $(INCDIR)/obstack.h libaout.h libbfd.h $(INCDIR)/aout64.h \
@ -291,19 +289,14 @@ sunos.o : sunos.c aoutf1.h $(INCDIR)/bfd.h $(INCDIR)/obstack.h \
libaout.h libbfd.h $(INCDIR)/aout64.h $(INCDIR)/stab.gnu.h \ libaout.h libbfd.h $(INCDIR)/aout64.h $(INCDIR)/stab.gnu.h \
$(INCDIR)/stab.def $(INCDIR)/ar.h $(INCDIR)/stab.def $(INCDIR)/ar.h
demo64.o : demo64.c demo64.o : demo64.c
coff-i960.o : coff-i960.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/coff-i960.h $(INCDIR)/internalcoff.h libcoff.h coffcode.h
srec.o : srec.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h srec.o : srec.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h
oasys.o : oasys.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \ oasys.o : oasys.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/oasys.h liboasys.h $(INCDIR)/oasys.h liboasys.h
ieee.o : ieee.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \ ieee.o : ieee.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/ieee.h libieee.h $(INCDIR)/ieee.h libieee.h
coff-m68k.o : coff-m68k.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \ coff-h8300.o: coff-h8300.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/coff-m68k.h $(INCDIR)/internalcoff.h libcoff.h coffcode.h $(INCDIR)/coff-h8300.h $(INCDIR)/internalcoff.h libcoff.h coffcode.h
coff-a29k.o : coff-a29k.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/coff-a29k.h $(INCDIR)/internalcoff.h libcoff.h coffcode.h
coff-rs6000.o: coff-rs6000.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/coff-rs6000.h $(INCDIR)/internalcoff.h libcoff.h coffcode.h
format.o : format.c $(INCDIR)/bfd.h \ format.o : format.c $(INCDIR)/bfd.h \
$(INCDIR)/obstack.h libbfd.h $(INCDIR)/obstack.h libbfd.h
section.o : section.c $(INCDIR)/bfd.h \ section.o : section.c $(INCDIR)/bfd.h \
@ -315,11 +308,7 @@ syms.o : syms.c $(INCDIR)/bfd.h \
syms.o : stab-syms.c syms.o : stab-syms.c
reloc.o : reloc.c $(INCDIR)/bfd.h \ reloc.o : reloc.c $(INCDIR)/bfd.h \
$(INCDIR)/obstack.h libbfd.h $(INCDIR)/obstack.h libbfd.h
coff-m88k.o : coff-m88k.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/coff-m88k.h $(INCDIR)/internalcoff.h libcoff.h coffcode.h
coff-mips.o : coff-mips.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/coff-mips.h $(INCDIR)/internalcoff.h libcoff.h trad-core.h \
coffcode.h
trad-core.o : trad-core.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h \ trad-core.o : trad-core.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h \
libbfd.h libaout.h libbfd.h libaout.h
newsos3.o : newsos3.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \ newsos3.o : newsos3.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \

View File

@ -230,6 +230,19 @@ static reloc_howto_type howto_table[] =
#define BADMAG(x) A29KBADMAG(x) #define BADMAG(x) A29KBADMAG(x)
/* This macro translates an external r_type field into a pointer to an
entry in the above table */
#define RTYPE2HOWTO(cache_ptr, dst) \
if (dst.r_type == R_IHCONST) { \
/* Add in the value which was stored in the symbol index */\
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; \
#include "coffcode.h" #include "coffcode.h"
bfd_target a29kcoff_big_vec = bfd_target a29kcoff_big_vec =

View File

@ -20,13 +20,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id$ */ /* $Id$ */
#define I386 1
#include <ansidecl.h>
#include <sysdep.h>
#include "bfd.h" #include "bfd.h"
#include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
#include "obstack.h" #include "obstack.h"
#include "i386coff.h" #include "coff-i386.h"
#include "internalcoff.h" #include "internalcoff.h"
#include "libcoff.h" #include "libcoff.h"
@ -60,6 +58,11 @@ static reloc_howto_type howto_table[] =
#define SELECT_RELOC(x,howto) { x = howto->type; } #define SELECT_RELOC(x,howto) { x = howto->type; }
#define BADMAG(x) I386BADMAG(x) #define BADMAG(x) I386BADMAG(x)
#define I386 1 /* Customize coffcode.h */
#define RTYPETOHOWTO(cache_ptr, dst) \
cache_ptr->howto = howto_table + dst.r_type;
#include "coffcode.h" #include "coffcode.h"
#define coff_write_armap bsd_write_armap #define coff_write_armap bsd_write_armap
@ -70,7 +73,7 @@ bfd *a ;
bfd_target i386coff_vec = bfd_target i386coff_vec =
{ {
"i386coff", /* name */ "coff-i386", /* name */
bfd_target_coff_flavour, bfd_target_coff_flavour,
false, /* data byte order is little */ false, /* data byte order is little */
false, /* header byte order is little */ false, /* header byte order is little */

View File

@ -1,34 +1,34 @@
/* Intel 960 COFF support for BFD. */ /* Intel 960 COFF support for BFD.
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Cygnus Support.
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Diddler. This program is free software; you can redistribute it and/or modify
BFD is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option) the Free Software Foundation; either version 2 of the License, or
any later version. (at your option) any later version.
BFD is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with BFD; see the file COPYING. If not, write to along with this program; if not, write to the Free Software
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id$ */ /* $Id$ */
#define I960 1 #define I960 1
#define BADMAG(x) I960BADMAG(x) #define BADMAG(x) I960BADMAG(x)
#include <ansidecl.h>
#include <sysdep.h>
#include "bfd.h" #include "bfd.h"
#include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
#include "obstack.h" #include "obstack.h"
#include "intel-coff.h" #include "coff-i960.h"
#include "internalcoff.h"
#include "libcoff.h" /* to allow easier abstraction-breaking */ #include "libcoff.h" /* to allow easier abstraction-breaking */
@ -36,7 +36,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define BAL 0x0b000000 /* Template for 'bal' instruction */ #define BAL 0x0b000000 /* Template for 'bal' instruction */
#define BAL_MASK 0x00ffffff #define BAL_MASK 0x00ffffff
static bfd_reloc_status_enum_type static bfd_reloc_status_type
optcall_callback(abfd, reloc_entry, symbol_in, data, ignore_input_section) optcall_callback(abfd, reloc_entry, symbol_in, data, ignore_input_section)
bfd *abfd; bfd *abfd;
arelent *reloc_entry; arelent *reloc_entry;
@ -47,13 +47,13 @@ asection *ignore_input_section;
/* This item has already been relocated correctly, but we may be /* This item has already been relocated correctly, but we may be
* able to patch in yet better code - done by digging out the * able to patch in yet better code - done by digging out the
* correct info on this symbol */ * correct info on this symbol */
bfd_reloc_status_enum_type result; bfd_reloc_status_type result;
coff_symbol_type *cs = coffsymbol(symbol_in); coff_symbol_type *cs = coffsymbol(symbol_in);
/* So the target symbol has to be of coff type, and the symbol /* So the target symbol has to be of coff type, and the symbol
has to have the correct native information within it */ has to have the correct native information within it */
if ((cs->symbol.the_bfd->xvec->flavour != bfd_target_coff_flavour_enum) if ((cs->symbol.the_bfd->xvec->flavour != bfd_target_coff_flavour)
|| (cs->native == (struct internal_syment *)NULL)) { || (cs->native == (combined_entry_type *)NULL)) {
/* This is interesting, consider the case where we're outputting */ /* This is interesting, consider the case where we're outputting */
/* coff from a mix n match input, linking from coff to a symbol */ /* coff from a mix n match input, linking from coff to a symbol */
/* defined in a bout file will cause this match to be true. Should */ /* defined in a bout file will cause this match to be true. Should */
@ -62,17 +62,17 @@ asection *ignore_input_section;
result = bfd_reloc_dangerous; result = bfd_reloc_dangerous;
} }
else { else {
switch (cs->native->n_sclass) switch (cs->native->u.syment.n_sclass)
{ {
case C_LEAFSTAT: case C_LEAFSTAT:
case C_LEAFEXT: case C_LEAFEXT:
/* This is a call to a leaf procedure, replace instruction with a bal /* This is a call to a leaf procedure, replace instruction with a bal
to the correct location */ to the correct location */
{ {
union internal_auxent *aux = (union internal_auxent *)(cs->native+2); union internal_auxent *aux = &((cs->native+2)->u.auxent);
int word = bfd_get_32(abfd, data + reloc_entry->address); int word = bfd_get_32(abfd, data + reloc_entry->address);
int olf = (aux->x_bal.x_balntry - cs->native->n_value); int olf = (aux->x_bal.x_balntry - cs->native->u.syment.n_value);
BFD_ASSERT(cs->native->n_numaux==2); BFD_ASSERT(cs->native->u.syment.n_numaux==2);
/* We replace the original call instruction with a bal to */ /* We replace the original call instruction with a bal to */
/* the bal entry point - the offset of which is described in the */ /* the bal entry point - the offset of which is described in the */
/* 2nd auxent of the original symbol. We keep the native sym and */ /* 2nd auxent of the original symbol. We keep the native sym and */
@ -85,10 +85,9 @@ asection *ignore_input_section;
result = bfd_reloc_ok; result = bfd_reloc_ok;
break; break;
case C_SCALL: case C_SCALL:
{ /* This is a call to a system call, replace with a calls to # */
/* This is a call to a system call, replace with a calls to # */ BFD_ASSERT(0);
BFD_ASSERT(0); result = bfd_reloc_ok;
}
break; break;
default: default:
result = bfd_reloc_ok; result = bfd_reloc_ok;
@ -141,12 +140,15 @@ static reloc_howto_type howto_table[] =
/* The real code is in coffcode.h */ /* The real code is in coffcode.h */
#define RTYPE2HOWTO(cache_ptr, dst) \
cache_ptr->howto = howto_table + dst.r_type;
#include "coffcode.h" #include "coffcode.h"
bfd_target icoff_little_vec = bfd_target icoff_little_vec =
{ {
"coff-Intel-little", /* name */ "coff-Intel-little", /* name */
bfd_target_coff_flavour_enum, bfd_target_coff_flavour,
false, /* data byte order is little */ false, /* data byte order is little */
false, /* header byte order is little */ false, /* header byte order is little */
@ -158,6 +160,7 @@ bfd_target icoff_little_vec =
'/', /* 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 */
@ -174,7 +177,7 @@ bfd_target icoff_little_vec =
bfd_target icoff_big_vec = bfd_target icoff_big_vec =
{ {
"coff-Intel-big", /* name */ "coff-Intel-big", /* name */
bfd_target_coff_flavour_enum, bfd_target_coff_flavour,
false, /* data byte order is little */ false, /* data byte order is little */
true, /* header byte order is big */ true, /* header byte order is big */
@ -186,6 +189,7 @@ bfd_target icoff_big_vec =
'/', /* 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_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 */

View File

@ -1,34 +1,33 @@
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc. /* Motorola 68000 COFF back-end for BFD.
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Diddler. This file is part of BFD, the Binary File Descriptor library.
BFD is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option) the Free Software Foundation; either version 2 of the License, or
any later version. (at your option) any later version.
BFD is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with BFD; see the file COPYING. If not, write to along with this program; if not, write to the Free Software
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id$ */ /* $Id$ */
#define M68 1
#include <ansidecl.h>
#include <sysdep.h>
#include "bfd.h" #include "bfd.h"
#include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
#include "obstack.h" #include "obstack.h"
#include "m68kcoff.h" #include "coff-m68k.h"
#include "internalcoff.h"
#include "libcoff.h" #include "libcoff.h"
static reloc_howto_type howto_table[] = static reloc_howto_type howto_table[] =
{ {
HOWTO(R_RELBYTE, 0, 0, 8, false, 0, true, true,0,"8", true, 0x000000ff,0x000000ff, false), HOWTO(R_RELBYTE, 0, 0, 8, false, 0, true, true,0,"8", true, 0x000000ff,0x000000ff, false),
@ -40,20 +39,24 @@ static reloc_howto_type howto_table[] =
}; };
/* Turn a howto into a reloc nunmber */ /* Turn a howto into a reloc number */
#define SELECT_RELOC(x,howto) { x = howto_table[howto->size +(int)howto->pc_relative*3].type; } #define SELECT_RELOC(x,howto) { x = howto_table[howto->size +(int)howto->pc_relative*3].type; }
#define BADMAG(x) M68KBADMAG(x) #define BADMAG(x) M68KBADMAG(x)
#include "coff-code.h" #define M68 1 /* Customize coffcode.h */
#define RTYPE2HOWTO(internal, relocentry) \
(internal)->howto = ( howto_table + (relocentry).r_type - R_RELBYTE);
#include "coffcode.h"
#define coff_write_armap bsd_write_armap #define coff_write_armap bsd_write_armap
bfd_target m68kcoff_vec = bfd_target m68kcoff_vec =
{ {
"m68kcoff", /* name */ "coff-m68k", /* name */
bfd_target_coff_flavour_enum, bfd_target_coff_flavour,
true, /* data byte order is big */ true, /* data byte order is big */
true, /* header byte order is big */ true, /* header byte order is big */
@ -64,7 +67,7 @@ bfd_target m68kcoff_vec =
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'/', /* ar_pad_char */ '/', /* ar_pad_char */
15, /* ar_max_namelen */ 15, /* ar_max_namelen */
3, /* minimum section alignment */
_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 */
@ -76,8 +79,4 @@ _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs
_bfd_write_archive_contents, bfd_false}, _bfd_write_archive_contents, bfd_false},
JUMP_TABLE(coff) JUMP_TABLE(coff)
};
};

View File

@ -81,6 +81,23 @@ static reloc_howto_type howto_table[] =
}; };
/* Code to swap in the reloc offset */
#define SWAP_IN_RELOC_OFFSET bfd_h_get_16
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_16
/* Code to turn an external r_type into a pointer to an entry in the
above howto table */
#define RTYPE2HOWTO(cache_ptr, dst) \
if (dst.r_type >= R_PCR16L && dst.r_type <= R_VRT32) { \
cache_ptr->howto = howto_table + dst.r_type - R_PCR16L; \
cache_ptr->addend += dst.r_offset << 16; \
} \
else { \
BFD_ASSERT(0); \
}
#define BADMAG(x) MC88BADMAG(x) #define BADMAG(x) MC88BADMAG(x)
#include "coffcode.h" #include "coffcode.h"
@ -89,7 +106,7 @@ static reloc_howto_type howto_table[] =
bfd_target m88kbcs_vec = bfd_target m88kbcs_vec =
{ {
"m88kbcs", /* name */ "coff-m88kbcs", /* name */
bfd_target_coff_flavour, bfd_target_coff_flavour,
true, /* data byte order is big */ true, /* data byte order is big */
true, /* header byte order is big */ true, /* header byte order is big */

View File

@ -27,19 +27,19 @@ structures on disk, and the occasional extra field.
Coff in all its varieties is implimented with a few common files and a Coff in all its varieties is implimented with a few common files and a
number of implementation specific files. For example, The 88k bcs coff number of implementation specific files. For example, The 88k bcs coff
format is implemented in the file @code{m88k-bcs.c}. This file format is implemented in the file @code{coff-m88k.c}. This file
@code{#include}s @code{m88k-bcs.h} which defines the external @code{#include}s @code{coff-m88k.h} which defines the external
structure of the coff format for the 88k, and @code{internalcoff.h} structure of the coff format for the 88k, and @code{internalcoff.h}
which defines the internal structure. @code{m88k-bcs.c} also defines which defines the internal structure. @code{coff-m88k.c} also defines
the relocations used by the 88k format @xref{Relocations}. Then the the relocations used by the 88k format @xref{Relocations}. Then the
major portion of coff code is included (@code{coffcode.h}) which major portion of coff code is included (@code{coffcode.h}) which
defines the methods used to act upon the types defined in defines the methods used to act upon the types defined in
@code{m88k-bcs.h} and @code{internalcoff.h}. @code{coff-m88k.h} and @code{internalcoff.h}.
The Intel i960 processor version of coff is implemented in The Intel i960 processor version of coff is implemented in
@code{icoff.c}. This file has the same structure as @code{coff-i960.c}. This file has the same structure as
@code{m88k-bcs.c}, except that it includes @code{intel-coff.h} rather @code{coff-m88k.c}, except that it includes @code{coff-i960.h} rather
than @code{m88k-bcs.h}. than @code{coff-m88k.h}.
@subsection Porting To A New Version of Coff @subsection Porting To A New Version of Coff
@ -402,8 +402,8 @@ DEFUN(bfd_swap_reloc_in,(abfd, reloc_src, reloc_dst),
reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type); reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type);
#endif #endif
#if M88 #ifdef SWAP_IN_RELOC_OFFSET
reloc_dst->r_offset = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_offset); reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET(abfd, reloc_src->r_offset);
#endif #endif
} }
@ -418,10 +418,18 @@ DEFUN(coff_swap_reloc_out,(abfd, src, dst),
struct external_reloc *reloc_dst = (struct external_reloc *)dst; struct external_reloc *reloc_dst = (struct external_reloc *)dst;
bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) 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, (bfd_byte *) 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, (bfd_byte *) reloc_dst->r_type); bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *)
#if M88 reloc_dst->r_type);
bfd_h_put_16(abfd, reloc_src->r_offset, (bfd_byte *) reloc_dst->r_offset);
#ifdef SWAP_OUT_RELOC_OFFSET
SWAP_OUT_RELOC_OFFSET(abfd,
reloc_src->r_offset,
(bfd_byte *) reloc_dst->r_offset);
#endif #endif
#ifdef SWAP_OUT_RELOC_EXTRA
SWAP_OUT_RELOC_EXTRA(abfd,reloc_src, reloc_dst);
#endif
return sizeof(struct external_reloc); return sizeof(struct external_reloc);
} }
@ -1065,6 +1073,12 @@ machine = 0;
break; break;
#endif #endif
#ifdef H8300MAGIC
case H8300MAGIC:
arch = bfd_arch_h8300;
machine = 0;
break;
#endif
default: /* Unreadable input file type */ default: /* Unreadable input file type */
arch = bfd_arch_obscure; arch = bfd_arch_obscure;
@ -1741,30 +1755,90 @@ DEFUN(coff_print_symbol,(ignore_abfd, filep, symbol, how),
{ {
FILE *file = (FILE *)filep; FILE *file = (FILE *)filep;
switch (how) { switch (how) {
case bfd_print_symbol_name: case bfd_print_symbol_name:
fprintf(file, "%s", symbol->name); fprintf(file, "%s", symbol->name);
break; break;
case bfd_print_symbol_more: case bfd_print_symbol_more:
fprintf(file, "coff %lx %lx", (unsigned long) coffsymbol(symbol)->native, fprintf(file, "coff %lx %lx", (unsigned long) coffsymbol(symbol)->native,
(unsigned long) coffsymbol(symbol)->lineno); (unsigned long) coffsymbol(symbol)->lineno);
break; break;
case bfd_print_symbol_nm: case bfd_print_symbol_nm:
case bfd_print_symbol_all:
{
CONST char *section_name = symbol->section == (asection *) NULL ?
"*abs" : symbol->section->name;
bfd_print_symbol_vandf((PTR) file, symbol);
fprintf(file, " %-5s %s %s %s",
section_name,
coffsymbol(symbol)->native ? "n" : "g",
coffsymbol(symbol)->lineno ? "l" : " ",
symbol->name);
}
break;
case bfd_print_symbol_all:
/* Print out the symbols in a reasonable way */
{
CONST char *section_name = symbol->section == (asection *) NULL ?
"*abs" : symbol->section->name;
if (coffsymbol(symbol)->native)
{ {
CONST char *section_name = symbol->section == (asection *) NULL ? unsigned int aux;
(CONST char *)"*abs" : symbol->section->name; combined_entry_type *combined = coffsymbol(symbol)->native;
bfd_print_symbol_vandf((PTR) file, symbol); combined_entry_type *root = obj_raw_syments(ignore_abfd);
fprintf(file,"[%3d]",
combined - root);
fprintf(file, " %-5s %s %s %s", fprintf(file, "(sc %2d)(fl%4x)(ty%3x)(sc%3d) nx(%d) %08x %s",
section_name, combined->u.syment.n_scnum,
coffsymbol(symbol)->native ? "n" : "g", combined->u.syment.n_flags,
coffsymbol(symbol)->lineno ? "l" : " ", combined->u.syment.n_type,
symbol->name); combined->u.syment.n_sclass,
} combined->u.syment.n_numaux,
combined->u.syment.n_value,
symbol->name
);
for (aux = 0; aux < combined->u.syment.n_numaux; aux++)
{
fprintf(file,"\n");
switch (combined->u.syment.n_sclass) {
case C_FILE:
fprintf(file, "File ");
break;
default:
fprintf(file, "AUX tv %x lnno %x size %x",
combined[aux+1].u.auxent.x_sym.x_misc.x_lnsz.x_lnno,
combined[aux+1].u.auxent.x_sym.x_misc.x_lnsz.x_size);
break;
}
}
break;
}
}
else {
bfd_print_symbol_vandf((PTR) file, symbol);
fprintf(file, " %-5s %s %s %s",
section_name,
coffsymbol(symbol)->native ? "n" : "g",
coffsymbol(symbol)->lineno ? "l" : " ",
symbol->name);
}
}
}
} }
#endif /* NO_COFF_SYMBOLS */ #endif /* NO_COFF_SYMBOLS */
@ -1782,7 +1856,7 @@ DEFUN(coff_set_flags,(abfd, magicp, flagsp),
#ifdef I960ROMAGIC #ifdef I960ROMAGIC
case bfd_arch_i960: case bfd_arch_i960:
{ {
unsigned flags; unsigned flags;
@ -1836,20 +1910,25 @@ DEFUN(coff_set_flags,(abfd, magicp, flagsp),
#endif #endif
#ifdef MC88MAGIC #ifdef MC88MAGIC
case bfd_arch_m88k: case bfd_arch_m88k:
*magicp = MC88OMAGIC; *magicp = MC88OMAGIC;
return true; return true;
break; break;
#endif
#ifdef H8300MAGIC
case bfd_arch_h8300:
*magicp = H8300MAGIC;
return true;
break;
#endif #endif
#ifdef A29K_MAGIC_BIG #ifdef A29K_MAGIC_BIG
case bfd_arch_a29k: case bfd_arch_a29k:
if (abfd->xvec->byteorder_big_p) if (abfd->xvec->byteorder_big_p)
*magicp = A29K_MAGIC_BIG; *magicp = A29K_MAGIC_BIG;
else else
*magicp = A29K_MAGIC_LITTLE; *magicp = A29K_MAGIC_LITTLE;
return true; return true;
break; break;
#endif #endif
#ifdef U802TOCMAGIC #ifdef U802TOCMAGIC
@ -2665,7 +2744,6 @@ asection *asect;
if (cache_ptr->line_number == 0) { if (cache_ptr->line_number == 0) {
coff_symbol_type *sym = coff_symbol_type *sym =
(coff_symbol_type *) (dst.l_addr.l_symndx (coff_symbol_type *) (dst.l_addr.l_symndx
+ obj_symbol_slew(abfd)
+ obj_raw_syments(abfd))->u.syment._n._n_n._n_zeroes; + obj_raw_syments(abfd))->u.syment._n._n_n._n_zeroes;
cache_ptr->u.sym = (asymbol *) sym; cache_ptr->u.sym = (asymbol *) sym;
sym->lineno = cache_ptr; sym->lineno = cache_ptr;
@ -2942,15 +3020,15 @@ DEFUN(coff_get_symtab, (abfd, alocation),
/* This nasty code looks at the symbol to decide whether or /* This nasty code looks at the symbol to decide whether or
not it is descibes a constructor/destructor entry point. It not it is descibes a constructor/destructor entry point. It
is structured this way to (hopefully) speed non matches */ is structured this way to (hopefully) speed non matches */
#if 0
if (symbase->symbol.name[9] == '$') if (0 && symbase->symbol.name[9] == '$')
{ {
bfd_constructor_entry(abfd, bfd_constructor_entry(abfd,
(asymbol **)location, (asymbol **)location,
symbase->symbol.name[10] == 'I' ? symbase->symbol.name[10] == 'I' ?
"CTOR" : "DTOR"); "CTOR" : "DTOR");
} }
#endif
*(location++) = symbase++; *(location++) = symbase++;
counter++; counter++;
} }
@ -2999,60 +3077,91 @@ addend field.
@end itemize @end itemize
*/ */
#ifndef CALC_ADDEND
#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
if (ptr && ptr->the_bfd == abfd \
&& ptr->section != (asection *) NULL \
&& ((ptr->flags & BSF_OLD_COMMON)== 0)) \
{ \
cache_ptr->addend = -(ptr->section->vma + ptr->value); \
} \
else { \
cache_ptr->addend = 0; \
}
#endif
static boolean static boolean
DEFUN(coff_slurp_reloc_table,(abfd, asect, symbols), DEFUN(coff_slurp_reloc_table,(abfd, asect, symbols),
bfd *abfd AND bfd *abfd AND
sec_ptr asect AND sec_ptr asect AND
asymbol **symbols) asymbol **symbols)
{ {
RELOC *native_relocs; RELOC *native_relocs;
arelent *reloc_cache; arelent *reloc_cache;
if (asect->relocation) arelent *cache_ptr;
return true;
if (asect->reloc_count == 0) unsigned int idx;
return true;
if (asect->flags & SEC_CONSTRUCTOR) if (asect->relocation)
return true; return true;
if (asect->reloc_count == 0)
return true;
if (asect->flags & SEC_CONSTRUCTOR)
return true;
#ifndef NO_COFF_SYMBOLS #ifndef NO_COFF_SYMBOLS
if (!coff_slurp_symbol_table(abfd)) if (!coff_slurp_symbol_table(abfd))
return false; return false;
#endif #endif
native_relocs = native_relocs =
(RELOC *) buy_and_read(abfd, (RELOC *) buy_and_read(abfd,
asect->rel_filepos, asect->rel_filepos,
SEEK_SET, SEEK_SET,
(size_t) (RELSZ * (size_t) (RELSZ *
asect->reloc_count)); asect->reloc_count));
reloc_cache = (arelent *) reloc_cache = (arelent *)
bfd_alloc(abfd, (size_t) (asect->reloc_count * sizeof(arelent))); bfd_alloc(abfd, (size_t) (asect->reloc_count * sizeof(arelent)));
if (reloc_cache == NULL) { if (reloc_cache == NULL) {
bfd_error = no_memory; bfd_error = no_memory;
return false; return false;
} { /* on error */ }
arelent *cache_ptr;
RELOC *src;
for (cache_ptr = reloc_cache,
src = native_relocs;
cache_ptr < reloc_cache + asect->reloc_count;
cache_ptr++,
src++) {
struct internal_reloc dst;
asymbol *ptr;
bfd_swap_reloc_in(abfd, src, &dst);
dst.r_symndx += obj_symbol_slew(abfd);
cache_ptr->sym_ptr_ptr = symbols + obj_convert(abfd)[dst.r_symndx]; for (idx = 0; idx < asect->reloc_count; idx ++)
{
struct internal_reloc dst;
asymbol *ptr;
struct external_reloc *src;
cache_ptr = reloc_cache + idx;
src = native_relocs + idx;
bfd_swap_reloc_in(abfd, src, &dst);
if (dst.r_symndx != -1)
{
cache_ptr->sym_ptr_ptr = symbols + obj_convert(abfd)[dst.r_symndx];
}
else
{
cache_ptr->sym_ptr_ptr = 0;
ptr = 0;
goto puke_logic;
}
#ifdef A29K #ifdef A29K
/* AMD has two relocation entries for the 'consth' instruction. /* AMD has two relocation entries for the 'consth' instruction.
* The first is R_IHIHALF (part 1), the second is R_IHCONST * The first is R_IHIHALF (part 1), the second is R_IHCONST
* (part 2). The second entry's r_symndx does not contain * (part 2). The second entry's r_symndx does not contain
* an index to a symbol but rather a value (apparently). * an index to a symbol but rather a value (apparently).
* Also, see the ifdef below for saving the r_symndx value in addend. * Also, see the ifdef below for saving the r_symndx value in addend.
*/ */
if (dst.r_type == R_IHCONST) { if (dst.r_type == R_IHCONST) {
ptr = NULL; ptr = NULL;
} else }
else
#endif #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;
@ -3064,58 +3173,28 @@ 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 && ptr->the_bfd == abfd puke_logic:
&& ptr->section != (asection *) NULL cache_ptr->address = dst.r_vaddr;
&& ((ptr->flags & BSF_OLD_COMMON)== 0)) /*
{ The symbols definitions that we have read in have been
#ifndef M88 relocated as if their sections started at 0. But the offsets
cache_ptr->addend = -(ptr->section->vma + ptr->value); refering to the symbols in the raw data have not been
#else modified, so we have to have a negative addend to compensate.
cache_ptr->addend = 0;
#endif Note that symbols which used to be common must be left alone */
} /* Calculate any reloc addend by looking at the symbol */
else { CALC_ADDEND(abfd, ptr, dst, cache_ptr);
cache_ptr->addend = 0;
}
cache_ptr->address -= asect->vma; cache_ptr->address -= asect->vma;
cache_ptr->section = (asection *) NULL;
cache_ptr->section = (asection *) NULL; /* Fill in the cache_ptr->howto field from dst.r_type */
RTYPE2HOWTO(cache_ptr, dst);
#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
cache_ptr->howto = howto_table + dst.r_type;
#endif
#if I960
cache_ptr->howto = howto_table + dst.r_type;
#endif
#if M68
cache_ptr->howto = howto_table + dst.r_type - R_RELBYTE;
#endif
#if M88
if (dst.r_type >= R_PCR16L && dst.r_type <= R_VRT32) {
cache_ptr->howto = howto_table + dst.r_type - R_PCR16L;
cache_ptr->addend += dst.r_offset << 16;
}
else {
BFD_ASSERT(0);
}
#endif
}
} }
asect->relocation = reloc_cache; asect->relocation = reloc_cache;
return true; return true;
} }

View File

@ -3,6 +3,7 @@
# appropriate for this directory. For more information, check any # appropriate for this directory. For more information, check any
# existing configure script. # existing configure script.
configdirs="doc"
srctrigger=libbfd.c srctrigger=libbfd.c
srcname="BFD" srcname="BFD"
@ -130,7 +131,7 @@ amd)
hitachi) hitachi)
case "${target_cpu}" in case "${target_cpu}" in
h8300) bfd_target=h8300-ieee ;; h8300) bfd_target=h8300-coff ;;
*) echo "bad hitachi cpu" ;; *) echo "bad hitachi cpu" ;;
esac esac
;; ;;

View File

@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sysdep.h>
#include "bfd.h" #include "bfd.h"
#include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
#define DEFINE_TABLE #define DEFINE_TABLE
@ -96,21 +96,21 @@ FILE *stream)
/* Find the exact opcode/arg combo */ /* Find the exact opcode/arg combo */
while (*p) { while (*p) {
op_enum_type *nib; op_type *nib;
unsigned int len = 0; unsigned int len = 0;
q = *p++; q = *p++;
nib =q->data.nib; nib =q->data.nib;
while (*nib != E) { while (*nib != E) {
op_enum_type looking_for = *nib; op_type looking_for = *nib;
int thisnib = data[len>>1] ; int thisnib = data[len>>1] ;
thisnib = (len & 1) ? (thisnib & 0xf) : ((thisnib >> 4) & 0xf); thisnib = (len & 1) ? (thisnib & 0xf) : ((thisnib >> 4) & 0xf);
if ((int)looking_for & (int)B31) { if ((int)looking_for & (int)B31) {
if (((int)thisnib & 0x8) ==0) goto fail; if (((int)thisnib & 0x8) ==0) goto fail;
looking_for = (op_enum_type)((int)looking_for & ~(int)B31); looking_for = (op_type)((int)looking_for & ~(int)B31);
} }
if ((int)looking_for & (int)B30) { if ((int)looking_for & (int)B30) {
if (((int)thisnib & 0x8) !=0) goto fail; if (((int)thisnib & 0x8) !=0) goto fail;
looking_for = (op_enum_type)((int)looking_for & ~(int)B30); looking_for = (op_type)((int)looking_for & ~(int)B30);
} }
switch (looking_for) { switch (looking_for) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
@ -130,7 +130,7 @@ FILE *stream)
rdisp = thisnib; rdisp = thisnib;
break; break;
case KBIT: case KBIT:
abs = thisnib == 0x80 ? 2:1; abs = thisnib == 0x8 ? 2:1;
break; break;
case IMM8: case IMM8:
case ABS8SRC: case ABS8SRC:
@ -167,7 +167,7 @@ FILE *stream)
; ;
} }
fprintf(stream, "%02x %02x .word\tH'%x,H'%x\n", fprintf(stream, "%02x %02x .word\tH'%x,H'%x",
data[0], data[1], data[0], data[1],
data[0], data[1]); data[0], data[1]);
return 2; return 2;
@ -184,7 +184,7 @@ FILE *stream)
fprintf(stream, "%s\t",q->name); fprintf(stream, "%s\t",q->name);
/* Now print out the args */ /* Now print out the args */
{ {
op_enum_type *args = q->args.nib; op_type *args = q->args.nib;
int hadone = 0; int hadone = 0;
while (*args != E) { while (*args != E) {
if (hadone) if (hadone)
@ -193,7 +193,7 @@ FILE *stream)
case IMM16: case IMM16:
case IMM8: case IMM8:
case IMM3: case IMM3:
fprintf(stream, "#H'%x", (unsigned)abs); break; fprintf(stream, "#0x%x", (unsigned)abs); break;
case RD8: case RD8:
fprintf(stream, "%s", regnames[rd]); break; fprintf(stream, "%s", regnames[rd]); break;
case RS8: case RS8:
@ -214,14 +214,14 @@ FILE *stream)
case ABS16SRC: case ABS16SRC:
case ABS16DST: case ABS16DST:
case ABS8DST: case ABS8DST:
fprintf(stream, "@H'%x", (unsigned)abs); break; fprintf(stream, "@0x%x", (unsigned)abs); break;
case DISP8: case DISP8:
fprintf(stream, ".%s%d (%x)",(char)abs>0 ? "+" :"", (char)abs, fprintf(stream, ".%s%d (%x)",(char)abs>0 ? "+" :"", (char)abs,
addr + (char)abs); addr + (char)abs);
break; break;
case DISPSRC: case DISPSRC:
case DISPDST: case DISPDST:
fprintf(stream, "@(%d,r%d)", abs, rdisp & 0x7); break; fprintf(stream, "@(0x%x,r%d)", abs, rdisp & 0x7); break;
case CCR: case CCR:
fprintf(stream, "ccr"); break; fprintf(stream, "ccr"); break;
case KBIT: case KBIT:
@ -238,25 +238,25 @@ FILE *stream)
unsigned int DEFUN( print_insn_h8300,(addr, data, file), unsigned int DEFUN(print_insn_h8300,(addr, data, file),
bfd_vma addr AND bfd_vma addr AND
CONST bfd_byte *data AND CONST char *data AND
PTR file) PTR file)
{ {
static boolean init; static boolean init;
if (!init) { if (!init) {
bfd_h8_disassemble_init(); bfd_h8_disassemble_init();
init= 1; init= 1;
} }
return bfd_h8_disassemble(addr, data, file);
return bfd_h8_disassemble(addr, (bfd_byte *)data, file);
} }
/* /*
Relocations for the H8 Relocations for the H8
*/ */
static bfd_reloc_status_enum_type static bfd_reloc_status_type
DEFUN(howto16_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section), DEFUN(howto16_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section),
bfd *abfd AND bfd *abfd AND
arelent *reloc_entry AND arelent *reloc_entry AND
@ -277,7 +277,7 @@ asection *ignore_input_section)
} }
static bfd_reloc_status_enum_type static bfd_reloc_status_type
DEFUN(howto8_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section), DEFUN(howto8_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section),
bfd *abfd AND bfd *abfd AND
arelent *reloc_entry AND arelent *reloc_entry AND
@ -298,7 +298,7 @@ asection *ignore_input_section)
} }
static bfd_reloc_status_enum_type static bfd_reloc_status_type
DEFUN(howto8_FFnn_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section), DEFUN(howto8_FFnn_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section),
bfd *abfd AND bfd *abfd AND
arelent *reloc_entry AND arelent *reloc_entry AND
@ -319,7 +319,7 @@ asection *ignore_input_section)
return bfd_reloc_ok; return bfd_reloc_ok;
} }
static bfd_reloc_status_enum_type static bfd_reloc_status_type
DEFUN(howto8_pcrel_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section), DEFUN(howto8_pcrel_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section),
bfd *abfd AND bfd *abfd AND
arelent *reloc_entry AND arelent *reloc_entry AND
@ -355,8 +355,8 @@ static reloc_howto_type howto_8_pcrel
static CONST struct reloc_howto_struct * static CONST struct reloc_howto_struct *
DEFUN(local_bfd_reloc_type_lookup,(arch, code), DEFUN(local_bfd_reloc_type_lookup,(arch, code),
bfd_arch_info_struct_type *arch AND CONST struct bfd_arch_info *arch AND
bfd_reloc_code_enum_type code) bfd_reloc_code_type code)
{ {
switch (code) { switch (code) {
case BFD_RELOC_16: case BFD_RELOC_16:
@ -375,7 +375,7 @@ int bfd_default_scan_num_mach();
static boolean static boolean
DEFUN(h8300_scan,(info, string), DEFUN(h8300_scan,(info, string),
CONST struct bfd_arch_info_struct *info AND CONST struct bfd_arch_info *info AND
CONST char *string) CONST char *string)
{ {
if (strcmp(string,"h8300") == 0) return true; if (strcmp(string,"h8300") == 0) return true;
@ -384,7 +384,8 @@ CONST char *string)
if (strcmp(string,"H8/300") == 0) return true; if (strcmp(string,"H8/300") == 0) return true;
return false; return false;
} }
static bfd_arch_info_struct_type arch_info_struct =
static bfd_arch_info_type arch_info_struct =
{ {
16, /* 16 bits in a word */ 16, /* 16 bits in a word */
16, /* 16 bits in an address */ 16, /* 16 bits in an address */
@ -401,13 +402,8 @@ static bfd_arch_info_struct_type arch_info_struct =
0, 0,
}; };
void
DEFUN_VOID(bfd_h8300_arch)
void DEFUN_VOID(bfd_h8300_arch)
{ {
bfd_arch_linkin(&arch_info_struct); bfd_arch_linkin(&arch_info_struct);
} }

View File

@ -18,64 +18,48 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id$ */
/* Object file tdata; access macros */ /* Object file tdata; access macros */
#define obj_icof(bfd) ((struct icofdata *) ((bfd)->tdata)) #define coff_data(bfd) ((coff_data_type *) ((bfd)->tdata))
#define coff_data(bfd) ((struct icofdata *) ((bfd)->tdata)) #define exec_hdr(bfd) (coff_data(bfd)->hdr)
#define exec_hdr(bfd) (obj_icof(bfd)->hdr) #define obj_symbols(bfd) (coff_data(bfd)->symbols)
#define obj_symbols(bfd) (obj_icof(bfd)->symbols) #define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos)
#define obj_sym_filepos(bfd) (obj_icof(bfd)->sym_filepos)
#define obj_relocbase(bfd) (obj_icof(bfd)->relocbase) #define obj_relocbase(bfd) (coff_data(bfd)->relocbase)
#define obj_raw_syments(bfd) (obj_icof(bfd)->raw_syments) #define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments)
#define obj_convert(bfd) (obj_icof(bfd)->conversion_table) #define obj_convert(bfd) (coff_data(bfd)->conversion_table)
#if CFILE_STUFF
#define obj_symbol_slew(bfd) (obj_icof(bfd)->symbol_index_slew)
#else
#define obj_symbol_slew(bfd) 0
#endif
#define obj_string_table(bfd) (obj_icof(bfd)->string_table)
#if 0
typedef struct coff_ptr_struct /* `Tdata' information kept for COFF files. */
typedef struct coff_tdata
{ {
unsigned int offset; struct coff_symbol_struct *symbols; /* symtab for input bfd */
char fix_tag;
char fix_end;
union {
union internal_auxent auxent;
struct internal_syment syment;
} u;
} combined_entry_type;
typedef struct
{
asymbol symbol;
combined_entry_type *native;
struct lineno_cache_entry *lineno;
} coff_symbol_type;
#endif
typedef struct icofdata
{
struct coff_symbol_struct *symbols; /* symtab for input bfd */
unsigned int *conversion_table; unsigned int *conversion_table;
file_ptr sym_filepos; file_ptr sym_filepos;
long symbol_index_slew; /* used during read to mark whether a long symbol_index_slew; /* used during read to mark whether a
C_FILE symbol as been added. */ C_FILE symbol as been added. */
struct coff_ptr_struct *raw_syments; struct coff_ptr_struct *raw_syments;
struct lineno *raw_linenos; struct lineno *raw_linenos;
unsigned int raw_syment_count; unsigned int raw_syment_count;
char *string_table;
unsigned short flags; unsigned short flags;
/* These are only valid once writing has begun */ /* These are only valid once writing has begun */
long int relocbase; long int relocbase;
/* These members communicate important constants about the symbol table
to GDB's symbol-reading code. These `constants' unfortunately vary
from coff implementation to implementation... */
unsigned local_n_btmask;
unsigned local_n_btshft;
unsigned local_n_tmask;
unsigned local_n_tshift;
unsigned local_symesz;
unsigned local_auxesz;
unsigned local_linesz;
} coff_data_type; } coff_data_type;
/* We take the address of the first element of a asymbol to ensure that the /* We take the address of the first element of a asymbol to ensure that the
@ -86,9 +70,9 @@ struct coff_ptr_struct *raw_syments;
/*THE FOLLOWING IS EXTRACTED FROM THE SOURCE*/ /*THE FOLLOWING IS EXTRACTED FROM THE SOURCE*/
/* FROM coffcode.h*/ /*:coffcode.h*/
/* ------------------------------START FROM coffcode.h
/*
The hidden information for an asymbol is: The hidden information for an asymbol is:
*/ */
@ -154,8 +138,6 @@ A pointer to the linenumber information for this symbol
} coff_symbol_type; } coff_symbol_type;
/* /*
*/
--------------------------------END FROM coffcode.h*/

View File

@ -358,6 +358,7 @@ extern bfd_target i386aout_vec;
extern bfd_target a29kcoff_big_vec; extern bfd_target a29kcoff_big_vec;
extern bfd_target trad_core_vec; extern bfd_target trad_core_vec;
extern bfd_target rs6000coff_vec; extern bfd_target rs6000coff_vec;
extern bfd_target h8300coff_vec;
#ifdef DEFAULT_VECTOR #ifdef DEFAULT_VECTOR
extern bfd_target DEFAULT_VECTOR; extern bfd_target DEFAULT_VECTOR;
@ -406,6 +407,7 @@ SELECT_VECS,
#define I386AOUT_VEC i386aout_vec #define I386AOUT_VEC i386aout_vec
#define A29KCOFF_BIG_VEC a29kcoff_big_vec #define A29KCOFF_BIG_VEC a29kcoff_big_vec
#define RS6000COFF_VEC rs6000coff_vec #define RS6000COFF_VEC rs6000coff_vec
#define H8300COFF_VEC h8300coff_vec
#endif #endif
bfd_target *target_vector[] = { bfd_target *target_vector[] = {
@ -448,6 +450,9 @@ bfd_target *target_vector[] = {
#endif #endif
#endif #endif
#ifdef H300COFF_VEC
&h8300coff_vec,
#endif
#ifdef M88KBCS_VEC #ifdef M88KBCS_VEC
&M88KBCS_VEC, &M88KBCS_VEC,
#endif #endif