* bfd.c: Remove strerror() to libiberty.

* elf.c:  Remove elf_set_section_contents, use generic one.  Lint.
* libbfd-in.h, libbfd.c:  Add bfd_generic_set_section_contents.
* libbfd.c (bfd_generic_{get,set}_section_contents):  Check that
last byte of transfer, not first byte, is within the section.

* host-aout.c:  Remove `BSD' archive support.  Lint.

* archures.c: Rename `struct bfd_arch_info_struct' to `struct
bfd_arch_info'.  Rename `typedef bfd_arch_info_struct_type' to
`bfd_arch_info_type'.  All uses changed.
* reloc.c:  Rename `bfd_reloc_status_enum_type' to
`bfd_reloc_status_type'.  Rename `bfd_reloc_code_enum_real_type'
to `bfd_reloc_code_real_type'.  (This seems to be a misnomer,
it needs a better name.)  All uses changed.
* targets.c:  Rename `enum target_flavour_enum' to `enum
target_flavour', and remove the `_enum' from all of the enum
values themselves.  All uses changed.

* configure.in, config/h-i386mach:  i386 mach host.
* config/t-i386-aout:  Use host-aout.c.

* trad-core.c:  Give it its own xvec's to make it independent
of other file formats.
* ecoff.c, host-aout.c:  Remove refs to trad-core.
* config/t-dec3100, t-hp300bsd, t-tahoe, t-vax:  Define TRAD_CORE.
* targets.c:  #ifdef TRAD_CORE, include it in the vector.
This commit is contained in:
John Gilmore 1991-10-05 05:18:08 +00:00
parent 5784123fb7
commit 9e2dad8ed4
8 changed files with 416 additions and 514 deletions

View File

@ -1,3 +1,34 @@
Fri Oct 4 18:18:46 1991 John Gilmore (gnu at cygnus.com)
* bfd.c: Remove strerror() to libiberty.
* elf.c: Remove elf_set_section_contents, use generic one. Lint.
* libbfd-in.h, libbfd.c: Add bfd_generic_set_section_contents.
* libbfd.c (bfd_generic_{get,set}_section_contents): Check that
last byte of transfer, not first byte, is within the section.
* host-aout.c: Remove `BSD' archive support. Lint.
* archures.c: Rename `struct bfd_arch_info_struct' to `struct
bfd_arch_info'. Rename `typedef bfd_arch_info_struct_type' to
`bfd_arch_info_type'. All uses changed.
* reloc.c: Rename `bfd_reloc_status_enum_type' to
`bfd_reloc_status_type'. Rename `bfd_reloc_code_enum_real_type'
to `bfd_reloc_code_real_type'. (This seems to be a misnomer,
it needs a better name.) All uses changed.
* targets.c: Rename `enum target_flavour_enum' to `enum
target_flavour', and remove the `_enum' from all of the enum
values themselves. All uses changed.
* configure.in, config/h-i386mach: i386 mach host.
* config/t-i386-aout: Use host-aout.c.
* trad-core.c: Give it its own xvec's to make it independent
of other file formats.
* ecoff.c, host-aout.c: Remove refs to trad-core.
* config/t-dec3100, t-hp300bsd, t-tahoe, t-vax: Define TRAD_CORE.
* targets.c: #ifdef TRAD_CORE, include it in the vector.
Fri Oct 4 17:38:03 1991 Steve Chamberlain (steve at cygnus.com) Fri Oct 4 17:38:03 1991 Steve Chamberlain (steve at cygnus.com)
* reloc.c: Extended NEWHOWTO macro * reloc.c: Extended NEWHOWTO macro

View File

