* app.c: MRI compatibility - allow single quote to start a string.

* as.c: fix typo recently introduced.
	* as.h : Don't include aout/reloc.h - it's not right for COFF!
	* expr.c: Much rewriting, to accomodate MRI syntax for
	expressions. Also easier to read now.
	* listing.c: Put back defuns
	* read.c: modified to accept MRI syntax, put back listing pseudo
	ops so that an assembler built with NO_LISTING ignores list ops
	rather than pukes.
	* write.c, write.h: fixs - only keep a reloc type in a fix if the target
	machine is a SPARC or a 29K.
	* config/obj-aout.c: added s_sect pseudo op
	* config/obj-coffbfd.c: lints, set the filehdr flags right and
	fill in the timestamp.
	* config/obj-coffbfd.h: Since we don't include aout/reloc.h
	anymore, define all the relocs which the tc-<x> bit will use so we
	can translate from them to the coff types.
	* config/tc-a29k.c: reloc_type isn't ane enum any more
	* config/tc-m68k.c: Added NO_RELOC definition.

Now compiles for sparc aout, 68k aout (MRI and MIT syntax),
29k coff.

So far works as replacement for sparc and 68k /bin/as.
This commit is contained in:
Steve Chamberlain 1992-02-22 20:45:24 +00:00
parent 3b548344d0
commit c593cf412b
11 changed files with 3247 additions and 2901 deletions

View File

@ -30,6 +30,7 @@ Things-to-keep:
.gdbinit
COPYING
ChangeLog
Makefile.bat
Makefile.in
NOTES
NOTES.config
@ -51,7 +52,7 @@ bignum-copy.c
bignum.h
cond.c
config
configdos.bat
configure.bat
configure.in
debug.c
doc
@ -105,7 +106,33 @@ echo Done in `pwd`.
#
#
# $Log$
# Revision 1.9 1992/02/17 15:52:52 rich
# Revision 1.10 1992/02/22 20:44:46 sac
# * app.c: MRI compatibility - allow single quote to start a string.
# * as.c: fix typo recently introduced.
# * as.h : Don't include aout/reloc.h - it's not right for COFF!
# * expr.c: Much rewriting, to accomodate MRI syntax for
# expressions. Also easier to read now.
# * listing.c: Put back defuns
# * read.c: modified to accept MRI syntax, put back listing pseudo
# ops so that an assembler built with NO_LISTING ignores list ops
# rather than pukes.
# * write.c, write.h: fixs - only keep a reloc type in a fix if the target
# machine is a SPARC or a 29K.
# * config/obj-aout.c: added s_sect pseudo op
# * config/obj-coffbfd.c: lints, set the filehdr flags right and
# fill in the timestamp.
# * config/obj-coffbfd.h: Since we don't include aout/reloc.h
# anymore, define all the relocs which the tc-<x> bit will use so we
# can translate from them to the coff types.
# * config/tc-a29k.c: reloc_type isn't ane enum any more
# * config/tc-m68k.c: Added NO_RELOC definition.
#
# Now compiles for sparc aout, 68k aout (MRI and MIT syntax),
# 29k coff.
#
# So far works as replacement for sparc and 68k /bin/as.
#
# Revision 1.9 1992/02/17 15:52:52 rich
# fighting bitrot in a major way
#
# Revision 1.8 1992/02/14 00:21:34 pesch

View File

