Safely check in r16 targets for binutils.

This commit is contained in:
Michael Tiemann 1994-11-24 20:30:11 +00:00
parent 481faa25ac
commit d94aca1aff
18 changed files with 1630 additions and 110 deletions

View File

@ -23,6 +23,14 @@ else
lose_these_too="${mpw_files} ${lose_these_too}"
fi
r16_files="cpu-r16.c aout-r16.c"
if ( echo $* | grep keep\-r16 > /dev/null ) ; then
keep_these_too="${r16_files} ${keep_these_too}"
else
lose_these_too="${r16_files} ${lose_these_too}"
fi
# All files listed between the "Things-to-keep:" line and the
# "Files-to-sed:" line will be kept. All other files will be removed.
# Directories listed in this section will have their own Sanitize

38
bfd/aout-r16.c Normal file
View File

@ -0,0 +1,38 @@
/* BFD back-end for SOP a.out binaries.
Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program 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 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define TARGET_IS_BIG_ENDIAN_P
#define PAGE_SIZE 4096
#define SEGMENT_SIZE 4096
#define TEXT_START_ADDR 0x0
/* #define N_HEADER_IN_TEXT(x) 0 */
#define N_SHARED_LIB(x) 0
#define ARCH 32
#define BYTES_IN_WORD 4
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
#include "aout/ar.h"
#include "libaout.h"
#define DEFAULT_ARCH bfd_arch_sop
#define MY(OP) CAT(sop_aout_,OP)
#define TARGETNAME "a.out-sop"
#include "aout-target.h"

View File

