*** empty log message ***

This commit is contained in:
Steve Chamberlain 1991-04-08 23:26:05 +00:00
parent ad19c0a2d1
commit de7c1ff613
8 changed files with 190 additions and 175 deletions

View file

@ -357,6 +357,13 @@ coff_real_object_p(abfd, nscns, opthdr)
abfd->obj_machine = 68020;
break;
#endif
#ifdef MC88MAGIC
case MC88MAGIC:
case MC88DMAGIC:
abfd->obj_arch = bfd_arch_m88k;
abfd->obj_machine = 88100;
break;
#endif
#ifdef I960ROMAGIC
case I960ROMAGIC:
case I960RWMAGIC:
@ -1126,9 +1133,9 @@ coff_set_flags(abfd, magicp, flagsp)
*magicp = MC68MAGIC;
return true;
#endif
#if M88DMAGIC
#ifdef M88MAGIC
case bfd_arch_m88k:
*magicp = MC88DMAGIC;
*magicp = MC88MAGIC;
return true;
break;
#endif
@ -1711,7 +1718,7 @@ get_normalized_symtab(abfd)
}
else {
if ((((AUXENT *) (retval + 1))->x_file.x_n.x_offset
= (int) malloc(namelength)) == NULL) {
= (int) malloc(namelength+1)) == NULL) {
bfd_error = no_memory;
return (NULL);
} /* on error */
@ -1740,7 +1747,6 @@ get_normalized_symtab(abfd)
/* ...and normalize symbol names. */
for (s = retval + obj_symbol_slew(abfd); s < end; ++s) {
if (s->n_zeroes != 0) {
/*
This is a "short" name. Make it long.
@ -1763,7 +1769,7 @@ get_normalized_symtab(abfd)
return (NULL);
} /* on error */
bzero(newstring, i);
strncpy(newstring, s->n_name, 8);
strncpy(newstring, s->n_name, i -1 );
s->n_offset = (int) newstring;
s->n_zeroes = 0;

View file

@ -1,3 +1,4 @@
/*#define UNDERSCORE_HACK 0*/
/*
bfd backend for oasys objects.
@ -90,7 +91,13 @@ bfd *abfd;
/* Buy enough memory for all the symbols and all the names */
data->symbols =
(asymbol *)malloc(sizeof(asymbol) * abfd->symcount);
#ifdef UNDERSCORE_HACK
/* buy 1 more char for each symbol to keep the underscore in*/
data->strings = malloc(data->symbol_string_length +
abfd->symcount);
#else
data->strings = malloc(data->symbol_string_length);
#endif
dest_undefined = data->symbols;
dest_defined = data->symbols + abfd->symcount -1;
@ -98,6 +105,7 @@ bfd *abfd;
string_ptr = data->strings;
bfd_seek(abfd, (file_ptr)0, SEEK_SET);
while (loop) {
oasys_read_record(abfd, &record);
switch (record.header.type) {
case oasys_record_is_header_enum:
@ -105,12 +113,16 @@ bfd *abfd;
case oasys_record_is_local_enum:
case oasys_record_is_symbol_enum:
{
int flag = record.header.type == oasys_record_is_local_enum ?
(BSF_LOCAL) : (BSF_GLOBAL | BSF_EXPORT);
size_t length = oasys_string_length(&record);
switch (record.symbol.relb[0] & RELOCATION_TYPE_BITS) {
case RELOCATION_TYPE_ABS:
dest = dest_defined--;
dest->section = 0;
dest->flags = BSF_ABSOLUTE | BSF_EXPORT | BSF_GLOBAL;
dest->flags = BSF_ABSOLUTE | flag;
break;
case RELOCATION_TYPE_REL:
dest = dest_defined--;
@ -119,11 +131,11 @@ bfd *abfd;
RELOCATION_SECT_BITS];
if (record.header.type == oasys_record_is_local_enum)
{
dest->flags = BSF_LOCAL;
dest->flags = BSF_LOCAL;
}
else {
dest->flags = BSF_EXPORT | BSF_GLOBAL;
dest->flags = flag;
}
break;
case RELOCATION_TYPE_UND:
@ -142,9 +154,15 @@ bfd *abfd;
}
dest->name = string_ptr;
dest->the_bfd = abfd;
dest->udata = (void *)NULL;
dest->value = bfd_h_getlong(abfd, &record.symbol.value);
#if UNDERSCORE_HACK
string_ptr[0] = '_';
string_ptr++;
#endif
memcpy(string_ptr, record.symbol.name, length);
string_ptr[length] =0;
string_ptr += length +1;
}
@ -163,8 +181,7 @@ bfd *abfd;
{
oasys_slurp_symbol_table (abfd);
return (abfd->symcount != 0) ?
(abfd->symcount+1) * (sizeof (oasys_symbol_type *)) : 0;
return (abfd->symcount+1) * (sizeof (oasys_symbol_type *));
}
/*
@ -289,10 +306,12 @@ bfd *abfd;
/* Inspect the records, but only keep the section info -
remember the size of the symbols
*/
static_data.first_data_record = 0;
while (loop) {
oasys_record_union_type record;
oasys_read_record(abfd, &record);
if (record.header.length < sizeof(record.header))
if (record.header.length < sizeof(record.header))
return (bfd_target *)NULL;
switch ((oasys_record_enum_type)(record.header.type)) {
@ -429,6 +448,7 @@ bfd *abfd;
per->reloc_tail_ptr = (oasys_reloc_type **)&(s->relocation);
}
if (data->first_data_record == 0) return true;
bfd_seek(abfd, data->first_data_record, SEEK_SET);
while (loop) {
oasys_read_record(abfd, &record);
@ -436,93 +456,112 @@ bfd *abfd;
case oasys_record_is_header_enum:
break;
case oasys_record_is_data_enum:
{
{
uint8e_type *src = record.data.data;
uint8e_type *end_src = ((uint8e_type *)&record) + record.header.length;
unsigned int relbit;
bfd_byte *dst_ptr ;
bfd_byte *dst_base_ptr ;
asection *section;
unsigned int count;
uint8e_type *src = record.data.data;
uint8e_type *end_src = ((uint8e_type *)&record) +
record.header.length;
unsigned int relbit;
bfd_byte *dst_ptr ;
bfd_byte *dst_base_ptr ;
asection *section;
unsigned int count;
bfd_vma dst_offset = bfd_h_getlong(abfd, record.data.addr);
section = data->sections[record.data.relb & RELOCATION_SECT_BITS];
per = oasys_per_section(section);
dst_base_ptr = dst_ptr = oasys_per_section(section)->data + dst_offset;
bfd_vma dst_offset = bfd_h_getlong(abfd, record.data.addr);
section = data->sections[record.data.relb & RELOCATION_SECT_BITS];
per = oasys_per_section(section);
dst_base_ptr = oasys_per_section(section)->data;
dst_ptr = oasys_per_section(section)->data +
dst_offset;
while (src < end_src) {
uint8e_type mod_byte = *src++;
count = 8;
for (relbit = 1; count-- != 0; relbit <<=1)
{
if (relbit & mod_byte)
{
uint8e_type reloc = *src;
/* This item needs to be relocated */
switch (reloc & RELOCATION_TYPE_BITS) {
case RELOCATION_TYPE_ABS:
break;
case RELOCATION_TYPE_REL:
{
/* Relocate the item relative to the section */
oasys_reloc_type *r =
(oasys_reloc_type *)
obstack_alloc(&per->reloc_obstack,
sizeof(oasys_reloc_type));
*(per->reloc_tail_ptr) = r;
per->reloc_tail_ptr = &r->next;
r->next= (oasys_reloc_type *)NULL;
/* Reference to undefined symbol */
src++;
/* There is no symbol */
r->symbol = 0;
/* Work out the howto */
r->relent.section =
data->sections[reloc & RELOCATION_SECT_BITS];
r->relent.addend = 0;
r->relent.address = dst_ptr - dst_base_ptr;
r->relent.howto = &howto_table[reloc>>6];
section->reloc_count++;
}
break;
case RELOCATION_TYPE_UND:
{
oasys_reloc_type *r =
(oasys_reloc_type *)
obstack_alloc(&per->reloc_obstack,
sizeof(oasys_reloc_type));
*(per->reloc_tail_ptr) = r;
per->reloc_tail_ptr = &r->next;
r->next= (oasys_reloc_type *)NULL;
/* Reference to undefined symbol */
src++;
/* Get symbol number */
r->symbol = (src[0]<<8) | src[1];
/* Work out the howto */
r->relent.section = (asection *)NULL;
r->relent.addend = 0;
r->relent.address = dst_ptr - dst_base_ptr;
r->relent.howto = &howto_table[reloc>>6];
section->reloc_count++;
src+=2;
}
break;
case RELOCATION_TYPE_COM:
BFD_FAIL();
}
}
*dst_ptr++ = *src++;
while (src < end_src) {
uint32_type gap = end_src - src -1;
uint8e_type mod_byte = *src++;
count = 8;
if (mod_byte == 0 && gap >= 8) {
dst_ptr[0] = src[0];
dst_ptr[1] = src[1];
dst_ptr[2] = src[2];
dst_ptr[3] = src[3];
dst_ptr[4] = src[4];
dst_ptr[5] = src[5];
dst_ptr[6] = src[6];
dst_ptr[7] = src[7];
dst_ptr+= 8;
src += 8;
}
}
}
else {
for (relbit = 1; count-- != 0 && gap != 0; gap --, relbit <<=1)
{
if (relbit & mod_byte)
{
uint8e_type reloc = *src;
/* This item needs to be relocated */
switch (reloc & RELOCATION_TYPE_BITS) {
case RELOCATION_TYPE_ABS:
break;
case RELOCATION_TYPE_REL:
{
/* Relocate the item relative to the section */
oasys_reloc_type *r =
(oasys_reloc_type *)
obstack_alloc(&per->reloc_obstack,
sizeof(oasys_reloc_type));
*(per->reloc_tail_ptr) = r;
per->reloc_tail_ptr = &r->next;
r->next= (oasys_reloc_type *)NULL;
/* Reference to undefined symbol */
src++;
/* There is no symbol */
r->symbol = 0;
/* Work out the howto */
r->relent.section =
data->sections[reloc & RELOCATION_SECT_BITS];
r->relent.addend = 0;
r->relent.address = dst_ptr - dst_base_ptr;
r->relent.howto = &howto_table[reloc>>6];
r->relent.sym_ptr_ptr = (asymbol **)NULL;
section->reloc_count++;
}
break;
case RELOCATION_TYPE_UND:
{
oasys_reloc_type *r =
(oasys_reloc_type *)
obstack_alloc(&per->reloc_obstack,
sizeof(oasys_reloc_type));
*(per->reloc_tail_ptr) = r;
per->reloc_tail_ptr = &r->next;
r->next= (oasys_reloc_type *)NULL;
/* Reference to undefined symbol */
src++;
/* Get symbol number */
r->symbol = (src[0]<<8) | src[1];
/* Work out the howto */
r->relent.section = (asection *)NULL;
r->relent.addend = 0;
r->relent.address = dst_ptr - dst_base_ptr;
r->relent.howto = &howto_table[reloc>>6];
r->relent.sym_ptr_ptr = (asymbol **)NULL;
section->reloc_count++;
src+=2;
}
break;
case RELOCATION_TYPE_COM:
BFD_FAIL();
}
}
*dst_ptr++ = *src++;
}
}
}
}
break;
case oasys_record_is_local_enum:
case oasys_record_is_symbol_enum:

View file

@ -37,6 +37,7 @@ extern bfd_target ieee_vec;
extern bfd_target oasys_vec;
extern bfd_target m88k_bcs_vec;
vvvvvvvvvvvvvvvvvvvv
bfd_target *target_vector[] = {
&aout_little_vec,
&ieee_vec,
@ -50,3 +51,4 @@ bfd_target *target_vector[] = {
&srec_vec,
NULL,
};
^^^^^^^^^^^^^^^^^^^^

View file

@ -3,8 +3,8 @@
#
# $Id$
#
srcdir = ../common
VPATH = ../common
srcdir=../common
VPATH=../common
BASEDIR = ../..
HOSTDIR = ../$(HOST)/
INCLUDE = $(srcdir)/$(BASEDIR)/include-cygnus
@ -14,9 +14,20 @@ DEBUG = -g
#__sun3__#EXTRA_DEF=-DHOST_SYS=SUN3_SYS
#__sun4__#EXTRA_DEF=-DHOST_SYS=SUN4_SYS
#__dgux__#EXTRA_DEF=-DHOST_SYS=DGUX_SYS
CFLAGS = $(INCLUDES) $(EXTRA_DEF) $(DEBUG)
LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
.SUFFIXES: .y
.y.o:
yacc -tvd $<
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
# install.
@ -25,7 +36,7 @@ PROGS = $(HOSTDIR)/ld.new
# for self hosting
GNUTARGET=a.out-generic-big
LDEMULATION=gld
bfdlib=$(srcdir)/$(BASEDIR)/bfd/$(HOST)/libbfd.a
BFDLIB=$(srcdir)/$(BASEDIR)/bfd/$(HOST)/libbfd.a
OBJS= ldgram.o ldlex.o ldlang.o ldmain.o ldwrite.o ldexp.o ld-lnk960.o ld-gld68k.o \
ld-gld.o ld-gld960.o ld-emul.o ldversion.o ldmisc.o ldsym.o ldfile.o
@ -57,32 +68,27 @@ $(BFDLIB): $(BFDSOURCES)
$(PROGS): $(OBJS) $(BFDLIB)
# (cd ../bfd; make)
# LDEMULATION=gld; export LDEMULATION; GNUTARGET=a.out-generic-big;./ldok -format a.out-generic-big -o ld /lib/crt0.o $(OBJS) $(bfdlib) -lc /usr/local/lib/gcc/sparc/1.91/gnulib
# gld -o ld /lib/crt0.o $(OBJS) $(bfdlib) -lc /usr/local/lib/gcc/sparc/1.91/gnulib
$(CC) -Bstatic -o ld.new $(OBJS) $(bfdlib)
# LDEMULATION=gld; export LDEMULATION; GNUTARGET=a.out-generic-big;./ldok -format a.out-generic-big -o ld /lib/crt0.o $(OBJS) $(BFDLIB) -lc /usr/local/lib/gcc/sparc/1.91/gnulib
# gld -o ld /lib/crt0.o $(OBJS) $(BFDLIB) -lc /usr/local/lib/gcc/sparc/1.91/gnulib
$(CC) -Bstatic -o ld.new $(OBJS) $(BFDLIB)
ld1: ld
gcc -v -B./ -o ld1 $(OBJS) $(bfdlib)
gcc -v -B./ -o ld1 $(OBJS) $(BFDLIB)
ld2: ld1
mv ld1 ld
gcc -v -B./ -o ld2 $(OBJS) $(bfdlib)
gcc -v -B./ -o ld2 $(OBJS) $(BFDLIB)
ld3: ld2
mv ld2 ld
gcc -v -B./ -o ld3 $(OBJS) $(bfdlib)
gcc -v -B./ -o ld3 $(OBJS) $(BFDLIB)
ld.dvi:ld.tex
tex ld.tex
ldgram.o:ldgram.y
yacc -d ldgram.y
mv y.tab.c ldgram.tab.c
$(CC) -c $(CFLAGS) ldgram.tab.c
mv ldgram.tab.o ldgram.o
ldgram.tab.h:y.tab.h
ldgram.o: ldgram.y
ldgram.tab.h:ldgram.y
cp y.tab.h ldgram.tab.h
ldlex.c: ldlex.l ldgram.tab.h
@ -96,11 +102,11 @@ ldlang.o: ldlang.c ldgram.tab.h
ld-gld.o: ld-gld.c
ld-gld68k.o: ld-gld68k.c
ld-gld960.o: ld-gld960.c
ld-emul.o:ld-emul.c
ld-lnk960.o:ld-lnk960.c
ldexp.o:ldexp.c ldgram.tab.h
ldmisc.o:ldmisc.c
ldsym.o:ldsym.c
ld-emul.o: ld-emul.c
ld-lnk960.o: ld-lnk960.c
ldexp.o: ldexp.c ldgram.tab.h
ldmisc.o: ldmisc.c
ldsym.o: ldsym.c
clean:
- rm -f $(OBJS) $(GENERATED_SOURCES) $(GENERATED_HEADERS)

View file

@ -119,7 +119,7 @@ char *target;
ld_emulation = &ld_gld960_emulation;
}
else {
info("%P%F unrecognised emulation mode: %s",target);
info("%P%F unrecognised emulation mode: %s\n",target);
}
}

View file

@ -20,9 +20,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
$Id$
$Log$
Revision 1.2 1991/03/22 23:02:31 steve
Brought up to sync with Intel again.
Revision 1.3 1991/04/08 23:21:26 steve
*** empty log message ***
* Revision 1.2 1991/03/22 23:02:31 steve
* Brought up to sync with Intel again.
*
* Revision 1.2 1991/03/15 18:45:55 rich
* foo
*
@ -199,10 +202,13 @@ lnk960_before_allocation()
static void
lnk960_after_allocation()
{
lang_abs_symbol_at_end_of(".text","_etext");
lang_abs_symbol_at_end_of(".data","_edata");
lang_abs_symbol_at_beginning_of(".bss","_bss_start");
lang_abs_symbol_at_end_of(".bss","_end");
extern ld_config_type config;
if (config.relocateable_output == false) {
lang_abs_symbol_at_end_of(".text","_etext");
lang_abs_symbol_at_end_of(".data","_edata");
lang_abs_symbol_at_beginning_of(".bss","_bss_start");
lang_abs_symbol_at_end_of(".bss","_end");
}
}
static struct

View file

@ -225,10 +225,10 @@ command_line_option:
{
force_make_executable = true;
}
| OPTION_d {
| OPTION_d {
command_line.force_common_definition = true;
}
| OPTION_dc
| OPTION_dc
{
command_line.force_common_definition = true;
}
@ -236,16 +236,17 @@ command_line_option:
{
/* Ignored */
}
| OPTION_dp
| OPTION_dp
{
command_line.force_common_definition = true;
}
| OPTION_format NAME
| OPTION_format NAME
{
lang_add_target($2);
}
| OPTION_Texp { hex_mode =true; }
| OPTION_Texp
{ hex_mode =true; }
exp
{ lang_section_start($1, $3);
hex_mode = false; }
@ -290,9 +291,11 @@ command_line_option:
| OPTION_defsym
{
ldgram_in_defsym = true;
hex_mode = true;
}
assignment
{
hex_mode = false;
ldgram_in_defsym = false;
}

View file

@ -18,53 +18,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id$
*
* $Log$
* Revision 1.4 1991/03/27 02:29:22 steve
* *** empty log message ***
*
* Revision 1.3 1991/03/27 00:52:49 steve
* *** empty log message ***
*
* Revision 1.2 1991/03/22 23:02:34 steve
* Brought up to sync with Intel again.
*
* Revision 1.3 1991/03/16 22:19:21 rich
* pop
*
* Revision 1.2 1991/03/15 18:52:42 rich
* pop
*
* Revision 1.1 1991/03/13 00:48:23 chrisb
* Initial revision
*
* Revision 1.8 1991/03/10 09:31:28 rich
* Modified Files:
* Makefile config.h ld-emul.c ld-emul.h ld-gld.c ld-gld960.c
* ld-lnk960.c ld.h lddigest.c ldexp.c ldexp.h ldfile.c ldfile.h
* ldgram.y ldinfo.h ldlang.c ldlang.h ldlex.h ldlex.l ldmain.c
* ldmain.h ldmisc.c ldmisc.h ldsym.c ldsym.h ldversion.c
* ldversion.h ldwarn.h ldwrite.c ldwrite.h y.tab.h
*
* As of this round of changes, ld now builds on all hosts of (Intel960)
* interest and copy passes my copy test on big endian hosts again.
*
* Revision 1.7 1991/03/09 03:31:03 sac
* After a fatal info message, the output file is deleted.
*
* Revision 1.6 1991/03/09 03:25:06 sac
* Added support for LONG, SHORT and BYTE keywords in scripts
*
* Revision 1.5 1991/03/06 21:59:31 sac
* Completed G++ support
*
* Revision 1.4 1991/03/06 02:26:02 sac
* Added support for constructor sections.
* Remove parsing ambiguity.
* Lint
*
* Revision 1.3 1991/02/22 17:15:01 sac
* Added RCS keywords and copyrights
*
*/