1999-09-04 Steve Chamberlain <sac@pobox.com>

* config/tc-pj.c: New file, supports picoJava in ELF.
	* config/tc-pj.h: Ditto.
	* configure.in (pjl*, pj*): New targets.
	* Makefile.am: Rebuild dependencies.
	(CPU_TYPES): Add pj.
	(TARGET_CPU_CFILES): Add config/tc-pj.c.
	(TARGET_CPU_HFILES): Add config/tc-pj.h.
	* doc/c-pj.texi: New file.
	* doc/as.texinfo: Add some PJ specifics.
	* doc/all.texi: Add PJ to the list of all architectures, sort them
	all alphabetically.
	* doc/Makefile.in (CPU_DOCS): Add c-pj.texi.
	* configure, Makefile.in, doc/Makefile.in: Rebuild.
This commit is contained in:
Ian Lance Taylor 1999-09-04 17:29:22 +00:00
parent 2ef5e2a158
commit 041dd5a9f4
13 changed files with 1213 additions and 509 deletions

View File

@ -1,3 +1,19 @@
1999-09-04 Steve Chamberlain <sac@pobox.com>
* config/tc-pj.c: New file, supports picoJava in ELF.
* config/tc-pj.h: Ditto.
* configure.in (pjl*, pj*): New targets.
* Makefile.am: Rebuild dependencies.
(CPU_TYPES): Add pj.
(TARGET_CPU_CFILES): Add config/tc-pj.c.
(TARGET_CPU_HFILES): Add config/tc-pj.h.
* doc/c-pj.texi: New file.
* doc/as.texinfo: Add some PJ specifics.
* doc/all.texi: Add PJ to the list of all architectures, sort them
all alphabetically.
* doc/Makefile.in (CPU_DOCS): Add c-pj.texi.
* configure, Makefile.in, doc/Makefile.in: Rebuild.
1999-09-02 Alan Modra <alan@spri.levels.unisa.edu.au>
* config/obj-multi.h: Include obj-elf.h if OBJ_MAYBE_ELF. Reformat.

View File