@ -1,8 +1,7 @@
/* BFD library support routines for architectures.
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
@ -35,7 +34,7 @@ SECTION
The architecture information is provided by each architecture package.
The set of default architectures is selected by the macro
<<SELECT_ARCHITECTURES>>. This is normally set up in the
<<config/target.mt>> file of your choice. If the name is not
@file{config/@var{target}.mt} file of your choice. If the name is not
defined, then all the architectures supported are included.
When BFD starts up, all the architectures are called with an
@ -44,7 +43,7 @@ SECTION
generally this would be one for each machine and one for the
default case (an item with a machine field of 0).
BFD's idea of an architecture is implemented in <<archures.c>>.
BFD's idea of an architecture is implemented in @file{archures.c}.
*/
/*
@ -82,6 +81,9 @@ DESCRIPTION
.#define bfd_mach_i960_mc 4
.#define bfd_mach_i960_xa 5
.#define bfd_mach_i960_ca 6
. {* start-sanitize-i960xl *}
.#define bfd_mach_i960_xl 7
. {* end-sanitize-i960xl *}
.
. bfd_arch_a29k, {* AMD 29000 *}
. bfd_arch_sparc, {* SPARC *}
@ -98,6 +100,7 @@ DESCRIPTION
. bfd_arch_h8300, {* Hitachi H8/300 *}
.#define bfd_mach_h8300 1
.#define bfd_mach_h8300h 2
. bfd_arch_powerpc, {* PowerPC *}
. bfd_arch_rs6000, {* IBM RS/6000 *}
. bfd_arch_hppa, {* HP PA RISC *}
. bfd_arch_z8k, {* Zilog Z8000 *}
@ -106,6 +109,8 @@ DESCRIPTION
. bfd_arch_h8500, {* Hitachi H8/500 *}
. bfd_arch_sh, {* Hitachi SH *}
. bfd_arch_alpha, {* Dec Alpha *}
. bfd_arch_arm, {* Advanced Risc Machines ARM *}
. bfd_arch_ns32k, {* National Semiconductors ns32000 *}
. bfd_arch_last
. };
@ -172,8 +177,8 @@ DESCRIPTION
*/
CONST char *
DEFUN(bfd_printable_name, (abfd),
bfd *abfd)
bfd_printable_name (abfd)
bfd *abfd;
{
return abfd->arch_info->printable_name;
}
@ -195,8 +200,8 @@ DESCRIPTION
*/
bfd_arch_info_type *
DEFUN(bfd_scan_arch,(string),
CONST char *string)
bfd_scan_arch (string)
CONST char *string;
{
struct bfd_arch_info *ap;
@ -231,10 +236,9 @@ DESCRIPTION
*/
CONST bfd_arch_info_type *
DEFUN(bfd_arch_get_compatible,(abfd, bbfd),
CONST bfd *abfd AND
CONST bfd *bbfd)
bfd_arch_get_compatible (abfd, bbfd)
CONST bfd *abfd;
CONST bfd *bbfd;
{
return abfd->arch_info->compatible(abfd->arch_info,bbfd->arch_info);
}
@ -274,9 +278,10 @@ DESCRIPTION
Set the architecture info of @var{abfd} to @var{arg}.
*/
void DEFUN(bfd_set_arch_info,(abfd, arg),
bfd *abfd AND
bfd_arch_info_type *arg)
void
bfd_set_arch_info (abfd, arg)
bfd *abfd;
bfd_arch_info_type *arg;
{
abfd->arch_info = arg;
}
@ -297,10 +302,11 @@ DESCRIPTION
pointer.
*/
boolean DEFUN(bfd_default_set_arch_mach,(abfd, arch, mach),
bfd *abfd AND
enum bfd_architecture arch AND
unsigned long mach)
boolean
bfd_default_set_arch_mach (abfd, arch, mach)
bfd *abfd;
enum bfd_architecture arch;
unsigned long mach;
{
static struct bfd_arch_info *old_ptr = &bfd_default_arch_struct;
boolean found = false;
@ -322,7 +328,7 @@ boolean DEFUN(bfd_default_set_arch_mach,(abfd, arch, mach),
if (found==false) {
/*looked for it and it wasn't there, so put in the default */
old_ptr = &bfd_default_arch_struct;
bfd_error = bad_value;
bfd_set_error (bfd_error_bad_value);
}
}
else {
@ -349,7 +355,9 @@ DESCRIPTION
*/
enum bfd_architecture DEFUN(bfd_get_arch, (abfd), bfd *abfd)
enum bfd_architecture
bfd_get_arch (abfd)
bfd *abfd;
{
return abfd->arch_info->arch;
}
@ -367,7 +375,8 @@ DESCRIPTION
*/
unsigned long
DEFUN(bfd_get_mach, (abfd), bfd *abfd)
bfd_get_mach (abfd)
bfd *abfd;
{
return abfd->arch_info->mach;
}
@ -385,7 +394,9 @@ DESCRIPTION
*/
unsigned int DEFUN(bfd_arch_bits_per_byte, (abfd), bfd *abfd)
unsigned int
bfd_arch_bits_per_byte (abfd)
bfd *abfd;
{
return abfd->arch_info->bits_per_byte;
}
@ -402,7 +413,9 @@ DESCRIPTION
architecture's addresses.
*/
unsigned int DEFUN(bfd_arch_bits_per_address, (abfd), bfd *abfd)
unsigned int
bfd_arch_bits_per_address (abfd)
bfd *abfd;
{
return abfd->arch_info->bits_per_address;
}
@ -410,6 +423,7 @@ unsigned int DEFUN(bfd_arch_bits_per_address, (abfd), bfd *abfd)
extern void bfd_a29k_arch PARAMS ((void));
extern void bfd_alpha_arch PARAMS ((void));
extern void bfd_arm_arch PARAMS ((void));
extern void bfd_h8300_arch PARAMS ((void));
extern void bfd_h8500_arch PARAMS ((void));
extern void bfd_hppa_arch PARAMS ((void));
@ -418,12 +432,17 @@ extern void bfd_i960_arch PARAMS ((void));
extern void bfd_m68k_arch PARAMS ((void));
extern void bfd_m88k_arch PARAMS ((void));
extern void bfd_mips_arch PARAMS ((void));
extern void bfd_powerpc_arch PARAMS ((void));
extern void bfd_rs6000_arch PARAMS ((void));
extern void bfd_sh_arch PARAMS ((void));
/* start-sanitize-r16 */
extern void bfd_r16_arch PARAMS ((void));
/* end-sanitize-r16 */
extern void bfd_sparc_arch PARAMS ((void));
extern void bfd_vax_arch PARAMS ((void));
extern void bfd_we32k_arch PARAMS ((void));
extern void bfd_z8k_arch PARAMS ((void));
extern void bfd_ns32k_arch PARAMS ((void));
static void (*archures_init_table[]) PARAMS ((void)) =
{
@ -432,6 +451,7 @@ static void (*archures_init_table[]) PARAMS ((void)) =
#else
bfd_a29k_arch,
bfd_alpha_arch,
bfd_arm_arch,
bfd_h8300_arch,
bfd_h8500_arch,
bfd_hppa_arch,
@ -440,12 +460,17 @@ static void (*archures_init_table[]) PARAMS ((void)) =
bfd_m68k_arch,
bfd_m88k_arch,
bfd_mips_arch,
bfd_powerpc_arch,
bfd_rs6000_arch,
bfd_sh_arch,
/* start-sanitize-r16 */
bfd_r16_arch,
/* end-sanitize-r16 */
bfd_sparc_arch,
bfd_vax_arch,
bfd_we32k_arch,
bfd_z8k_arch,
bfd_ns32k_arch,
#endif
0
};
@ -466,7 +491,7 @@ DESCRIPTION
*/
void
DEFUN_VOID(bfd_arch_init)
bfd_arch_init ()
{
void (**ptable) PARAMS ((void));
for (ptable = archures_init_table;
@ -489,8 +514,9 @@ DESCRIPTION
Link the architecture info structure @var{ptr} into the list.
*/
void DEFUN(bfd_arch_linkin,(ptr),
bfd_arch_info_type *ptr)
void
bfd_arch_linkin (ptr)
bfd_arch_info_type *ptr;
{
ptr->next = bfd_arch_info_list;
bfd_arch_info_list = ptr;
@ -511,9 +537,9 @@ DESCRIPTION
*/
CONST bfd_arch_info_type *
DEFUN(bfd_default_compatible,(a,b),
CONST bfd_arch_info_type *a AND
CONST bfd_arch_info_type *b)
bfd_default_compatible (a,b)
CONST bfd_arch_info_type *a;
CONST bfd_arch_info_type *b;
{
if(a->arch != b->arch) return NULL;
@ -540,9 +566,9 @@ DESCRIPTION
*/
boolean
DEFUN(bfd_default_scan,(info, string),
CONST struct bfd_arch_info *info AND
CONST char *string)
bfd_default_scan (info, string)
CONST struct bfd_arch_info *info;
CONST char *string;
{
CONST char *ptr_src;
CONST char *ptr_tst;
@ -661,8 +687,8 @@ DESCRIPTION
*/
bfd_arch_info_type *
DEFUN(bfd_get_arch_info,(abfd),
bfd *abfd)
bfd_get_arch_info (abfd)
bfd *abfd;
{
return abfd->arch_info;
}
@ -686,9 +712,9 @@ DESCRIPTION
*/
bfd_arch_info_type *
DEFUN(bfd_lookup_arch,(arch, machine),
enum bfd_architecture arch AND
long machine)
bfd_lookup_arch (arch, machine)
enum bfd_architecture arch;
long machine;
{
bfd_arch_info_type *ap;
bfd_check_init();
@ -721,9 +747,9 @@ DESCRIPTION
*/
CONST char *
DEFUN(bfd_printable_arch_mach,(arch, machine),
enum bfd_architecture arch AND
unsigned long machine)
bfd_printable_arch_mach (arch, machine)
enum bfd_architecture arch;
unsigned long machine;
{
bfd_arch_info_type *ap = bfd_lookup_arch(arch, machine);
if(ap) return ap->printable_name;

View File

@ -25,6 +25,7 @@ strip_underscore=no
case "${canon}" in
alpha-*-netware*) bfd_name=alpha-nlm ;;
alpha-*-*) bfd_name=alphaosf ;;
arm-*-riscix*) bfd_name=riscix ;;
a29k-*-ebmon*) bfd_name=a29k-coff strip_underscore=yes ;;
a29k-*-udi*) bfd_name=a29k-coff strip_underscore=yes ;;
a29k-*-aout*) bfd_name=a29k-aout strip_underscore=yes ;;
@ -33,6 +34,9 @@ case "${canon}" in
h8300*-*-*) bfd_name=h8300-coff strip_underscore=yes ;;
h8500-*-*) bfd_name=h8500-coff strip_underscore=yes ;;
sh-*-*) bfd_name=sh-coff strip_underscore=yes ;;
# start-sanitize-r16
r16-*-aout) bfd_name=r16-aout ;;
# end-sanitize-r16
hppa*-*-*elf*) bfd_name=hppa-elf ;;
hppa*-*-bsd*) bfd_name=hppabsd ;;
hppa*-*-hpux*) bfd_name=hppahpux ;;
@ -49,7 +53,7 @@ case "${canon}" in
i[345]86-*-coff) bfd_name=i386-coff ;;
i[345]86-*-aix*) bfd_name=i386-coff ;;
i[345]86-*-elf) bfd_name=i386-elf ;;
i[345]86-*-netbsd*) bfd_name=i386-netbsd strip_underscore=yes ;;
i[345]86-*-netbsd*) bfd_name=i386-nbsd strip_underscore=yes ;;
i[345]86-*-netware*) bfd_name=i386-nlm ;;
i[345]86-*-linux*) bfd_name=i386-linux strip_underscore=yes ;;
i[345]86-*-lynxos*) bfd_name=i386-lynx ;;
@ -73,6 +77,7 @@ case "${canon}" in
m68*-*-coff*) bfd_name=m68k-coff ;;
m68*-*-hpux*) bfd_name=hp300hpux strip_underscore=yes ;;
m68*-*-lynxos*) bfd_name=m68k-lynx ;;
m68*-*-netbsd*) bfd_name=m68k-nbsd strip_underscore=yes ;;
m68*-*-os68k*) bfd_name=m68k-aout strip_underscore=yes ;;
m68*-*-sunos*) bfd_name=m68k-aout strip_underscore=yes ;;
m68*-*-sysv4*) bfd_name=m68k-elf ;;
@ -111,6 +116,7 @@ case "${canon}" in
powerpc-*-netware*) bfd_name=ppc-nlm ;;
rs6000-*-*) bfd_name=rs6000 ;;
sparc-*-lynxos*) bfd_name=sparc-lynx ;;
sparc-*-netbsd*) bfd_name=sparc-nbsd strip_underscore=yes;;
sparc-*-solaris2*) bfd_name=sparc-elf ;;
sparc-*-sysv4*) bfd_name=sparc-elf ;;
sparc64-*-aout*) bfd_name=sparc-aout strip_underscore=yes ;;

