diff options
author | John Gilmore <gnu@cygnus> | 1991-10-05 05:18:08 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1991-10-05 05:18:08 +0000 |
commit | 9e2dad8ed4b31d55281cca6915da87d2ea487125 (patch) | |
tree | 11f55d72a3ea4588a6ae85d86824c7543aef9814 | |
parent | 5784123fb7a17931182241875d6affa7d3900727 (diff) | |
download | gdb-9e2dad8ed4b31d55281cca6915da87d2ea487125.zip gdb-9e2dad8ed4b31d55281cca6915da87d2ea487125.tar.gz gdb-9e2dad8ed4b31d55281cca6915da87d2ea487125.tar.bz2 |
* 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.
-rw-r--r-- | bfd/ChangeLog | 31 | ||||
-rw-r--r-- | bfd/aoutf1.h | 185 | ||||
-rw-r--r-- | bfd/aoutx.h | 548 | ||||
-rw-r--r-- | bfd/bout.c | 20 | ||||
-rw-r--r-- | bfd/coff-a29k.c | 6 | ||||
-rw-r--r-- | bfd/host-aout.c | 62 | ||||
-rw-r--r-- | bfd/libaout.h | 49 | ||||
-rw-r--r-- | bfd/newsos3.c | 9 |
8 files changed, 406 insertions, 504 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e6fc190..8fd6be8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -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) * reloc.c: Extended NEWHOWTO macro diff --git a/bfd/aoutf1.h b/bfd/aoutf1.h index 2ced6eb..cc5fc74 100644 --- a/bfd/aoutf1.h +++ b/bfd/aoutf1.h @@ -81,17 +81,17 @@ DEFUN(NAME(sunos,object_p), (abfd), static void DEFUN(choose_reloc_size,(abfd), bfd *abfd) - { - switch (abfd->obj_arch) { - case bfd_arch_sparc: - case bfd_arch_a29k: - obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; - break; - default: - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - break; - } +{ + switch (bfd_get_arch(abfd)) { + case bfd_arch_sparc: + case bfd_arch_a29k: + obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; + break; + default: + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + break; } +} /* Set parameters about this a.out file that are machine-dependent. This routine is called from some_aout_object_p just before it returns. */ @@ -101,103 +101,102 @@ sunos4_callback (abfd) bfd *abfd; { struct internal_exec *execp = exec_hdr (abfd); - + enum bfd_architecture arch; + long machine; WORK_OUT_FILE_POSITIONS(abfd, execp); /* Determine the architecture and machine type of the object file. */ switch (N_MACHTYPE (*exec_hdr (abfd))) { - + case M_UNKNOWN: - abfd->obj_arch = bfd_arch_unknown; - abfd->obj_machine = 0; + arch = bfd_arch_unknown; + machine = 0; break; case M_68010: - abfd->obj_arch = bfd_arch_m68k; - abfd->obj_machine = 68010; + arch = bfd_arch_m68k; + machine = 68010; break; case M_68020: - abfd->obj_arch = bfd_arch_m68k; - abfd->obj_machine = 68020; + arch = bfd_arch_m68k; + machine = 68020; break; case M_SPARC: - abfd->obj_arch = bfd_arch_sparc; - abfd->obj_machine = 0; + arch = bfd_arch_sparc; + machine = 0; break; case M_386: - abfd->obj_arch = bfd_arch_i386; - abfd->obj_machine = 0; + arch = bfd_arch_i386; + machine = 0; break; case M_29K: - abfd->obj_arch = bfd_arch_a29k; - abfd->obj_machine = 0; + arch = bfd_arch_a29k; + machine = 0; break; default: - abfd->obj_arch = bfd_arch_obscure; - abfd->obj_machine = 0; + arch = bfd_arch_obscure; + machine = 0; break; } - + bfd_set_arch_mach(abfd, arch, machine); choose_reloc_size(abfd); return abfd->xvec; } /* Write an object file in SunOS format. -Section contents have already been written. We write the -file header, symbols, and relocation. */ + Section contents have already been written. We write the + file header, symbols, and relocation. */ boolean -DEFUN(NAME(aout,sunos4_write_object_contents),(abfd), +DEFUN(NAME(aout,sunos4_write_object_contents), + (abfd), bfd *abfd) - - { - bfd_size_type data_pad = 0; - struct external_exec exec_bytes; - struct internal_exec *execp = exec_hdr (abfd); - - +{ + bfd_size_type data_pad = 0; + struct external_exec exec_bytes; + 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! */ - switch (bfd_get_architecture(abfd)) { - case bfd_arch_m68k: - switch (bfd_get_machine(abfd)) { - case 68010: - N_SET_MACHTYPE(*execp, M_68010); - break; - default: - case 68020: - N_SET_MACHTYPE(*execp, M_68020); - break; - } - break; - case bfd_arch_sparc: - N_SET_MACHTYPE(*execp, M_SPARC); - break; - case bfd_arch_i386: - N_SET_MACHTYPE(*execp, M_386); - break; - case bfd_arch_a29k: - N_SET_MACHTYPE(*execp, M_29K); + /* Magic number, maestro, please! */ + switch (bfd_get_arch(abfd)) { + case bfd_arch_m68k: + switch (bfd_get_mach(abfd)) { + case 68010: + N_SET_MACHTYPE(*execp, M_68010); break; default: - N_SET_MACHTYPE(*execp, M_UNKNOWN); + case 68020: + N_SET_MACHTYPE(*execp, M_68020); + break; } + break; + case bfd_arch_sparc: + N_SET_MACHTYPE(*execp, M_SPARC); + break; + case bfd_arch_i386: + N_SET_MACHTYPE(*execp, M_386); + break; + case bfd_arch_a29k: + N_SET_MACHTYPE(*execp, M_29K); + break; + default: + N_SET_MACHTYPE(*execp, M_UNKNOWN); + } - choose_reloc_size(abfd); - - /* FIXME */ - N_SET_FLAGS (*execp, 0x1); + choose_reloc_size(abfd); + + /* FIXME */ + N_SET_FLAGS (*execp, 0x1); + + WRITE_HEADERS(abfd, execp); - WRITE_HEADERS(abfd, execp); - return true; } @@ -207,14 +206,14 @@ DEFUN(NAME(aout,sunos4_write_object_contents),(abfd), #define CORE_NAMELEN 16 /* The core structure is taken from the Sun documentation. -Unfortunately, they don't document the FPA structure, or at least I -can't find it easily. Fortunately the core header contains its own -length. So this shouldn't cause problems, except for c_ucode, which -so far we don't use but is easy to find with a little arithmetic. */ + Unfortunately, they don't document the FPA structure, or at least I + can't find it easily. Fortunately the core header contains its own + length. So this shouldn't cause problems, except for c_ucode, which + so far we don't use but is easy to find with a little arithmetic. */ /* But the reg structure can be gotten from the SPARC processor handbook. -This really should be in a GNU include file though so that gdb can use -the same info. */ + This really should be in a GNU include file though so that gdb can use + the same info. */ struct regs { int r_psr; int r_pc; @@ -240,19 +239,19 @@ struct regs { /* Taken from Sun documentation: */ /* FIXME: It's worse than we expect. This struct contains TWO substructs -neither of whose size we know, WITH STUFF IN BETWEEN THEM! We can't -even portably access the stuff in between! */ + neither of whose size we know, WITH STUFF IN BETWEEN THEM! We can't + even portably access the stuff in between! */ struct external_sparc_core { int c_magic; /* Corefile magic number */ int c_len; /* Sizeof (struct core) */ #define SPARC_CORE_LEN 432 int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */ - struct external_exec c_aouthdr; /* A.out header */ - int c_signo; /* Killing signal, if any */ - int c_tsize; /* Text size (bytes) */ - int c_dsize; /* Data size (bytes) */ - int c_ssize; /* Stack size (bytes) */ + struct external_exec c_aouthdr; /* A.out header */ + int c_signo; /* Killing signal, if any */ + int c_tsize; /* Text size (bytes) */ + int c_dsize; /* Data size (bytes) */ + int c_ssize; /* Stack size (bytes) */ char c_cmdname[CORE_NAMELEN + 1]; /* Command name */ double fp_stuff[1]; /* external FPU state (size unknown by us) */ /* The type "double" is critical here, for alignment. @@ -288,12 +287,12 @@ struct internal_sunos_core { int c_len; /* Sizeof (struct core) */ long c_regs_pos; /* file offset of General purpose registers */ int c_regs_size; /* size of General purpose registers */ - struct internal_exec c_aouthdr; /* A.out header */ - int c_signo; /* Killing signal, if any */ - int c_tsize; /* Text size (bytes) */ - int c_dsize; /* Data size (bytes) */ - int c_ssize; /* Stack size (bytes) */ - long c_stacktop; /* Stack top (address) */ + struct internal_exec c_aouthdr; /* A.out header */ + int c_signo; /* Killing signal, if any */ + int c_tsize; /* Text size (bytes) */ + int c_dsize; /* Data size (bytes) */ + int c_ssize; /* Stack size (bytes) */ + long c_stacktop; /* Stack top (address) */ char c_cmdname[CORE_NAMELEN + 1]; /* Command name */ long fp_stuff_pos; /* file offset of external FPU state (regs) */ int fp_stuff_size; /* Size of it */ @@ -308,7 +307,7 @@ DEFUN(swapcore_sun3,(abfd, ext, intcore), struct internal_sunos_core *intcore) { struct external_sun3_core *extcore = (struct external_sun3_core *)ext; - + intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_magic); intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_len ); intcore->c_regs_pos = (long) (((struct external_sun3_core *)0)->c_regs); @@ -324,9 +323,10 @@ DEFUN(swapcore_sun3,(abfd, ext, intcore), intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - (file_ptr)(((struct external_sun3_core *)0)->fp_stuff); /* Ucode is the last thing in the struct -- just before the end */ - intcore->c_ucode = bfd_h_get_32 (abfd, - intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore); - intcore->c_stacktop = 0x0E000000; /* By experimentation */ + intcore->c_ucode = + bfd_h_get_32 (abfd, + intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore); + intcore->c_stacktop = 0x0E000000; /* By experimentation */ } @@ -354,8 +354,9 @@ DEFUN(swapcore_sparc,(abfd, ext, intcore), intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - (file_ptr)(((struct external_sparc_core *)0)->fp_stuff); /* Ucode is the last thing in the struct -- just before the end */ - intcore->c_ucode = bfd_h_get_32 (abfd, - intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore); + intcore->c_ucode = + bfd_h_get_32 (abfd, + intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore); /* Supposedly the user stack grows downward from the bottom of kernel memory. Presuming that this remains true, this definition will work. */ #define SPARC_USRSTACK (-(128*1024*1024)) @@ -587,7 +588,7 @@ a.out versions. */ bfd_target VECNAME = { TARGETNAME, - bfd_target_aout_flavour_enum, + bfd_target_aout_flavour, true, /* target byte order */ true, /* target headers byte order */ (HAS_RELOC | EXEC_P | /* object flags */ diff --git a/bfd/aoutx.h b/bfd/aoutx.h index ad1828e..f3d507c 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -112,6 +112,7 @@ selected. #include <sysdep.h> #include <ansidecl.h> +struct external_exec; #include "libaout.h" #include "libbfd.h" #include "aout64.h" @@ -131,126 +132,6 @@ and sparcs) also have a full integer for an addend. */ #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[] = { @@ -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_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). */ @@ -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 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. */ obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; @@ -644,6 +505,7 @@ DEFUN(NAME(aout,machine_type),(arch, machine), return arch_flags; } + /*doc* *i aout_<size>_set_arch_mach @@ -663,8 +525,7 @@ DEFUN(NAME(aout,set_arch_mach),(abfd, arch, machine), enum bfd_architecture arch AND unsigned long machine) { - abfd->obj_arch = arch; - abfd->obj_machine = machine; + bfd_default_set_arch_mach(abfd, arch, machine); if (arch != bfd_arch_unknown && NAME(aout,machine_type) (arch, machine) == M_UNKNOWN) return false; /* We can't represent this type */ @@ -672,17 +533,17 @@ DEFUN(NAME(aout,set_arch_mach),(abfd, arch, machine), } /*doc* -*i aout_<size>new_section_hook - -Called by the BFD in response to a @code{bfd_make_section} request. -*; PROTO(boolean, aout_<size>_new_section_hook, - (bfd *abfd, - asection *newsect)); + *i aout_<size>new_section_hook + + Called by the BFD in response to a @code{bfd_make_section} request. + *; PROTO(boolean, aout_<size>_new_section_hook, + (bfd *abfd, + asection *newsect)); */ boolean -DEFUN(NAME(aout,new_section_hook),(abfd, newsect), - bfd *abfd AND - asection *newsect) + DEFUN(NAME(aout,new_section_hook),(abfd, newsect), + bfd *abfd AND + asection *newsect) { /* align to double at least */ newsect->alignment_power = 3; @@ -709,50 +570,50 @@ DEFUN(NAME(aout,new_section_hook),(abfd, newsect), } boolean -DEFUN(NAME(aout,set_section_contents),(abfd, section, location, offset, count), - bfd *abfd AND - sec_ptr section AND - PTR location AND - file_ptr offset AND - bfd_size_type count) + DEFUN(NAME(aout,set_section_contents),(abfd, section, location, offset, count), + bfd *abfd AND + sec_ptr section AND + PTR location AND + file_ptr offset AND + bfd_size_type count) { if (abfd->output_has_begun == false) - { /* set by bfd.c handler */ - switch (abfd->direction) - { - case read_direction: - case no_direction: - bfd_error = invalid_operation; - return false; - - case both_direction: - break; - - case write_direction: - if ((obj_textsec (abfd) == NULL) || (obj_datasec (abfd) == NULL)) - { - bfd_error = invalid_operation; - return false; + { /* set by bfd.c handler */ + switch (abfd->direction) + { + case read_direction: + case no_direction: + bfd_error = invalid_operation; + return false; + + case both_direction: + break; + + case write_direction: + if ((obj_textsec (abfd) == NULL) || (obj_datasec (abfd) == NULL)) + { + bfd_error = invalid_operation; + return false; + } + /*if (abfd->flags & D_PAGED) { + obj_textsec(abfd)->filepos = 0; } - /*if (abfd->flags & D_PAGED) { - obj_textsec(abfd)->filepos = 0; - } - else*/ { - obj_textsec(abfd)->filepos = EXEC_BYTES_SIZE; + else*/ { + obj_textsec(abfd)->filepos = EXEC_BYTES_SIZE; + } + obj_textsec(abfd)->size = align_power(obj_textsec(abfd)->size, + obj_textsec(abfd)->alignment_power); + obj_datasec(abfd)->filepos = obj_textsec (abfd)->size + EXEC_BYTES_SIZE; + obj_datasec(abfd)->size = align_power(obj_datasec(abfd)->size, + obj_datasec(abfd)->alignment_power); } - obj_textsec(abfd)->size = align_power(obj_textsec(abfd)->size, - obj_textsec(abfd)->alignment_power); - obj_datasec(abfd)->filepos = obj_textsec (abfd)->size + EXEC_BYTES_SIZE; - obj_datasec(abfd)->size = align_power(obj_datasec(abfd)->size, - obj_datasec(abfd)->alignment_power); - } - } + } /* regardless, once we know what we're doing, we might as well get going */ if (section != obj_bsssec(abfd)) { bfd_seek (abfd, section->filepos + offset, SEEK_SET); - + if (count) { return (bfd_write ((PTR)location, 1, count, abfd) == count) ? true : false; @@ -765,116 +626,116 @@ DEFUN(NAME(aout,set_section_contents),(abfd, section, location, offset, count), /* Classify stabs symbols */ #define sym_in_text_section(sym) \ -(((sym)->type & (N_ABS | N_TEXT | N_DATA | N_BSS))== N_TEXT) + (((sym)->type & (N_ABS | N_TEXT | N_DATA | N_BSS))== N_TEXT) #define sym_in_data_section(sym) \ -(((sym)->type & (N_ABS | N_TEXT | N_DATA | N_BSS))== N_DATA) + (((sym)->type & (N_ABS | N_TEXT | N_DATA | N_BSS))== N_DATA) #define sym_in_bss_section(sym) \ -(((sym)->type & (N_ABS | N_TEXT | N_DATA | N_BSS))== N_BSS) + (((sym)->type & (N_ABS | N_TEXT | N_DATA | N_BSS))== N_BSS) /* Symbol is undefined if type is N_UNDF|N_EXT and if it has -zero in the "value" field. Nonzeroes there are fortrancommon -symbols. */ + zero in the "value" field. Nonzeroes there are fortrancommon + symbols. */ #define sym_is_undefined(sym) \ -((sym)->type == (N_UNDF | N_EXT) && (sym)->symbol.value == 0) + ((sym)->type == (N_UNDF | N_EXT) && (sym)->symbol.value == 0) /* Symbol is a global definition if N_EXT is on and if it has -a nonzero type field. */ + a nonzero type field. */ #define sym_is_global_defn(sym) \ -(((sym)->type & N_EXT) && (sym)->type & N_TYPE) + (((sym)->type & N_EXT) && (sym)->type & N_TYPE) /* Symbol is debugger info if any bits outside N_TYPE or N_EXT -are on. */ + are on. */ #define sym_is_debugger_info(sym) \ -((sym)->type & ~(N_EXT | N_TYPE)) + ((sym)->type & ~(N_EXT | N_TYPE)) #define sym_is_fortrancommon(sym) \ -(((sym)->type == (N_EXT)) && (sym)->symbol.value != 0) + (((sym)->type == (N_EXT)) && (sym)->symbol.value != 0) /* Symbol is absolute if it has N_ABS set */ #define sym_is_absolute(sym) \ -(((sym)->type & N_TYPE)== N_ABS) + (((sym)->type & N_TYPE)== N_ABS) #define sym_is_indirect(sym) \ -(((sym)->type & N_ABS)== N_ABS) + (((sym)->type & N_ABS)== N_ABS) /* Only in their own functions for ease of debugging; when sym flags have -stabilised these should be inlined into their (single) caller */ - + stabilised these should be inlined into their (single) caller */ + static void DEFUN(translate_from_native_sym_flags,(sym_pointer, cache_ptr, abfd), - struct external_nlist *sym_pointer AND - aout_symbol_type *cache_ptr AND - bfd *abfd) - { - switch (cache_ptr->type & N_TYPE) { - case N_SETA: - case N_SETT: - case N_SETD: - case N_SETB: - { - char *copy = bfd_alloc(abfd, strlen(cache_ptr->symbol.name)+1); - asection *section ; - arelent_chain *reloc = (arelent_chain *)bfd_alloc(abfd, sizeof(arelent_chain)); - strcpy(copy, cache_ptr->symbol.name); - section = bfd_make_section(abfd,copy); - switch ( (cache_ptr->type & N_TYPE) ) { - case N_SETA: - section->flags = SEC_CONSTRUCTOR; - reloc->relent.section = (asection *)NULL; - cache_ptr->symbol.section = (asection *)NULL; - break; - case N_SETT: - section->flags = SEC_CONSTRUCTOR_TEXT; - reloc->relent.section = (asection *)obj_textsec(abfd); - cache_ptr->symbol.value -= reloc->relent.section->vma; - break; - case N_SETD: - section->flags = SEC_CONSTRUCTOR_DATA; - reloc->relent.section = (asection *)obj_datasec(abfd); - cache_ptr->symbol.value -= reloc->relent.section->vma; - break; - case N_SETB: - section->flags = SEC_CONSTRUCTOR_BSS; - reloc->relent.section = (asection *)obj_bsssec(abfd); - cache_ptr->symbol.value -= reloc->relent.section->vma; - break; - } - cache_ptr->symbol.section = reloc->relent.section; - reloc->relent.addend = cache_ptr->symbol.value ; +struct external_nlist *sym_pointer AND +aout_symbol_type *cache_ptr AND +bfd *abfd) +{ + switch (cache_ptr->type & N_TYPE) { + case N_SETA: + case N_SETT: + case N_SETD: + case N_SETB: + { + char *copy = bfd_alloc(abfd, strlen(cache_ptr->symbol.name)+1); + asection *section ; + arelent_chain *reloc = (arelent_chain *)bfd_alloc(abfd, sizeof(arelent_chain)); + strcpy(copy, cache_ptr->symbol.name); + section = bfd_make_section(abfd,copy); + switch ( (cache_ptr->type & N_TYPE) ) { + case N_SETA: + section->flags = SEC_CONSTRUCTOR; + reloc->relent.section = (asection *)NULL; + cache_ptr->symbol.section = (asection *)NULL; + break; + case N_SETT: + section->flags = SEC_CONSTRUCTOR_TEXT; + reloc->relent.section = (asection *)obj_textsec(abfd); + cache_ptr->symbol.value -= reloc->relent.section->vma; + break; + case N_SETD: + section->flags = SEC_CONSTRUCTOR_DATA; + reloc->relent.section = (asection *)obj_datasec(abfd); + cache_ptr->symbol.value -= reloc->relent.section->vma; + break; + case N_SETB: + section->flags = SEC_CONSTRUCTOR_BSS; + reloc->relent.section = (asection *)obj_bsssec(abfd); + cache_ptr->symbol.value -= reloc->relent.section->vma; + break; + } + cache_ptr->symbol.section = reloc->relent.section; + reloc->relent.addend = cache_ptr->symbol.value ; - /* We modify the symbol to belong to a section depending upon the - name of the symbol - probably __CTOR__ or __DTOR__ but we don't - really care, and add to the size of the section to contain a - pointer to the symbol. Build a reloc entry to relocate to this - symbol attached to this section. */ + /* We modify the symbol to belong to a section depending upon the + name of the symbol - probably __CTOR__ or __DTOR__ but we don't + really care, and add to the size of the section to contain a + pointer to the symbol. Build a reloc entry to relocate to this + symbol attached to this section. */ - section->reloc_count++; - section->alignment_power = 2; - reloc->relent.sym_ptr_ptr = (asymbol **)NULL; - reloc->next = section->constructor_chain; - section->constructor_chain = reloc; - reloc->relent.address = section->size; - section->size += sizeof(int *); + section->reloc_count++; + section->alignment_power = 2; + reloc->relent.sym_ptr_ptr = (asymbol **)NULL; + reloc->next = section->constructor_chain; + section->constructor_chain = reloc; + reloc->relent.address = section->size; + section->size += sizeof(int *); - reloc->relent.howto = howto_table_ext +CTOR_TABLE_RELOC_IDX; - cache_ptr->symbol.flags |= BSF_DEBUGGING | BSF_CONSTRUCTOR; - } - break; + reloc->relent.howto = howto_table_ext +CTOR_TABLE_RELOC_IDX; + cache_ptr->symbol.flags |= BSF_DEBUGGING | BSF_CONSTRUCTOR; + } + break; default: if (cache_ptr->type == N_WARNING) { - /* This symbol is the text of a warning message, the next symbol - is the symbol to associate the warning with */ - cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_WARNING; - cache_ptr->symbol.value = (bfd_vma)((cache_ptr+1)); - /* We furgle with the next symbol in place. We don't want it to be undefined, we'll trample the type */ - (sym_pointer+1)->e_type[0] = 0xff; - break; - } + /* This symbol is the text of a warning message, the next symbol + is the symbol to associate the warning with */ + cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_WARNING; + cache_ptr->symbol.value = (bfd_vma)((cache_ptr+1)); + /* We furgle with the next symbol in place. We don't want it to be undefined, we'll trample the type */ + (sym_pointer+1)->e_type[0] = 0xff; + break; + } if ((cache_ptr->type | N_EXT) == (N_INDR | N_EXT)) { /* Two symbols in a row for an INDR message. The first symbol contains the name we will match, the second symbol contains the @@ -1023,90 +884,90 @@ hold them all plus all the cached symbol entries. */ asymbol * DEFUN(NAME(aout,make_empty_symbol),(abfd), bfd *abfd) - { - aout_symbol_type *new = - (aout_symbol_type *)bfd_zalloc (abfd, sizeof (aout_symbol_type)); - new->symbol.the_bfd = abfd; +{ + aout_symbol_type *new = + (aout_symbol_type *)bfd_zalloc (abfd, sizeof (aout_symbol_type)); + new->symbol.the_bfd = abfd; - return &new->symbol; - } + return &new->symbol; +} boolean DEFUN(NAME(aout,slurp_symbol_table),(abfd), bfd *abfd) - { - bfd_size_type symbol_size; - bfd_size_type string_size; - unsigned char string_chars[BYTES_IN_WORD]; - struct external_nlist *syms; - char *strings; - aout_symbol_type *cached; +{ + bfd_size_type symbol_size; + bfd_size_type string_size; + unsigned char string_chars[BYTES_IN_WORD]; + struct external_nlist *syms; + char *strings; + aout_symbol_type *cached; - /* If there's no work to be done, don't do any */ - if (obj_aout_symbols (abfd) != (aout_symbol_type *)NULL) return true; - symbol_size = exec_hdr(abfd)->a_syms; - if (symbol_size == 0) { - bfd_error = no_symbols; - return false; - } + /* If there's no work to be done, don't do any */ + if (obj_aout_symbols (abfd) != (aout_symbol_type *)NULL) return true; + symbol_size = exec_hdr(abfd)->a_syms; + if (symbol_size == 0) { + bfd_error = no_symbols; + return false; + } - bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET); - if (bfd_read ((PTR)string_chars, BYTES_IN_WORD, 1, abfd) != BYTES_IN_WORD) - return false; - string_size = GET_WORD (abfd, string_chars); + bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET); + if (bfd_read ((PTR)string_chars, BYTES_IN_WORD, 1, abfd) != BYTES_IN_WORD) + return false; + string_size = GET_WORD (abfd, string_chars); - strings =(char *) bfd_alloc(abfd, string_size + 1); - cached = (aout_symbol_type *) - bfd_zalloc(abfd, (bfd_size_type)(bfd_get_symcount (abfd) * sizeof(aout_symbol_type))); - - /* malloc this, so we can free it if simply. The symbol caching - might want to allocate onto the bfd's obstack */ - syms = (struct external_nlist *) malloc(symbol_size); - bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET); - if (bfd_read ((PTR)syms, 1, symbol_size, abfd) != symbol_size) { - bailout: - if (syms) free (syms); - if (cached) bfd_release (abfd, cached); - if (strings)bfd_release (abfd, strings); - return false; - } + strings =(char *) bfd_alloc(abfd, string_size + 1); + cached = (aout_symbol_type *) + bfd_zalloc(abfd, (bfd_size_type)(bfd_get_symcount (abfd) * sizeof(aout_symbol_type))); + + /* malloc this, so we can free it if simply. The symbol caching + might want to allocate onto the bfd's obstack */ + syms = (struct external_nlist *) malloc(symbol_size); + bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET); + if (bfd_read ((PTR)syms, 1, symbol_size, abfd) != symbol_size) { + bailout: + if (syms) free (syms); + if (cached) bfd_release (abfd, cached); + if (strings)bfd_release (abfd, strings); + return false; + } - bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET); - if (bfd_read ((PTR)strings, 1, string_size, abfd) != string_size) { - goto bailout; - } + bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET); + if (bfd_read ((PTR)strings, 1, string_size, abfd) != string_size) { + goto bailout; + } - /* OK, now walk the new symtable, cacheing symbol properties */ - { - register struct external_nlist *sym_pointer; - register struct external_nlist *sym_end = syms + bfd_get_symcount (abfd); - register aout_symbol_type *cache_ptr = cached; + /* OK, now walk the new symtable, cacheing symbol properties */ + { + register struct external_nlist *sym_pointer; + register struct external_nlist *sym_end = syms + bfd_get_symcount (abfd); + register aout_symbol_type *cache_ptr = cached; - /* Run through table and copy values */ - for (sym_pointer = syms, cache_ptr = cached; - sym_pointer < sym_end; sym_pointer++, cache_ptr++) - { - bfd_vma x = GET_WORD(abfd, sym_pointer->e_strx); - cache_ptr->symbol.the_bfd = abfd; - if (x) - cache_ptr->symbol.name = x + strings; - else - cache_ptr->symbol.name = (char *)NULL; + /* Run through table and copy values */ + for (sym_pointer = syms, cache_ptr = cached; + sym_pointer < sym_end; sym_pointer++, cache_ptr++) + { + bfd_vma x = GET_WORD(abfd, sym_pointer->e_strx); + cache_ptr->symbol.the_bfd = abfd; + if (x) + cache_ptr->symbol.name = x + strings; + else + cache_ptr->symbol.name = (char *)NULL; - cache_ptr->symbol.value = GET_SWORD(abfd, sym_pointer->e_value); - cache_ptr->desc = bfd_get_16(abfd, sym_pointer->e_desc); - cache_ptr->other =bfd_get_8(abfd, sym_pointer->e_other); - cache_ptr->type = bfd_get_8(abfd, sym_pointer->e_type); - cache_ptr->symbol.udata = 0; - translate_from_native_sym_flags (sym_pointer, cache_ptr, abfd); - } - } + cache_ptr->symbol.value = GET_SWORD(abfd, sym_pointer->e_value); + cache_ptr->desc = bfd_get_16(abfd, sym_pointer->e_desc); + cache_ptr->other =bfd_get_8(abfd, sym_pointer->e_other); + cache_ptr->type = bfd_get_8(abfd, sym_pointer->e_type); + cache_ptr->symbol.udata = 0; + translate_from_native_sym_flags (sym_pointer, cache_ptr, abfd); + } + } - obj_aout_symbols (abfd) = cached; - free((PTR)syms); + obj_aout_symbols (abfd) = cached; + free((PTR)syms); - return true; - } + return true; +} void @@ -1708,21 +1569,21 @@ DEFUN(NAME(aout,print_symbol),(ignore_abfd, afile, symbol, how), bfd *ignore_abfd AND PTR afile AND asymbol *symbol AND - bfd_print_symbol_enum_type how) + bfd_print_symbol_type how) { FILE *file = (FILE *)afile; switch (how) { - case bfd_print_symbol_name_enum: + case bfd_print_symbol_name: if (symbol->name) fprintf(file,"%s", symbol->name); break; - case bfd_print_symbol_type_enum: + case bfd_print_symbol_more: fprintf(file,"%4x %2x %2x",(unsigned)(aout_symbol(symbol)->desc & 0xffff), (unsigned)(aout_symbol(symbol)->other & 0xff), (unsigned)(aout_symbol(symbol)->type)); break; - case bfd_print_symbol_all_enum: + case bfd_print_symbol_all: { CONST char *section_name = symbol->section == (asection *)NULL ? "*abs" : symbol->section->name; @@ -1733,8 +1594,7 @@ DEFUN(NAME(aout,print_symbol),(ignore_abfd, afile, symbol, how), section_name, (unsigned)(aout_symbol(symbol)->desc & 0xffff), (unsigned)(aout_symbol(symbol)->other & 0xff), - (unsigned)(aout_symbol(symbol)->type & 0xff), - symbol->name); + (unsigned)(aout_symbol(symbol)->type & 0xff)); if (symbol->name) fprintf(file," %s", symbol->name); } @@ -1825,9 +1685,9 @@ DEFUN(NAME(aout,find_nearest_line),(abfd, } int -DEFUN(NAME(aout,sizeof_headers),(ignore_abfd, ignore), +DEFUN(NAME(aout,sizeof_headers),(ignore_abfd, execable), bfd *ignore_abfd AND - boolean ignore) + boolean execable) { return EXEC_BYTES_SIZE; } @@ -35,7 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ ( ((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 bfd_target *, b_out_callback, (bfd *)); @@ -115,9 +115,10 @@ b_out_callback (abfd) swap_exec_header (abfd, execp); /* Architecture and machine type */ - abfd->obj_arch = bfd_arch_i960; /* B.out only used on i960 */ - abfd->obj_machine = bfd_mach_i960_core; /* Default */ -/* FIXME: Set real machine type from file here */ + bfd_set_arch_mach(abfd, + bfd_arch_i960, /* B.out only used on i960 */ + bfd_mach_i960_core /* Default */ + ); /* The positions of the string table and symbol table. */ 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_MASK 0x00ffffff -static bfd_reloc_status_enum_type +static bfd_reloc_status_type callj_callback(abfd, reloc_entry, symbol_in, data, input_section) bfd *abfd; arelent *reloc_entry; @@ -639,8 +640,8 @@ b_out_set_arch_mach (abfd, arch, machine) enum bfd_architecture arch; unsigned long machine; { - abfd->obj_arch = arch; - abfd->obj_machine = machine; + bfd_default_set_arch_mach(abfd, arch, machine); + if (arch == bfd_arch_unknown) /* Unknown machine arch is OK */ return true; 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); } - @@ -703,7 +703,7 @@ DEFUN(b_out_sizeof_headers,(ignore_abfd, ignore), bfd_target b_out_vec_big_host = { "b.out.big", /* name */ - bfd_target_aout_flavour_enum, + bfd_target_aout_flavour, false, /* data byte order is little */ true, /* hdr byte order is big */ (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 = { "b.out.little", /* name */ - bfd_target_aout_flavour_enum, + bfd_target_aout_flavour, false, /* data byte order is little */ false, /* header byte order is little */ (HAS_RELOC | EXEC_P | /* object flags */ diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c index 169bdc8..eb999a4 100644 --- a/bfd/coff-a29k.c +++ b/bfd/coff-a29k.c @@ -56,7 +56,7 @@ asymbol *symbol; return(relocation); } -static bfd_reloc_status_enum_type +static bfd_reloc_status_type a29k_reloc(abfd, reloc_entry, symbol_in, data, input_section) bfd *abfd; arelent *reloc_entry; @@ -68,7 +68,7 @@ asection *input_section; static unsigned long part1_consth_value; unsigned long insn, value, sym_value; unsigned short r_type; -/* bfd_reloc_status_enum_type result;*/ +/* bfd_reloc_status_type result;*/ /* coff_symbol_type *cs = coffsymbol(symbol_in);*/ r_type = reloc_entry->howto->type; @@ -212,7 +212,7 @@ static reloc_howto_type howto_table[] = bfd_target a29kcoff_big_vec = { "coff-a29k-big", /* name */ - bfd_target_coff_flavour_enum, + bfd_target_coff_flavour, true, /* data byte order is big */ true, /* header byte order is big */ diff --git a/bfd/host-aout.c b/bfd/host-aout.c index 251dd3d..c2e63a2 100644 --- a/bfd/host-aout.c +++ b/bfd/host-aout.c @@ -250,38 +250,38 @@ DEFUN(NAME(host_aout,write_object_contents), (abfd), /* We use BFD generic archive files. */ #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_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_write_armap bsd_write_armap -#define aout_32_truncate_arname bfd_bsd_truncate_arname -/* #define aout_32_machine_type sunos_machine_type */ +#define aout_32_write_armap (PROTO (boolean, (*), \ + (bfd *arch, unsigned int elength, struct orl *map, int orl_count, \ + int stridx))) bfd_false +#define aout_32_truncate_arname bfd_dont_truncate_arname -/* Traditional Unix core files with upage */ -#define aout_32_core_file_failing_command trad_unix_core_file_failing_command -#define aout_32_core_file_failing_signal trad_unix_core_file_failing_signal -#define aout_32_core_file_matches_executable_p trad_unix_core_file_matches_executable_p - - -#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 +/* No core file defined here -- configure in trad-core.c separately. */ +#define aout_32_core_file_failing_command bfd_false +#define aout_32_core_file_failing_signal bfd_false +#define aout_32_core_file_matches_executable_p bfd_true +#define some_kinda_core_file_p bfd_false #define aout_32_bfd_debug_info_start 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_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 a.out versions. */ @@ -290,7 +290,7 @@ DEFUN(NAME(host_aout,write_object_contents), (abfd), bfd_target host_aout_big_vec = { "a.out-host-big", - bfd_target_aout_flavour_enum, + bfd_target_aout_flavour, true, /* target byte order */ true, /* target headers byte order */ (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 */ {_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_generic_mkarchive, bfd_false}, {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 = { "a.out-host-little", - bfd_target_aout_flavour_enum, + bfd_target_aout_flavour, false, /* target byte order */ false, /* target headers byte order */ (HAS_RELOC | EXEC_P | /* object flags */ @@ -326,11 +326,11 @@ bfd_target host_aout_little_vec = ' ', /* ar_pad_char */ 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, /* hdrs */ + _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putb16, /* data */ + _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */ {_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_generic_mkarchive, bfd_false}, {bfd_false, NAME(host_aout,write_object_contents), /* bfd_write_contents */ diff --git a/bfd/libaout.h b/bfd/libaout.h index c3b55ac..269dd41 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -1,26 +1,26 @@ /* 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 - share large masses of code. This means we only have to fix bugs in - one place, most of the time. */ +This file is part of BFD, the Binary File Descriptor library. -/* Copyright (C) 1990, 1991 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Diddler. - -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 -the Free Software Foundation; either version 1, or (at your option) -any later version. +the Free Software Foundation; either version 2 of the License, or +(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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with BFD; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +along with this program; if not, write to the Free Software +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$ */ @@ -30,7 +30,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define CAT3(a,b,c) a/**/b/**/c #endif - /* Parameterize the a.out code based on whether it is being built for a 32-bit architecture or a 64-bit architecture. */ #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) +/* 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 { asymbol symbol; 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 (alent *, NAME(aout,get_lineno), (bfd *ignore_abfd, asymbol *ignore_symbol)); 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,find_nearest_line), (bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset, CONST char **filename_ptr, @@ -172,18 +176,23 @@ PROTO (void, NAME(aout,swap_exec_header_out),(bfd *abfd, struct internal_exec *e #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) \ { \ execp->a_text = obj_textsec (abfd)->size + EXEC_BYTES_SIZE; \ 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) \ + { N_SET_MAGIC (*execp, NMAGIC); } \ + else \ + { N_SET_MAGIC(*execp, OMAGIC); } \ } \ - else { \ - N_SET_MAGIC(*execp, OMAGIC); \ - } \ if (abfd->flags & D_PAGED) \ { \ data_pad = ((obj_datasec(abfd)->size + PAGE_SIZE -1) \ diff --git a/bfd/newsos3.c b/bfd/newsos3.c index 8952c0f..588e56b 100644 --- a/bfd/newsos3.c +++ b/bfd/newsos3.c @@ -78,9 +78,10 @@ DEFUN(newsos3_callback,(abfd), WORK_OUT_FILE_POSITIONS(abfd, execp) ; - /* Determine the architecture and machine type of the object file. */ - abfd->obj_arch = bfd_arch_m68k; - abfd->obj_machine = 0; + /* Determine the architecture and machine type of the object file. + */ + bfd_default_set_arch_mach(abfd, bfd_arch_m68k, 0); + return abfd->xvec; } @@ -145,7 +146,7 @@ DEFUN(newsos3_write_object_contents,(abfd), bfd_target newsos3_vec = /* Sony 68k-based machines running newsos3 */ { "a.out-newsos3", /* name */ - bfd_target_aout_flavour_enum, + bfd_target_aout_flavour, true, /* target byte order */ true, /* target headers byte order */ (HAS_RELOC | EXEC_P | /* object flags */ |