From 214f8f2392b9c23f589ca2346e30faff01d8e09f Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 9 Oct 1992 01:39:06 +0000 Subject: [PATCH] * aout-target.h (callback): Don't define this function if it won't be used. * aoutx.h (some_aout_object_p): Restore old aout_data value if this type doesn't match. Don't lose if file sections have already been created. (set_arch_mach): Set reloc_entry_size. (slurp_symbol_table): Use bfd_h_get_{16,8} for reaeding symbol data. * hosts/i386bsd.h: New file. * configure.in: Recognize i[34]86-*-bsd host. * aout-target.h (callback, write_object_contents): Delete unused variables. * aoutx.h (reloc_type_lookup): New function. * aout-target.h (MY_reloc_howto_type_lookup): Use it as default. * aoutf1.h (sunos4_reloc_type_lookup): Deleted. (MY_reloc_howto_type_lookup): Don't define it. * aoutx.h (adjust_sizes_and_vmas): Don't bother with padding for OMAGIC files. (slurp_symbol_table): Use header byte order, not target byte order, for reading symbol data. --- bfd/ChangeLog | 27 +++++++ bfd/aout-target.h | 8 +- bfd/aoutf1.h | 183 +++++++++++++++++++++++--------------------- bfd/aoutx.h | 105 ++++++++++++++++++------- bfd/configure.in | 1 + bfd/hosts/.Sanitize | 1 + bfd/hosts/i386bsd.h | 46 +++++++++++ bfd/i386bsd.c | 26 ++----- 8 files changed, 260 insertions(+), 137 deletions(-) create mode 100644 bfd/hosts/i386bsd.h diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9d1f4dd80a3..1b716a7228f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,30 @@ +Thu Oct 8 18:12:49 1992 Ken Raeburn (raeburn@cygnus.com) + + * aout-target.h (callback): Don't define this function if it won't be + used. + + * aoutx.h (some_aout_object_p): Restore old aout_data value if this + type doesn't match. Don't lose if file sections have already been + created. + (set_arch_mach): Set reloc_entry_size. + (slurp_symbol_table): Use bfd_h_get_{16,8} for reaeding symbol data. + + * hosts/i386bsd.h: New file. + * configure.in: Recognize i[34]86-*-bsd host. + + * aout-target.h (callback, write_object_contents): Delete unused + variables. + + * aoutx.h (reloc_type_lookup): New function. + * aout-target.h (MY_reloc_howto_type_lookup): Use it as default. + * aoutf1.h (sunos4_reloc_type_lookup): Deleted. + (MY_reloc_howto_type_lookup): Don't define it. + + * aoutx.h (adjust_sizes_and_vmas): Don't bother with padding for + OMAGIC files. + (slurp_symbol_table): Use header byte order, not target byte + order, for reading symbol data. + Thu Oct 8 17:33:39 1992 John Gilmore (gnu@cygnus.com) * configure.in: Undo some brain damage in the host section. diff --git a/bfd/aout-target.h b/bfd/aout-target.h index 3dec207573f..9b8273a7c9e 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -22,14 +22,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "aout/ar.h" /*#include "libaout.h"*/ +extern CONST struct reloc_howto_struct * NAME(aout,reloc_type_lookup) (); + /* Set parameters about this a.out file that are machine-dependent. This routine is called from some_aout_object_p just before it returns. */ +#ifndef MY_callback static bfd_target * DEFUN(MY(callback),(abfd), bfd *abfd) { struct internal_exec *execp = exec_hdr (abfd); - struct aout_backend_data *abdp; /* Calculate the file positions of the parts of a newly read aout header */ obj_textsec (abfd)->_raw_size = N_TXTSIZE(*execp); @@ -72,6 +74,7 @@ DEFUN(MY(callback),(abfd), return abfd->xvec; } +#endif #ifndef MY_object_p /* Finish up the reading of an a.out file header */ @@ -153,7 +156,6 @@ static boolean DEFUN(MY(write_object_contents),(abfd), bfd *abfd) { - bfd_size_type data_pad = 0; struct external_exec exec_bytes; struct internal_exec *execp = exec_hdr (abfd); @@ -320,7 +322,7 @@ static CONST struct aout_backend_data MY(backend_data) = { #define MY_bfd_debug_info_accumulat NAME(aout,bfd_debug_info_accumulat) #endif #ifndef MY_reloc_howto_type_lookup -#define MY_reloc_howto_type_lookup 0 +#define MY_reloc_howto_type_lookup NAME(aout,reloc_type_lookup) #endif #ifndef MY_make_debug_symbol #define MY_make_debug_symbol 0 diff --git a/bfd/aoutf1.h b/bfd/aoutf1.h index 491bc541b73..8f4906ccee4 100644 --- a/bfd/aoutf1.h +++ b/bfd/aoutf1.h @@ -53,64 +53,17 @@ The name put into the target vector. void (*bfd_error_trap)(); -static bfd_target *sunos4_callback (); - /*SUPPRESS558*/ /*SUPPRESS529*/ -bfd_target * -DEFUN(NAME(sunos,object_p), (abfd), - bfd *abfd) -{ - struct external_exec exec_bytes; /* Raw exec header from file */ - struct internal_exec exec; /* Cleaned-up exec header */ - - if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE) { - bfd_error = wrong_format; - return 0; - } - - exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info); - - if (N_BADMAG (exec)) return 0; - - NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec); - - return NAME(aout,some_aout_object_p) (abfd, &exec, sunos4_callback); -} - - /* Determine the size of a relocation entry, based on the architecture */ -static void -DEFUN(choose_reloc_size,(abfd), -bfd *abfd) -{ - 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. */ - -static bfd_target * -sunos4_callback (abfd) - bfd *abfd; +void +DEFUN(NAME(sunos,set_arch_mach), (abfd, machtype), + bfd *abfd AND int machtype) { - struct internal_exec *execp = exec_hdr (abfd); + /* Determine the architecture and machine type of the object file. */ 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))) { + switch (machtype) { case M_UNKNOWN: /* Some Sun3s make magic numbers without cpu types in them, so @@ -157,18 +110,27 @@ sunos4_callback (abfd) break; } bfd_set_arch_mach(abfd, arch, machine); - choose_reloc_size(abfd); - adata(abfd)->page_size = PAGE_SIZE; -#ifdef SEGMENT_SIZE - adata(abfd)->segment_size = SEGMENT_SIZE; -#else - adata(abfd)->segment_size = PAGE_SIZE; -#endif - adata(abfd)->exec_bytes_size = EXEC_BYTES_SIZE; - - return abfd->xvec; } +#define SET_ARCH_MACH(ABFD, EXEC) \ + NAME(sunos,set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \ + choose_reloc_size(ABFD); + +/* Determine the size of a relocation entry, based on the architecture */ +static void +DEFUN(choose_reloc_size,(abfd), +bfd *abfd) +{ + 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; + } +} /* Write an object file in SunOS format. Section contents have already been written. We write the @@ -183,8 +145,6 @@ DEFUN(NAME(aout,sunos4_write_object_contents), struct external_exec exec_bytes; struct internal_exec *execp = exec_hdr (abfd); - execp->a_text = obj_textsec (abfd)->size; - /* Magic number, maestro, please! */ switch (bfd_get_arch(abfd)) { case bfd_arch_m68k: @@ -217,7 +177,7 @@ DEFUN(NAME(aout,sunos4_write_object_contents), N_SET_FLAGS (*execp, 0x1); WRITE_HEADERS(abfd, execp); - + return true; } @@ -338,7 +298,7 @@ DEFUN(swapcore_sun3,(abfd, ext, intcore), intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_tsize); intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_dsize); intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_ssize); - bcopy (extcore->c_cmdname, intcore->c_cmdname, sizeof (intcore->c_cmdname)); + memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); intcore->fp_stuff_pos = (long) (((struct external_sun3_core *)0)->fp_stuff); /* FP stuff takes up whole rest of struct, except c_ucode. */ intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - @@ -369,7 +329,7 @@ DEFUN(swapcore_sparc,(abfd, ext, intcore), intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_tsize); intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_dsize); intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_ssize); - bcopy (extcore->c_cmdname, intcore->c_cmdname, sizeof (intcore->c_cmdname)); + memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); intcore->fp_stuff_pos = (long) (((struct external_sparc_core *)0)->fp_stuff); /* FP stuff takes up whole rest of struct, except c_ucode. */ intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - @@ -385,14 +345,14 @@ DEFUN(swapcore_sparc,(abfd, ext, intcore), } /* need this cast because ptr is really void * */ -#define core_hdr(bfd) (((struct suncoredata *) (bfd->tdata))->hdr) -#define core_datasec(bfd) (((struct suncoredata *) ((bfd)->tdata))->data_section) -#define core_stacksec(bfd) (((struct suncoredata*)((bfd)->tdata))->stack_section) -#define core_regsec(bfd) (((struct suncoredata *) ((bfd)->tdata))->reg_section) -#define core_reg2sec(bfd) (((struct suncoredata *) ((bfd)->tdata))->reg2_section) +#define core_hdr(bfd) ((bfd)->tdata.sun_core_data) +#define core_datasec(bfd) (core_hdr(bfd)->data_section) +#define core_stacksec(bfd) (core_hdr(bfd)->stack_section) +#define core_regsec(bfd) (core_hdr(bfd)->reg_section) +#define core_reg2sec(bfd) (core_hdr(bfd)->reg2_section) /* These are stored in the bfd's tdata */ -struct suncoredata { +struct sun_core_struct { struct internal_sunos_core *hdr; /* core file header */ asection *data_section; asection *stack_section; @@ -410,7 +370,7 @@ DEFUN(sunos4_core_file_p,(abfd), struct internal_sunos_core *core; char *extcore; struct mergem { - struct suncoredata suncoredata; + struct sun_core_struct suncoredata; struct internal_sunos_core internal_sunos_core; char external_core[1]; } *mergem; @@ -466,8 +426,8 @@ DEFUN(sunos4_core_file_p,(abfd), return 0; } - set_tdata (abfd, &mergem->suncoredata); - core_hdr (abfd) = core; + abfd->tdata.sun_core_data = &mergem->suncoredata; + abfd->tdata.sun_core_data->hdr = core; /* create the sections. This is raunchy, but bfd_close wants to reclaim them */ @@ -506,10 +466,10 @@ DEFUN(sunos4_core_file_p,(abfd), core_regsec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS; core_reg2sec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS; - core_stacksec (abfd)->size = core->c_ssize; - core_datasec (abfd)->size = core->c_dsize; - core_regsec (abfd)->size = core->c_regs_size; - core_reg2sec (abfd)->size = core->fp_stuff_size; + core_stacksec (abfd)->_raw_size = core->c_ssize; + core_datasec (abfd)->_raw_size = core->c_dsize; + core_regsec (abfd)->_raw_size = core->c_regs_size; + core_reg2sec (abfd)->_raw_size = core->fp_stuff_size; core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize); core_datasec (abfd)->vma = N_DATADDR(core->c_aouthdr); @@ -541,14 +501,14 @@ DEFUN(sunos4_core_file_p,(abfd), static char *sunos4_core_file_failing_command (abfd) bfd *abfd; { - return core_hdr (abfd)->c_cmdname; + return core_hdr (abfd)->hdr->c_cmdname; } static int DEFUN(sunos4_core_file_failing_signal,(abfd), bfd *abfd) { - return core_hdr (abfd)->c_signo; + return core_hdr (abfd)->hdr->c_signo; } static boolean @@ -561,10 +521,61 @@ DEFUN(sunos4_core_file_matches_executable_p, (core_bfd, exec_bfd), return false; } - return (bcmp ((char *)&core_hdr (core_bfd)->c_aouthdr, - (char *) exec_hdr (exec_bfd), - sizeof (struct internal_exec)) == 0) ? true : false; + return (memcmp ((char *)&((core_hdr (core_bfd)->hdr)->c_aouthdr), + (char *) exec_hdr (exec_bfd), + sizeof (struct internal_exec)) == 0) ? true : false; +} + +extern reloc_howto_type aout_32_ext_howto_table[]; + +static reloc_howto_type * +DEFUN (sunos4_reloc_type_lookup, (abfd, code), + bfd *abfd AND + bfd_reloc_code_real_type code) +{ + switch (bfd_get_arch (abfd)) + { + default: + return 0; + case bfd_arch_sparc: + switch (code) + { + default: + return 0; +#define IDX(i,j) case i: return &aout_32_ext_howto_table[j] + IDX (BFD_RELOC_CTOR, 2); + IDX (BFD_RELOC_32, 2); + IDX (BFD_RELOC_HI22, 8); + IDX (BFD_RELOC_LO10, 11); + IDX (BFD_RELOC_32_PCREL_S2, 6); + } + } } + +static boolean +DEFUN (sunos4_set_sizes, (abfd), + bfd *abfd) +{ + switch (bfd_get_arch (abfd)) + { + default: + return false; + case bfd_arch_sparc: + adata(abfd).page_size = 0x2000; + adata(abfd).segment_size = 0x2000; + adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; + return true; + case bfd_arch_m68k: + adata(abfd).page_size = 0x2000; + adata(abfd).segment_size = 0x20000; + adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; + return true; + } +} + +static CONST struct aout_backend_data sunos4_aout_backend = { + 0, 1, 0, sunos4_set_sizes, +}; #define MY_core_file_failing_command sunos4_core_file_failing_command #define MY_core_file_failing_signal sunos4_core_file_failing_signal @@ -573,9 +584,9 @@ DEFUN(sunos4_core_file_matches_executable_p, (core_bfd, exec_bfd), #define MY_bfd_debug_info_start bfd_void #define MY_bfd_debug_info_end bfd_void #define MY_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void -#define MY_object_p NAME(sunos,object_p) #define MY_core_file_p sunos4_core_file_p #define MY_write_object_contents NAME(aout,sunos4_write_object_contents) +#define MY_backend_data &sunos4_aout_backend #define TARGET_IS_BIG_ENDIAN_P diff --git a/bfd/aoutx.h b/bfd/aoutx.h index b7d61970b3a..12e3d23d116 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -178,7 +178,6 @@ reloc_howto_type howto_table_ext[] = HOWTO(RELOC_GLOB_DAT,0, 2, 0, false, 0, false, true,0,"GLOB_DAT", 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), - }; /* Convert standard reloc records to "arelent" format (incl byte swap). */ @@ -195,6 +194,41 @@ HOWTO( 6, 0, 2, 32, true, 0, false, true,0,"DISP32", true, 0xfffffff HOWTO( 7, 0, 3, 64, true, 0, false, true,0,"DISP64", true, 0xfeedface,0xfeedface, false), }; +CONST struct reloc_howto_struct * +DEFUN(NAME(aout,reloc_type_lookup),(abfd,code), + bfd *abfd AND + bfd_reloc_code_real_type code) +{ +#define EXT(i,j) case i: return &howto_table_ext[j] +#define STD(i,j) case i: return &howto_table_std[j] + int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE; + if (code == BFD_RELOC_CTOR) + switch (bfd_get_arch_info (abfd)->bits_per_address) + { + case 32: + code = BFD_RELOC_32; + break; + } + if (ext) + switch (code) + { + EXT (BFD_RELOC_32, 2); + EXT (BFD_RELOC_HI22, 8); + EXT (BFD_RELOC_LO10, 11); + EXT (BFD_RELOC_32_PCREL_S2, 6); + } + else + /* std relocs */ + switch (code) + { + STD (BFD_RELOC_16, 1); + STD (BFD_RELOC_32, 2); + STD (BFD_RELOC_8_PCREL, 4); + STD (BFD_RELOC_16_PCREL, 5); + STD (BFD_RELOC_32_PCREL, 6); + } + return 0; +} extern bfd_error_vector_type bfd_error_vector; @@ -307,7 +341,7 @@ DEFUN(NAME(aout,some_aout_object_p),(abfd, execp, callback_to_real_object_p), struct internal_exec *execp AND bfd_target *(*callback_to_real_object_p) ()) { - struct aout_data_struct *rawptr; + struct aout_data_struct *rawptr, *oldrawptr; bfd_target *result; rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, sizeof (struct aout_data_struct )); @@ -316,6 +350,7 @@ DEFUN(NAME(aout,some_aout_object_p),(abfd, execp, callback_to_real_object_p), return 0; } + oldrawptr = abfd->tdata.aout_data; abfd->tdata.aout_data = rawptr; abfd->tdata.aout_data->a.hdr = &rawptr->e; *(abfd->tdata.aout_data->a.hdr) = *execp; /* Copy in the internal_exec struct */ @@ -356,19 +391,15 @@ DEFUN(NAME(aout,some_aout_object_p),(abfd, execp, callback_to_real_object_p), /* create the sections. This is raunchy, but bfd_close wants to reclaim them */ - obj_textsec (abfd) = (asection *)NULL; - obj_datasec (abfd) = (asection *)NULL; - obj_bsssec (abfd) = (asection *)NULL; - - (void)bfd_make_section(abfd, ".text"); - (void)bfd_make_section(abfd, ".data"); - (void)bfd_make_section(abfd, ".bss"); -/* (void)bfd_make_section(abfd, BFD_ABS_SECTION_NAME); - (void)bfd_make_section (abfd, BFD_UND_SECTION_NAME); - (void)bfd_make_section (abfd, BFD_COM_SECTION_NAME);*/ - abfd->sections = obj_textsec (abfd); - obj_textsec (abfd)->next = obj_datasec (abfd); - obj_datasec (abfd)->next = obj_bsssec (abfd); + obj_textsec (abfd) = bfd_make_section_old_way (abfd, ".text"); + obj_datasec (abfd) = bfd_make_section_old_way (abfd, ".data"); + obj_bsssec (abfd) = bfd_make_section_old_way (abfd, ".bss"); + +#if 0 + (void)bfd_make_section (abfd, ".text"); + (void)bfd_make_section (abfd, ".data"); + (void)bfd_make_section (abfd, ".bss"); +#endif obj_datasec (abfd)->_raw_size = execp->a_data; obj_bsssec (abfd)->_raw_size = execp->a_bss; @@ -422,15 +453,6 @@ DEFUN(NAME(aout,some_aout_object_p),(abfd, execp, callback_to_real_object_p), break; } - /* Determine the size of a relocation entry */ - switch (abfd->obj_arch) { - case bfd_arch_sparc: - case bfd_arch_a29k: - obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; - default: - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - } - adata(abfd)->page_size = PAGE_SIZE; adata(abfd)->segment_size = SEGMENT_SIZE; adata(abfd)->exec_bytes_size = EXEC_BYTES_SIZE; @@ -460,6 +482,17 @@ DEFUN(NAME(aout,some_aout_object_p),(abfd, execp, callback_to_real_object_p), if ((execp->a_entry >= obj_textsec(abfd)->vma) && (execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size)) abfd->flags |= EXEC_P; + if (result) + { + abfd->sections = obj_textsec (abfd); + obj_textsec (abfd)->next = obj_datasec (abfd); + obj_datasec (abfd)->next = obj_bsssec (abfd); + } + else + { + free (rawptr); + abfd->tdata.aout_data = oldrawptr; + } return result; } @@ -595,6 +628,17 @@ DEFUN(NAME(aout,set_arch_mach),(abfd, arch, machine), NAME(aout,machine_type) (arch, machine) == M_UNKNOWN) return false; /* We can't represent this type */ + /* Determine the size of a relocation entry */ + switch (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; + } + return (*aout_backend_info(abfd)->set_sizes) (abfd); } @@ -664,15 +708,16 @@ DEFUN (NAME (aout,adjust_sizes_and_vmas), (abfd, text_size, text_end), { file_ptr pos = adata (abfd).exec_bytes_size; bfd_vma vma = 0; - int pad; + int pad = 0; obj_textsec(abfd)->filepos = pos; pos += obj_textsec(abfd)->_raw_size; vma += obj_textsec(abfd)->_raw_size; if (!obj_datasec(abfd)->user_set_vma) { - /* ?? Does alignment in the file image really matter? */ +#if 0 /* ?? Does alignment in the file image really matter? */ pad = align_power (vma, obj_datasec(abfd)->alignment_power) - vma; +#endif obj_textsec(abfd)->_raw_size += pad; pos += pad; vma += pad; @@ -683,7 +728,9 @@ DEFUN (NAME (aout,adjust_sizes_and_vmas), (abfd, text_size, text_end), vma += obj_datasec(abfd)->_raw_size; if (!obj_bsssec(abfd)->user_set_vma) { +#if 0 pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma; +#endif obj_datasec(abfd)->_raw_size += pad; pos += pad; vma += pad; @@ -1282,9 +1329,9 @@ DEFUN(NAME(aout,slurp_symbol_table),(abfd), 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->desc = bfd_h_get_16(abfd, sym_pointer->e_desc); + cache_ptr->other = bfd_h_get_8(abfd, sym_pointer->e_other); + cache_ptr->type = bfd_h_get_8(abfd, sym_pointer->e_type); cache_ptr->symbol.udata = 0; translate_from_native_sym_flags (sym_pointer, cache_ptr, abfd); } diff --git a/bfd/configure.in b/bfd/configure.in index 5180e09ff34..c3fdd47baea 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -24,6 +24,7 @@ a29k-*-*) my_host=ultra3 ;; hppa*-hp-hpux) my_host=hppahpux ;; hppa*-hp-bsd) my_host=hppabsd ;; +i[34]86-*-bsd) my_host=i386bsd ;; i[34]86-ncr*-sysv4*) my_host=ncr3000 ;; i[34]86-*-go32) my_host=go32 ;; i[34]86-*-sysv4*) my_host=i386v4 ;; diff --git a/bfd/hosts/.Sanitize b/bfd/hosts/.Sanitize index 39130f23a07..3956c65e3a3 100644 --- a/bfd/hosts/.Sanitize +++ b/bfd/hosts/.Sanitize @@ -38,6 +38,7 @@ hp300bsd.h hp300.h hppabsd.h hppahpux.h +i386bsd.h i386linux.h i386mach.h i386v.h diff --git a/bfd/hosts/i386bsd.h b/bfd/hosts/i386bsd.h new file mode 100644 index 00000000000..6f1d7d72dfb --- /dev/null +++ b/bfd/hosts/i386bsd.h @@ -0,0 +1,46 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef O_ACCMODE +#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) +#endif + +#define SEEK_SET 0 +#define SEEK_CUR 1 + +extern PTR EXFUN(malloc, (unsigned)); +extern PTR EXFUN(realloc, (PTR, unsigned)); +extern void EXFUN(free, (PTR)); + +#define HAVE_STRERROR + +#define HOST_PAGE_SIZE NBPG +#define HOST_SEGMENT_SIZE NBPG +#define HOST_MACHINE_ARCH bfd_arch_i386 +#define HOST_TEXT_START_ADDR 0 /* By inspection */ +#define HOST_STACK_END_ADDR KERNBASE + +/* EXACT TYPES */ +typedef char int8e_type; +typedef unsigned char uint8e_type; +typedef short int16e_type; +typedef unsigned short uint16e_type; +typedef int int32e_type; +typedef unsigned int uint32e_type; + +/* CORRECT SIZE OR GREATER */ +typedef char int8_type; +typedef unsigned char uint8_type; +typedef short int16_type; +typedef unsigned short uint16_type; +typedef int int32_type; +typedef unsigned int uint32_type; +#include "fopen-same.h" diff --git a/bfd/i386bsd.c b/bfd/i386bsd.c index 3c86c8b5f93..560ddd62a0c 100644 --- a/bfd/i386bsd.c +++ b/bfd/i386bsd.c @@ -1,4 +1,4 @@ -/* BFD back-end for i386 a.out binaries. +/* BFD back-end for i386 a.out binaries under 386BSD. Copyright (C) 1990, 1991 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,32 +18,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* The only 386 aout system we have here is GO32 from DJ. - These numbers make BFD work with that. If your aout 386 system - doesn't work with these, we'll have to split them into different - files. Send me (sac@cygnus.com) the runes to make it work on your - system, and I'll stick it in for the next release. +/* This data should be correct (or made correct) for the format used + under 386BSD (from Bill and Lynne Jolitz). It may be good for BSD/386 + (from BSDI) as well; I haven't had a chance to test it. */ - */ #define TARGET_IS_LITTLE_ENDIAN_P #define N_HEADER_IN_TEXT(x) 0 #define BYTES_IN_WORD 4 #define ARCH 32 -#if 0 -#define N_TXTOFF(x) 0x20 -#define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0) -#else -#define N_TXTOFF(x) (N_MAGIC(x)==ZMAGIC ? 0x1000 : 0x20) -#define N_TXTADDR(x) 0 -#endif +#define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? 0x1000 : 0x20) +#define N_TXTADDR(x) 0 #define N_TXTSIZE(x) ((x).a_text) -#if 0 -#define N_DATADDR(x) (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) : (SEGMENT_SIZE + ((0x1020+(x).a_text-1) & ~(SEGMENT_SIZE-1)))) -#define NOSUBEXECB - -#endif #define PAGE_SIZE 4096 #define SEGMENT_SIZE PAGE_SIZE #define DEFAULT_ARCH bfd_arch_i386 @@ -55,4 +42,5 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "sysdep.h" #include "libbfd.h" #include "libaout.h" + #include "aout-target.h" -- 2.30.2