View File

@ -202,6 +202,9 @@ do
pc532machaout_vec) tb="$tb pc532-mach.o aout-ns32k.o stab-syms.o" ;;
rs6000coff_vec) tb="$tb coff-rs6000.o" ;;
shcoff_vec) tb="$tb coff-sh.o cofflink.o" ;;
# start-sanitize-r16
r16_aout_vec) tb="$tb aout32.o reloc16.o" ;;
# end-sanitize-r16
shlcoff_vec) tb="$tb coff-sh.o cofflink.o" ;;
som_vec) tb="$tb som.o" ;;
sparclynx_aout_vec) tb="$tb sparclynx.o lynx-core.o aout32.o stab-syms.o" ;;

79
bfd/cpu-r16.c Normal file
View File

@ -0,0 +1,79 @@
/* BFD library support routines for the Experiment SOP architecture.
Copyright (C) 1993 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program 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 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
int bfd_default_scan_num_mach();
static boolean
DEFUN(scan_mach,(info, string),
CONST struct bfd_arch_info *info AND
CONST char *string)
{
if (strcmp(string,"sop") == 0) return true;
if (strcmp(string,"SOP") == 0) return true;
return false;
}
#if 0
/* This routine is provided two arch_infos and returns whether
they'd be compatible */
static CONST bfd_arch_info_type *
DEFUN(compatible,(a,b),
CONST bfd_arch_info_type *a AND
CONST bfd_arch_info_type *b)
{
if (a->arch != b->arch || a->mach != b->mach)
return NULL;
return a;
}
#endif
static bfd_arch_info_type arch_info_struct[] =
{
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_r16,
0, /* only 1 machine */
"SOP", /* arch_name */
"SOP", /* printable name */
1,
true, /* the default machine */
bfd_default_compatible,
scan_mach,
0,
0,
},
};
void
DEFUN_VOID(bfd_sop_arch)
{
bfd_arch_linkin(&arch_info_struct[0]);
}