@ -1,5 +1,30 @@
Sat Feb 22 12:26:28 1992 Steve Chamberlain (sac at rtl.cygnus.com)
* app.c: MRI compatibility - allow single quote to start a string.
* as.c: fix typo recently introduced.
* as.h : Don't include aout/reloc.h - it's not right for COFF!
* expr.c: Much rewriting, to accomodate MRI syntax for
expressions. Also easier to read now.
* listing.c: Put back defuns
* read.c: modified to accept MRI syntax, put back listing pseudo
ops so that an assembler built with NO_LISTING ignores list ops
rather than pukes.
* write.c, write.h: fixs - only keep a reloc type in a fix if the target
machine is a SPARC or a 29K.
* config/obj-aout.c: added s_sect pseudo op
* config/obj-coffbfd.c: lints, set the filehdr flags right and
fill in the timestamp.
* config/obj-coffbfd.h: Since we don't include aout/reloc.h
anymore, define all the relocs which the tc-<x> bit will use so we
can translate from them to the coff types.
* config/tc-a29k.c: reloc_type isn't ane enum any more
* config/tc-m68k.c: Added NO_RELOC definition.
Fri Feb 21 06:21:07 1992 K. Richard Pixley (rich@rtl.cygnus.com)
* Makefile.in: put header files before C source for TAGS; remove
references to non-existent syscalls.h.
* read.c, write.c subsegs.c: back out the .bss changes.
Fri Feb 21 01:08:48 1992 Minh Tran-Le (TRANLE@INTELLICORP.COM)

View File

@ -65,7 +65,7 @@
#include <stdio.h>
#include <assert.h>
#include "listing.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free xfree
@ -263,7 +263,7 @@ struct frag /* a code fragment */
typedef struct frag fragS;
COMMON fragS * frag_now; /* -> current frag we are building. */
COMMON fragS *frag_now; /* -> current frag we are building. */
/* This frag is incomplete. */
/* It is, however, included in frchain_now. */
/* Frag_now->fr_fix is bogus. Use: */
@ -389,7 +389,8 @@ void subsegs_begin();
/* these define types needed by the interfaces */
#include "struc-symbol.h"
#include "aout/reloc.h"
/*#include "aout/reloc.h"*/
#include "write.h"
#include "expr.h"
#include "frags.h"
@ -400,6 +401,8 @@ void subsegs_begin();
#include "tc.h"
#include "obj.h"
#include "listing.h"
/*
* Local Variables:
* comment-column: 0

File diff suppressed because it is too large Load Diff

View File

@ -40,6 +40,20 @@
#elif defined(TC_A29K)
#include "coff/a29k.h"
#define TARGET_FORMAT "coff-a29k-big"
/* Allow translate from aout relocs to coff relocs */
#define NO_RELOC 20
#define RELOC_32 1
#define RELOC_8 2
#define RELOC_CONST 3
#define RELOC_CONSTH 4
#define RELOC_JUMPTARG 5
#define RELOC_BASE22 6
#define RELOC_HI22 7
#define RELOC_LO10 8
#define RELOC_BASE13 9
#define RELOC_WDISP22 10
#define RELOC_WDISP30 11
#else
help me
#endif

View File