@ -82,7 +82,7 @@ static void
DEFUN(choose_reloc_size,(abfd), DEFUN(choose_reloc_size,(abfd),
bfd *abfd) bfd *abfd)
{ {
switch (abfd->obj_arch) { switch (bfd_get_arch(abfd)) {
case bfd_arch_sparc: case bfd_arch_sparc:
case bfd_arch_a29k: case bfd_arch_a29k:
obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
@ -101,48 +101,49 @@ sunos4_callback (abfd)
bfd *abfd; bfd *abfd;
{ {
struct internal_exec *execp = exec_hdr (abfd); struct internal_exec *execp = exec_hdr (abfd);
enum bfd_architecture arch;
long machine;
WORK_OUT_FILE_POSITIONS(abfd, execp); WORK_OUT_FILE_POSITIONS(abfd, execp);
/* Determine the architecture and machine type of the object file. */ /* Determine the architecture and machine type of the object file. */
switch (N_MACHTYPE (*exec_hdr (abfd))) { switch (N_MACHTYPE (*exec_hdr (abfd))) {
case M_UNKNOWN: case M_UNKNOWN:
abfd->obj_arch = bfd_arch_unknown; arch = bfd_arch_unknown;
abfd->obj_machine = 0; machine = 0;
break; break;
case M_68010: case M_68010:
abfd->obj_arch = bfd_arch_m68k; arch = bfd_arch_m68k;
abfd->obj_machine = 68010; machine = 68010;
break; break;
case M_68020: case M_68020:
abfd->obj_arch = bfd_arch_m68k; arch = bfd_arch_m68k;
abfd->obj_machine = 68020; machine = 68020;
break; break;
case M_SPARC: case M_SPARC:
abfd->obj_arch = bfd_arch_sparc; arch = bfd_arch_sparc;
abfd->obj_machine = 0; machine = 0;
break; break;
case M_386: case M_386:
abfd->obj_arch = bfd_arch_i386; arch = bfd_arch_i386;
abfd->obj_machine = 0; machine = 0;
break; break;
case M_29K: case M_29K:
abfd->obj_arch = bfd_arch_a29k; arch = bfd_arch_a29k;
abfd->obj_machine = 0; machine = 0;
break; break;
default: default:
abfd->obj_arch = bfd_arch_obscure; arch = bfd_arch_obscure;
abfd->obj_machine = 0; machine = 0;
break; break;
} }
bfd_set_arch_mach(abfd, arch, machine);
choose_reloc_size(abfd); choose_reloc_size(abfd);
return abfd->xvec; return abfd->xvec;
} }
@ -153,22 +154,20 @@ Section contents have already been written. We write the
file header, symbols, and relocation. */ file header, symbols, and relocation. */
boolean boolean
DEFUN(NAME(aout,sunos4_write_object_contents),(abfd), DEFUN(NAME(aout,sunos4_write_object_contents),
(abfd),
bfd *abfd) bfd *abfd)
{ {
bfd_size_type data_pad = 0; bfd_size_type data_pad = 0;
struct external_exec exec_bytes; struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd); struct internal_exec *execp = exec_hdr (abfd);
execp->a_text = obj_textsec (abfd)->size; execp->a_text = obj_textsec (abfd)->size;
/* Magic number, maestro, please! */ /* Magic number, maestro, please! */
switch (bfd_get_architecture(abfd)) { switch (bfd_get_arch(abfd)) {
case bfd_arch_m68k: case bfd_arch_m68k:
switch (bfd_get_machine(abfd)) { switch (bfd_get_mach(abfd)) {
case 68010: case 68010:
N_SET_MACHTYPE(*execp, M_68010); N_SET_MACHTYPE(*execp, M_68010);
break; break;
@ -324,7 +323,8 @@ DEFUN(swapcore_sun3,(abfd, ext, intcore),
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
(file_ptr)(((struct external_sun3_core *)0)->fp_stuff); (file_ptr)(((struct external_sun3_core *)0)->fp_stuff);
/* Ucode is the last thing in the struct -- just before the end */ /* Ucode is the last thing in the struct -- just before the end */
intcore->c_ucode = bfd_h_get_32 (abfd, intcore->c_ucode =
bfd_h_get_32 (abfd,
intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore); intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore);
intcore->c_stacktop = 0x0E000000; /* By experimentation */ intcore->c_stacktop = 0x0E000000; /* By experimentation */
} }
@ -354,7 +354,8 @@ DEFUN(swapcore_sparc,(abfd, ext, intcore),
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
(file_ptr)(((struct external_sparc_core *)0)->fp_stuff); (file_ptr)(((struct external_sparc_core *)0)->fp_stuff);
/* Ucode is the last thing in the struct -- just before the end */ /* Ucode is the last thing in the struct -- just before the end */
intcore->c_ucode = bfd_h_get_32 (abfd, intcore->c_ucode =
bfd_h_get_32 (abfd,
intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore); intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore);
/* Supposedly the user stack grows downward from the bottom of kernel memory. /* Supposedly the user stack grows downward from the bottom of kernel memory.
Presuming that this remains true, this definition will work. */ Presuming that this remains true, this definition will work. */
@ -587,7 +588,7 @@ a.out versions. */
bfd_target VECNAME = bfd_target VECNAME =
{ {
TARGETNAME, TARGETNAME,
bfd_target_aout_flavour_enum, bfd_target_aout_flavour,
true, /* target byte order */ true, /* target byte order */
true, /* target headers byte order */ true, /* target headers byte order */
(HAS_RELOC | EXEC_P | /* object flags */ (HAS_RELOC | EXEC_P | /* object flags */

View File

@ -112,6 +112,7 @@ selected.
#include <sysdep.h> #include <sysdep.h>
#include <ansidecl.h> #include <ansidecl.h>
struct external_exec;
#include "libaout.h" #include "libaout.h"
#include "libbfd.h" #include "libbfd.h"
#include "aout64.h" #include "aout64.h"
@ -131,126 +132,6 @@ and sparcs) also have a full integer for an addend.
*/ */
#define CTOR_TABLE_RELOC_IDX 2 #define CTOR_TABLE_RELOC_IDX 2
/* start-sanitize-v9 */
/* Provided the symbol, returns the value reffed */
static bfd_vma
DEFUN(get_symbol_value,(symbol, input_section),
asymbol *symbol AND
asection *input_section)
{
bfd_vma relocation = 0;
if (symbol != (asymbol *)NULL) {
if (symbol->flags & BSF_FORT_COMM) {
relocation = 0;
} else {
relocation = symbol->value;
}
if (symbol->section != (asection *)NULL) {
relocation += symbol->section->output_section->vma +
symbol->section->output_offset;
}
}
else {
/* No symbol, so use the input section value */
relocation = input_section->output_section->vma + input_section->output_offset;
}
return relocation;
}
static bfd_reloc_status_enum_type
DEFUN(reloc64,(abfd, reloc_entry, symbol_in, data, input_section),
bfd *abfd AND
arelent *reloc_entry AND
asymbol *symbol_in AND
unsigned char *data AND
asection *input_section)
{
bfd_vma sym_value = get_symbol_value(symbol_in, input_section);
bfd_vma value = bfd_get_64(abfd, (bfd_byte *)data + reloc_entry->address);
value += sym_value + reloc_entry->addend;
bfd_put_64(abfd, value, (bfd_byte *)data+reloc_entry->address);
return bfd_reloc_ok;
}
static bfd_reloc_status_enum_type
DEFUN(disp64,(abfd, reloc_entry, symbol_in, data, input_section),
bfd *abfd AND
arelent *reloc_entry AND
asymbol *symbol_in AND
unsigned char *data AND
asection *input_section)
{
bfd_vma sym_value = get_symbol_value(symbol_in, input_section);
/* bfd_get_64(abfd, (bfd_byte *)data + reloc_entry->address);*/
bfd_vma value = 0;
value += sym_value + reloc_entry->addend;
/* Subtract from the calculated value the pc */
value -= reloc_entry->address + input_section->output_section->vma;
bfd_put_64(abfd, value, (bfd_byte *)data+reloc_entry->address);
return bfd_reloc_ok;
}
/* High 22 bits of high half of a 64-bit value, in the low bits of the
target address. If we only have 32-bit values, this is always zeroes. */
static bfd_reloc_status_enum_type
DEFUN(hhi22,(abfd, reloc_entry, symbol_in, data, input_section),
bfd *abfd AND
arelent *reloc_entry AND
asymbol *symbol_in AND
unsigned char *data AND
asection *input_section)
{
bfd_vma sym_value = get_symbol_value(symbol_in, input_section);
bfd_vma value = bfd_get_32(abfd, (bfd_byte *)data + reloc_entry->address);
value &= ~0x3fffff;
value |= 0x3fffff & (((sym_value + reloc_entry->addend) >> 31) >> 11);
/* C does not define what happens if we shift it by >32 bits on a 32-bit
machine, but a shift of 31 and then 11 is well defined to give zero. */
bfd_put_32(abfd, value, (bfd_byte *)data+reloc_entry->address);
return bfd_reloc_ok;
}
/* Low 10 bits of high half of a 64-bit value, in the low bits of the
target address. If we only have 32-bit values, this is always zeroes. */
static bfd_reloc_status_enum_type
DEFUN(hlo10,(abfd, reloc_entry, symbol_in, data, input_section),
bfd *abfd AND
arelent *reloc_entry AND
asymbol *symbol_in AND
unsigned char *data AND
asection *input_section)
{
bfd_vma sym_value = get_symbol_value(symbol_in, input_section);
bfd_vma value = bfd_get_32(abfd, (bfd_byte *)data + reloc_entry->address);
value &= ~0x3ff;
value |= 0x3ff & (((sym_value + reloc_entry->addend) >> 31) >> 1);
/* C does not define what happens if we shift it by >32 bits on a 32-bit
machine, but a shift of 31 and then 1 is well defined to give zero. */
bfd_put_32(abfd, value, (bfd_byte *)data+reloc_entry->address);
return bfd_reloc_ok;
}
static bfd_reloc_status_enum_type
r64()
{
abort();
return bfd_reloc_notsupported;
}
/* end-sanitize-v9 */
static reloc_howto_type howto_table_ext[] = static reloc_howto_type howto_table_ext[] =
{ {
@ -279,26 +160,6 @@ static reloc_howto_type howto_table_ext[] =
HOWTO(RELOC_JMP_SLOT,0, 2, 0, false, 0, false, true,0,"JMP_SLOT", false, 0,0x00000000, false), HOWTO(RELOC_JMP_SLOT,0, 2, 0, false, 0, false, true,0,"JMP_SLOT", false, 0,0x00000000, false),
HOWTO(RELOC_RELATIVE,0, 2, 0, false, 0, false, true,0,"RELATIVE", false, 0,0x00000000, false), HOWTO(RELOC_RELATIVE,0, 2, 0, false, 0, false, true,0,"RELATIVE", false, 0,0x00000000, false),
/* start-sanitize-v9 */
HOWTO(RELOC_11, 0, 2, 21, true, 0, false, true,r64,"11", false, 0,/*0x00000000001fffff*/0, false),
HOWTO(RELOC_WDISP2_14, 0, 2, 21, true, 0, false, true,r64,"DISP2_14",false, 0,/*0x00000000001fffff*/0, false),
HOWTO(RELOC_WDISP19, 0, 3, 64, true, 0, false, true,r64,"DISP19", false, 0,/*0xffffffffffffffff*/0, false),
HOWTO(RELOC_HHI22, 42, 3, 22, false, 0, false, true,hhi22,"HHI22",false, 0,/*0x003fffff00000000*/0, false),
HOWTO(RELOC_HLO10, 32, 3, 10, false, 0, false, true,hlo10,"HLO10", false, 0,/*0x000003ff00000000*/0, false),
HOWTO(RELOC_JUMPTARG,2, 13, 16, true, 0, false, true,0,"JUMPTARG", false, 0,0x0000ffff, false),
HOWTO(RELOC_CONST, 0, 13, 16, false, 0, false, true,0,"CONST", false, 0,0x0000ffff, false),
HOWTO(RELOC_CONSTH, 16, 13, 16, false, 0, false, true,0,"CONSTH", false, 0,0x0000ffff, false),
HOWTO(RELOC_64, 0, 3, 64, false, 0, true, true,reloc64,"64", false, 0,/*0xffffffffffffffff*/0, false),
HOWTO(RELOC_DISP64, 0, 3, 64, true, 0, false, true,disp64,"DISP64", false, 0,/*0xffffffffffffffff*/0, false),
HOWTO(RELOC_WDISP21,2, 2, 21, true, 0, false, true,r64,"WDISP21",false, 0,/*0x00000000001fffff*/0, false),
HOWTO(RELOC_DISP21, 0, 2, 21, true, 0, false, true,r64,"DISP21", false, 0,/*0x00000000001fffff*/0, false),
HOWTO(RELOC_DISP14, 0, 2, 14, true, 0, false, true,r64,"DISP21", false, 0,/*0x0000000000003fff*/0, false),
/* end-sanitize-v9 */
}; };
/* Convert standard reloc records to "arelent" format (incl byte swap). */ /* Convert standard reloc records to "arelent" format (incl byte swap). */
@ -452,8 +313,8 @@ DEFUN(NAME(aout,some_aout_object_p),(abfd, callback_to_real_object_p),
/* Set the default architecture and machine type. These can be /* Set the default architecture and machine type. These can be
overridden in the callback routine. */ overridden in the callback routine. */
abfd->obj_arch = bfd_arch_unknown;
abfd->obj_machine = 0; bfd_default_set_arch_mach(abfd, bfd_arch_unknown, 0);
/* The default relocation entry size is that of traditional V7 Unix. */ /* The default relocation entry size is that of traditional V7 Unix. */
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
@ -644,6 +505,7 @@ DEFUN(NAME(aout,machine_type),(arch, machine),
return arch_flags; return arch_flags;
} }
/*doc* /*doc*
*i aout_<size>_set_arch_mach *i aout_<size>_set_arch_mach
@ -663,8 +525,7 @@ DEFUN(NAME(aout,set_arch_mach),(abfd, arch, machine),
enum bfd_architecture arch AND enum bfd_architecture arch AND
unsigned long machine) unsigned long machine)
{ {
abfd->obj_arch = arch; bfd_default_set_arch_mach(abfd, arch, machine);
abfd->obj_machine = machine;
if (arch != bfd_arch_unknown && if (arch != bfd_arch_unknown &&
NAME(aout,machine_type) (arch, machine) == M_UNKNOWN) NAME(aout,machine_type) (arch, machine) == M_UNKNOWN)
return false; /* We can't represent this type */ return false; /* We can't represent this type */
@ -1708,21 +1569,21 @@ DEFUN(NAME(aout,print_symbol),(ignore_abfd, afile, symbol, how),
bfd *ignore_abfd AND bfd *ignore_abfd AND
PTR afile AND PTR afile AND
asymbol *symbol AND asymbol *symbol AND
bfd_print_symbol_enum_type how) bfd_print_symbol_type how)
{ {
FILE *file = (FILE *)afile; FILE *file = (FILE *)afile;
switch (how) { switch (how) {
case bfd_print_symbol_name_enum: case bfd_print_symbol_name:
if (symbol->name) if (symbol->name)
fprintf(file,"%s", symbol->name); fprintf(file,"%s", symbol->name);
break; break;
case bfd_print_symbol_type_enum: case bfd_print_symbol_more:
fprintf(file,"%4x %2x %2x",(unsigned)(aout_symbol(symbol)->desc & 0xffff), fprintf(file,"%4x %2x %2x",(unsigned)(aout_symbol(symbol)->desc & 0xffff),
(unsigned)(aout_symbol(symbol)->other & 0xff), (unsigned)(aout_symbol(symbol)->other & 0xff),
(unsigned)(aout_symbol(symbol)->type)); (unsigned)(aout_symbol(symbol)->type));
break; break;
case bfd_print_symbol_all_enum: case bfd_print_symbol_all:
{ {
CONST char *section_name = symbol->section == (asection *)NULL ? CONST char *section_name = symbol->section == (asection *)NULL ?
"*abs" : symbol->section->name; "*abs" : symbol->section->name;
@ -1733,8 +1594,7 @@ DEFUN(NAME(aout,print_symbol),(ignore_abfd, afile, symbol, how),
section_name, section_name,
(unsigned)(aout_symbol(symbol)->desc & 0xffff), (unsigned)(aout_symbol(symbol)->desc & 0xffff),
(unsigned)(aout_symbol(symbol)->other & 0xff), (unsigned)(aout_symbol(symbol)->other & 0xff),
(unsigned)(aout_symbol(symbol)->type & 0xff), (unsigned)(aout_symbol(symbol)->type & 0xff));
symbol->name);
if (symbol->name) if (symbol->name)
fprintf(file," %s", symbol->name); fprintf(file," %s", symbol->name);
} }
@ -1825,9 +1685,9 @@ DEFUN(NAME(aout,find_nearest_line),(abfd,
} }
int int
DEFUN(NAME(aout,sizeof_headers),(ignore_abfd, ignore), DEFUN(NAME(aout,sizeof_headers),(ignore_abfd, execable),
bfd *ignore_abfd AND bfd *ignore_abfd AND
boolean ignore) boolean execable)
{ {
return EXEC_BYTES_SIZE; return EXEC_BYTES_SIZE;
} }

View File

@ -35,7 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
( ((addr) + ((1<<(align))-1)) & (-1 << (align))) ( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
#define EXEC_BYTES_SIZE (sizeof (struct exec))
PROTO (static boolean, b_out_squirt_out_relocs,(bfd *abfd, asection *section)); PROTO (static boolean, b_out_squirt_out_relocs,(bfd *abfd, asection *section));
PROTO (static bfd_target *, b_out_callback, (bfd *)); PROTO (static bfd_target *, b_out_callback, (bfd *));
@ -115,9 +115,10 @@ b_out_callback (abfd)
swap_exec_header (abfd, execp); swap_exec_header (abfd, execp);
/* Architecture and machine type */ /* Architecture and machine type */
abfd->obj_arch = bfd_arch_i960; /* B.out only used on i960 */ bfd_set_arch_mach(abfd,
abfd->obj_machine = bfd_mach_i960_core; /* Default */ bfd_arch_i960, /* B.out only used on i960 */
/* FIXME: Set real machine type from file here */ bfd_mach_i960_core /* Default */
);
/* The positions of the string table and symbol table. */ /* The positions of the string table and symbol table. */
obj_str_filepos (abfd) = N_STROFF (anexec); obj_str_filepos (abfd) = N_STROFF (anexec);
@ -254,7 +255,7 @@ swap_exec_header (abfd, execp)
#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
callj_callback(abfd, reloc_entry, symbol_in, data, input_section) callj_callback(abfd, reloc_entry, symbol_in, data, input_section)
bfd *abfd; bfd *abfd;
arelent *reloc_entry; arelent *reloc_entry;
@ -639,8 +640,8 @@ b_out_set_arch_mach (abfd, arch, machine)
enum bfd_architecture arch; enum bfd_architecture arch;
unsigned long machine; unsigned long machine;
{ {
abfd->obj_arch = arch; bfd_default_set_arch_mach(abfd, arch, machine);
abfd->obj_machine = machine;
if (arch == bfd_arch_unknown) /* Unknown machine arch is OK */ if (arch == bfd_arch_unknown) /* Unknown machine arch is OK */
return true; return true;
if (arch == bfd_arch_i960) /* i960 default is OK */ if (arch == bfd_arch_i960) /* i960 default is OK */
@ -667,7 +668,6 @@ DEFUN(b_out_sizeof_headers,(ignore_abfd, ignore),
{ {
return sizeof(struct internal_exec); return sizeof(struct internal_exec);
} }
@ -703,7 +703,7 @@ DEFUN(b_out_sizeof_headers,(ignore_abfd, ignore),
bfd_target b_out_vec_big_host = bfd_target b_out_vec_big_host =
{ {
"b.out.big", /* name */ "b.out.big", /* name */
bfd_target_aout_flavour_enum, bfd_target_aout_flavour,
false, /* data byte order is little */ false, /* data byte order is little */
true, /* hdr byte order is big */ true, /* hdr byte order is big */
(HAS_RELOC | EXEC_P | /* object flags */ (HAS_RELOC | EXEC_P | /* object flags */
@ -730,7 +730,7 @@ _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs
bfd_target b_out_vec_little_host = bfd_target b_out_vec_little_host =
{ {
"b.out.little", /* name */ "b.out.little", /* name */
bfd_target_aout_flavour_enum, bfd_target_aout_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 */
(HAS_RELOC | EXEC_P | /* object flags */ (HAS_RELOC | EXEC_P | /* object flags */

View File

@ -56,7 +56,7 @@ asymbol *symbol;
return(relocation); return(relocation);
} }
static bfd_reloc_status_enum_type static bfd_reloc_status_type
a29k_reloc(abfd, reloc_entry, symbol_in, data, input_section) a29k_reloc(abfd, reloc_entry, symbol_in, data, input_section)
bfd *abfd; bfd *abfd;
arelent *reloc_entry; arelent *reloc_entry;
@ -68,7 +68,7 @@ asection *input_section;
static unsigned long part1_consth_value; static unsigned long part1_consth_value;
unsigned long insn, value, sym_value; unsigned long insn, value, sym_value;
unsigned short r_type; unsigned short r_type;
/* 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);*/
r_type = reloc_entry->howto->type; r_type = reloc_entry->howto->type;
@ -212,7 +212,7 @@ static reloc_howto_type howto_table[] =
bfd_target a29kcoff_big_vec = bfd_target a29kcoff_big_vec =
{ {
"coff-a29k-big", /* name */ "coff-a29k-big", /* 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 */

View File

@ -250,38 +250,38 @@ DEFUN(NAME(host_aout,write_object_contents), (abfd),
/* We use BFD generic archive files. */ /* We use BFD generic archive files. */
#define aout_32_openr_next_archived_file bfd_generic_openr_next_archived_file #define aout_32_openr_next_archived_file bfd_generic_openr_next_archived_file
#define aout_32_generic_stat_arch_elt bfd_generic_stat_arch_elt #define aout_32_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define aout_32_slurp_armap bfd_slurp_bsd_armap #define aout_32_slurp_armap bfd_false
#define aout_32_slurp_extended_name_table bfd_true #define aout_32_slurp_extended_name_table bfd_true
#define aout_32_write_armap bsd_write_armap #define aout_32_write_armap (PROTO (boolean, (*), \
#define aout_32_truncate_arname bfd_bsd_truncate_arname (bfd *arch, unsigned int elength, struct orl *map, int orl_count, \
/* #define aout_32_machine_type sunos_machine_type */ int stridx))) bfd_false
#define aout_32_truncate_arname bfd_dont_truncate_arname
/* Traditional Unix core files with upage */ /* No core file defined here -- configure in trad-core.c separately. */
#define aout_32_core_file_failing_command trad_unix_core_file_failing_command #define aout_32_core_file_failing_command bfd_false
#define aout_32_core_file_failing_signal trad_unix_core_file_failing_signal #define aout_32_core_file_failing_signal bfd_false
#define aout_32_core_file_matches_executable_p trad_unix_core_file_matches_executable_p #define aout_32_core_file_matches_executable_p bfd_true
#define some_kinda_core_file_p bfd_false
#define aout_64_openr_next_archived_file bfd_generic_openr_next_archived_file
#define aout_64_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define aout_64_slurp_armap bfd_slurp_bsd_armap
#define aout_64_slurp_extended_name_table bfd_true
#define aout_64_write_armap bsd_write_armap
#define aout_64_truncate_arname bfd_bsd_truncate_arname
/* #define aout_64_machine_type sunos_machine_type */
#define aout_64_core_file_failing_command trad_unix_core_file_failing_command
#define aout_64_core_file_failing_signal trad_unix_core_file_failing_signal
#define aout_64_core_file_matches_executable_p trad_unix_core_file_matches_executable_p
#define aout_64_bfd_debug_info_start bfd_void
#define aout_64_bfd_debug_info_end bfd_void
#define aout_64_bfd_debug_info_accumulate bfd_void
#define aout_32_bfd_debug_info_start bfd_void #define aout_32_bfd_debug_info_start bfd_void
#define aout_32_bfd_debug_info_end bfd_void #define aout_32_bfd_debug_info_end bfd_void
#define aout_32_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void #define aout_32_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
#define aout_64_openr_next_archived_file aout_32_openr_next_archived_file
#define aout_64_generic_stat_arch_elt aout_32_generic_stat_arch_elt
#define aout_64_slurp_armap aout_32_slurp_armap
#define aout_64_slurp_extended_name_table aout_32_slurp_extended_name_table
#define aout_64_write_armap aout_32_write_armap
#define aout_64_truncate_arname aout_32_truncate_arname
#define aout_64_core_file_failing_command aout_32_core_file_failing_command
#define aout_64_core_file_failing_signal aout_32_core_file_failing_signal
#define aout_64_core_file_matches_executable_p aout_32_core_file_matches_executable_p
#define aout_64_bfd_debug_info_start aout_32_bfd_debug_info_start
#define aout_64_bfd_debug_info_end aout_32_bfd_debug_info_end
#define aout_64_bfd_debug_info_accumulate aout_32_bfd_debug_info_accumulate
/* We implement these routines ourselves, rather than using the generic /* We implement these routines ourselves, rather than using the generic
a.out versions. */ a.out versions. */
@ -290,7 +290,7 @@ DEFUN(NAME(host_aout,write_object_contents), (abfd),
bfd_target host_aout_big_vec = bfd_target host_aout_big_vec =
{ {
"a.out-host-big", "a.out-host-big",
bfd_target_aout_flavour_enum, bfd_target_aout_flavour,
true, /* target byte order */ true, /* target byte order */
true, /* target headers byte order */ true, /* target headers byte order */
(HAS_RELOC | EXEC_P | /* object flags */ (HAS_RELOC | EXEC_P | /* object flags */
@ -304,7 +304,7 @@ bfd_target host_aout_big_vec =
_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, NAME(host_aout,object_p), {_bfd_dummy_target, NAME(host_aout,object_p),
bfd_generic_archive_p, trad_unix_core_file_p}, bfd_generic_archive_p, some_kinda_core_file_p},
{bfd_false, NAME(host_aout,mkobject), {bfd_false, NAME(host_aout,mkobject),
_bfd_generic_mkarchive, bfd_false}, _bfd_generic_mkarchive, bfd_false},
{bfd_false, NAME(host_aout,write_object_contents), /* bfd_write_contents */ {bfd_false, NAME(host_aout,write_object_contents), /* bfd_write_contents */
@ -316,7 +316,7 @@ bfd_target host_aout_big_vec =
bfd_target host_aout_little_vec = bfd_target host_aout_little_vec =
{ {
"a.out-host-little", "a.out-host-little",
bfd_target_aout_flavour_enum, bfd_target_aout_flavour,
false, /* target byte order */ false, /* target byte order */
false, /* target headers byte order */ false, /* target headers byte order */
(HAS_RELOC | EXEC_P | /* object flags */ (HAS_RELOC | EXEC_P | /* object flags */
@ -326,11 +326,11 @@ bfd_target host_aout_little_vec =
' ', /* ar_pad_char */ ' ', /* ar_pad_char */
16, /* ar_max_namelen */ 16, /* ar_max_namelen */
3, /* minimum alignment power */ 3, /* minimum alignment power */
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */ _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putb16, /* data */
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */ _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */
{_bfd_dummy_target, NAME(host_aout,object_p), {_bfd_dummy_target, NAME(host_aout,object_p),
bfd_generic_archive_p, trad_unix_core_file_p}, bfd_generic_archive_p, some_kinda_core_file_p},
{bfd_false, NAME(host_aout,mkobject), {bfd_false, NAME(host_aout,mkobject),
_bfd_generic_mkarchive, bfd_false}, _bfd_generic_mkarchive, bfd_false},
{bfd_false, NAME(host_aout,write_object_contents), /* bfd_write_contents */ {bfd_false, NAME(host_aout,write_object_contents), /* bfd_write_contents */

View File

@ -1,26 +1,26 @@
/* BFD back-end data structures for a.out (and similar) files. /* BFD back-end data structures for a.out (and similar) files.
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Cygnus Support.
We try to encapsulate the differences in a few routines, and otherwise This file is part of BFD, the Binary File Descriptor library.
share large masses of code. This means we only have to fix bugs in
one place, most of the time. */
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify
This file is part of BFD, the Binary File Diddler.
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. */
/* We try to encapsulate the differences in the various a.out file
variants in a few routines, and otherwise share large masses of code.
This means we only have to fix bugs in one place, most of the time. */
/* $Id$ */ /* $Id$ */
@ -30,7 +30,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define CAT3(a,b,c) a/**/b/**/c #define CAT3(a,b,c) a/**/b/**/c
#endif #endif
/* Parameterize the a.out code based on whether it is being built /* Parameterize the a.out code based on whether it is being built
for a 32-bit architecture or a 64-bit architecture. */ for a 32-bit architecture or a 64-bit architecture. */
#if ARCH_SIZE==64 #if ARCH_SIZE==64
@ -59,6 +58,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define obj_reloc_entry_size(bfd) (adata(bfd)->reloc_entry_size) #define obj_reloc_entry_size(bfd) (adata(bfd)->reloc_entry_size)
/* Declare these types at file level, since they are used in parameter
lists, which have wierd scope. */
struct external_exec;
struct internal_exec;
typedef struct aout_symbol { typedef struct aout_symbol {
asymbol symbol; asymbol symbol;
short desc; short desc;
@ -129,7 +133,7 @@ PROTO (unsigned int, NAME(aout,get_reloc_upper_bound), (bfd *abfd, sec_ptr asect
PROTO (void, NAME(aout,reclaim_reloc), (bfd *ignore_abfd, sec_ptr ignore)); PROTO (void, NAME(aout,reclaim_reloc), (bfd *ignore_abfd, sec_ptr ignore));
PROTO (alent *, NAME(aout,get_lineno), (bfd *ignore_abfd, asymbol *ignore_symbol)); PROTO (alent *, NAME(aout,get_lineno), (bfd *ignore_abfd, asymbol *ignore_symbol));
PROTO (void, NAME(aout,print_symbol), (bfd *ignore_abfd, PTR file, PROTO (void, NAME(aout,print_symbol), (bfd *ignore_abfd, PTR file,
asymbol *symbol, bfd_print_symbol_enum_type how)); asymbol *symbol, bfd_print_symbol_type how));
PROTO (boolean, NAME(aout,close_and_cleanup), (bfd *abfd)); PROTO (boolean, NAME(aout,close_and_cleanup), (bfd *abfd));
PROTO (boolean, NAME(aout,find_nearest_line), (bfd *abfd, asection *section, PROTO (boolean, NAME(aout,find_nearest_line), (bfd *abfd, asection *section,
asymbol **symbols, bfd_vma offset, CONST char **filename_ptr, asymbol **symbols, bfd_vma offset, CONST char **filename_ptr,
@ -172,17 +176,22 @@ PROTO (void, NAME(aout,swap_exec_header_out),(bfd *abfd, struct internal_exec *e
#define WRITE_HEADERS(abfd, execp) \ #define WRITE_HEADERS(abfd, execp) \
{ \ { \
if ((obj_textsec(abfd)->vma & 0xff )== EXEC_BYTES_SIZE) \
abfd->flags |= D_PAGED; \
else \
abfd->flags &= ~D_PAGED; \
if (abfd->flags & D_PAGED) \ if (abfd->flags & D_PAGED) \
{ \ { \
execp->a_text = obj_textsec (abfd)->size + EXEC_BYTES_SIZE; \ execp->a_text = obj_textsec (abfd)->size + EXEC_BYTES_SIZE; \
N_SET_MAGIC (*execp, ZMAGIC); \ N_SET_MAGIC (*execp, ZMAGIC); \
} \ } \
else if (abfd->flags & WP_TEXT) \ else \
{ \ { \
N_SET_MAGIC (*execp, NMAGIC); \ execp->a_text = obj_textsec (abfd)->size; \
} \ if (abfd->flags & WP_TEXT) \
else { \ { N_SET_MAGIC (*execp, NMAGIC); } \
N_SET_MAGIC(*execp, OMAGIC); \ else \
{ N_SET_MAGIC(*execp, OMAGIC); } \
} \ } \
if (abfd->flags & D_PAGED) \ if (abfd->flags & D_PAGED) \
{ \ { \

View File

@ -78,9 +78,10 @@ DEFUN(newsos3_callback,(abfd),
WORK_OUT_FILE_POSITIONS(abfd, execp) ; WORK_OUT_FILE_POSITIONS(abfd, execp) ;
/* Determine the architecture and machine type of the object file. */ /* Determine the architecture and machine type of the object file.
abfd->obj_arch = bfd_arch_m68k; */
abfd->obj_machine = 0; bfd_default_set_arch_mach(abfd, bfd_arch_m68k, 0);
return abfd->xvec; return abfd->xvec;
} }
@ -145,7 +146,7 @@ DEFUN(newsos3_write_object_contents,(abfd),
bfd_target newsos3_vec = /* Sony 68k-based machines running newsos3 */ bfd_target newsos3_vec = /* Sony 68k-based machines running newsos3 */
{ {
"a.out-newsos3", /* name */ "a.out-newsos3", /* name */
bfd_target_aout_flavour_enum, bfd_target_aout_flavour,
true, /* target byte order */ true, /* target byte order */
true, /* target headers byte order */ true, /* target headers byte order */
(HAS_RELOC | EXEC_P | /* object flags */ (HAS_RELOC | EXEC_P | /* object flags */