@ -55,6 +55,7 @@ CPU_TYPES = \
mn10200 \
mn10300 \
ns32k \
pj \
ppc \
sh \
sparc \
@ -211,6 +212,7 @@ TARGET_CPU_CFILES = \
config/tc-mn10200.c \
config/tc-mn10300.c \
config/tc-ns32k.c \
config/tc-pj.c \
config/tc-ppc.c \
config/tc-sh.c \
config/tc-sparc.c \
@ -244,6 +246,7 @@ TARGET_CPU_HFILES = \
config/tc-mn10200.h \
config/tc-mn10300.h \
config/tc-ns32k.h \
config/tc-pj.h \
config/tc-ppc.h \
config/tc-sh.h \
config/tc-sparc.h \
@ -1128,6 +1131,12 @@ DEPTC_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h $(INCDIR)/opcode/ns32k.h \
$(INCDIR)/obstack.h
DEPTC_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
$(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
$(INCDIR)/opcode/pj.h
DEPTC_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h $(INCDIR)/opcode/pj.h
DEPTC_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
$(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h
@ -1404,6 +1413,13 @@ DEPOBJ_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h subsegs.h \
$(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
DEPOBJ_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
$(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
$(INCDIR)/obstack.h subsegs.h
DEPOBJ_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h subsegs.h \
$(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
DEPOBJ_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
$(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
@ -1633,6 +1649,11 @@ DEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \
DEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h
DEP_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
$(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
DEP_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h
DEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
$(INCDIR)/bfdlink.h

View File

@ -161,6 +161,7 @@ CPU_TYPES = \
mn10200 \
mn10300 \
ns32k \
pj \
ppc \
sh \
sparc \
@ -323,6 +324,7 @@ TARGET_CPU_CFILES = \
config/tc-mn10200.c \
config/tc-mn10300.c \
config/tc-ns32k.c \
config/tc-pj.c \
config/tc-ppc.c \
config/tc-sh.c \
config/tc-sparc.c \
@ -357,6 +359,7 @@ TARGET_CPU_HFILES = \
config/tc-mn10200.h \
config/tc-mn10300.h \
config/tc-ns32k.h \
config/tc-pj.h \
config/tc-ppc.h \
config/tc-sh.h \
config/tc-sparc.h \
@ -837,6 +840,14 @@ DEPTC_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h $(INCDIR)/opcode/ns32k.h \
$(INCDIR)/obstack.h
DEPTC_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
$(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
$(INCDIR)/opcode/pj.h
DEPTC_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h $(INCDIR)/opcode/pj.h
DEPTC_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
$(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h
@ -1193,6 +1204,15 @@ DEPOBJ_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h subsegs.h \
$(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
DEPOBJ_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
$(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
$(INCDIR)/obstack.h subsegs.h
DEPOBJ_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h subsegs.h \
$(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
DEPOBJ_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
$(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
@ -1501,6 +1521,13 @@ DEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h
DEP_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
$(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
DEP_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h
DEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
$(INCDIR)/bfdlink.h

View File

@ -2,13 +2,17 @@
Changes in 2.10:
Support for the Motorolla MCore 210 processor added.
picoJava architecture support added.
A new pseudo-op .intel_syntax has been implemented to allow gas to parse i386 assembly
programs with intel syntax.
Motorola MCore 210 processor support added.
A new pseudo-op .intel_syntax has been implemented to allow gas to parse i386
assembly programs with intel syntax.
New pseudo-ops .func,.endfunc to aid in debugging user-written assembler code.
Added -gdwarf2 option to generate DWARF 2 debugging information.
Full 16-bit mode support for i386.
Greatly improved instruction operand checking for i386. This change will

594
gas/config/tc-pj.c Normal file
View File

@ -0,0 +1,594 @@
/*-
tc-pj.c -- Assemble code for Pico Java
Copyright (C) 1999 Free Software Foundation.
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, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Contributed by Steve Chamberlain of Transmeta, sac@pobox.com */
#include "as.h"
#include "opcode/pj.h"
extern const pj_opc_info_t pj_opc_info[512];
const char comment_chars[] = "!/";
const char line_separator_chars[] = ";";
const char line_comment_chars[] = "/!#";
static int pending_reloc;
static struct hash_control *opcode_hash_control;
static void
little (ignore)
int ignore ATTRIBUTE_UNUSED;
{
target_big_endian = 0;
}
static void
big (ignore)
int ignore ATTRIBUTE_UNUSED;
{
target_big_endian = 1;
}
const pseudo_typeS md_pseudo_table[] = {
{"ml", little, 0},
{"mb", big, 0},
{0, 0, 0}
};
const char FLT_CHARS[] = "rRsSfFdDxXpP";
const char EXP_CHARS[] = "eE";
void
md_operand (op)
expressionS *op;
{
if (strncmp (input_line_pointer, "%hi16", 5) == 0)
{
if (pending_reloc)
as_bad (_ ("confusing relocation expressions"));
pending_reloc = BFD_RELOC_PJ_CODE_HI16;
input_line_pointer += 5;
expression (op);
}
if (strncmp (input_line_pointer, "%lo16", 5) == 0)
{
if (pending_reloc)
as_bad (_ ("confusing relocation expressions"));
pending_reloc = BFD_RELOC_PJ_CODE_LO16;
input_line_pointer += 5;
expression (op);
}
}
/* Parse an expression and then restore the input line pointer. */
static char *
parse_exp_save_ilp (s, op)
char *s;
expressionS *op;
{
char *save = input_line_pointer;
input_line_pointer = s;
expression (op);
s = input_line_pointer;
input_line_pointer = save;
return s;
}
/* This is called by emit_expr via TC_CONS_FIX_NEW when creating a
reloc for a cons. We could use the definition there, except that
we want to handle magic pending reloc expressions specially. */
void
pj_cons_fix_new_pj (frag, where, nbytes, exp)
fragS *frag;
int where;
int nbytes;
expressionS *exp;
{
static int rv[5][2] =
{ { 0, 0 },
{ BFD_RELOC_8, BFD_RELOC_8 },
{ BFD_RELOC_PJ_CODE_DIR16, BFD_RELOC_16 },
{ 0, 0 },
{ BFD_RELOC_PJ_CODE_DIR32, BFD_RELOC_32 }};
fix_new_exp (frag, where, nbytes, exp, 0,
pending_reloc ? pending_reloc
: rv [nbytes][(now_seg->flags & SEC_CODE) ? 0 : 1]);
pending_reloc = 0;
}
/* Turn a reloc description character from the pj-opc.h table into
code which BFD can handle. */
static int
c_to_r (x)
char x;
{
switch (x)
{
case O_R8:
return BFD_RELOC_8_PCREL;
case O_U8:
case O_8:
return BFD_RELOC_8;
case O_R16:
return BFD_RELOC_PJ_CODE_REL16;
case O_U16:
case O_16:
return BFD_RELOC_PJ_CODE_DIR16;
case O_R32:
return BFD_RELOC_PJ_CODE_REL32;
case O_32:
return BFD_RELOC_PJ_CODE_DIR32;
}
abort ();
return 0;
}
/* Handler for the ipush fake opcode,
turns ipush <foo> into sipush lo16<foo>, sethi hi16<foo>. */
static void
ipush_code (opcode, str)
pj_opc_info_t *opcode ATTRIBUTE_UNUSED;
char *str;
{
int mod = 0;
char *b = frag_more (6);
expressionS arg;
b[0] = 0x11;
b[3] = 0xed;
parse_exp_save_ilp (str + 1, &arg, &mod);
if (mod)
as_bad (_ ("can't have relocation for ipush"));
fix_new_exp (frag_now, b - frag_now->fr_literal + 1, 2,
&arg, 0, BFD_RELOC_PJ_CODE_DIR16);
fix_new_exp (frag_now, b - frag_now->fr_literal + 4, 2,
&arg, 0, BFD_RELOC_PJ_CODE_HI16);
}
/* Insert names into the opcode table which are really mini macros,
not opcodes. The fakeness is inidicated with an opcode of -1. */
static void
fake_opcode (name, func) const char *
name;
void (*func) ();
{
pj_opc_info_t *fake = (pj_opc_info_t *) xmalloc (sizeof (pj_opc_info_t));
fake->opcode = -1;
fake->opcode_next = -1;
fake->name = (const char *) func;
hash_insert (opcode_hash_control, name, (char *) fake);
}
/* Enter another entry into the opcode hash table so the same opcode
can have another name. */
static void
alias (new, old) const char *
new;
const char *old;
{
hash_insert (opcode_hash_control, new,
(char *) hash_find (opcode_hash_control, old));
}
/* This function is called once, at assembler startup time. It sets
up the hash table with all the opcodes in it, and also initializes
some aliases for compatibility with other assemblers. */
void
md_begin ()
{
const pj_opc_info_t *opcode;
opcode_hash_control = hash_new ();
/* Insert names into hash table */
for (opcode = pj_opc_info; opcode->name; opcode++)
hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
/* Insert the only fake opcode. */
fake_opcode ("ipush", ipush_code);
/* Add some aliases for opcode names. */
alias ("ifeq_s", "ifeq");
alias ("ifne_s", "ifne");
alias ("if_icmpge_s", "if_icmpge");
alias ("if_icmpne_s", "if_icmpne");
alias ("if_icmpeq_s", "if_icmpeq");
alias ("if_icmpgt_s", "if_icmpgt");
alias ("goto_s", "goto");
bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0);
}
/* This is the guts of the machine-dependent assembler. STR points to a
machine dependent instruction. This function is supposed to emit
the frags/bytes it assembles to.
*/
void
md_assemble (str)
char *str;
{
unsigned char *op_start;
unsigned char *op_end;
// pj_operan_info operand[3];
pj_opc_info_t *opcode;
char *output;
int idx = 0;
char pend;
int nlen = 0;
/* Drop leading whitespace */
while (*str == ' ')
str++;
/* find the op code end */
for (op_start = op_end = (unsigned char *) (str);
*op_end && !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
nlen++;
pend = *op_end;
*op_end = 0;
if (nlen == 0)
{
as_bad (_ ("can't find opcode "));
}
opcode = (pj_opc_info_t *) hash_find (opcode_hash_control, op_start);
*op_end = pend;
if (opcode == NULL)
{
as_bad (_ ("unknown opcode %s"), op_start);
return;
}
if (opcode->opcode == -1)
{
/* It's a fake opcode.. dig out the args and pretend that was
what we were passed */
((void (*)()) opcode->name) (opcode, op_end);
}
else
{
int an;
output = frag_more (opcode->len);
output[idx++] = opcode->opcode;
if (opcode->opcode_next != -1)
output[idx++] = opcode->opcode_next;
for (an = 0; opcode->arg[an]; an++)
{
expressionS arg;
if (*op_end == ',' && an != 0)
op_end++;
if (*op_end == 0)
as_bad ("expected expresssion");
op_end = parse_exp_save_ilp (op_end, &arg);
fix_new_exp (frag_now,
output - frag_now->fr_literal + idx,
ASIZE (opcode->arg[an]),
&arg,
PCREL (opcode->arg[an]),
pending_reloc ? pending_reloc : c_to_r (opcode->arg[an]));
idx += ASIZE (opcode->arg[an]);
pending_reloc = 0;
}
while (isspace (*op_end))
op_end++;
if (*op_end != 0)
as_warn ("extra stuff on line ignored");
}
if (pending_reloc)
as_bad ("Something forgot to clean up\n");
}
/* Turn a string in input_line_pointer into a floating point constant of type
type, and store the appropriate bytes in *litP. The number of LITTLENUMS
emitted is stored in *sizeP . An error message is returned, or NULL on OK.
*/
char *
md_atof (type, litP, sizeP)
int type;
char *litP;
int *sizeP;
{
int prec;
LITTLENUM_TYPE words[4];
char *t;
int i;
switch (type)
{
case 'f':
prec = 2;
break;
case 'd':
prec = 4;
break;
default:
*sizeP = 0;
return _ ("bad call to md_atof");
}
t = atof_ieee (input_line_pointer, type, words);
if (t)
input_line_pointer = t;
*sizeP = prec * 2;
if (!target_big_endian)
{
for (i = prec - 1; i >= 0; i--)
{
md_number_to_chars (litP, (valueT) words[i], 2);
litP += 2;
}
}
else
{
for (i = 0; i < prec; i++)
{
md_number_to_chars (litP, (valueT) words[i], 2);
litP += 2;
}
}
return NULL;
}
CONST char *md_shortopts = "";
struct option md_longopts[] = {
#define OPTION_LITTLE (OPTION_MD_BASE)
#define OPTION_BIG (OPTION_LITTLE + 1)
{"little", no_argument, NULL, OPTION_LITTLE},
{"big", no_argument, NULL, OPTION_BIG},
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (c, arg)
int c;
char *arg ATTRIBUTE_UNUSED;
{
switch (c)
{
case OPTION_LITTLE:
little ();
break;
case OPTION_BIG:
big ();
break;
default:
return 0;
}
return 1;
}
void
md_show_usage (stream)
FILE *stream;
{
fprintf (stream, _ ("\
PJ options:\n\
-little generate little endian code\n\
-big generate big endian code\n"));
}
/* Apply a fixup to the object file. */
int
md_apply_fix (fixP, valp)
fixS *fixP;
valueT *valp;
{
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
long val = *valp;
long max, min;
int shift;
/* adjust_reloc_syms won't convert a reloc against a weak symbol
into a reloc against a section, but bfd_install_relocation will
screw up if the symbol is defined, so we have to adjust val here
to avoid the screw up later. */
if (fixP->fx_addsy != NULL && S_IS_WEAK (fixP->fx_addsy))
val -= S_GET_VALUE (fixP->fx_addsy);
max = min = 0;
shift = 0;
switch (fixP->fx_r_type)
{
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
fixP->fx_done = 0;
return 0;
case BFD_RELOC_PJ_CODE_REL16:
if (val < -0x8000 || val >= 0x7fff)
as_bad_where (fixP->fx_file, fixP->fx_line, _ ("pcrel too far"));
buf[0] |= (val >> 8) & 0xff;
buf[1] = val & 0xff;
break;
case BFD_RELOC_PJ_CODE_HI16:
*buf++ = val >> 24;
*buf++ = val >> 16;
fixP->fx_addnumber = val & 0xffff;
break;
case BFD_RELOC_PJ_CODE_DIR16:
case BFD_RELOC_PJ_CODE_LO16:
*buf++ = val >> 8;
*buf++ = val >> 0;
max = 0xffff;
min = -0xffff;
break;
case BFD_RELOC_8:
max = 0xff;
min = -0xff;
*buf++ = val;
break;
case BFD_RELOC_PJ_CODE_DIR32:
*buf++ = val >> 24;
*buf++ = val >> 16;
*buf++ = val >> 8;
*buf++ = val >> 0;
break;
case BFD_RELOC_32:
if (target_big_endian)
{
*buf++ = val >> 24;
*buf++ = val >> 16;
*buf++ = val >> 8;
*buf++ = val >> 0;
}
else
{
*buf++ = val >> 0;
*buf++ = val >> 8;
*buf++ = val >> 16;
*buf++ = val >> 24;
}
break;
case BFD_RELOC_16:
if (target_big_endian)
{
*buf++ = val >> 8;
*buf++ = val >> 0;
}
else
{
*buf++ = val >> 0;
*buf++ = val >> 8;
}
break;
default:
abort ();
}
if (max != 0 && (val < min || val > max))
as_bad_where (fixP->fx_file, fixP->fx_line, _ ("offset out of range"));
return 0;
}
/* Put number into target byte order. Always put values in an
executable section into big endian order. */
void
md_number_to_chars (ptr, use, nbytes)
char *ptr;
valueT use;
int nbytes;
{
if (target_big_endian || now_seg->flags & SEC_CODE)
number_to_chars_bigendian (ptr, use, nbytes);
else
number_to_chars_littleendian (ptr, use, nbytes);
}
/* Translate internal representation of relocation info to BFD target
format. */
arelent *
tc_gen_reloc (section, fixp)
asection *section ATTRIBUTE_UNUSED;
fixS *fixp;
{
arelent *rel;
bfd_reloc_code_real_type r_type;
rel = (arelent *) xmalloc (sizeof (arelent));
rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
r_type = fixp->fx_r_type;
rel->addend = fixp->fx_addnumber;
rel->howto = bfd_reloc_type_lookup (stdoutput, r_type);
if (rel->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_ ("Cannot represent relocation type %s"),
bfd_get_reloc_code_name (r_type));
/* Set howto to a garbage value so that we can keep going. */
rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32);
assert (rel->howto != NULL);
}
return rel;
}

62
gas/config/tc-pj.h Normal file
View File

@ -0,0 +1,62 @@
/*-This file is tc-pj.h
Copyright (C) 1999 Free Software Foundation, Inc.
Contributed by Steve Chamberlain of Transmeta, sac@pobox.com
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, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Contributed by Steve Chamberlain, of Transmeta. sac@pobox.com. */
#define WORKING_DOT_WORD
#define IGNORE_NONSTANDARD_ESCAPES
#define TARGET_ARCH bfd_arch_pj
#define TARGET_FORMAT (target_big_endian ? "elf32-pj" : "elf32-pjl")
#define LISTING_HEADER \
(target_big_endian \
? "Pico Java GAS Big Endian" \
: "Pico Java GAS Little Endian")
void pj_cons_fix_new_pj PARAMS ((struct frag *, int, int, expressionS *));
arelent *tc_gen_reloc PARAMS((asection *section, struct fix *fixp));
#define md_section_align(SEGMENT, SIZE) (SIZE)
#define md_convert_frag(B, S, F) (as_fatal (_("convert_frag\n")), 0)
#define md_estimate_size_before_relax(A, B) (as_fatal (_("estimate size\n")),0)
#define md_undefined_symbol(NAME) 0
/* PC relative operands are relative to the start of the opcode, and the operand
is always one byte into the opcode. */
#define md_pcrel_from(FIXP) \
((FIXP)->fx_where + (FIXP)->fx_frag->fr_address - 1)
#define TC_CONS_FIX_NEW(FRAG, WHERE, NBYTES, EXP) \
pj_cons_fix_new_pj(FRAG, WHERE, NBYTES, EXP)
/* Always leave vtable relocs untouched in the output. */
#define TC_FORCE_RELOCATION(FIX) \
((FIX)->fx_r_type == BFD_RELOC_VTABLE_INHERIT \
|| (FIX)->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
#define obj_fix_adjustable(FIX) \
(! ((FIX)->fx_r_type == BFD_RELOC_VTABLE_INHERIT \
|| (FIX)->fx_r_type == BFD_RELOC_VTABLE_ENTRY))

911
gas/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -103,6 +103,8 @@ changequote([,])dnl
m8*) cpu_type=m88k ;;
mips*el) cpu_type=mips endian=little ;;
mips*) cpu_type=mips endian=big ;;
pjl*) cpu_type=pj endian=little ;;
pj*) cpu_type=pj endian=big ;;
powerpcle*) cpu_type=ppc endian=little ;;
powerpc*) cpu_type=ppc endian=big ;;
rs6000*) cpu_type=ppc ;;
@ -277,6 +279,7 @@ changequote([,])dnl
;;
mn10200-*-*) fmt=elf bfd_gas=yes ;;
mn10300-*-*) fmt=elf bfd_gas=yes ;;
pj*) fmt=elf ;;
ppc-*-pe | ppc-*-cygwin* | ppc-*-winnt*)
fmt=coff em=pe ;;
ppc-*-aix*) fmt=coff ;;

View File

@ -27,6 +27,7 @@ CPU_DOCS = \
c-m68k.texi \
c-mips.texi \
c-ns32k.texi \
c-pj.texi \
c-sh.texi \
c-sparc.texi \
c-vax.texi \

View File

@ -131,6 +131,7 @@ CPU_DOCS = \
c-m68k.texi \
c-mips.texi \
c-ns32k.texi \
c-pj.texi \
c-sh.texi \
c-sparc.texi \
c-vax.texi \
@ -343,7 +344,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \

View File

@ -32,19 +32,20 @@
@set D30V
@set H8/300
@set H8/500
@set SH
@set HPPA
@set I80386
@set I960
@set MCORE
@set MIPS
@set M32R
@set M680X0
@set Z8000
@set MCORE
@set MIPS
@set PJ
@set SH
@set SPARC
@set V850
@set VAX
@set VXWORKS
@set HPPA
@set V850
@set Z8000
@c Does this version of the assembler use the difference-table kluge?
@set DIFF-TBL-KLUGE

View File

@ -239,6 +239,9 @@ Here is a brief summary of how to invoke @code{@value{AS}}. For details,
@ifset HPPA
@c HPPA has no machine-dependent assembler options (yet).
@end ifset
@ifset PJ
[ -mb | -me ]
@end ifset
@ifset SPARC
@c The order here is important. See c-sparc.texi.
[ -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite
@ -504,6 +507,26 @@ unit coprocessor. The default is to assume an MMU for 68020 and up.
@end table
@end ifset
@ifset PJ
The following options are available when @value{AS} is configured for
a picoJava processor.
@table @code
@cindex PJ endianness
@cindex endianness, PJ
@cindex big endian output, PJ
@item -mb
Generate ``big endian'' format output.
@cindex little endian output, PJ
@item -ml
Generate ``little endian'' format output.
@end table
@end ifset
@ifset SPARC
The following options are available when @code{@value{AS}} is configured
for the SPARC architecture:
@ -1523,6 +1546,9 @@ is considered a comment and is ignored. The line comment character is
@ifset I960
@samp{#} on the i960;
@end ifset
@ifset PJ
@samp{;} for picoJava;
@end ifset
@ifset SH
@samp{!} for the Hitachi SH;
@end ifset
@ -4844,6 +4870,9 @@ subject, see the hardware manufacturer's manual.
@ifset SH
* SH-Dependent:: Hitachi SH Dependent Features
@end ifset
@ifset PJ
* PJ-Dependent:: picoJava Dependent Features
@end ifset
@ifset SPARC
* Sparc-Dependent:: SPARC Dependent Features
@end ifset
@ -5014,6 +5043,10 @@ family.
@include c-ns32k.texi
@end ifset
@ifset PJ
@include c-pj.texi
@end ifset
@ifset SH
@include c-sh.texi
@end ifset

28
gas/doc/c-pj.texi Normal file
View File

@ -0,0 +1,28 @@
@c Copyright (C) 1999 Free Software Foundation, Inc.
@c This is part of the GAS manual.
@c For copying conditions, see the file as.texinfo.
@page
@node PJ-Dependent
@chapter picoJava Dependent Features
@cindex PJ support
@menu
* PJ Options:: Options
@end menu
@node PJ Options
@section Options
@cindex PJ options
@cindex options, PJ
@code{@value{AS}} has two addiitional command-line options for the picoJava
architecture.
@table @code
@item -ml
This option selects little endian data output.
@item -mb
This option selects big endian data output.
@end table