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)
#define BADMAG(x) I960BADMAG(x)
#include <ansidecl.h>
-#include "sysdep.h"
+
#include "bfd.h"
#include "libbfd.h"
#include "obstack.h"
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 */
/* 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;
'/', /* 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 =
'/', /* 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},
/* 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"
'/', /* 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},
{
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;
}
'/', /* 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},
#include "bfd.h"
#include "libbfd.h"
-#include "sysdep.h"
+
#include "intel-coff.h"
#include "libcoff.h" /* to allow easier abstraction-breaking */
(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},
(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 */
*/
/* Most of this hacked by Steve Chamberlain, steve@cygnus.com */
-
+#if 0
#include <ansidecl.h>
#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
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 *));
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();
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;
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
/* 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.
+
/* 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.
#define __BFD_H_SEEN__
#include "ansidecl.h"
+#include "sysdep.h"
#include "obstack.h"
/* Make it easier to declare prototypes (puts conditional here) */
# endif
#endif
-#define BFD_VERSION "1.9"
+#define BFD_VERSION "1.10"
/* forward declaration */
typedef struct _bfd bfd;
/* 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 */
\f
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 */
bfd_arch_m88k, /* Motorola 88xxx */
bfd_arch_pyramid, /* Pyramid Technology */
bfd_arch_h8_300, /* Hitachi H8/300 */
- bfd_arch_last,
+ bfd_arch_last
};
\f
/* symbols and relocation */
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 */
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;
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
{
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;
\f
/* 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 */
/* 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 */
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));
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 */
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 */
/* 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 */
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));
\f
/* 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.
#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) )
-\f
+ ((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
#endif /* GNU960 */
+
+
#endif /* __BFD_H_SEEN__ */
#define DGUX_SYS 9
#define DEC3100_SYS 10
#define HP9000_SYS 11
-
+#define APOLLO400_SYS 12
+#define DOS_SYS 13
#include <ansidecl.h>
#if __STDC__
#define USG
#include <sys/h-hp9000.h>
#endif
+#if HOST_SYS==APOLLO400_SYS
+#define HOST_IS_APOLLO400 1
+#include <sys/h-ap400.h>
+#endif
+
+#if HOST_SYS==DOS_SYS
+#define HOST_IS_DOS 1
+#include <sys/h_dos.h>
+#endif
#endif
.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
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
$(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)
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
tags TAGS:$(SOURCES) $(HEADERS)
- etags -t $(SOURCES) $(HEADERS)
+ etags -t $?
release:
(cd /4/steve/ld; tar cf - $(LDSOURCES) $(HEADERS) $(MANSOURCES)) | tar xf -
echo Version $$V
-dep: $(LDSOURCES) $(PROCESSED_SCRIPTS)
+dep: $(LDSOURCES) $(PROCESSED_SCRIPTS)
mkdep $(CFLAGS) $?
# Dummy target to force execution of dependent targets.
#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
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 *
#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
{
#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
/* 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;
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++)
{
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);
}
}
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");
}
}
}
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;
{
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();
}
}
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);