View File

@ -486,6 +486,9 @@ extern const bfd_target pc532machaout_vec;
extern const bfd_target riscix_vec;
extern const bfd_target rs6000coff_vec;
extern const bfd_target shcoff_vec;
/* start-sanitize-r16 */
extern bfd_target r16_aout_vec;
/* end-sanitize-r16 */
extern const bfd_target shlcoff_vec;
extern const bfd_target sparclynx_aout_vec;
extern const bfd_target sparclynx_coff_vec;
@ -637,6 +640,9 @@ const bfd_target * const bfd_target_vector[] = {
&rs6000coff_vec,
&shcoff_vec,
&shlcoff_vec,
/* start-sanitize-r16 */
&r16_aout_vec,
/* end-sanitize-r16 */
&sparclynx_aout_vec,
&sparclynx_coff_vec,
&sparcnetbsd_vec,

37
config.sub vendored
View File

@ -126,6 +126,9 @@ case $os in
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
@ -156,7 +159,7 @@ case $basic_machine in
| sh-* | powerpc-* | sparc64-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-* \
| m88110-* | m680[01234]0-* | m683?2-* | z8k-* \
| h8500-*) # CYGNUS LOCAL
| h8500-* ) # CYGNUS LOCAL
;;
# start-sanitize-arc
arc)
@ -165,6 +168,13 @@ case $basic_machine in
arc-*)
;;
# end-sanitize-arc
# start-sanitize-r16
r16)
basic_machine=$basic_machine-unknown
;;
r16-*)
;;
# end-sanitize-r16
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd) # CYGNUS LOCAL
@ -304,11 +314,7 @@ case $basic_machine in
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hds)
basic_machine=h8300-hitachi
os=-hds
;;
h8300hms) # CYGNUS LOCAL
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
@ -363,7 +369,7 @@ case $basic_machine in
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppaosf)
hppaosf) # CYGNUS LOCAL
basic_machine=hppa1.1-hp
os=-osf
;;
@ -447,7 +453,7 @@ case $basic_machine in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
monitor) # CYGNUS LOCAL
monitor) # CYGNUS LOCAL
basic_machine=m68k-rom68k
os=-coff
;;
@ -652,7 +658,7 @@ case $basic_machine in
os=-sysv4
basic_machine=i386-unknown
;;
v810 | necv810)
v810 | necv810) # CYGNUS LOCAL
basic_machine=v810-nec
os=-none
;;
@ -764,6 +770,9 @@ case $os in
-solaris)
os=-solaris2
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative must end in a *, to match a version number.
@ -776,9 +785,9 @@ case $os in
| -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -ptx* \
| -go32 | -vsta | -sim | -es1800* | -udi | -hms* | -xray | -hds* \
| -os68k* | -none* | -v88r* | -coff \
| -ptx* | -coff* | -winnt* \
| -go32 | -vsta | -sim | -es1800* | -udi | -hms* | -xray \
| -os68k* | -none* | -v88r* | -windows* | -osx \
| -abug | -ecoff* | -netware* | -proelf | -os9* )
# The last three lines above are CYGNUS LOCAL
;;
@ -876,10 +885,10 @@ case $basic_machine in
# default.
# os=-sunos4
;;
m68*-cisco)
m68*-cisco) # CYGNUS LOCAL
os=-aout
;;
mips*-cisco)
mips*-cisco) # CYGNUS LOCAL
os=-elf
;;
*-tti) # must be before sparc entry or we get the wrong os.

