From: Steve Chamberlain Date: Sat, 18 May 1991 02:57:45 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=19b03b7aa4dd0eccffab131fd91495ef122fccc7;p=binutils-gdb.git *** empty log message *** --- diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 22bcb459807..462e3949a3d 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -37,16 +37,16 @@ CFLAGS = -g $(HDEFINES) $(TDEFINES) $(CSEARCH) $(CSWITCHES) # -DINTEL960VERSION BFD_LIBS = libbfd.o opncls.o bfd.o archive.o targets.o cache.o \ archures.o -BFD_BACKENDS = oasys.o ieee.o srec.o aout.o sunos.o icoff.o b.out.o \ - m68kcoff.o m88k-bcs.o coffswap.o ecoff.o newsos3.o # trad-core.o +BFD_BACKENDS = oasys.o ieee.o srec.o aout64.o aout32.o sunos.o icoff.o demo64.o \ + m68kcoff.o m88k-bcs.o coffswap.o ecoff.o newsos3.o # trad-core.o bout.o BFD_H=$(INCDIR)/bfd.h SYSDEP_H=$(INCDIR)/sysdep.h # C source files that correspond to .o's. CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c archures.c \ - aout.c sunos.c icoff.c b.out.c srec.c oasys.c ieee.c m68kcoff.c \ - m88k-bcs.c coffswap.c ecoff.c trad-core.c newsos3.c + aout64.c aout32.c sunos.c demo64.c icoff.c srec.c oasys.c ieee.c m68kcoff.c \ + m88k-bcs.c coffswap.c ecoff.c trad-core.c newsos3.c #bout.c STAGESTUFF = $(TARGETLIB) $(OFILES) diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c index cbbd49ea396..a0b04be17ef 100644 --- a/bfd/coff-i960.c +++ b/bfd/coff-i960.c @@ -24,7 +24,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define BADMAG(x) I960BADMAG(x) #include -#include "sysdep.h" + #include "bfd.h" #include "libbfd.h" #include "obstack.h" @@ -70,7 +70,7 @@ asection *ignore_input_section; to the correct location */ { union internal_auxent *aux = (union internal_auxent *)(cs->native+2); - int word = bfd_getlong(abfd, data + reloc_entry->address); + int word = bfd_get_32(abfd, data + reloc_entry->address); int olf = (aux->x_bal.x_balntry - cs->native->n_value); BFD_ASSERT(cs->native->n_numaux==2); /* We replace the original call instruction with a bal to */ @@ -80,7 +80,7 @@ asection *ignore_input_section; /* offset of the bal entry point */ word = ((word + olf) & BAL_MASK) | BAL; - bfd_putlong(abfd, word, data+reloc_entry->address); + bfd_put_32(abfd, word, data+reloc_entry->address); } result = bfd_reloc_ok; break; @@ -158,17 +158,17 @@ bfd_target icoff_little_vec = '/', /* ar_pad_char */ 15, /* ar_max_namelen */ - _do_getllong, _do_putllong, _do_getlshort, _do_putlshort, /* data */ - _do_getllong, _do_putllong, _do_getlshort, _do_putlshort, /* hdrs */ + _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */ + _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */ - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {bfd_false, coff_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, coff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, coff_mkobject, /* bfd_set_format */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, JUMP_TABLE(coff) -}; + }; bfd_target icoff_big_vec = @@ -186,8 +186,8 @@ bfd_target icoff_big_vec = '/', /* ar_pad_char */ 15, /* ar_max_namelen */ - _do_getllong, _do_putllong, _do_getlshort, _do_putlshort, /* data */ - _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* hdrs */ +_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */ +_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */ {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ bfd_generic_archive_p, _bfd_dummy_target}, diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c index 19bf02986d6..c3ae26e0a75 100644 --- a/bfd/coff-m68k.c +++ b/bfd/coff-m68k.c @@ -41,8 +41,8 @@ static reloc_howto_type howto_table[] = /* Turn a howto into a reloc nunmber */ -#define SELECT_RELOC(x,howto) { x = howto_table[howto->size +howto->pc_relative*3].type; } +#define SELECT_RELOC(x,howto) { x = howto_table[howto->size +(int)howto->pc_relative*3].type; } #define BADMAG(x) M68KBADMAG(x) #include "coff-code.h" @@ -65,8 +65,8 @@ bfd_target m68kcoff_vec = '/', /* ar_pad_char */ 15, /* ar_max_namelen */ - _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* data */ - _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* hdrs */ +_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 */ {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ bfd_generic_archive_p, _bfd_dummy_target}, diff --git a/bfd/coff-m88k.c b/bfd/coff-m88k.c index cdb7908846e..71a4497ea8c 100644 --- a/bfd/coff-m88k.c +++ b/bfd/coff-m88k.c @@ -57,13 +57,13 @@ asection *ignore_input_section) { long relocation; bfd_vma addr = reloc_entry->address; - long x = bfd_getshort(abfd, (bfd_byte *)data + addr); + long x = bfd_get_16(abfd, (bfd_byte *)data + addr); HOWTO_PREPARE(relocation, symbol_in); x = (x + relocation + reloc_entry->addend) >> 16; - bfd_putshort(abfd, x, (bfd_byte *)data + addr); + bfd_put_16(abfd, x, (bfd_byte *)data + addr); return bfd_reloc_ok; } @@ -105,8 +105,8 @@ bfd_target m88k_bcs_vec = '/', /* ar_pad_char */ 15, /* ar_max_namelen */ - _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* data */ - _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* hdrs */ +_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 */ {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ bfd_generic_archive_p, _bfd_dummy_target}, diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index effbac41f06..362be5696ed 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -29,7 +29,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "bfd.h" #include "libbfd.h" -#include "sysdep.h" + #include "intel-coff.h" #include "libcoff.h" /* to allow easier abstraction-breaking */ @@ -50,8 +50,8 @@ bfd_target ecoff_little_vec = (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */ '/', /* ar_pad_char */ 15, /* ar_max_namelen */ - _do_getllong, _do_putllong, _do_getlshort, _do_putlshort, /* data */ - _do_getllong, _do_putllong, _do_getlshort, _do_putlshort, /* hdrs */ +_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */ +_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */ {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ bfd_generic_archive_p, _bfd_dummy_target}, @@ -74,9 +74,8 @@ bfd_target ecoff_big_vec = (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */ ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ - _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* data */ - _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* hdrs */ - +_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 */ {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ bfd_generic_archive_p, _bfd_dummy_target}, {bfd_false, coff_mkobject, bfd_false, /* bfd_set_format */ diff --git a/bfd/coffswap.c b/bfd/coffswap.c index 78aea536f60..b1f74517eeb 100755 --- a/bfd/coffswap.c +++ b/bfd/coffswap.c @@ -19,14 +19,14 @@ You should have received a copy of the GNU General Public License along with */ /* Most of this hacked by Steve Chamberlain, steve@cygnus.com */ - +#if 0 #include #include "intel-coff.h" #include "bfd.h" #include "libcoff.h" /* to allow easier abstraction-breaking */ #define sp(x) bfd_h_put_x(abfd, x, &x) -#if 0 + /* All the generic swapping routines: FIXME diff --git a/bfd/hosts/sparc.h b/bfd/hosts/sparc.h index 376aad6fcb4..a4652a233e7 100644 --- a/bfd/hosts/sparc.h +++ b/bfd/hosts/sparc.h @@ -17,14 +17,14 @@ extern PROTO(int, close,(int)); extern PROTO(int, fcntl,(int des, int cmd)); extern PROTO(int, fprintf,(FILE *,char *,...)); extern PROTO(int, printf,(char *,...)); -extern PROTO(int, oqsort,(void *data,int els, int siz, int func())); +extern PROTO(int, qsort,(void *data,int els, int siz, int func())); extern PROTO(void, exit,(int)); extern PROTO(int, fseek,(FILE*, int, int)); extern PROTO(int, fclose,(FILE*)); extern PROTO(void, bcopy,(char*,char*,int)); extern PROTO(int, bcmp,(char *, char *, int)); extern PROTO(void, bzero,(char *, int)); -extern PROTO(char *,memset,(char*, int, int)); +extern PROTO(PTR,memset,(PTR, int,unsigned int)); PROTO(PTR, memcpy,(PTR,CONST PTR,unsigned int)); extern char * strchr(); extern PROTO(void, perror,(char *)); @@ -38,9 +38,13 @@ extern int fwrite(); extern int sscanf(); extern int stat(); extern int strtol(); -void free(); -char *malloc(); -char *realloc(); +#ifndef DONTDECLARE_MALLOC +extern PROTO(PTR,malloc,(unsigned)); +extern PROTO(PTR ,realloc, (PTR, unsigned)); +#endif + +extern PROTO(int, free,(PTR)); + PROTO (void, perror, (char *s)); extern char *strrchr(); extern char *ctime(); @@ -63,6 +67,16 @@ typedef unsigned short uint16e_type; typedef int int32e_type; typedef unsigned int uint32e_type; + +#ifdef __GNUC__ +typedef unsigned long long uint64e_type; + +#else +typedef struct { + uint32e_type low, high; +} uint64e_type; + +#endif /* CORRECT SIZE OR GREATER */ typedef char int8_type; typedef unsigned char uint8_type; @@ -71,3 +85,26 @@ typedef unsigned short uint16_type; typedef int int32_type; typedef unsigned int uint32_type; +#ifdef __GNUC__ +typedef unsigned long long uint64_type; +typedef long long int64_type; +#else +typedef struct { + uint32e_type low, high; +} uint64_type; + +typedef struct { + uint32e_type low, high; +} int64_type; + +#endif + + +#define BYTES_IN_PRINTF_INT 4 +#ifndef __GNUC__ +#define uint64_typeLOW(x) (uint32_type)(((x).low)) +#define uint64_typeHIGH(x) (uint32_type)(((x).high)) +#else +#define uint64_typeLOW(x) (uint32_type)(((x) & 0xffffffff)) +#define uint64_typeHIGH(x) (uint32_type)(((x) >> 32) & 0xffffffff) +#endif diff --git a/include/a.out.sun4.h b/include/a.out.sun4.h index 3ba363d55e4..4ce569da971 100755 --- a/include/a.out.sun4.h +++ b/include/a.out.sun4.h @@ -10,7 +10,7 @@ /* Offset in a.out file of the text section. For ZMAGIC, the text section actually includes the a.out header. */ -#define N_TXTOFF(x) ( (N_MAGIC((x)) == ZMAGIC) ? 0 : sizeof(struct exec) ) +#define N_TXTOFF(x) ( (N_MAGIC((x)) == ZMAGIC) ? 0 : EXEC_BYTES_SIZE) /* Virtual Address of text segment from the a.out file. For OMAGIC, (almost always "unlinked .o's" these days), should be zero. diff --git a/include/bfd.h b/include/bfd.h index 0a3d71073d7..8d50c433ae5 100644 --- a/include/bfd.h +++ b/include/bfd.h @@ -1,5 +1,7 @@ + /* A -*- C -*- header file for the bfd library */ + /*** bfd.h -- The only header file required by users of the bfd library */ /* Copyright (C) 1990, 1991 Free Software Foundation, Inc. @@ -27,6 +29,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define __BFD_H_SEEN__ #include "ansidecl.h" +#include "sysdep.h" #include "obstack.h" /* Make it easier to declare prototypes (puts conditional here) */ @@ -38,7 +41,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ # endif #endif -#define BFD_VERSION "1.9" +#define BFD_VERSION "1.10" /* forward declaration */ typedef struct _bfd bfd; @@ -52,11 +55,29 @@ typedef enum boolean {false, true} boolean; /* Try to avoid breaking stuff */ typedef long int file_ptr; -/* This is used to refer to locations inside a section's rawdata */ +/* Support for different sizes of target format ints */ + +#ifdef TARGET_64_BIT +/* 64 bit machines use these items */ +typedef uint64_type rawdata_offset; +typedef uint64_type bfd_vma; +typedef uint64_type bfd_word; +typedef uint64_type bfd_offset; +typedef uint64_type bfd_size_type; +typedef uint64_type symvalue; +#define printf_vma(x) printf("%08x%08x",uint64_typeHIGH(x), uint64_typeLOW(x)) +#define fprintf_vma(s,x) fprintf(s,"%08x%08x",uint64_typeHIGH(x), uint64_typeLOW(x)) +#else typedef unsigned long int rawdata_offset; - typedef unsigned long bfd_vma; typedef unsigned long bfd_offset; +typedef unsigned long bfd_word; +typedef unsigned long bfd_size; +typedef unsigned long symvalue; +typedef unsigned long bfd_size_type; +#define printf_vma(x) printf("%08x",x) +#define fprintf_vma(s,x) fprintf(s,"%08x",x) +#endif typedef unsigned int flagword; /* 32 bits of flags */ @@ -91,12 +112,24 @@ enum bfd_architecture { bfd_arch_m68k, /* Motorola 68xxx */ bfd_arch_vax, /* DEC Vax */ bfd_arch_i960, /* Intel 960 */ -#define bfd_mach_i960_core 0 -#define bfd_mach_i960_kb_sb 1 -#define bfd_mach_i960_mc 2 -#define bfd_mach_i960_xa 3 -#define bfd_mach_i960_ca 4 -#define bfd_mach_i960_ka_sa 5 + + /* The order of the following is important. + * A lower number indicates a machine type + * that only accepts a subset of the + * instructions available to machines with + * higher numbers. + * + * The exception is the "ca", which is + * incompatible with all other machines except + * "core". + */ +#define bfd_mach_i960_core 1 +#define bfd_mach_i960_ka_sa 2 +#define bfd_mach_i960_kb_sb 3 +#define bfd_mach_i960_mc 4 +#define bfd_mach_i960_xa 5 +#define bfd_mach_i960_ca 6 + bfd_arch_a29k, /* AMD 29000 */ bfd_arch_sparc, /* Sun (SPARC International) SPARC */ @@ -111,7 +144,7 @@ enum bfd_architecture { bfd_arch_m88k, /* Motorola 88xxx */ bfd_arch_pyramid, /* Pyramid Technology */ bfd_arch_h8_300, /* Hitachi H8/300 */ - bfd_arch_last, + bfd_arch_last }; /* symbols and relocation */ @@ -127,9 +160,9 @@ typedef enum {bfd_symclass_unknown = 0, bfd_symclass_undefined /* none known */ } symclass; -typedef unsigned long symvalue; /* someday they may be 64-bit qtys */ + typedef int symtype; /* Who knows, yet? */ -typedef int bfd_size_type; + /* Symbol cache classifications: (Bfd-Symbol-Flag_FOOBAR) */ #define BSF_NO_FLAGS 0x00 #define BSF_LOCAL 0x01 /* bfd_symclass_unknown */ @@ -206,7 +239,8 @@ typedef enum bfd_reloc_status { bfd_reloc_dangerous} bfd_reloc_status_enum_type; -typedef CONST struct rint { +typedef CONST struct rint +{ unsigned int type; unsigned int rightshift; unsigned int size; @@ -219,21 +253,21 @@ typedef CONST struct rint { bfd_reloc_status_enum_type (*special_function)(); char *name; boolean partial_inplace; -/* Two mask fields, - the src_mask is used to select what parts of the read in data are to - be used in the relocation sum. Eg, if this was an 8 bit bit of data - which we read and relocated, this would be 0x000000ff. When we have - relocs which have an addend, such as sun4 extended relocs, the value - in the offset part of a relocating field is garbage so we never use - it. In this case the mask would be 0x00000000. - - The dst_mask is what parts of the instruction are replaced into the - instruction. In most cases src_mask == dst_mask, except in the above - special case, where dst_mask would be 0x000000ff, and src_mask would - be 0x00000000. -*/ - unsigned int src_mask; /* What things to take from the source */ - unsigned int dst_mask; /* What things to put into the dest */ + /* Two mask fields, + the src_mask is used to select what parts of the read in data are to + be used in the relocation sum. Eg, if this was an 8 bit bit of data + which we read and relocated, this would be 0x000000ff. When we have + relocs which have an addend, such as sun4 extended relocs, the value + in the offset part of a relocating field is garbage so we never use + it. In this case the mask would be 0x00000000. + + The dst_mask is what parts of the instruction are replaced into the + instruction. In most cases src_mask == dst_mask, except in the above + special case, where dst_mask would be 0x000000ff, and src_mask would + be 0x00000000. + */ + bfd_word src_mask; /* What things to take from the source */ + bfd_word dst_mask; /* What things to put into the dest */ /* Does a pc rel offset already have the offset of the jump from the beginnining of the module in place - eg on the sun3, a pcrel @@ -387,7 +421,7 @@ typedef enum { bfd_print_symbol_name_enum, bfd_print_symbol_type_enum, - bfd_print_symbol_all_enum, + bfd_print_symbol_all_enum } bfd_print_symbol_enum_type; @@ -450,16 +484,20 @@ typedef struct bfd_target /* Byte swapping for data */ /* Note that these don't take bfd as first arg. Certain other handlers could do the same. */ - SDEF (long, bfd_getxlong, (bfd_byte *)); - SDEF (void, bfd_putxlong, (unsigned long, bfd_byte *)); - SDEF (short, bfd_getxshort, (bfd_byte *)); - SDEF (void, bfd_putxshort, (int, bfd_byte *)); + SDEF (uint64_type,bfd_getx64, (bfd_byte *)); + SDEF (void, bfd_putx64, (uint64_type, bfd_byte *)); + SDEF (uint32_type, bfd_getx32, (bfd_byte *)); + SDEF (void, bfd_putx32, (unsigned long, bfd_byte *)); + SDEF (uint16_type, bfd_getx16, (bfd_byte *)); + SDEF (void, bfd_putx16, (int, bfd_byte *)); /* Byte swapping for headers */ - SDEF (long, bfd_h_getxlong, (bfd_byte *)); - SDEF (void, bfd_h_putxlong, (unsigned long, bfd_byte *)); - SDEF (short, bfd_h_getxshort, (bfd_byte *)); - SDEF (void, bfd_h_putxshort, (int, bfd_byte *)); + SDEF (uint64_type, bfd_h_getx64, (bfd_byte *)); + SDEF (void, bfd_h_putx64, (uint64_type, bfd_byte *)); + SDEF (uint32_type, bfd_h_getx32, (bfd_byte *)); + SDEF (void, bfd_h_putx32, (unsigned long, bfd_byte *)); + SDEF (uint16_type, bfd_h_getx16, (bfd_byte *)); + SDEF (void, bfd_h_putx16, (int, bfd_byte *)); /* Format-dependent */ SDEF_FMT (struct bfd_target *, _bfd_check_format, (bfd *));/* file fmt or 0 */ @@ -483,9 +521,9 @@ typedef struct bfd_target /* All the standard stuff */ SDEF (boolean, _close_and_cleanup, (bfd *)); /* free any allocated data */ SDEF (boolean, _bfd_set_section_contents, (bfd *, sec_ptr, PTR, - file_ptr, int)); + file_ptr, bfd_size_type)); SDEF (boolean, _bfd_get_section_contents, (bfd *, sec_ptr, PTR, - file_ptr, int)); + file_ptr, bfd_size_type)); SDEF (boolean, _new_section_hook, (bfd *, sec_ptr)); /* Symbols and relocation */ @@ -495,7 +533,7 @@ typedef struct bfd_target SDEF (unsigned int, _bfd_canonicalize_reloc, (bfd *, sec_ptr, arelent **, asymbol**)); - /* FIXME: For steve -- clean up later */ + SDEF (asymbol *, _bfd_make_empty_symbol, (bfd *)); SDEF (void, _bfd_print_symbol, (bfd *, PTR, asymbol *, bfd_print_symbol_enum_type)); @@ -599,8 +637,8 @@ struct _bfd char *iostream; /* stdio FILE *, unless an archive element */ boolean cacheable; /* iostream can be closed if desired */ - struct _bfd *lru_prev; /* Used for file caching */ - struct _bfd *lru_next; /* Used for file caching */ + struct _bfd *lru_prev; /* Used for file caching */ + struct _bfd *lru_next; /* Used for file caching */ file_ptr where; /* Where the file was when closed */ boolean opened_once; boolean mtime_set; /* Flag indicating mtime is available */ @@ -613,11 +651,11 @@ struct _bfd both_direction = 3} direction; flagword flags; /* format_specific */ -/* -Currently my_archive is tested before adding origin to anything. I -believe that this can become always an add of origin, with origin set -to 0 for non archive files -*/ + /* + Currently my_archive is tested before adding origin to anything. I + believe that this can become always an add of origin, with origin set + to 0 for non archive files + */ file_ptr origin; /* for archive contents */ boolean output_has_begun; /* cf bfd_set_section_size */ @@ -634,13 +672,13 @@ to 0 for non archive files /* Archive stuff. strictly speaking we don't need all three bfd* vars, but doing so would allow recursive archives! */ PTR arelt_data; /* needed if this came from an archive */ - struct _bfd *my_archive; /* if this is an archive element */ - struct _bfd *next; /* output chain pointer */ - struct _bfd *archive_head; /* for output archive */ + struct _bfd *my_archive; /* if this is an archive element */ + struct _bfd *next; /* output chain pointer */ + struct _bfd *archive_head; /* for output archive */ boolean has_armap; /* if an arch; has it an armap? */ PTR tdata; /* target-specific storage */ - PTR usrdata; /* application-specific storage */ + PTR usrdata; /* application-specific storage */ /* Should probably be enabled here always, so that library may be changed to switch this on and off, while user code may remain unchanged */ @@ -687,10 +725,10 @@ PROTO (boolean, bfd_set_section_size, (bfd *abfd, sec_ptr ptr, unsigned long val)); PROTO (boolean, bfd_get_section_contents, (bfd *abfd, sec_ptr section, PTR location, - file_ptr offset, int count)); + file_ptr offset, bfd_size_type count)); PROTO (boolean, bfd_set_section_contents, (bfd *abfd, sec_ptr section, PTR location, - file_ptr offset, int count)); + file_ptr offset, bfd_size_type count)); PROTO (unsigned long, bfd_get_next_mapent, (bfd *abfd, symindex prev, carsym **entry)); PROTO (bfd *, bfd_get_elt_at_index, (bfd *abfd, int index)); @@ -773,26 +811,33 @@ BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, section,symbols, offset, filename /* Some byte-swapping i/o operations */ +#define LONGLONG_SIZE 8 #define LONG_SIZE 4 #define SHORT_SIZE 2 #define BYTE_SIZE 1 -#define bfd_putchar(abfd, val, ptr) (*((char *)ptr) = (char)val) -#define bfd_getchar(abfd, ptr) (*((char *)ptr)) +#define bfd_put_8(abfd, val, ptr) (*((char *)ptr) = (char)val) +#define bfd_get_8(abfd, ptr) (*((char *)ptr)) + +#define bfd_put_32(abfd, val, ptr) BFD_SEND(abfd, bfd_putx32, (val,ptr)) +#define bfd_get_32(abfd, ptr) BFD_SEND(abfd, bfd_getx32, (ptr)) -#define bfd_putlong(abfd, val, ptr) BFD_SEND(abfd, bfd_putxlong, (val,ptr)) -#define bfd_getlong(abfd, ptr) BFD_SEND(abfd, bfd_getxlong, (ptr)) +#define bfd_put_64(abfd, val, ptr) BFD_SEND(abfd, bfd_putx64, (val,ptr)) +#define bfd_get_64(abfd, ptr) BFD_SEND(abfd, bfd_getx64, (ptr)) -#define bfd_putshort(abfd, val, ptr) BFD_SEND(abfd, bfd_putxshort, (val,ptr)) -#define bfd_getshort(abfd, ptr) BFD_SEND(abfd, bfd_getxshort, (ptr)) +#define bfd_put_16(abfd, val, ptr) BFD_SEND(abfd, bfd_putx16, (val,ptr)) +#define bfd_get_16(abfd, ptr) BFD_SEND(abfd, bfd_getx16, (ptr)) -#define bfd_h_putchar(abfd, val, ptr) bfd_putchar (abfd, val, ptr) -#define bfd_h_getchar(abfd, ptr) bfd_getchar (abfd, ptr) +#define bfd_h_put_8(abfd, val, ptr) bfd_put_8 (abfd, val, ptr) +#define bfd_h_get_8(abfd, ptr) bfd_get_8 (abfd, ptr) -#define bfd_h_putlong(abfd, val, ptr) BFD_SEND(abfd, bfd_h_putxlong, (val, (bfd_byte *) ptr)) -#define bfd_h_getlong(abfd, ptr) BFD_SEND(abfd, bfd_h_getxlong, ((bfd_byte *) ptr)) +#define bfd_h_put_32(abfd, val, ptr) BFD_SEND(abfd, bfd_h_putx32, (val, (bfd_byte *) ptr)) +#define bfd_h_get_32(abfd, ptr) BFD_SEND(abfd, bfd_h_getx32, ((bfd_byte *) ptr)) -#define bfd_h_putshort(abfd, val, ptr) BFD_SEND(abfd, bfd_h_putxshort,(val,ptr)) -#define bfd_h_getshort(abfd, ptr) BFD_SEND(abfd, bfd_h_getxshort,(ptr)) +#define bfd_h_put_64(abfd, val, ptr) BFD_SEND(abfd, bfd_h_putx64, (val, (bfd_byte *) ptr)) +#define bfd_h_get_64(abfd, ptr) BFD_SEND(abfd, bfd_h_getx64, ((bfd_byte *) ptr)) + +#define bfd_h_put_16(abfd, val, ptr) BFD_SEND(abfd, bfd_h_putx16,(val,ptr)) +#define bfd_h_get_16(abfd, ptr) BFD_SEND(abfd, bfd_h_getx16,(ptr)) /* General purpose one fits all. The do { } while (0) makes a single statement out of it, for use in things like nested if-statements. @@ -808,20 +853,21 @@ BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, section,symbols, offset, filename #define bfd_h_put_x(abfd, val, ptr) \ do { \ + if (sizeof((ptr)) == LONGLONG_SIZE) \ + bfd_h_put_64 (abfd, val, (ptr));\ if (sizeof((ptr)) == LONG_SIZE) \ - bfd_h_putlong (abfd, val, (ptr));\ + bfd_h_put_32 (abfd, val, (ptr));\ else if (sizeof((ptr)) == SHORT_SIZE) \ - bfd_h_putshort (abfd, val, (ptr));\ + bfd_h_put_16 (abfd, val, (ptr));\ else if (sizeof((ptr)) == BYTE_SIZE) \ - bfd_h_putchar (abfd, val, (ptr));\ + bfd_h_put_8 (abfd, val, (ptr));\ else abort(); } while (0) #define bfd_h_get_x(abfd, ptr) \ - ((sizeof((ptr))==LONG_SIZE) ? bfd_h_getlong (abfd, &(ptr[0])):\ - (sizeof((ptr))==SHORT_SIZE) ? bfd_h_getshort(abfd, &(ptr[0])):\ - (sizeof((ptr))==BYTE_SIZE) ? bfd_h_getchar (abfd, &(ptr[0])):\ - (abort(),1) ) - + ((sizeof((ptr))==LONGLONG_SIZE) ? bfd_h_get_64 (abfd, &(ptr[0])):\ + (sizeof((ptr))==LONG_SIZE) ? bfd_h_get_32 (abfd, &(ptr[0])):\ + (sizeof((ptr))==SHORT_SIZE) ? bfd_h_get_16(abfd, &(ptr[0])):\ + bfd_h_get_8 (abfd, &(ptr[0]))) #ifdef GNU960 #define BFD_COFF_FORMAT bfd_target_coff_flavour_enum @@ -850,4 +896,6 @@ extern PROTO (char *, bfd_make_targ_name,( enum target_flavour_enum format, int #endif /* GNU960 */ + + #endif /* __BFD_H_SEEN__ */ diff --git a/include/sysdep.h b/include/sysdep.h index ccaf13dbaf8..9f39a5d31ce 100755 --- a/include/sysdep.h +++ b/include/sysdep.h @@ -42,7 +42,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define DGUX_SYS 9 #define DEC3100_SYS 10 #define HP9000_SYS 11 - +#define APOLLO400_SYS 12 +#define DOS_SYS 13 #include #if __STDC__ @@ -100,5 +101,14 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define USG #include #endif +#if HOST_SYS==APOLLO400_SYS +#define HOST_IS_APOLLO400 1 +#include +#endif + +#if HOST_SYS==DOS_SYS +#define HOST_IS_DOS 1 +#include +#endif #endif diff --git a/ld/Makefile.in b/ld/Makefile.in index 1e93cfaeda7..37136c1d9b6 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -40,11 +40,6 @@ LINTFLAGS = $(INCLUDES) $(EXTRA_DEF) .SUFFIXES: .y .x .script $(SUFFIXES) -.y.o: - $(YACC) $< - mv y.tab.c ldgram.tab.c - $(CC) -c $(CFLAGS) ldgram.tab.c - mv ldgram.tab.o ldgram.o # go directly to ld.new in case this ld isn't capable of # linking native object on this host. It can be renamed on @@ -73,10 +68,10 @@ LDCSOURCES=ldlang.c ldmain.c ldwrite.c ldlnk960.c ldgld.c ldgld68k.c \ ldgldm88kbcs.c \ ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c ldvanilla.c -GENERATED_SOURCES=ldgram.tab.c ldlex.c ldgram.tab.h y.tab.h -GENERATED_HEADERS=ldgram.tab.h +GENERATED_SOURCES=ldgramtb.c ldlex.c ldgramtb.h +GENERATED_HEADERS=ldgramtb.h -LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l +LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgramtb.h BFDSOURCES=../../bfd/common/*.c @@ -89,6 +84,13 @@ all: Makefile $(PROCESSED_SCRIPTS) $(LD_PROG) $(PROCESSED_SCRIPTS): mkscript $(SCRIPTS) +ldgramtb.o ldgramtb.h:ldgram.y + $(YACC) $< + mv y.tab.c ldgramtb.c + mv y.tab.h ldgramtb.h + $(CC) -c $(CFLAGS) ldgramtb.c + mv ldgramtb.o ldgram.o + #$(BFDLIB): $(BFDSOURCES) # (cd ../bfd; make) @@ -116,9 +118,6 @@ ld.dvi:ld.tex mkscript: mkscript.c -ldgram.o: ldgram.y -ldgram.tab.h:ldgram.y - cp y.tab.h ldgram.tab.h ldgld.o: $(PROCESSED_SCRIPTS) ldgld.c @@ -186,7 +185,7 @@ lintlog:$(SOURCES) Makefile tags TAGS:$(SOURCES) $(HEADERS) - etags -t $(SOURCES) $(HEADERS) + etags -t $? release: (cd /4/steve/ld; tar cf - $(LDSOURCES) $(HEADERS) $(MANSOURCES)) | tar xf - @@ -220,7 +219,7 @@ roll: echo Version $$V -dep: $(LDSOURCES) $(PROCESSED_SCRIPTS) +dep: $(LDSOURCES) $(PROCESSED_SCRIPTS) mkdep $(CFLAGS) $? # Dummy target to force execution of dependent targets. diff --git a/ld/config/hmake-sun4 b/ld/config/hmake-sun4 index 9c7fb77301a..b53bfde0ae2 100755 --- a/ld/config/hmake-sun4 +++ b/ld/config/hmake-sun4 @@ -3,6 +3,6 @@ YACC=yacc -tvd #CC=gcc -Wall -ansi #stuff for self hosting HOSTING_CRT0=/lib/crt0.o -HOSTING_LIBS=/limbo/latest/=sun4/lib/gcc/sparc/1.92/gnulib -lc +HOSTING_LIBS=/limbo/latest/=sun4/lib/gcc/sparc/1.93/gnulib -lc HOSTING_EMU=LDEMULATION=gld; export LDEMULATION diff --git a/ld/ldgld960.c b/ld/ldgld960.c index 7e7e6e0481c..bdb1c7bcceb 100755 --- a/ld/ldgld960.c +++ b/ld/ldgld960.c @@ -108,9 +108,7 @@ gld960_before_allocation() static void gld960_set_output_arch() { - /* Set the output architecture and machine if possible */ - unsigned long machine = 0; - bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine); + bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core); } static char * @@ -119,7 +117,7 @@ gld960_choose_target() #ifdef GNU960 output_filename = "b.out"; - return bfd_make_targ_name(BFD_BOUT_FORMAT,HOST_BYTE_ORDER_BIG_P); + return bfd_make_targ_name(BFD_BOUT_FORMAT, 0); #else diff --git a/ld/ldlnk960.c b/ld/ldlnk960.c index f7f725957c2..ea4df268be4 100755 --- a/ld/ldlnk960.c +++ b/ld/ldlnk960.c @@ -244,7 +244,7 @@ lnk960_choose_target() { #ifdef GNU960 - return bfd_make_targ_name(BFD_COFF_FORMAT,HOST_BYTE_ORDER_BIG_P); + return bfd_make_targ_name(BFD_COFF_FORMAT, 0); #else diff --git a/ld/ldsym.c b/ld/ldsym.c index 7fcff3a7b2d..4e6bec5712f 100644 --- a/ld/ldsym.c +++ b/ld/ldsym.c @@ -98,7 +98,7 @@ DEFUN(ldsym_get,(key), /* Nothing was found; create a new symbol table entry. */ - bp = (ldsym_type *) ldmalloc (sizeof (ldsym_type)); + bp = (ldsym_type *) ldmalloc ((bfd_size_type)(sizeof (ldsym_type))); bp->srefs_chain = (asymbol **)NULL; bp->sdefs_chain = (asymbol **)NULL; bp->scoms_chain = (asymbol **)NULL; @@ -149,9 +149,9 @@ list_file_locals (entry) lang_input_statement_type *entry; { asymbol **q; - fprintf (stderr, "\nLocal symbols of "); + printf ( "\nLocal symbols of "); info("%I", entry); - fprintf (stderr, ":\n\n"); + printf (":\n\n"); if (entry->asymbols) { for (q = entry->asymbols; *q; q++) { @@ -169,21 +169,21 @@ static void print_file_stuff(f) lang_input_statement_type *f; { - fprintf (stderr, " %s", f->filename); - fprintf (stderr, " "); + fprintf (stdout, " %s", f->filename); + fprintf (stdout, " "); if (f->just_syms_flag) { - fprintf (stderr, " symbols only\n"); + fprintf (stdout, " symbols only\n"); } else { asection *s; - if (option_longmap) { + if (true || option_longmap) { for (s = f->the_bfd->sections; s != (asection *)NULL; s = s->next) { - fprintf (stderr, "%08lx %08x 2**%2ud %s\n", - s->output_offset, + print_address(s->output_offset); + printf ( "%08x 2**%2ud %s\n", (unsigned)s->size, s->alignment_power, s->name); } } @@ -191,12 +191,11 @@ lang_input_statement_type *f; for (s = f->the_bfd->sections; s != (asection *)NULL; s = s->next) { - fprintf (stderr, "%s %lx(%x) ", - s->name, - s->output_offset, - (unsigned) s->size); + printf("%s ", s->name); + print_address(s->output_offset); + printf("(%x)", (unsigned)s->size); } - fprintf (stderr, "hex \n"); + printf("hex \n"); } } } @@ -204,11 +203,11 @@ lang_input_statement_type *f; void ldsym_print_symbol_table () { - fprintf (stderr, "\nFiles:\n\n"); + fprintf (stdout, "\nFiles:\n\n"); lang_for_each_file(print_file_stuff); - fprintf (stderr, "\nGlobal symbols:\n\n"); + fprintf (stdout, "\nGlobal symbols:\n\n"); { register ldsym_type *sp; @@ -218,41 +217,42 @@ ldsym_print_symbol_table () { asymbol *defsym = *(sp->sdefs_chain); asection *defsec = bfd_get_section(defsym); - fprintf(stderr,"%08lx ",defsym->value); + print_address(defsym->value); if (defsec) { - fprintf(stderr,"%08lx ",defsym->value+defsec->vma); - fprintf(stderr, - "%7s", + print_space(); + print_address(defsym->value+defsec->vma); + printf("%7s", bfd_section_name(output_bfd, defsec)); } else { - fprintf(stderr," ......."); + printf(" ......."); } } else { - fprintf(stderr,"undefined"); + printf("undefined"); } if (sp->scoms_chain) { - fprintf(stderr, " common size %5lu %s", - (*(sp->scoms_chain))->value, sp->name); + printf(" common size "); + print_address((*(sp->scoms_chain))->value); + printf("%s ",sp->name); } if (sp->sdefs_chain) { - fprintf(stderr, " symbol def %08lx %s", - (*(sp->sdefs_chain))->value, - sp->name); + printf(" symbol def "); + print_address((*(sp->sdefs_chain))->value); + printf("%s ",sp->name); } else { - fprintf(stderr, " undefined %s", - sp->name); + printf(" undefined "); + printf("%s ",sp->name); } - fprintf(stderr, "\n"); + print_nl(); } } @@ -414,7 +414,7 @@ ldsym_write() extern unsigned int total_symbols_seen; asymbol ** symbol_table = (asymbol **) - ldmalloc ((size_t)(global_symbol_count + + ldmalloc ((bfd_size_type)(global_symbol_count + total_files_seen + total_symbols_seen + 1) * sizeof (asymbol *)); asymbol ** tablep = write_file_locals(symbol_table);