@ -48,7 +48,10 @@ struct machine_it {
expressionS exp;
int pcrel;
int reloc_offset; /* Offset of reloc within insn */
enum reloc_type reloc;
int reloc;
} the_insn;
#if __STDC__ == 1
@ -861,10 +864,6 @@ short tc_coff_fix2rtype(fixP)
fixS *fixP;
{
/* FIXME-NOW: relocation type handling is not yet written for
a29k. */
switch (fixP->fx_r_type) {
case RELOC_32: return(R_WORD);
case RELOC_8: return(R_BYTE);

View File

@ -1,38 +1,42 @@
/* tc-a29k.h -- Assemble for the AMD 29000.
Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GAS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GAS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id$ */
#define TC_A29K
#define tc_aout_pre_write_hook(x) {;} /* not used */
#define tc_coff_symbol_emit_hook(a) {;} /* not used */
#define tc_crawl_symbol_chain(a) {;} /* not used */
#define tc_headers_hook(a) {;} /* not used */
#define tc_headers_hook(a) ; /* not used */
#define tc_headers_hook(a) ; /* not used */
#define tc_crawl_symbol_chain(a) ; /* not used */
#define tc_coff_symbol_emit_hook(a) ; /* not used */
#define AOUT_MACHTYPE 101
#define TC_COFF_FIX2RTYPE(fix_ptr) tc_coff_fix2rtype(fix_ptr)
#define BFD_ARCH bfd_arch_a29k
#define COFF_MAGIC SIPFBOMAGIC
/* Should the reloc be output ?
on the 29k, this is true only if there is a symbol attatched.
on the h8, this is allways true, since no fixup is done
*/
on the 29k, this is true only if there is a symbol attatched.
on the h8, this is allways true, since no fixup is done
*/
#define TC_COUNT_RELOC(x) (x->fx_addsy)
/* end of tc-a29k.h */
#define COFF_FLAGS F_AR32W
#define reloc_type int

1257
gas/expr.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -18,16 +18,7 @@
along with GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
This thing should be set up to do byteordering correctly. But...
In order to cross-assemble the target machine must have an a.out header
similar to the one in a.out.h on THIS machine. Byteorder doesn't matter,
we take special care of it, but the numbers must be the same SIZE (# of
bytes) and in the same PLACE. If this is not true, you will have some
trouble.
*/
/* This thing should be set up to do byteordering correctly. But... */
#include "as.h"
#include "subsegs.h"
@ -45,11 +36,9 @@
#ifndef MANY_SEGMENTS
static struct frag *text_frag_root;
static struct frag *data_frag_root;
static struct frag *bss_frag_root;
static struct frag *text_last_frag; /* Last frag in segment. */
static struct frag *data_last_frag; /* Last frag in segment. */
static struct frag *bss_last_frag; /* Last frag in segment. */
#endif
static object_headers headers;
@ -94,7 +83,9 @@ symbolS *add_symbol; /* X_add_symbol. */
symbolS *sub_symbol; /* X_subtract_symbol. */
long offset; /* X_add_number. */
int pcrel; /* TRUE if PC-relative relocation. */
enum reloc_type r_type; /* Relocation type */
#if defined(TC_SPARC) || defined(TC_A29K)
int r_type; /* Relocation type */
#endif
{
fixS *fixP;
@ -107,8 +98,9 @@ enum reloc_type r_type; /* Relocation type */
fixP->fx_subsy = sub_symbol;
fixP->fx_offset = offset;
fixP->fx_pcrel = pcrel;
#if defined(TC_SPARC) || defined(TC_A29K)
fixP->fx_r_type = r_type;
#endif
/* JF these 'cuz of the NS32K stuff */
fixP->fx_im_disp = 0;
fixP->fx_pcrel_adjust = 0;
@ -207,23 +199,17 @@ void write_object_file()
for (frchainP = frchain_root; frchainP; frchainP = next_frchainP) {
know( frchainP->frch_root );
* prev_fragPP = frchainP->frch_root;
prev_fragPP = & frchainP->frch_last->fr_next;
next_frchainP = frchainP->frch_next;
if (next_frchainP == NULL)
{
bss_last_frag = frchainP->frch_last;
}
else if (next_frchainP == data0_frchainP)
{
text_last_frag = frchainP->frch_last;
prev_fragPP = & data_frag_root;
}
else if (next_frchainP == bss0_frchainP)
{
data_last_frag = frchainP->frch_last;
prev_fragPP = & bss_frag_root;
}
prev_fragPP = & frchainP->frch_last->fr_next;
if (((next_frchainP = frchainP->frch_next) == NULL)
|| next_frchainP == data0_frchainP) {
prev_fragPP = & data_frag_root;
if (next_frchainP) {
text_last_frag = frchainP->frch_last;
} else {
data_last_frag = frchainP->frch_last;
}
}
} /* walk the frag chain */
/*
@ -248,7 +234,6 @@ void write_object_file()
relax_segment(text_frag_root, SEG_TEXT);
relax_segment(data_frag_root, SEG_DATA);
relax_segment(bss_frag_root, SEG_BSS);
/*
* Now the addresses of frags are correct within the segment.
*/
@ -287,18 +272,7 @@ void write_object_file()
bss_address_frag.fr_address = (H_GET_TEXT_SIZE(&headers) +
H_GET_DATA_SIZE(&headers));
H_SET_BSS_SIZE(&headers, bss_last_frag->fr_address);
/*
* now fixup all bss frags addresses
*/
if (bss_frag_root)
{
relax_addressT slide;
slide = bss_address_frag.fr_address;
for (fragP = bss_frag_root; fragP; fragP = fragP->fr_next)
fragP->fr_address += slide;
}
H_SET_BSS_SIZE(&headers,local_bss_counter);
/*
*
@ -410,11 +384,17 @@ void write_object_file()
lie->sub,
lie->addnum,
0, 0, 2, 0, 0);
#else /* TC_NS32K */
#elif defined(TC_SPARC) || defined(TC_A29K)
fix_new( lie->frag, lie->word_goes_here - lie->frag->fr_literal,
2, lie->add,
lie->sub, lie->addnum,
0, NO_RELOC);
#else
fix_new( lie->frag, lie->word_goes_here - lie->frag->fr_literal,
2, lie->add,
lie->sub, lie->addnum,
0, 0);
#endif /* TC_NS32K */
/* md_number_to_chars(lie->word_goes_here,
S_GET_VALUE(lie->add)
@ -620,14 +600,14 @@ void write_object_file()
void relax_segment(segment_frag_root, segment)
struct frag * segment_frag_root;
segT segment; /* SEG_DATA or SEG_TEXT or SEG_BSS */
segT segment; /* SEG_DATA or SEG_TEXT */
{
register struct frag * fragP;
register relax_addressT address;
/* register relax_addressT old_address; JF unused */
/* register relax_addressT new_address; JF unused */
#ifndef MANY_SEGMENTS
know(segment == SEG_DATA || segment == SEG_TEXT || segment == SEG_BSS);
know(segment == SEG_DATA || segment == SEG_TEXT);
#endif
/* In case md_estimate_size_before_relax() wants to make fixSs. */
subseg_change(segment, 0);
@ -768,10 +748,7 @@ segT segment; /* SEG_DATA or SEG_TEXT or SEG_BSS */
if (symbolP) {
#ifdef MANY_SEGMENTS
#else
know((S_GET_SEGMENT(symbolP) == SEG_ABSOLUTE)
|| (S_GET_SEGMENT(symbolP) == SEG_DATA)
|| (S_GET_SEGMENT(symbolP) == SEG_TEXT)
|| (S_GET_SEGMENT(symbolP) == SEG_BSS));
know((S_GET_SEGMENT(symbolP) == SEG_ABSOLUTE) || (S_GET_SEGMENT(symbolP) == SEG_DATA) || (S_GET_SEGMENT(symbolP) == SEG_TEXT));
know(symbolP->sy_frag);
know(!(S_GET_SEGMENT(symbolP) == SEG_ABSOLUTE) || (symbolP->sy_frag == &zero_address_frag));
#endif
@ -1084,16 +1061,10 @@ segT this_segment_type; /* N_TYPE bits for segment. */
#endif /* TC_I960 */
#ifdef OBJ_COFF
/* This really needed to be
like this for COFF output.
- mtranle@paris
But I'm not sure it's right
for i960 or a29k coff.
xoxorich. */
#ifdef TE_I386AIX
if (S_IS_COMMON(add_symbolP))
add_number += S_GET_VALUE(add_symbolP);
#endif /* TE_I386AIX */
#endif /* OBJ_COFF */
++seg_reloc_count;

View File

@ -35,49 +35,32 @@
#define S_LOCAL_NAME(s) (LOCAL_LABEL(S_GET_NAME(s)))
/* The bit_fix was implemented to support machines that need variables
to be inserted in bitfields other than 1, 2 and 4 bytes.
Furthermore it gives us a possibillity to mask in bits in the symbol
when it's fixed in the objectcode and check the symbols limits.
The or-mask is used to set the huffman bits in displacements for the
ns32k port.
The acbi, addqi, movqi, cmpqi instruction requires an assembler that
can handle bitfields. Ie handle an expression, evaluate it and insert
the result in an some bitfield. ( ex: 5 bits in a short field of a opcode)
*/
#include "bit_fix.h"
struct bit_fix {
int fx_bit_size; /* Length of bitfield */
int fx_bit_offset; /* Bit offset to bitfield */
long fx_bit_base; /* Where do we apply the bitfix.
If this is zero, default is assumed. */
long fx_bit_base_adj;/* Adjustment of base */
long fx_bit_max; /* Signextended max for bitfield */
long fx_bit_min; /* Signextended min for bitfield */
long fx_bit_add; /* Or mask, used for huffman prefix */
};
typedef struct bit_fix bit_fixS;
/*
* FixSs may be built up in any order.
*/
struct fix {
fragS *fx_frag; /* Which frag? */
long fx_where; /* Where is the 1st byte to fix up? */
symbolS *fx_addsy; /* NULL or Symbol whose value we add in. */
symbolS *fx_subsy; /* NULL or Symbol whose value we subtract. */
long fx_offset; /* Absolute number we add in. */
struct fix *fx_next; /* NULL or -> next fixS. */
short int fx_size; /* How many bytes are involved? */
char fx_pcrel; /* TRUE: pc-relative. */
char fx_pcrel_adjust;/* pc-relative offset adjust */
char fx_im_disp; /* TRUE: value is a displacement */
bit_fixS *fx_bit_fixP; /* IF NULL no bitfix's to do */
char fx_bsr; /* sequent-hack */
enum reloc_type fx_r_type; /* Sparc hacks */
char fx_callj; /* TRUE if target is a 'callj'
(used by i960) */
fragS *fx_frag; /* Which frag? */
long fx_where; /* Where is the 1st byte to fix up? */
symbolS *fx_addsy; /* NULL or Symbol whose value we add in. */
symbolS *fx_subsy; /* NULL or Symbol whose value we subtract. */
long fx_offset; /* Absolute number we add in. */
struct fix *fx_next; /* NULL or -> next fixS. */
short int fx_size; /* How many bytes are involved? */
char fx_pcrel; /* TRUE: pc-relative. */
char fx_pcrel_adjust; /* pc-relative offset adjust */
char fx_im_disp; /* TRUE: value is a displacement */
bit_fixS *fx_bit_fixP; /* IF NULL no bitfix's to do */
char fx_bsr; /* sequent-hack */
#if defined(TC_SPARC) || defined(TC_A29K)
/* Hacks for machines where the type of reloc can't be
worked out by looking at how big it is */
int fx_r_type;
#endif
char fx_callj; /* TRUE if target is a 'callj' (used by i960) */
long fx_addnumber;
};
@ -88,6 +71,7 @@ COMMON char *next_object_file_charP;
#ifndef MANY_SEGMENTS
COMMON fixS *text_fix_root, *text_fix_tail; /* Chains fixSs. */
COMMON fixS *data_fix_root, *data_fix_tail; /* Chains fixSs. */
COMMON fixS *bss_fix_root, *bss_fix_tail; /* Chains fixSs. */
#endif
COMMON fixS **seg_fix_rootP, **seg_fix_tailP; /* -> one of above. */
extern long string_byte_count;
@ -95,7 +79,7 @@ extern int section_alignment[];
#if __STDC__ == 1
bit_fixS *bit_fix_new(char size, char offset, long base_type, long base_adj, long min, long max, long add);
bit_fixS *bit_fix_new(int size, int offset, long base_type, long base_adj, long min, long max, long add);
void append(char **charPP, char *fromP, unsigned long length);
void record_alignment(segT seg, int align);
void write_object_file(void);