View File

@ -15,6 +15,14 @@
Do-first:
r16_files="tc-r16.c tc-r16.h"
if ( echo $* | grep keep\-r16 > /dev/null ) ; then
keep_these_too="${r16_files} ${keep_these_too}"
else
lose_these_too="${r16_files} ${lose_these_too}"
fi
# All files listed between the "Things-to-keep:" line and the
# "Files-to-sed:" line will be kept. All other files will be removed.
# Directories listed in this section will have their own Sanitize

1016
gas/config/tc-r16.c Normal file

File diff suppressed because it is too large Load Diff

55
gas/config/tc-r16.h Normal file
View File

@ -0,0 +1,55 @@
/* This file is tc-r16.h
Copyright (C) 1993 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. */
#ifndef TC_R16
#define TC_R16 1
#ifdef BFD_ASSEMBLER
#define TARGET_ARCH bfd_arch_r16
#define TARGET_BYTES_BIG_ENDIAN 1
#ifdef OBJ_AOUT
#define TARGET_FORMAT "a.out-r16"
#endif
#else /* ! BFD_ASSEMBLER */
#define BFD_ARCH bfd_arch_r16
#define NO_RELOC 0
#define RELOC_32 1234
#endif /* ! BFD_ASSEMBLER */
#define AOUT_MACHTYPE 155
/* Don't write out relocs for pcrel stuff*/
#define TC_COUNT_RELOC(x) (((x)->fx_addsy||(x)->fx_subsy)&&(x)->fx_r_type < 22)
#define IGNORE_NONSTANDARD_ESCAPES
#define TC_RELOC_MANGLE(a,b,c) tc_reloc_mangle(a,b,c)
#define DO_NOT_STRIP 0
#define DO_STRIP 0
#define LISTING_HEADER "R16 Experimental GAS "
#define NEED_FX_R_TYPE 1
#define COFF_FLAGS 1
#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag)
#endif

View File

@ -150,18 +150,22 @@ case ${generic_target} in
sh-*-coff) obj_format=coff ;;
# start-sanitize-r16
r16-*-aout) obj_format=aout ;;
# end-sanitize-r16
ns32k-pc532-mach*) obj_format=aout emulation=pc532 ;;
ns32k-pc532-netbsd*) obj_format=aout emulation=nbsd532 ;;
sparc*-*-sunos4*) obj_format=aout emulation=sun3 ;;
sparc*-*-aout | sparc*-*-vxworks)
sparc-*-sunos4*) obj_format=aout emulation=sun3 ;;
sparc-*-aout | sparc*-*-vxworks)
obj_format=aout ;;
sparc*-*-coff) obj_format=coff ;;
sparc*-*-lynxos*) obj_format=coff emulation=lynx ;;
sparc*-fujitsu-none) obj_format=aout ;;
sparc*-*-elf | sparc*-*-solaris*)
sparc-*-coff) obj_format=coff ;;
sparc-*-lynxos*) obj_format=coff emulation=lynx ;;
sparc-fujitsu-none) obj_format=aout ;;
sparc-*-elf | sparc*-*-solaris*)
obj_format=elf ;;
sparc*-*-netbsd*) obj_format=aout emulation=nbsd bfd_gas=yes ;;
sparc-*-netbsd*) obj_format=aout emulation=nbsd bfd_gas=yes ;;
vax-*-bsd* | vax-*-ultrix*)
obj_format=aout ;;
@ -225,7 +229,7 @@ case ${cpu_type}-${obj_format} in
mips-*) bfd_gas=yes ;;
ns32k-*) bfd_gas=yes ;;
ppc-*) bfd_gas=yes ;;
sparc*-*) bfd_gas=yes ;;
sparc-*) bfd_gas=yes ;;
*-elf) bfd_gas=yes ;;
*-ecoff) bfd_gas=yes ;;
*-som) bfd_gas=yes ;;

View File

@ -15,6 +15,13 @@
Do-first:
r16_files="r16-aout.mt"
if ( echo $* | grep keep\-r16 > /dev/null ) ; then
keep_these_too="${r16_files} ${keep_these_too}"
else
lose_these_too="${r16_files} ${lose_these_too}"
fi
# All files listed between the "Things-to-keep:" line and the
# "Do-last:" line will be kept. All other files will be removed.

1
ld/config/r16-aout.mt Normal file
View File

@ -0,0 +1 @@
EMUL=sopaout

View File

@ -23,6 +23,14 @@ else
lose_these_too="${mpw_files} ${lose_these_too}"
fi
r16_files="r16-dis.c r16-opc.h"
if ( echo $* | grep keep\-r16 > /dev/null ) ; then
keep_these_too="${r16_files} ${keep_these_too}"
else
lose_these_too="${r16_files} ${lose_these_too}"
fi
# All files listed between the "Things-to-keep:" line and the
# "Files-to-sed:" line will be kept. All other files will be removed.
# Directories listed in this section will have their own Sanitize

View File

@ -8,58 +8,15 @@ srcname="opcodes"
# per-host:
case "${host}" in
a29k-nyu-sym1) my_host=ultra3 ;;
hppa*-hp-bsd) my_host=hppabsd ;;
hppa*-hp-hpux) my_host=hppahpux ;;
i860-stratus-sysv4) my_host=stratus ;;
i[34]86-*-go32) my_host=go32 ;;
i[34]86-*-linux) my_host=i386linux ;;
i[34]86-*-mach) my_host=i386mach ;;
i[34]86-*-msdos*) my_host=dose ;;
i[34]86-*-sysv*) my_host=i386v ;;
i[34]86-*-sco) my_host=i386v ;;
i[34]86-*-sysv4*) my_host=i386v4 ;;
i[34]86-ncr-sysv4*) my_host=ncr3000 ;;
m68k-apollo-bsd*) my_host=apollo68 ;;
m68k-apollo-sysv*) my_host=apollov68 ;;
m68k-cbm-amigados) my_host=amigados ;;
m68k-cbm-sysv4*) my_host=amix ;;
m68k-hp-bsd) my_host=hp300bsd ;;
m68k-hp-hpux) my_host=hp300 ;; # renamed from hp9000
m68k-sony-*) my_host=news ;;
m68k-sun-sunos*) my_host=sun3 ;;
m88k-dg-dgux) my_host=dgux ;;
m88k-harris-*) my_host=harris ;;
m88k-motorola-*) my_host=delta88 ;;
mips-dec-ultrix) my_host=decstation ;;
mips-sgi-irix | mips-sgi-irix3) my_host=irix3 ;;
mips-sgi-irix4) my_host=irix4 ;;
romp-ibm-bsd*) my_host=rtbsd ;;
rs6000-ibm-aix) my_host=rs6000 ;;
sparc-*-sysv4) my_host=sysv4 ;;
sparc-*-sysv64) my_host=sysv4-ll ;;
sparc-sun-solaris2) my_host=solaris2 ;;
sparc-sun-sunos*) my_host=sparc ;;
sparc-sun-sunos64) my_host=sparc-ll ;;
tahoe-*-*) my_host=tahoe ;;
vax-dec-bsd*) my_host=vaxbsd ;;
vax-dec-ultrix*) my_host=vaxult ;;
we32k-*-*) my_host=we32k ;;
esac
. ${srcdir}/../bfd/configure.host
# Set up to make a link between the host's include file and "sysdep.h".
files="../bfd/hosts/${my_host}.h"
links="sysdep.h"
if [ ! -f ${srcdir}/${files} ] ; then
if [ -n "${my_host}" ] ; then
echo '***' No file ${srcdir}/${files} 1>&2
fi
echo '***' ${srcname} does not support host ${host} 1>&2
exit 1
files=../bfd/hosts/std-host.h
echo "[${srcname} has no specific support for host ${host} -- using std-host]"
fi
host_makefile_frag=
@ -68,3 +25,125 @@ if [ -f ${srcdir}/../bfd/config/${my_host}.mh ] ; then
fi
# per-target:
# Canonicalize the secondary target names.
if [ -n "$enable_targets" ]; then
for targ in `echo $enable_targets | sed 's/,/ /g'`
do
result=`$configsub $targ 2>/dev/null`
if [ -n "$result" ]; then
canon_targets="$canon_targets $result"
else
# Allow targets that config.sub doesn't recognize, like "all".
canon_targets="$canon_targets $targ"
fi
done
fi
all_targets=false
for targ in $target $canon_targets
do
bfd_target=`${config_shell} $srcdir/../bfd/config.bfd $targ`
if [ "x$bfd_target" = "xall" ]; then
all_targets=true
else
if [ ! -f ${srcdir}/../bfd/config/${bfd_target}.mt ] ; then
echo '***' No file ${srcdir}/../bfd/config/${bfd_target}.mt 1>&2
echo '***' opcodes does not support target ${bfd_target} 1>&2
echo '***' Look in bfd/config.bfd for supported targets 1>&2
exit 1
fi
if [ "x$targ" = "x$target" ]; then
target_makefile_frag=${srcdir}/../bfd/config/${bfd_target}.mt
else
target_extra_frags="$target_extra_frags ${srcdir}/../bfd/config/${bfd_target}.mt"
fi
fi
done
# We don't do any links based on the target system, just makefile config.
# post-target:
rm -f Makefile.tmp Makefile.2
mv Makefile Makefile.tmp
if [ x${all_targets} = xfalse ]; then
allfrags="$target_makefile_frag $target_extra_frags"
# The architectures in all the configured targets.
SELECT_ARCHITECTURES=`sed -n '
s/SELECT_ARCHITECTURES[ ]*=[ ]*//p
' $allfrags`
# Target architecture .o files.
ta=
for arch in $SELECT_ARCHITECTURES
do
ad=`echo $arch | sed -e s/bfd_//g -e s/_arch//g`
archdefs="$archdefs -DARCH_$ad"
case "$arch" in
bfd_a29k_arch) ta="$ta a29k-dis.o" ;;
bfd_alpha_arch) ta="$ta alpha-dis.o" ;;
bfd_arm_arch) ta="$ta arm-dis.o" ;;
bfd_h8300_arch) ta="$ta h8300-dis.o" ;;
bfd_h8500_arch) ta="$ta h8500-dis.o" ;;
bfd_hppa_arch) ta="$ta hppa-dis.o" ;;
bfd_i386_arch) ta="$ta i386-dis.o" ;;
bfd_i960_arch) ta="$ta i960-dis.o" ;;
bfd_m68k_arch) ta="$ta m68k-dis.o" ;;
bfd_m88k_arch) ta="$ta m88k-dis.o" ;;
bfd_mips_arch) ta="$ta mips-dis.o mips-opc.o" ;;
bfd_ns32k_arch) ta="$ta ns32k-dis.o" ;;
bfd_powerpc_arch) ta="$ta ppc-dis.o ppc-opc.o" ;;
bfd_rs6000_arch) ta="$ta ppc-dis.o ppc-opc.o" ;;
bfd_sh_arch) ta="$ta sh-dis.o" ;;
# start-sanitize-r16
bfd_r16_arch) ta="$ta r16-dis.o" ;;
# end-sanitize-r16
bfd_sparc_arch) ta="$ta sparc-dis.o sparc-opc.o" ;;
bfd_vax_arch) ;;
bfd_we32k_arch) ;;
bfd_z8k_arch) ta="$ta z8k-dis.o" ;;
"") ;;
*) echo "*** unknown target architecture $arch" 1>&2; exit 1 ;;
esac
done
# Weed out duplicate .o files.
f=""
for i in $ta ; do
case " $f " in
*" $i "*) ;;
*) f="$f $i" ;;
esac
done
ta="$f"
# And duplicate -D flags.
f=""
for i in $archdefs ; do
case " $f " in
*" $i "*) ;;
*) f="$f $i" ;;
esac
done
archdefs="$f"
echo "ARCHDEFS = $archdefs" >> Makefile.2
echo "BFD_MACHINES = $ta" >> Makefile.2
else # all_targets is true
echo 'ARCHDEFS = -DARCH_all' >> Makefile.2
echo 'BFD_MACHINES = $(ALL_MACHINES)' >> Makefile.2
fi # all_targets is true
cat Makefile.tmp >> Makefile.2
rm -f Makefile.tmp
mv Makefile.2 Makefile

49
opcodes/r16-dis.c Normal file
View File

@ -0,0 +1,49 @@
/* Disassemble R16 instructions.
Copyright (C) 1993 Free Software Foundation, Inc.
This program 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 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#define STATIC_TABLE
#define DEFINE_TABLE
#include "r16-opc.h"
#include "dis-asm.h"
int
print_insn_sop(memaddr, info)
bfd_vma memaddr;
struct disassemble_info *info;
{
fprintf_ftype fprintf = info->fprintf_func;
void *stream = info->stream;
unsigned char insn[2];
unsigned char nibs[4];
int status;
int relmask = ~0;
r16_opcode_info *op;
int dslot = 0;
status = info->read_memory_func(memaddr, insn, 2, info);
if (status != 0)
{
info->memory_error_func(status, memaddr, info);
return -1;
}
/**** DISASSEMBLY NOT YET IMPLEMENTED ****/
fprintf(stream,".word 0x%02x%02x", insn[0], insn[1]);
return 2;
}

118
opcodes/r16-opc.h Normal file
View File

@ -0,0 +1,118 @@
typedef enum {
O0, OT, O1, OC, O2, OI, OB, LS, BR, LI, LR, LJ, OM
} r16_opclass;
typedef struct inst
{ char *name;
unsigned short opclass;
unsigned short inst;
} r16_opcode_info;
#ifdef DEFINE_TABLE
r16_opcode_info r16_table[]={
{ "bkpt", O0, 0x0000 },
{ "sync", O0, 0x0001 },
{ "rte", O0, 0x0002 },
{ "rfi", O0, 0x0003 },
{ "stop", O0, 0x0004 },
{ "wait", O0, 0x0005 },
{ "trap", OT, 0x0010 },
{ "mvc", O1, 0x0020 },
{ "mvcv", O1, 0x0030 },
{ "jmp", O1, 0x0040 },
{ "jsr", O1, 0x0050 },
{ "jmpt", O1, 0x0060 },
{ "jmpf", O1, 0x0070 },
{ "tsteq", O1, 0x0080 },
{ "tstgt", O1, 0x0090 },
{ "tstlt", O1, 0x00A0 },
{ "tstbz", O1, 0x00B0 },
{ "inct", O1, 0x00C0 },
{ "incf", O1, 0x00D0 },
{ "dect", O1, 0x00E0 },
{ "decf", O1, 0x00F0 },
{ "zextb", O1, 0x0100 },
{ "sextb", O1, 0x0110 },
{ "zexth", O1, 0x0120 },
{ "sexth", O1, 0x0130 },
{ "xtrb3", O1, 0x0140 },
{ "xtrb2", O1, 0x0150 },
{ "xtrb1", O1, 0x0160 },
{ "xtrb0", O1, 0x0170 },
{ "decgt", O1, 0x01C0 },
{ "declt", O1, 0x01D0 },
{ "brev", O1, 0x01E0 },
{ "not", O1, 0x01F0 },
{ "mfcr", OC, 0x0200 },
{ "mtcr", OC, 0x0300 },
{ "mov", O2, 0x0400 },
{ "movnc", O2, 0x0600 },
{ "tst", O2, 0x0700 },
{ "cmpeq", O2, 0x0800 },
{ "cmpgt", O2, 0x0900 },
{ "cmphi", O2, 0x0A00 },
{ "bgenr", O2, 0x0D00 },
{ "movt", O2, 0x0E00 },
{ "movf", O2, 0x0F00 },
{ "and", O2, 0x1000 },
{ "andn", O2, 0x1100 },
{ "xor", O2, 0x1200 },
{ "xnor", O2, 0x1300 },
{ "or", O2, 0x1400 },
{ "rsub", O2, 0x1500 },
{ "addu", O2, 0x1600 },
{ "subu", O2, 0x1700 },
{ "ixh", O2, 0x1800 },
{ "ixw", O2, 0x1900 },
{ "addc", O2, 0x1A00 },
{ "subc", O2, 0x1B00 },
{ "lsr", O2, 0x1C00 },
{ "asr", O2, 0x1D00 },
{ "lsl", O2, 0x1E00 },
{ "rotl", O2, 0x1F00 },
{ "movi", OB, 0x2000 },
{ "andi", OB, 0x2200 },
{ "movit", OB, 0x2400 },
{ "movif", OB, 0x2600 },
{ "btsti", OB, 0x2800 },
{ "bclri", OB, 0x2A00 },
{ "bseti", OB, 0x2C00 },
{ "bmaski", OB, 0x2E00 },
{ "bgeni", OB, 0x3000 },
{ "rsubi", OB, 0x3200 },
{ "addi", OI, 0x3400 },
{ "subi", OI, 0x3600 },
{ "lsri", OB, 0x3800 },
{ "lsrc", O1, 0x3800 },
{ "asri", OB, 0x3A00 },
{ "asrc", O1, 0x3A00 },
{ "lsli", OB, 0x3C00 },
{ "lslc", O1, 0x3C00 },
{ "rotli", OB, 0x3E00 },
{ "rotlc", O1, 0x3E00 },
{ "ldm", OM, 0x6000 },
{ "stm", OM, 0x6010 },
{ "mult", O2, 0x6100 },
{ "mvir1", LI, 0x6800 },
{ "lrw", LR, 0x7000 },
{ "jmpi", LJ, 0x7300 },
{ "jsri", LJ, 0x7F00 },
{ "ld", LS, 0x8000 },
{ "st", LS, 0x9000 },
{ "ld.b", LS, 0xA000 },
{ "st.b", LS, 0xB000 },
{ "ld.h", LS, 0xC000 },
{ "st.h", LS, 0xD000 },
{ "br", BR, 0xE000 },
{ "bsr", BR, 0xE800 },
{ "bt", BR, 0xF000 },
{ "bf", BR, 0xF800 },
{ 0, 0, 0 }
};
#endif