1
0
mirror of https://github.com/cahirwpz/amigaos-cross-toolchain synced 2025-11-23 12:11:19 +00:00

Patched binutils 2.10.1.

This commit is contained in:
Krystian Bacławski
2012-08-08 13:26:23 +02:00
parent cc9e675fd3
commit aceee0ded0
57 changed files with 14440 additions and 1 deletions

View File

@ -0,0 +1,43 @@
--- binutils-2.10.1/bfd/Makefile.am 2000-04-12 01:58:39.000000000 +0200
+++ binutils-2.10.1/bfd/Makefile.am 2012-08-08 12:35:51.000000000 +0200
@@ -113,7 +113,10 @@
# The .o files needed by all of the 32 bit vectors that are configured into
# target_vector in targets.c if configured with --enable-targets=all.
BFD32_BACKENDS = \
+ amigaos.lo \
+ amigaoslink.lo \
aout-adobe.lo \
+ aout-amiga.lo \
aout-arm.lo \
aout-ns32k.lo \
aout-sparcle.lo \
@@ -243,7 +246,10 @@
xcofflink.lo
BFD32_BACKENDS_CFILES = \
+ amigaos.c \
+ amigaoslink.c \
aout-adobe.c \
+ aout-amiga.c \
aout-arm.c \
aout-ns32k.c \
aout-sparcle.c \
@@ -440,7 +446,7 @@
SOURCE_HFILES = \
aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h \
ecoffswap.h elf32-arm.h elfcode.h elfcore.h \
- elflink.h freebsd.h genlink.h go32stub.h libaout.h \
+ elflink.h freebsd.h genlink.h go32stub.h libamiga.h libaout.h \
libbfd.h libcoff.h libecoff.h elf-bfd.h libhppa.h libieee.h \
libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h nlmcode.h \
nlmswap.h ns32k.h peicode.h som.h vms.h
@@ -720,6 +726,9 @@
cpu-we32k.lo: cpu-we32k.c
cpu-w65.lo: cpu-w65.c
cpu-z8k.lo: cpu-z8k.c
+amigaos.lo: amigaos.c libamiga.h bfd.h
+amigaoslink.lo: bfd.h libamiga.h amigaoslink.c
+aout-amiga.lo: aout-amiga.c aoutf1.h bfd.h
aout-adobe.lo: aout-adobe.c $(INCDIR)/aout/adobe.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
$(INCDIR)/bfdlink.h

View File

@ -0,0 +1,43 @@
--- binutils-2.10.1/bfd/Makefile.in 2000-04-12 01:58:39.000000000 +0200
+++ binutils-2.10.1/bfd/Makefile.in 2012-08-08 12:35:51.000000000 +0200
@@ -230,7 +230,10 @@
# The .o files needed by all of the 32 bit vectors that are configured into
# target_vector in targets.c if configured with --enable-targets=all.
BFD32_BACKENDS = \
+ amigaos.lo \
+ amigaoslink.lo \
aout-adobe.lo \
+ aout-amiga.lo \
aout-arm.lo \
aout-ns32k.lo \
aout-sparcle.lo \
@@ -361,7 +364,10 @@
BFD32_BACKENDS_CFILES = \
+ amigaos.c \
+ amigaoslink.c \
aout-adobe.c \
+ aout-amiga.c \
aout-arm.c \
aout-ns32k.c \
aout-sparcle.c \
@@ -563,7 +569,7 @@
SOURCE_HFILES = \
aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h \
ecoffswap.h elf32-arm.h elfcode.h elfcore.h \
- elflink.h freebsd.h genlink.h go32stub.h libaout.h \
+ elflink.h freebsd.h genlink.h go32stub.h libamiga.h libaout.h \
libbfd.h libcoff.h libecoff.h elf-bfd.h libhppa.h libieee.h \
libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h nlmcode.h \
nlmswap.h ns32k.h peicode.h som.h vms.h
@@ -1248,6 +1254,9 @@
cpu-we32k.lo: cpu-we32k.c
cpu-w65.lo: cpu-w65.c
cpu-z8k.lo: cpu-z8k.c
+amigaos.lo: amigaos.c libamiga.h bfd.h
+amigaoslink.lo: bfd.h libamiga.h amigaoslink.c
+aout-amiga.lo: aout-amiga.c aoutf1.h bfd.h
aout-adobe.lo: aout-adobe.c $(INCDIR)/aout/adobe.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
$(INCDIR)/bfdlink.h

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
/* BFD backend for Amiga style a.out with flags set to 0
Copyright (C) 1990, 91, 92, 93, 1994 Free Software Foundation, Inc.
Written by Stephan Thesing.
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 TARGETNAME "a.out-amiga"
#define MY(OP) CAT(aout_amiga_,OP)
#include "bfd.h"
#define MY_exec_hdr_flags 0
extern boolean amiga_final_link (bfd *, struct bfd_link_info *);
#define MY_bfd_final_link amiga_final_link
extern bfd_byte *get_relocated_section_contents (bfd *,
struct bfd_link_info *,
struct bfd_link_order *,
bfd_byte *, boolean,
asymbol **);
#define MY_bfd_get_relocated_section_contents get_relocated_section_contents
/* Include the usual a.out support. */
#include "aoutf1.h"
/* Final link routine. We need to use a call back to get the correct
offsets in the output file. */
boolean
amiga_aout_bfd_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
return NAME (aout, final_link) (abfd, info, MY_final_link_callback);
}

View File

@ -0,0 +1,64 @@
--- binutils-2.10.1/bfd/aoutx.h 2000-05-28 12:57:49.000000000 +0200
+++ binutils-2.10.1/bfd/aoutx.h 2012-08-08 12:35:51.000000000 +0200
@@ -134,7 +134,8 @@
static boolean aout_get_external_symbols PARAMS ((bfd *));
static boolean translate_from_native_sym_flags
PARAMS ((bfd *, aout_symbol_type *));
-static boolean translate_to_native_sym_flags
+/*Amiga hack - used in amigaos.c, must be global */
+/*static*/ boolean translate_to_native_sym_flags
PARAMS ((bfd *, asymbol *, struct external_nlist *));
static void adjust_o_magic PARAMS ((bfd *, struct internal_exec *));
static void adjust_z_magic PARAMS ((bfd *, struct internal_exec *));
@@ -1603,7 +1604,7 @@
/* Set the fields of SYM_POINTER according to CACHE_PTR. */
-static boolean
+/*static*/ boolean
translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
bfd *abfd;
asymbol *cache_ptr;
@@ -2004,10 +2005,29 @@
r_length = g->howto->size ; /* Size as a power of two */
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
+#if 1
+ /* FIXME! "#if 1" is the wrong way to select this Amiga specific code.
+ We can't just test for __amigaos__ defined either, since we may be
+ building a cross compiler and __amigaos__ is only defined if the
+ compiler we are using is targeted for the Amiga. */
+ /* Changed for cooperation with AMIGA backend */
+ /* This only applies, if aout flavour 191194 ST*/
/* XXX This relies on relocs coming from a.out files. */
+ if (bfd_asymbol_bfd(sym)->xvec->flavour==bfd_target_aout_flavour)
+ {
+ r_baserel = (g->howto->type & 8) != 0;
+ r_jmptable = (g->howto->type & 16) != 0;
+ r_relative = (g->howto->type & 32) != 0;
+ }
+ else
+ {
+ r_baserel=r_jmptable=r_relative=0;
+ }
+#else
r_baserel = (g->howto->type & 8) != 0;
r_jmptable = (g->howto->type & 16) != 0;
r_relative = (g->howto->type & 32) != 0;
+#endif
#if 0
/* For a standard reloc, the addend is in the object file. */
@@ -2300,8 +2320,12 @@
/* Base relative relocs are always against the symbol table,
regardless of the setting of r_extern. r_extern just reflects
whether the symbol the reloc is against is local or global. */
+#if 0
+ /* FIXME! "#if 0" is the wrong way to disable this code. See comment
+ earlier in file. */
if (r_baserel)
r_extern = 1;
+#endif
if (r_extern && r_index > symcount)
{

View File

@ -0,0 +1,38 @@
--- binutils-2.10.1/bfd/archive.c 2000-05-28 12:57:49.000000000 +0200
+++ binutils-2.10.1/bfd/archive.c 2012-08-08 12:35:51.000000000 +0200
@@ -1407,7 +1407,7 @@
sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid);
sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid);
sprintf ((hdr->ar_mode), "%-8o", (unsigned int) status.st_mode);
- sprintf ((hdr->ar_size), "%-10ld", (long) status.st_size);
+ sprintf ((hdr->ar_size), "%-9ld", (long) status.st_size);
/* Correct for a lossage in sprintf whereby it null-terminates. I cannot
understand how these C losers could design such a ramshackle bunch of
IO operations */
@@ -1689,7 +1689,7 @@
memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
strcpy (hdr.ar_name, ename);
/* Round size up to even number in archive header. */
- sprintf (&(hdr.ar_size[0]), "%-10d",
+ sprintf (&(hdr.ar_size[0]), "%-9d",
(int) ((elength + 1) & ~1));
strncpy (hdr.ar_fmag, ARFMAG, 2);
for (i = 0; i < sizeof (struct ar_hdr); i++)
@@ -1944,7 +1944,7 @@
sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp);
sprintf (hdr.ar_uid, "%ld", (long) getuid ());
sprintf (hdr.ar_gid, "%ld", (long) getgid ());
- sprintf (hdr.ar_size, "%-10d", (int) mapsize);
+ sprintf (hdr.ar_size, "%-9d", (int) mapsize);
strncpy (hdr.ar_fmag, ARFMAG, 2);
for (i = 0; i < sizeof (struct ar_hdr); i++)
if (((char *) (&hdr))[i] == '\0')
@@ -2096,7 +2096,7 @@
memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
hdr.ar_name[0] = '/';
- sprintf (hdr.ar_size, "%-10d", (int) mapsize);
+ sprintf (hdr.ar_size, "%-9d", (int) mapsize);
sprintf (hdr.ar_date, "%ld", (long) time (NULL));
/* This, at least, is what Intel coff sets the values to.: */
sprintf ((hdr.ar_uid), "%d", 0);

View File

@ -0,0 +1,19 @@
--- binutils-2.10.1/bfd/bfd-in2.h 2000-04-29 03:45:48.000000000 +0200
+++ binutils-2.10.1/bfd/bfd-in2.h 2012-08-08 12:35:51.000000000 +0200
@@ -2710,6 +2710,8 @@
struct cisco_core_struct *cisco_core_data;
struct versados_data_struct *versados_data;
struct netbsd_core_struct *netbsd_core_data;
+ struct amiga_data_struct *amiga_data;
+ struct amiga_ardata_struct *amiga_ardata;
PTR any;
} tdata;
@@ -2928,6 +2930,7 @@
#endif
enum bfd_flavour {
bfd_target_unknown_flavour,
+ bfd_target_amiga_flavour,
bfd_target_aout_flavour,
bfd_target_coff_flavour,
bfd_target_ecoff_flavour,

View File

@ -0,0 +1,10 @@
--- binutils-2.10.1/bfd/bfd.c 1999-12-10 19:51:34.000000000 +0100
+++ binutils-2.10.1/bfd/bfd.c 2012-08-08 12:35:51.000000000 +0200
@@ -178,6 +178,7 @@
. struct cisco_core_struct *cisco_core_data;
. struct versados_data_struct *versados_data;
. struct netbsd_core_struct *netbsd_core_data;
+. struct amiga_data_struct *amiga_data;
. PTR any;
. } tdata;
.

View File

@ -0,0 +1,13 @@
--- binutils-2.10.1/bfd/config.bfd 2000-09-06 22:57:43.000000000 +0200
+++ binutils-2.10.1/bfd/config.bfd 2012-08-08 12:35:51.000000000 +0200
@@ -404,6 +404,10 @@
m68*-motorola-sysv*)
targ_defvec=m68ksysvcoff_vec
;;
+ m68*-*-amigaos*)
+ targ_defvec=amiga_vec
+ targ_selvecs="aout_amiga_vec amiga_vec"
+ ;;
m68*-hp-bsd*)
targ_defvec=hp300bsd_vec
targ_underscore=yes

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
--- binutils-2.10.1/bfd/configure 2000-10-16 13:27:20.000000000 +0200
+++ binutils-2.10.1/bfd/configure 2012-08-08 13:04:49.000000000 +0200
@@ -1835,7 +1835,6 @@
EXEEXT=""
test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
echo "$ac_t""${ac_cv_exeext}" 1>&6
-ac_exeext=$EXEEXT
host64=false
@@ -5052,6 +5051,7 @@
# with the two vector lists in targets.c.
a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;;
a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;;
+ amiga_vec) tb="$tb amigaos.lo amigaoslink.lo" ;;
armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;;
@@ -5064,6 +5064,7 @@
arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;;
+ aout_amiga_vec) tb="$tb aout-amiga.lo aout32.lo stab-syms.lo";;
aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;;
aout_arm_little_vec) tb="$tb aout-arm.lo aout32.lo" ;;
aout_mips_big_vec) tb="$tb mipsbsd.lo aout32.lo" ;;

View File

@ -0,0 +1,18 @@
--- binutils-2.10.1/bfd/configure.in 2000-10-16 13:27:22.000000000 +0200
+++ binutils-2.10.1/bfd/configure.in 2012-08-08 12:35:51.000000000 +0200
@@ -419,6 +419,7 @@
# with the two vector lists in targets.c.
a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;;
a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;;
+ amiga_vec) tb="$tb amigaos.lo amigaoslink.lo" ;;
armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;;
@@ -431,6 +432,7 @@
arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;;
+ aout_amiga_vec) tb="$tb aout-amiga.lo aout32.lo stab-syms.lo";;
aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;;
aout_arm_little_vec) tb="$tb aout-arm.lo aout32.lo" ;;
aout_mips_big_vec) tb="$tb mipsbsd.lo aout32.lo" ;;

View File

@ -0,0 +1,38 @@
--- binutils-2.10.1/bfd/doc/Makefile.am 1999-05-03 09:28:58.000000000 +0200
+++ binutils-2.10.1/bfd/doc/Makefile.am 2012-08-08 12:35:51.000000000 +0200
@@ -2,7 +2,7 @@
AUTOMAKE_OPTIONS = cygnus
-DOCFILES = aoutx.texi archive.texi archures.texi \
+DOCFILES = amiga.texi amigalink.texi aoutx.texi archive.texi archures.texi \
bfdt.texi cache.texi coffcode.texi \
core.texi elf.texi elfcode.texi format.texi libbfd.texi \
opncls.texi reloc.texi section.texi \
@@ -24,6 +24,7 @@
$(srcdir)/../cache.c $(srcdir)/../coffcode.h \
$(srcdir)/../corefile.c $(srcdir)/../elf.c \
$(srcdir)/../elfcode.h $(srcdir)/../format.c \
+ $(srcdir)/../amigaos.c $(srcdir)/../amigaoslink.c \
$(srcdir)/../libbfd.c $(srcdir)/../opncls.c \
$(srcdir)/../reloc.c $(srcdir)/../section.c \
$(srcdir)/../syms.c $(srcdir)/../targets.c \
@@ -183,6 +184,18 @@
touch s-linker
linker.texi: s-linker
+s-amiga: $(MKDOC) $(srcdir)/../amigaos.c $(srcdir)/doc.str
+ ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../amigaos.c >amiga.tmp
+ $(srcdir)/../../move-if-change amiga.tmp amiga.texi
+ touch s-amiga
+amiga.texi: s-amiga
+
+s-amigalink: $(MKDOC) $(srcdir)/../amigaoslink.c $(srcdir)/doc.str
+ ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../amigaoslink.c >amigalink.tmp
+ $(srcdir)/../../move-if-change amigalink.tmp amigalink.texi
+ touch s-amigalink
+amigalink.texi: s-amigalink
+
libbfd.h: $(srcdir)/../libbfd-in.h \
$(srcdir)/../init.c \
$(srcdir)/../libbfd.c \

View File

@ -0,0 +1,38 @@
--- binutils-2.10.1/bfd/doc/Makefile.in 2000-04-05 07:36:40.000000000 +0200
+++ binutils-2.10.1/bfd/doc/Makefile.in 2012-08-08 12:35:51.000000000 +0200
@@ -115,7 +115,7 @@
AUTOMAKE_OPTIONS = cygnus
-DOCFILES = aoutx.texi archive.texi archures.texi \
+DOCFILES = amiga.texi amigalink.texi aoutx.texi archive.texi archures.texi \
bfdt.texi cache.texi coffcode.texi \
core.texi elf.texi elfcode.texi format.texi libbfd.texi \
opncls.texi reloc.texi section.texi \
@@ -139,6 +139,7 @@
$(srcdir)/../cache.c $(srcdir)/../coffcode.h \
$(srcdir)/../corefile.c $(srcdir)/../elf.c \
$(srcdir)/../elfcode.h $(srcdir)/../format.c \
+ $(srcdir)/../amigaos.c $(srcdir)/../amigaoslink.c \
$(srcdir)/../libbfd.c $(srcdir)/../opncls.c \
$(srcdir)/../reloc.c $(srcdir)/../section.c \
$(srcdir)/../syms.c $(srcdir)/../targets.c \
@@ -537,6 +538,18 @@
touch s-linker
linker.texi: s-linker
+s-amiga: $(MKDOC) $(srcdir)/../amigaos.c $(srcdir)/doc.str
+ ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../amigaos.c >amiga.tmp
+ $(srcdir)/../../move-if-change amiga.tmp amiga.texi
+ touch s-amiga
+amiga.texi: s-amiga
+
+s-amigalink: $(MKDOC) $(srcdir)/../amigaoslink.c $(srcdir)/doc.str
+ ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../amigaoslink.c >amigalink.tmp
+ $(srcdir)/../../move-if-change amigalink.tmp amigalink.texi
+ touch s-amigalink
+amigalink.texi: s-amigalink
+
libbfd.h: $(srcdir)/../libbfd-in.h \
$(srcdir)/../init.c \
$(srcdir)/../libbfd.c \

View File

@ -0,0 +1,33 @@
--- binutils-2.10.1/bfd/doc/bfd.texinfo 1999-05-03 09:28:58.000000000 +0200
+++ binutils-2.10.1/bfd/doc/bfd.texinfo 2012-08-08 12:35:51.000000000 +0200
@@ -302,9 +302,10 @@
@chapter BFD back ends
@menu
* What to Put Where::
-* aout :: a.out backends
-* coff :: coff backends
-* elf :: elf backends
+* aout :: a.out backends
+* coff :: coff backends
+* elf :: elf backends
+* amiga :: amigaos backend
@ignore
* oasys :: oasys backends
* ieee :: ieee backend
@@ -320,11 +321,15 @@
@node coff, elf, aout, BFD back ends
@include coffcode.texi
-@node elf, , coff, BFD back ends
+@node elf, amiga , coff, BFD back ends
@include elf.texi
@c Leave this out until the file has some actual contents...
@c @include elfcode.texi
+@node amiga, , elf, BFD back ends
+@include amiga.texi
+@include amigalink.texi
+
@node Index, , BFD back ends , Top
@unnumbered Index
@printindex cp

View File

@ -0,0 +1,229 @@
/* BFD back-end data structures for AmigaOS.
Copyright (C) 1992-1994 Free Software Foundation, Inc.
Contributed by Leonard Norrgard.
Extended by Stephan Thesing Nov 94
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. */
#ifdef __STDC__
#define CAT3(a,b,c) a##b##c
#else
#define CAT3(a,b,c) a/**/b/**/c
#endif
#define GET_WORD bfd_h_get_32
#define GET_SWORD (int32_type)GET_WORD
#define PUT_WORD bfd_h_put_32
#define NAME(x,y) CAT3(x,_32_,y)
#define JNAME(x) CAT(x,_32)
#define BYTES_IN_WORD 4
/* Hunk ID numbers.*/
#define HUNK_UNIT 999
#define HUNK_NAME 1000
#define HUNK_CODE 1001
#define HUNK_DATA 1002
#define HUNK_BSS 1003
#define HUNK_RELOC32 1004
#define HUNK_ABSRELOC32 HUNK_RELOC32
#define HUNK_RELOC16 1005
#define HUNK_RELRELOC16 HUNK_RELOC16
#define HUNK_RELOC8 1006
#define HUNK_RELRELOC8 HUNK_RELOC8
#define HUNK_EXT 1007
#define HUNK_SYMBOL 1008
#define HUNK_DEBUG 1009
#define HUNK_END 1010
#define HUNK_HEADER 1011
#define HUNK_OVERLAY 1013
#define HUNK_BREAK 1014
#define HUNK_DREL32 1015
#define HUNK_DREL16 1016
#define HUNK_DREL8 1017
#define HUNK_LIB 1018
#define HUNK_INDEX 1019
#define HUNK_RELOC32SHORT 1020
#define HUNK_RELRELOC32 1021
#define HUNK_ABSRELOC16 1022
/* The hunk ID part. */
#define HUNK_VALUE(hunk_id) ((hunk_id) & 0x3fffffff)
/* Attributes of a hunk. */
#define HUNK_ATTRIBUTE(hunk_id) ((hunk_id) >> 30)
#define HUNK_ATTR_CHIP 0x01 /* Hunk contents must go into chip ram. */
#define HUNK_ATTR_FAST 0x02 /* fast */
#define HUNK_ATTR_FOLLOWS 0x03 /* Mem id follows */
#define EXT_SYMB 0
#define EXT_DEF 1
#define EXT_ABS 2
#define EXT_RES 3
#define EXT_REF32 129
#define EXT_ABSREF32 EXT_REF32
#define EXT_COMMON 130
#define EXT_ABSCOMMON EXT_COMMON
#define EXT_REF16 131
#define EXT_RELREF16 EXT_REF16
#define EXT_REF8 132
#define EXT_RELREF8 EXT_REF8
#define EXT_DEXT32 133
#define EXT_DREF32 EXT_DEXT32
#define EXT_DEXT16 134
#define EXT_DREF16 EXT_DEXT16
#define EXT_DEXT8 135
#define EXT_DREF8 EXT_DEXT8
#define EXT_RELREF32 136
#define EXT_RELCOMMON 137
#define EXT_ABSREF16 138
#define EXT_ABSREF8 139
typedef struct amiga_reloc
{
arelent relent;
struct amiga_reloc *next;
struct amiga_symbol *symbol;
long target_hunk;
} amiga_reloc_type;
typedef struct amiga_symbol
{
asymbol symbol;
/* struct amiga_symbol *next;*/
unsigned short hunk_number;
long index;
/* these come from a.out. Not used yet, but needed to compile */
short desc;
char other;
unsigned char type;
} amiga_symbol_type;
struct amiga_raw_symbol
{
struct amiga_raw_symbol *next;
unsigned long data[1];
};
typedef struct amiga_per_section
{
amiga_reloc_type *reloc_tail; /* last reloc *//* first is in section->relocation */
int attribute; /* Memory type required by this section */
unsigned long disk_size; /* Section size on disk. _raw_size may be larger than this */
int max_raw_relocs; /* Size of array */
unsigned long int num_raw_relocs8, num_raw_relocs16, num_raw_relocs32;
unsigned long raw_relocs8, raw_relocs16, raw_relocs32;
struct amiga_raw_symbol *first;
struct amiga_raw_symbol *last; /* tail */
/* the symbols for this section */
amiga_symbol_type *amiga_symbols;
unsigned long hunk_ext_pos; /* offset of hunk_ext in the bfd file */
unsigned long hunk_symbol_pos; /* offset of hunk_symbol in the bfd file */
} amiga_per_section_type;
#define amiga_per_section(x) ((amiga_per_section_type *)((x)->used_by_bfd))
/* The `tdata' struct for all a.out-like object file formats.
Various things depend on this struct being around any time an a.out
file is being handled. An example is dbxread.c in GDB. */
struct amiga_data
{
struct internal_exec *hdr; /* exec file header */
amiga_symbol_type *symbols; /* symtab for input bfd */
/* Filler, so we can pretend to be an a.out to GDB. */
asection *textsec;
asection *datasec;
asection *bsssec;
int nb_hunks; /* number of hunks in the file */
/* The positions of the string table and symbol table. */
file_ptr sym_filepos;
file_ptr str_filepos;
unsigned int n_symbols; /* number of symbols */
/* Size of a relocation entry in external form */
unsigned dummy_reloc_entry_size;
/* Size of a symbol table entry in external form */
unsigned symbol_entry_size;
unsigned exec_bytes_size;
unsigned vma_adjusted:1;
};
typedef struct amiga_data_struct
{
struct amiga_data a;
unsigned long symtab_size;
unsigned long stringtab_size;
unsigned long *first_byte;
unsigned long *file_end;
unsigned long *file_pointer;
amiga_symbol_type *symbols;
amiga_symbol_type *symbol_tail;
boolean IsLoadFile; /* If true, this is a load file (for output bfd only) */
int maxsymbols; /* Used by final_link routine to add symbols to output bfd.
This is the # of entries, allocated in abdfd->osymbols */
int nb_hunks;
/* The next two fields are set at final_link time
for the output bfd only */
boolean baserel; /* true if there is ___init_a4 in the global hash table */
bfd_vma a4init; /* cache the value for efficiency */
} amiga_data_type;
struct arch_syms
{
unsigned long offset; /* disk offset in the archive */
unsigned long size; /* size of the block of symbols */
unsigned long unit_offset; /* start of unit on disk */
struct arch_syms *next; /* linked list */
};
#define adata(bfd) ((bfd)->tdata.amiga_data->a)
/* We take the address of the first element of an asymbol to ensure that the
macro is only ever applied to an asymbol */
#define amiga_symbol(asymbol) ((amiga_symbol_type *)(&(asymbol)->the_bfd))
#define AMIGA_DATA(abfd) ((abfd)->tdata.amiga_data)
#define HUNKB_ADVISORY 29
#define HUNKB_CHIP 30
#define HUNKB_FAST 31
#define HUNKF_ADVISORY (1L << HUNKB_ADVISORY)
#define HUNKF_CHIP (1L << HUNKB_CHIP)
#define HUNKF_FAST (1L << HUNKB_FAST)
#define MEMF_ANY (0L)
#define MEMF_PUBLIC (1L << 0)
#define MEMF_CHIP (1L << 1)
#define MEMF_FAST (1L << 2)
#define MEMF_LOCAL (1L << 8)
#define MEMF_24BITDMA (1L << 9)
#define MEMF_KICK (1L << 10)
#define MEMF_CLEAR (1L << 16)
#define MEMF_LARGEST (1L << 17)
#define MEMF_REVERSE (1L << 18)
#define MEMF_TOTAL (1L << 19)
#define MEMF_NO_EXPUNGE (1L << 31)

View File

@ -0,0 +1,62 @@
--- binutils-2.10.1/bfd/linker.c 2000-01-14 19:13:40.000000000 +0100
+++ binutils-2.10.1/bfd/linker.c 2012-08-08 12:35:51.000000000 +0200
@@ -429,7 +429,8 @@
static boolean default_fill_link_order
PARAMS ((bfd *, struct bfd_link_info *, asection *,
struct bfd_link_order *));
-static boolean default_indirect_link_order
+/*Amiga hack - used in amigaoslink.c so must be global */
+/*static*/ boolean default_indirect_link_order
PARAMS ((bfd *, struct bfd_link_info *, asection *,
struct bfd_link_order *, boolean));
@@ -1197,8 +1198,17 @@
h->u.c.size = size;
power = bfd_log2 (size);
- if (power > 4)
- power = 4;
+ /* For the amiga, we don't want an alignment bigger than
+ 2**2. Doing this here is a horribly kludgy, but IMHO the
+ max power alignment really should be target-dependant so
+ that we wouldn't have to do this -- daniel */
+ if (bfd_get_flavour(abfd) == bfd_target_amiga_flavour) {
+ if (power > 2)
+ power = 2;
+ }
+ else
+ if (power > 4)
+ power = 4;
h->u.c.p->alignment_power = power;
if (p->section == bfd_com_section_ptr)
@@ -1659,8 +1669,18 @@
unsigned int power;
power = bfd_log2 (value);
- if (power > 4)
- power = 4;
+ /* For the amiga, we don't want an alignment bigger than
+ 2**2. Doing this here is a horribly kludgy, but IMHO
+ the max power alignment really should be
+ target-dependant so that we wouldn't have to do this --
+ daniel */
+ if (bfd_get_flavour(abfd) == bfd_target_amiga_flavour) {
+ if (power > 2)
+ power = 2;
+ }
+ else
+ if (power > 4)
+ power = 4;
h->u.c.p->alignment_power = power;
}
@@ -2640,7 +2660,7 @@
/* Default routine to handle a bfd_indirect_link_order. */
-static boolean
+/*static*/ boolean
default_indirect_link_order (output_bfd, info, output_section, link_order,
generic_linker)
bfd *output_bfd;

View File

@ -0,0 +1,28 @@
--- binutils-2.10.1/bfd/targets.c 2000-03-27 10:39:12.000000000 +0200
+++ binutils-2.10.1/bfd/targets.c 2012-08-08 12:35:51.000000000 +0200
@@ -138,6 +138,7 @@
.enum bfd_flavour {
. bfd_target_unknown_flavour,
+. bfd_target_amiga_flavour,
. bfd_target_aout_flavour,
. bfd_target_coff_flavour,
. bfd_target_ecoff_flavour,
@@ -486,6 +487,8 @@
we can't intermix extern's and initializers. */
extern const bfd_target a29kcoff_big_vec;
extern const bfd_target a_out_adobe_vec;
+extern const bfd_target amiga_vec;
+extern const bfd_target aout_amiga_vec;
extern const bfd_target aout_arm_big_vec;
extern const bfd_target aout_arm_little_vec;
extern const bfd_target aout_mips_big_vec;
@@ -676,6 +679,8 @@
it wasn't omitted by mistake. */
&a29kcoff_big_vec,
&a_out_adobe_vec,
+ &amiga_vec,
+ &aout_amiga_vec,
#if 0 /* No one seems to use this. */
&aout_mips_big_vec,
#endif

View File

@ -0,0 +1,12 @@
--- binutils-2.10.1/binutils/objcopy.c 2000-09-05 10:56:22.000000000 +0200
+++ binutils-2.10.1/binutils/objcopy.c 2012-08-08 12:35:51.000000000 +0200
@@ -1407,7 +1407,8 @@
if (relsize < 0)
RETURN_NONFATAL (bfd_get_filename (ibfd));
- if (relsize == 0)
+ /* Never, ever, strip reloc data on the Amiga! */
+ if (relsize == 0 && bfd_get_flavour(obfd) != bfd_target_amiga_flavour)
bfd_set_reloc (obfd, osection, (arelent **) NULL, 0);
else
{

View File

@ -0,0 +1,72 @@
--- binutils-2.10.1/gas/Makefile.am 2000-04-19 12:04:53.000000000 +0200
+++ binutils-2.10.1/gas/Makefile.am 2012-08-08 12:35:51.000000000 +0200
@@ -73,6 +73,7 @@
# We deliberately omit som, since it does not work as a cross assembler.
OBJ_FORMATS = \
+ amigahunk \
aout \
bout \
coff \
@@ -278,6 +279,7 @@
# OBJ files in config
OBJ_FORMAT_CFILES = \
+ config/obj-amigahunk.c \
config/obj-aout.c \
config/obj-bout.c \
config/obj-coff.c \
@@ -290,6 +292,7 @@
config/obj-vms.c
OBJ_FORMAT_HFILES = \
+ config/obj-amigahunk.h \
config/obj-aout.h \
config/obj-bout.h \
config/obj-coff.h \
@@ -305,6 +308,7 @@
TARG_ENV_HFILES = \
config/te-386bsd.h \
+ config/te-amiga.h \
config/te-aux.h \
config/te-delta.h \
config/te-delt88.h \
@@ -499,6 +503,8 @@
# We need all these explicit rules for the multi stuff. Because of
# these rules, we don't need one for OBJ_FORMAT_O.
+obj-amigahunk.o : $(srcdir)/config/obj-amigahunk.c
+ $(COMPILE) -c $(srcdir)/config/obj-amigahunk.c
obj-aout.o : $(srcdir)/config/obj-aout.c
$(COMPILE) -c $(srcdir)/config/obj-aout.c
obj-bout.o : $(srcdir)/config/obj-bout.c
@@ -1100,6 +1106,9 @@
emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h \
$(srcdir)/../opcodes/m32r-desc.h $(INCDIR)/opcode/cgen.h \
$(srcdir)/../opcodes/m32r-opc.h cgen.h
+DEPTC_m68k_amigaoshunk = $(srcdir)/config/obj-amigahunk.h $(srcdir)/config/tc-m68k.h \
+ $(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \
+ subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
DEPTC_m68k_aout = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
emul.h $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/m68k.h \
@@ -1453,6 +1462,9 @@
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \
emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
+DEPOBJ_m68k_amigaoshunk = $(srcdir)/config/obj-amigahunk.h $(srcdir)/config/tc-m68k.h \
+ $(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/obstack.h
DEPOBJ_m68k_aout = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
emul.h $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h
@@ -1734,6 +1746,8 @@
DEP_m32r_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-m32r.h
+DEP_m68k_amigaoshunk = $(srcdir)/config/obj-amigahunk.h \
+ $(srcdir)/config/tc-m68k.h $(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h
DEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
$(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h
DEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \

View File

@ -0,0 +1,75 @@
--- binutils-2.10.1/gas/Makefile.in 2000-04-19 12:04:53.000000000 +0200
+++ binutils-2.10.1/gas/Makefile.in 2012-08-08 12:35:51.000000000 +0200
@@ -178,6 +178,7 @@
# We deliberately omit som, since it does not work as a cross assembler.
OBJ_FORMATS = \
+ amigahunk \
aout \
bout \
coff \
@@ -390,6 +391,7 @@
# OBJ files in config
OBJ_FORMAT_CFILES = \
+ config/obj-amigahunk.c \
config/obj-aout.c \
config/obj-bout.c \
config/obj-coff.c \
@@ -403,6 +405,7 @@
OBJ_FORMAT_HFILES = \
+ config/obj-amigahunk.h \
config/obj-aout.h \
config/obj-bout.h \
config/obj-coff.h \
@@ -419,6 +422,7 @@
TARG_ENV_HFILES = \
config/te-386bsd.h \
+ config/te-amiga.h \
config/te-aux.h \
config/te-delta.h \
config/te-delt88.h \
@@ -799,6 +803,10 @@
$(srcdir)/../opcodes/m32r-desc.h $(INCDIR)/opcode/cgen.h \
$(srcdir)/../opcodes/m32r-opc.h cgen.h
+DEPTC_m68k_amigaoshunk = $(srcdir)/config/obj-amigahunk.h $(srcdir)/config/tc-m68k.h \
+ $(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \
+ subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
+
DEPTC_m68k_aout = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
emul.h $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/m68k.h \
@@ -1239,6 +1247,10 @@
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \
emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
+DEPOBJ_m68k_amigaoshunk = $(srcdir)/config/obj-amigahunk.h $(srcdir)/config/tc-m68k.h \
+ $(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/obstack.h
+
DEPOBJ_m68k_aout = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
emul.h $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h
@@ -1605,6 +1617,9 @@
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h
+DEP_m68k_amigaoshunk = $(srcdir)/config/obj-amigahunk.h \
+ $(srcdir)/config/tc-m68k.h $(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h
+
DEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
$(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h
@@ -2262,6 +2277,8 @@
# We need all these explicit rules for the multi stuff. Because of
# these rules, we don't need one for OBJ_FORMAT_O.
+obj-amigahunk.o : $(srcdir)/config/obj-amigahunk.c
+ $(COMPILE) -c $(srcdir)/config/obj-amigahunk.c
obj-aout.o : $(srcdir)/config/obj-aout.c
$(COMPILE) -c $(srcdir)/config/obj-aout.c
obj-bout.o : $(srcdir)/config/obj-bout.c

View File

@ -0,0 +1,36 @@
--- binutils-2.10.1/gas/as.c 2000-05-04 07:37:28.000000000 +0200
+++ binutils-2.10.1/gas/as.c 2012-08-08 12:35:51.000000000 +0200
@@ -79,6 +79,9 @@
#ifdef BFD_ASSEMBLER
segT reg_section, expr_section;
segT text_section, data_section, bss_section;
+#ifdef TE_AMIGA
+segT data_chip_section, bss_chip_section;
+#endif
#endif
/* The default obstack chunk size. If we set this to zero, the
@@ -1008,6 +1011,10 @@
text_section = subseg_new (TEXT_SECTION_NAME, 0);
data_section = subseg_new (DATA_SECTION_NAME, 0);
bss_section = subseg_new (BSS_SECTION_NAME, 0);
+#ifdef TE_AMIGA
+ data_chip_section = subseg_new (".data_chip", 0);
+ bss_chip_section = subseg_new (".bss_chip", 0);
+#endif
/* @@ FIXME -- we're setting the RELOC flag so that sections are assumed
to have relocs, otherwise we don't find out in time. */
applicable = bfd_applicable_section_flags (stdoutput);
@@ -1018,6 +1025,12 @@
applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
| SEC_DATA));
bfd_set_section_flags (stdoutput, bss_section, applicable & SEC_ALLOC);
+#ifdef TE_AMIGA
+ bfd_set_section_flags (stdoutput, data_chip_section,
+ applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC));
+ bfd_set_section_flags (stdoutput, bss_chip_section, applicable & SEC_ALLOC);
+#endif
+
seg_info (bss_section)->bss = 1;
subseg_new (BFD_ABS_SECTION_NAME, 0);
subseg_new (BFD_UND_SECTION_NAME, 0);

View File

@ -0,0 +1,25 @@
--- binutils-2.10.1/gas/as.h 2000-05-08 12:31:19.000000000 +0200
+++ binutils-2.10.1/gas/as.h 2012-08-08 12:35:51.000000000 +0200
@@ -616,6 +616,22 @@
#include "expr.h" /* Before targ-*.h */
+struct relax_type
+{
+ /* Forward reach. Signed number. > 0. */
+ long rlx_forward;
+ /* Backward reach. Signed number. < 0. */
+ long rlx_backward;
+
+ /* Bytes length of this address. */
+ unsigned char rlx_length;
+
+ /* Next longer relax-state. 0 means there is no 'next' relax-state. */
+ relax_substateT rlx_more;
+};
+
+typedef struct relax_type relax_typeS;
+
/* this one starts the chain of target dependant headers */
#include "targ-env.h"

View File

@ -0,0 +1,12 @@
--- binutils-2.10.1/gas/config/m68k-parse.h 1999-05-28 00:36:50.000000000 +0200
+++ binutils-2.10.1/gas/config/m68k-parse.h 2012-08-08 12:35:51.000000000 +0200
@@ -267,6 +267,9 @@
/* The expression itself. */
expressionS exp;
+
+ /* base-relative? */
+ short baserel;
};
/* The operand modes. */

View File

@ -0,0 +1,35 @@
--- binutils-2.10.1/gas/config/m68k-parse.y 1999-05-03 09:28:41.000000000 +0200
+++ binutils-2.10.1/gas/config/m68k-parse.y 2012-08-08 12:35:51.000000000 +0200
@@ -945,6 +945,7 @@
}
yylval.exp.size = SIZE_UNSPEC;
+ yylval.exp.baserel = 0;
if (s <= str + 2
|| (s[-2] != '.' && s[-2] != ':'))
tail = 0;
@@ -952,18 +953,21 @@
{
switch (s[-1])
{
+ case 'B':
+ yylval.exp.baserel = 1;
case 's':
case 'S':
case 'b':
- case 'B':
yylval.exp.size = SIZE_BYTE;
break;
- case 'w':
case 'W':
+ yylval.exp.baserel = 1;
+ case 'w':
yylval.exp.size = SIZE_WORD;
break;
- case 'l':
case 'L':
+ yylval.exp.baserel = 1;
+ case 'l':
yylval.exp.size = SIZE_LONG;
break;
default:

View File

@ -0,0 +1,576 @@
/* AmigaOS object file format
Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "as.h"
#ifdef BFD_ASSEMBLER
#undef NO_RELOC
#endif
#include "obstack.h"
#ifndef BFD_ASSEMBLER
/* in: segT out: N_TYPE bits */
const short seg_N_TYPE[] = {
N_ABS,
N_TEXT,
N_DATA,
N_BSS,
N_UNDF, /* unknown */
N_UNDF, /* error */
N_UNDF, /* expression */
N_UNDF, /* debug */
N_UNDF, /* ntv */
N_UNDF, /* ptv */
N_REGISTER, /* register */
};
const segT N_TYPE_seg[N_TYPE + 2] = { /* N_TYPE == 0x1E = 32-2 */
SEG_UNKNOWN, /* N_UNDF == 0 */
SEG_GOOF,
SEG_ABSOLUTE, /* N_ABS == 2 */
SEG_GOOF,
SEG_TEXT, /* N_TEXT == 4 */
SEG_GOOF,
SEG_DATA, /* N_DATA == 6 */
SEG_GOOF,
SEG_BSS, /* N_BSS == 8 */
SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_REGISTER, /* dummy N_REGISTER for regs = 30 */
SEG_GOOF,
};
#endif
static void obj_amiga_line (int);
static void obj_amiga_weak (int);
const pseudo_typeS obj_pseudo_table[] = {
{"line", obj_amiga_line, 0}, /* source code line number */
{"ln", obj_amiga_line, 0}, /* coff line number that we use anyway */
{"weak", obj_amiga_weak, 0}, /* mark symbol as weak. */
/* coff debug pseudos (ignored) */
{"def", s_ignore, 0},
{"dim", s_ignore, 0},
{"endef", s_ignore, 0},
{"ident", s_ignore, 0},
{"line", s_ignore, 0},
{"ln", s_ignore, 0},
{"scl", s_ignore, 0},
{"size", s_ignore, 0},
{"tag", s_ignore, 0},
{"type", s_ignore, 0},
{"val", s_ignore, 0},
{"version", s_ignore, 0},
{"optim", s_ignore, 0}, /* For sun386i cc (?) */
/* other stuff */
{"ABORT", s_abort, 0},
{NULL} /* end sentinel */
}; /* obj_pseudo_table */
#ifdef BFD_ASSEMBLER
void
obj_amiga_frob_symbol (sym, punt)
symbolS *sym;
int *punt;
{
flagword flags;
asection *sec;
int desc, type, other;
flags = sym->bsym->flags;
type = S_GET_TYPE (sym);
desc = S_GET_DESC (sym);
other = S_GET_OTHER (sym);
sec = sym->bsym->section;
/* Only frob simple symbols this way right now. */
if (!(type & ~(N_TYPE | N_EXT)))
{
if (type == (N_UNDF | N_EXT) && sec == &bfd_abs_section)
sym->bsym->section = sec = bfd_und_section_ptr;
if ((type & N_TYPE) != N_INDR
&& (type & N_TYPE) != N_SETA
&& (type & N_TYPE) != N_SETT
&& (type & N_TYPE) != N_SETD
&& (type & N_TYPE) != N_SETB
&& type != N_WARNING
&& (sec == &bfd_abs_section || sec == &bfd_und_section))
return;
if (flags & BSF_EXPORT)
type |= N_EXT;
switch (type & N_TYPE)
{
case N_SETA:
case N_SETT:
case N_SETD:
case N_SETB:
/* Set the debugging flag for constructor symbols so that
BFD leaves them alone. */
sym->bsym->flags |= BSF_DEBUGGING;
/* You can't put a common symbol in a set. The way a set
element works is that the symbol has a definition and a
name, and the linker adds the definition to the set of
that name. That does not work for a common symbol,
because the linker can't tell which common symbol the
user means. FIXME: Using as_bad here may be
inappropriate, since the user may want to force a
particular type without regard to the semantics of sets;
on the other hand, we certainly don't want anybody to be
mislead into thinking that their code will work. */
if (S_IS_COMMON (sym))
as_bad ("Attempt to put a common symbol into set %s",
S_GET_NAME (sym));
/* Similarly, you can't put an undefined symbol in a set. */
else if (!S_IS_DEFINED (sym))
as_bad ("Attempt to put an undefined symbol into set %s",
S_GET_NAME (sym));
break;
case N_INDR:
/* Put indirect symbols in the indirect section. */
sym->bsym->section = bfd_ind_section_ptr;
sym->bsym->flags |= BSF_INDIRECT;
if (type & N_EXT)
{
sym->bsym->flags |= BSF_EXPORT;
sym->bsym->flags &= ~BSF_LOCAL;
}
break;
case N_WARNING:
/* Mark warning symbols. */
sym->bsym->flags |= BSF_WARNING;
break;
}
}
else
{
sym->bsym->flags |= BSF_DEBUGGING;
}
S_SET_TYPE (sym, type);
/* Double check weak symbols. */
if (sym->bsym->flags & BSF_WEAK)
{
if (S_IS_COMMON (sym))
as_bad ("Symbol `%s' can not be both weak and common",
S_GET_NAME (sym));
}
}
void
obj_amiga_frob_file ()
{
/* Relocation processing may require knowing the VMAs of the sections.
Since writing to a section will cause the BFD back end to compute the
VMAs, fake it out here.... */
bfd_byte b = 0;
boolean x = true;
if (bfd_section_size (stdoutput, text_section) != 0)
{
x = bfd_set_section_contents (stdoutput, text_section, &b, (file_ptr) 0,
(bfd_size_type) 1);
}
else if (bfd_section_size (stdoutput, data_section) != 0)
{
x = bfd_set_section_contents (stdoutput, data_section, &b, (file_ptr) 0,
(bfd_size_type) 1);
}
assert (x == true);
}
#else
/* Relocation. */
/*
* emit_relocations()
*
* Crawl along a fixS chain. Emit the segment's relocations.
*/
void
obj_emit_relocations (where, fixP, segment_address_in_file)
char **where;
fixS *fixP; /* Fixup chain for this segment. */
relax_addressT segment_address_in_file;
{
for (; fixP; fixP = fixP->fx_next)
if (fixP->fx_done == 0)
{
tc_aout_fix_to_chars (*where, fixP, segment_address_in_file);
*where += md_reloc_size;
}
}
#ifndef obj_header_append
/* Aout file generation & utilities */
void
obj_header_append (where, headers)
char **where;
object_headers *headers;
{
tc_headers_hook (headers);
#ifdef CROSS_COMPILE
md_number_to_chars (*where, headers->header.a_info,
sizeof (headers->header.a_info));
*where += sizeof (headers->header.a_info);
md_number_to_chars (*where, headers->header.a_text,
sizeof (headers->header.a_text));
*where += sizeof (headers->header.a_text);
md_number_to_chars (*where, headers->header.a_data,
sizeof (headers->header.a_data));
*where += sizeof (headers->header.a_data);
md_number_to_chars (*where, headers->header.a_bss,
sizeof (headers->header.a_bss));
*where += sizeof (headers->header.a_bss);
md_number_to_chars (*where, headers->header.a_syms,
sizeof (headers->header.a_syms));
*where += sizeof (headers->header.a_syms);
md_number_to_chars (*where, headers->header.a_entry,
sizeof (headers->header.a_entry));
*where += sizeof (headers->header.a_entry);
md_number_to_chars (*where, headers->header.a_trsize,
sizeof (headers->header.a_trsize));
*where += sizeof (headers->header.a_trsize);
md_number_to_chars (*where, headers->header.a_drsize,
sizeof (headers->header.a_drsize));
*where += sizeof (headers->header.a_drsize);
#else /* CROSS_COMPILE */
append (where, (char *) &headers->header, sizeof (headers->header));
#endif /* CROSS_COMPILE */
}
#endif
void
obj_symbol_to_chars (where, symbolP)
char **where;
symbolS *symbolP;
{
md_number_to_chars ((char *) &(S_GET_OFFSET (symbolP)),
S_GET_OFFSET (symbolP),
sizeof (S_GET_OFFSET (symbolP)));
md_number_to_chars ((char *) &(S_GET_DESC (symbolP)),
S_GET_DESC (symbolP), sizeof (S_GET_DESC (symbolP)));
md_number_to_chars ((char *) &(symbolP->sy_symbol.n_value),
S_GET_VALUE (symbolP),
sizeof (symbolP->sy_symbol.n_value));
append (where, (char *) &symbolP->sy_symbol, sizeof (obj_symbol_type));
}
void
obj_emit_symbols (where, symbol_rootP)
char **where;
symbolS *symbol_rootP;
{
symbolS *symbolP;
/* Emit all symbols left in the symbol chain. */
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
{
/* Used to save the offset of the name. It is used to point
to the string in memory but must be a file offset. */
register char *temp;
temp = S_GET_NAME (symbolP);
S_SET_OFFSET (symbolP, symbolP->sy_name_offset);
/* Any symbol still undefined and is not a dbg symbol is made N_EXT. */
if (!S_IS_DEBUG (symbolP) && !S_IS_DEFINED (symbolP))
S_SET_EXTERNAL (symbolP);
/* Adjust the type of a weak symbol. */
if (S_GET_WEAK (symbolP))
{
switch (S_GET_TYPE (symbolP))
{
case N_UNDF:
S_SET_TYPE (symbolP, N_WEAKU);
break;
case N_ABS:
S_SET_TYPE (symbolP, N_WEAKA);
break;
case N_TEXT:
S_SET_TYPE (symbolP, N_WEAKT);
break;
case N_DATA:
S_SET_TYPE (symbolP, N_WEAKD);
break;
case N_BSS:
S_SET_TYPE (symbolP, N_WEAKB);
break;
default:
as_bad ("%s: bad type for weak symbol", temp);
break;
}
}
obj_symbol_to_chars (where, symbolP);
S_SET_NAME (symbolP, temp);
}
}
#endif /* ! BFD_ASSEMBLER */
static void
obj_amiga_line (ignore)
int ignore;
{
/* Assume delimiter is part of expression.
BSD4.2 as fails with delightful bug, so we
are not being incompatible here. */
new_logical_line ((char *) NULL, (int) (get_absolute_expression ()));
demand_empty_rest_of_line ();
} /* obj_aout_line() */
/* Handle .weak. This is a GNU extension. */
static void
obj_amiga_weak (ignore)
int ignore;
{
char *name;
int c;
symbolS *symbolP;
do
{
name = input_line_pointer;
c = get_symbol_end ();
symbolP = symbol_find_or_make (name);
*input_line_pointer = c;
SKIP_WHITESPACE ();
S_SET_WEAK (symbolP);
if (c == ',')
{
input_line_pointer++;
SKIP_WHITESPACE ();
if (*input_line_pointer == '\n')
c = '\n';
}
}
while (c == ',');
demand_empty_rest_of_line ();
}
void
obj_read_begin_hook ()
{
}
#ifndef BFD_ASSEMBLER
void
obj_crawl_symbol_chain (headers)
object_headers *headers;
{
symbolS *symbolP;
symbolS **symbolPP;
int symbol_number = 0;
tc_crawl_symbol_chain (headers);
symbolPP = &symbol_rootP; /*->last symbol chain link. */
while ((symbolP = *symbolPP) != NULL)
{
if (symbolP->sy_mri_common)
{
if (S_IS_EXTERNAL (symbolP))
as_bad ("%s: global symbols not supported in common sections",
S_GET_NAME (symbolP));
*symbolPP = symbol_next (symbolP);
continue;
}
if (flag_readonly_data_in_text && (S_GET_SEGMENT (symbolP) == SEG_DATA))
{
S_SET_SEGMENT (symbolP, SEG_TEXT);
} /* if pusing data into text */
resolve_symbol_value (symbolP);
/* OK, here is how we decide which symbols go out into the brave
new symtab. Symbols that do are:
* symbols with no name (stabd's?)
* symbols with debug info in their N_TYPE
Symbols that don't are:
* symbols that are registers
* symbols with \1 as their 3rd character (numeric labels)
* "local labels" as defined by S_LOCAL_NAME(name) if the -L
switch was passed to gas.
All other symbols are output. We complain if a deleted
symbol was marked external. */
if (!S_IS_REGISTER (symbolP)
&& (!S_GET_NAME (symbolP)
|| S_IS_DEBUG (symbolP)
|| !S_IS_DEFINED (symbolP)
|| S_IS_EXTERNAL (symbolP)
|| (S_GET_NAME (symbolP)[0] != '\001'
&& (flag_keep_locals || !S_LOCAL_NAME (symbolP)))))
{
symbolP->sy_number = symbol_number++;
/* The + 1 after strlen account for the \0 at the
end of each string */
if (!S_IS_STABD (symbolP))
{
/* Ordinary case. */
symbolP->sy_name_offset = string_byte_count;
string_byte_count += strlen (S_GET_NAME (symbolP)) + 1;
}
else /* .Stabd case. */
symbolP->sy_name_offset = 0;
symbolPP = &(symbol_next (symbolP));
}
else
{
if (S_IS_EXTERNAL (symbolP) || !S_IS_DEFINED (symbolP))
/* This warning should never get triggered any more.
Well, maybe if you're doing twisted things with
register names... */
{
as_bad ("Local symbol %s never defined.",
decode_local_label_name (S_GET_NAME (symbolP)));
} /* oops. */
/* Unhook it from the chain */
*symbolPP = symbol_next (symbolP);
} /* if this symbol should be in the output */
} /* for each symbol */
H_SET_SYMBOL_TABLE_SIZE (headers, symbol_number);
}
/*
* Find strings by crawling along symbol table chain.
*/
void
obj_emit_strings (where)
char **where;
{
symbolS *symbolP;
#ifdef CROSS_COMPILE
/* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
md_number_to_chars (*where, string_byte_count, sizeof (string_byte_count));
*where += sizeof (string_byte_count);
#else /* CROSS_COMPILE */
append (where, (char *) &string_byte_count,
(unsigned long) sizeof (string_byte_count));
#endif /* CROSS_COMPILE */
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
{
if (S_GET_NAME (symbolP))
append (&next_object_file_charP, S_GET_NAME (symbolP),
(unsigned long) (strlen (S_GET_NAME (symbolP)) + 1));
} /* walk symbol chain */
}
void
obj_pre_write_hook (headers)
object_headers *headers;
{
H_SET_DYNAMIC (headers, 0);
H_SET_VERSION (headers, AOUT_VERSION);
H_SET_MACHTYPE (headers, AOUT_MACHTYPE);
tc_aout_pre_write_hook (headers);
}
void
DEFUN_VOID (s_sect)
{
/* Strip out the section name */
char *section_name;
char *section_name_end;
char c;
unsigned int len;
unsigned int exp;
char *save;
section_name = input_line_pointer;
c = get_symbol_end ();
section_name_end = input_line_pointer;
len = section_name_end - section_name;
input_line_pointer++;
save = input_line_pointer;
SKIP_WHITESPACE ();
if (c == ',')
{
exp = get_absolute_expression ();
}
else if (*input_line_pointer == ',')
{
input_line_pointer++;
exp = get_absolute_expression ();
}
else
{
input_line_pointer = save;
exp = 0;
}
if (exp >= 1000)
{
as_bad ("subsegment index too high");
}
if (strcmp (section_name, ".text") == 0)
{
subseg_set (SEG_TEXT, (subsegT) exp);
}
if (strcmp (section_name, ".data") == 0)
{
if (flag_readonly_data_in_text)
subseg_set (SEG_TEXT, (subsegT) exp + 1000);
else
subseg_set (SEG_DATA, (subsegT) exp);
}
*section_name_end = c;
}
#endif /* ! BFD_ASSEMBLER */

View File

@ -0,0 +1,220 @@
/* obj-amigahunk.h, AmigaOS object file format for gas, the assembler.
Copyright (C) 1989, 1990, 1991, 1992, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Tag to validate an amiga object file format processing */
#define OBJ_AMIGAHUNK 1
#include "targ-cpu.h"
#include "aout_gnu.h"
#ifdef BFD_ASSEMBLER
#include "bfd/libamiga.h"
#define OUTPUT_FLAVOR bfd_target_amiga_flavour
#else /* ! BFD_ASSEMBLER */
extern const short seg_N_TYPE[];
extern const segT N_TYPE_seg[];
#ifndef DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (HUNK_UNIT)
#endif
#endif /* ! BFD_ASSEMBLER */
/* SYMBOL TABLE */
/* Symbol table macros and constants */
#ifdef BFD_ASSEMBLER
#define S_SET_OTHER(S,V) (amiga_symbol((S)->bsym)->other = (V))
#define S_SET_TYPE(S,T) (amiga_symbol((S)->bsym)->type = (T))
#define S_SET_DESC(S,D) (amiga_symbol((S)->bsym)->desc = (D))
#define S_GET_OTHER(S) (amiga_symbol((S)->bsym)->other)
#define S_GET_TYPE(S) (amiga_symbol((S)->bsym)->type)
#define S_GET_DESC(S) (amiga_symbol((S)->bsym)->desc)
asection *text_section, *data_section, *bss_section;
#define obj_frob_symbol(S,PUNT) obj_amiga_frob_symbol (S, &PUNT)
#define obj_frob_file() obj_amiga_frob_file ()
extern void obj_amiga_frob_symbol (struct symbol *, int *);
extern void obj_amiga_frob_file (void);
#define obj_sec_sym_ok_for_reloc(SEC) (1)
#else
/* We use the sy_obj field to record whether a symbol is weak. */
#define OBJ_SYMFIELD_TYPE char
/*
* Macros to extract information from a symbol table entry.
* This syntaxic indirection allows independence regarding a.out or coff.
* The argument (s) of all these macros is a pointer to a symbol table entry.
*/
/* True if the symbol is external */
#define S_IS_EXTERNAL(s) ((s)->sy_symbol.n_type & N_EXT)
/* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */
#define S_IS_DEFINED(s) ((S_GET_TYPE(s) != N_UNDF) || (S_GET_OTHER(s) != 0) || (S_GET_DESC(s) != 0))
#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER)
/* True if a debug special symbol entry */
#define S_IS_DEBUG(s) ((s)->sy_symbol.n_type & N_STAB)
/* True if a symbol is local symbol name */
/* A symbol name whose name begin with ^A is a gas internal pseudo symbol
nameless symbols come from .stab directives. */
#define S_IS_LOCAL(s) (S_GET_NAME(s) && \
!S_IS_DEBUG(s) && \
(S_GET_NAME(s)[0] == '\001' || \
(S_LOCAL_NAME(s) && !flag_keep_locals)))
/* True if a symbol is not defined in this file */
#define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT)
/* True if the symbol has been generated because of a .stabd directive */
#define S_IS_STABD(s) (S_GET_NAME(s) == (char *)0)
/* Accessors */
/* The name of the symbol */
#define S_GET_NAME(s) ((s)->sy_symbol.n_un.n_name)
/* The pointer to the string table */
#define S_GET_OFFSET(s) ((s)->sy_symbol.n_un.n_strx)
/* The type of the symbol */
#define S_GET_TYPE(s) ((s)->sy_symbol.n_type & N_TYPE)
/* The numeric value of the segment */
#define S_GET_SEGMENT(s) (N_TYPE_seg[S_GET_TYPE(s)])
/* The n_other expression value */
#define S_GET_OTHER(s) ((s)->sy_symbol.n_other)
/* The n_desc expression value */
#define S_GET_DESC(s) ((s)->sy_symbol.n_desc)
/* Whether the symbol is weak. */
#define S_GET_WEAK(s) ((s)->sy_obj)
/* Modifiers */
/* Assume that a symbol cannot be simultaneously in more than on segment */
/* set segment */
#define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg))
/* The symbol is external */
#define S_SET_EXTERNAL(s) ((s)->sy_symbol.n_type |= N_EXT)
/* The symbol is not external */
#define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT)
/* Set the name of the symbol */
#define S_SET_NAME(s,v) ((s)->sy_symbol.n_un.n_name = (v))
/* Set the offset in the string table */
#define S_SET_OFFSET(s,v) ((s)->sy_symbol.n_un.n_strx = (v))
/* Set the n_type field */
#define S_SET_TYPE(s,t) ((s)->sy_symbol.n_type = (t))
/* Set the n_other expression value */
#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v))
/* Set the n_desc expression value */
#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v))
/* Mark the symbol as weak. This causes n_type to be adjusted when
the symbol is written out. */
#define S_SET_WEAK(s) ((s)->sy_obj = 1)
/* File header macro and type definition */
#define H_GET_FILE_SIZE(h) (H_GET_HEADER_SIZE(h) \
+ H_GET_TEXT_SIZE(h) \
+ H_GET_DATA_SIZE(h) \
+ H_GET_SYMBOL_TABLE_SIZE(h) \
+ H_GET_TEXT_RELOCATION_SIZE(h) \
+ H_GET_DATA_RELOCATION_SIZE(h) \
+ H_GET_STRING_SIZE(h))
#define H_GET_HEADER_SIZE(h) (EXEC_BYTES_SIZE)
#define H_GET_TEXT_SIZE(h) ((h)->header.a_text)
#define H_GET_DATA_SIZE(h) ((h)->header.a_data)
#define H_GET_BSS_SIZE(h) ((h)->header.a_bss)
#define H_GET_TEXT_RELOCATION_SIZE(h) ((h)->header.a_trsize)
#define H_GET_DATA_RELOCATION_SIZE(h) ((h)->header.a_drsize)
#define H_GET_SYMBOL_TABLE_SIZE(h) ((h)->header.a_syms)
#define H_GET_ENTRY_POINT(h) ((h)->header.a_entry)
#define H_GET_STRING_SIZE(h) ((h)->string_table_size)
#define H_GET_LINENO_SIZE(h) (0)
#define H_GET_DYNAMIC(h) ((h)->header.a_info >> 31)
#define H_GET_VERSION(h) (((h)->header.a_info >> 24) & 0x7f)
#define H_GET_MACHTYPE(h) (((h)->header.a_info >> 16) & 0xff)
#define H_GET_MAGIC_NUMBER(h) ((h)->header.a_info & 0xffff)
#define H_SET_DYNAMIC(h,v) ((h)->header.a_info = (((v) << 31) \
| (H_GET_VERSION(h) << 24) \
| (H_GET_MACHTYPE(h) << 16) \
| (H_GET_MAGIC_NUMBER(h))))
#define H_SET_VERSION(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
| ((v) << 24) \
| (H_GET_MACHTYPE(h) << 16) \
| (H_GET_MAGIC_NUMBER(h))))
#define H_SET_MACHTYPE(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
| (H_GET_VERSION(h) << 24) \
| ((v) << 16) \
| (H_GET_MAGIC_NUMBER(h))))
#define H_SET_MAGIC_NUMBER(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
| (H_GET_VERSION(h) << 24) \
| (H_GET_MACHTYPE(h) << 16) \
| ((v))))
#define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = md_section_align(SEG_TEXT, (v)))
#define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = md_section_align(SEG_DATA, (v)))
#define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = md_section_align(SEG_BSS, (v)))
#define H_SET_RELOCATION_SIZE(h,t,d) (H_SET_TEXT_RELOCATION_SIZE((h),(t)),\
H_SET_DATA_RELOCATION_SIZE((h),(d)))
#define H_SET_TEXT_RELOCATION_SIZE(h,v) ((h)->header.a_trsize = (v))
#define H_SET_DATA_RELOCATION_SIZE(h,v) ((h)->header.a_drsize = (v))
#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * 12)
#define H_SET_ENTRY_POINT(h,v) ((h)->header.a_entry = (v))
#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
typedef struct
{
struct exec header; /* a.out header */
long string_table_size; /* names + '\0' + sizeof(int) */
}
object_headers;
/* line numbering stuff. */
#define OBJ_EMIT_LINENO(a, b, c) {;}
struct fix;
void tc_aout_fix_to_chars
(char *where, struct fix *fixP, relax_addressT segment_address);
#endif
#define obj_symbol_new_hook(s) {;}
#define EMIT_SECTION_SYMBOLS 0
#define AOUT_STABS
/* end of obj-aout.h */

View File

@ -0,0 +1,762 @@
--- binutils-2.10.1/gas/config/tc-m68k.c 2000-05-08 12:31:20.000000000 +0200
+++ binutils-2.10.1/gas/config/tc-m68k.c 2012-08-08 13:03:51.000000000 +0200
@@ -31,6 +31,12 @@
#include "elf/m68k.h"
#endif
+/* FIXME: delete this #define as soon as the code that references
+ N_TEXT is changed */
+#ifdef BFD_ASSEMBLER
+#define N_TEXT 4
+#endif
+
/* This string holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful. The macro
tc_comment_chars points to this. We use this, rather than the
@@ -74,6 +80,7 @@
static int flag_short_refs; /* -l option */
static int flag_long_jumps; /* -S option */
+static int flag_small_code; /* -sc option */
#ifdef REGISTER_PREFIX_OPTIONAL
int flag_reg_prefix_optional = REGISTER_PREFIX_OPTIONAL;
@@ -160,6 +167,9 @@
/* Mode AINDX (apc-relative) using PC, with variable target, might fit
in 16 or 8 bits. */
#define PCINDEX 7
+/* AmigaOS relocations */
+#define ABSREL 8
+#define IMMREL 9
struct m68k_incant
{
@@ -247,6 +257,7 @@
so, which. */
enum pic_relocation pic_reloc;
#endif
+ char baserel;
}
reloc[5]; /* Five is enough??? */
};
@@ -273,7 +284,7 @@
/* Static functions. */
static void insop PARAMS ((int, const struct m68k_incant *));
-static void add_fix PARAMS ((int, struct m68k_exp *, int, int));
+static void add_fix PARAMS ((int, struct m68k_exp *, int, int, int));
static void add_frag PARAMS ((symbolS *, offsetT, int));
/* Like addword, but goes BEFORE general operands */
@@ -296,11 +307,12 @@
/* The numo+1 kludge is so we can hit the low order byte of the prev word.
Blecch. */
static void
-add_fix (width, exp, pc_rel, pc_fix)
+add_fix (width, exp, pc_rel, pc_fix, base_rel)
int width;
struct m68k_exp *exp;
int pc_rel;
int pc_fix;
+ int base_rel;
{
the_ins.reloc[the_ins.nrel].n = ((width == 'B' || width == '3')
? (the_ins.numo*2-1)
@@ -313,7 +325,8 @@
#ifdef OBJ_ELF
the_ins.reloc[the_ins.nrel].pic_reloc = exp->pic_reloc;
#endif
- the_ins.reloc[the_ins.nrel++].pcrel = pc_rel;
+ the_ins.reloc[the_ins.nrel].pcrel = pc_rel;
+ the_ins.reloc[the_ins.nrel++].baserel = base_rel;
}
/* Cause an extra frag to be generated here, inserting up to 10 bytes
@@ -435,6 +448,15 @@
/* BCC68000 is for patching in an extra jmp instruction for long offsets
on the 68000. The 68000 doesn't support long branches with branchs */
+/* ABSREL (nice name;-)) is used in small-code, it might be
+ * implemented base-relative (a4), pc-relative, or base-rel with an extra
+ * add instruction to add the base-register
+ *
+ * IMMREL is the analogous mode for immediate addressing of variables. This
+ * one can lead into situations, where a replacement is not possible:
+ * addl #foo,a0
+ * can't be made pc-relative, if foo is in the text segment */
+
/* This table desribes how you change sizes for the various types of variable
size expressions. This version only supports two kinds. */
@@ -489,6 +511,17 @@
{32765, -32770, 2, TAB (PCINDEX, LONG)},
{0, 0, 4, 0},
{1, 1, 0, 0},
+
+ {127, -128, 0, 0},
+ {32767, -32768, 2, TAB(ABSREL,LONG)},
+ {0, 0, 6, 0},
+ {1, 1, 0, 0},
+
+ {127, -128, 0, 0},
+ {32767, -32768, 2, TAB(IMMREL,LONG)},
+ {0, 0, 6, 0},
+ {1, 1, 0, 0},
+
};
/* These are the machine dependent pseudo-ops. These are included so
@@ -510,12 +543,14 @@
{"even", s_even, 0},
{"skip", s_space, 0},
{"proc", s_proc, 0},
+#ifndef __amigaos__
#if defined (TE_SUN3) || defined (OBJ_ELF)
{"align", s_align_bytes, 0},
#endif
#ifdef OBJ_ELF
{"swbeg", s_ignore, 0},
#endif
+#endif
{"extend", float_cons, 'x'},
{"ldouble", float_cons, 'x'},
@@ -1898,7 +1933,20 @@
else
nextword = get_num (&opP->disp, 0);
if (isvar (&opP->disp))
- add_fix (s[1], &opP->disp, 0, 0);
+ {
+/* This doesn't work when the symbol is N_UNDF! So we ignore this for the moment.
+
+ if (flag_small_code)
+ {
+ add_frag (adds(&opP->disp),
+ offs(&opP->disp),
+ TAB(IMMREL, SZ_UNDEF));
+ break;
+ }
+ else
+*/
+ add_fix(s[1], &opP->disp, 0, 0, opP->disp.baserel);
+ }
switch (s[1])
{
case 'b':
@@ -2058,7 +2106,7 @@
)
{
addword (0x0170);
- add_fix ('l', &opP->disp, 1, 2);
+ add_fix ('l', &opP->disp, 1, 2, opP->disp.baserel);
}
else
{
@@ -2071,7 +2119,7 @@
else
{
addword (0x0170);
- add_fix ('l', &opP->disp, 0, 0);
+ add_fix ('l', &opP->disp, 0, 0, opP->disp.baserel);
}
}
else
@@ -2089,10 +2137,10 @@
{
if (opP->reg == PC)
{
- add_fix ('w', &opP->disp, 1, 0);
+ add_fix ('w', &opP->disp, 1, 0, opP->disp.baserel);
}
else
- add_fix ('w', &opP->disp, 0, 0);
+ add_fix ('w', &opP->disp, 0, 0, opP->disp.baserel);
}
}
addword (nextword);
@@ -2201,9 +2249,9 @@
fit (possible on m68000) let the
fixup processing complain later. */
if (opP->reg == PC)
- add_fix ('B', &opP->disp, 1, 1);
+ add_fix ('B', &opP->disp, 1, 1, 0); /* FIXME? -fnf */
else
- add_fix ('B', &opP->disp, 0, 0);
+ add_fix ('B', &opP->disp, 0, 0, 0); /* FIXME? -fnf */
}
else if (siz1 != SIZE_BYTE)
{
@@ -2333,9 +2381,9 @@
if (siz1 != SIZE_UNSPEC && isvar (&opP->disp))
{
if (opP->reg == PC || opP->reg == ZPC)
- add_fix (siz1 == SIZE_LONG ? 'l' : 'w', &opP->disp, 1, 2);
+ add_fix (siz1 == SIZE_LONG ? 'l' : 'w', &opP->disp, 1, 2, opP->disp.baserel);
else
- add_fix (siz1 == SIZE_LONG ? 'l' : 'w', &opP->disp, 0, 0);
+ add_fix (siz1 == SIZE_LONG ? 'l' : 'w', &opP->disp, 0, 0, opP->disp.baserel);
}
if (siz1 == SIZE_LONG)
addword (baseo >> 16);
@@ -2343,7 +2391,7 @@
addword (baseo);
if (siz2 != SIZE_UNSPEC && isvar (&opP->odisp))
- add_fix (siz2 == SIZE_LONG ? 'l' : 'w', &opP->odisp, 0, 0);
+ add_fix (siz2 == SIZE_LONG ? 'l' : 'w', &opP->odisp, 0, 0, opP->disp.baserel);
if (siz2 == SIZE_LONG)
addword (outro >> 16);
if (siz2 != SIZE_UNSPEC)
@@ -2374,6 +2422,7 @@
#endif
&& S_GET_SEGMENT (adds (&opP->disp)) == now_seg
&& relaxable_symbol (adds (&opP->disp))
+ && flag_small_code
&& !flag_long_jumps
&& !strchr ("~%&$?", s[0]))
{
@@ -2385,8 +2434,20 @@
}
/* Fall through into long */
case SIZE_LONG:
+#if 0
+ /* This doesn't work when the symbol is N_UNDF! We ignore this for now. */
+
+ if (flag_small_code)
+ {
+ tmpreg=0x3A; /* 7.2 */
+ add_frag (adds(&opP->disp),
+ offs(&opP->disp),
+ TAB(ABSREL, SZ_UNDEF));
+ break;
+ }
+#endif
if (isvar (&opP->disp))
- add_fix ('l', &opP->disp, 0, 0);
+ add_fix ('l', &opP->disp, 0, 0, opP->disp.baserel);
tmpreg = 0x39;/* 7.1 mode */
addword (nextword >> 16);
@@ -2398,7 +2459,7 @@
/* Fall through. */
case SIZE_WORD: /* Word */
if (isvar (&opP->disp))
- add_fix ('w', &opP->disp, 0, 0);
+ add_fix ('w', &opP->disp, 0, 0, opP->disp.baserel);
tmpreg = 0x38;/* 7.0 mode */
addword (nextword);
@@ -2434,7 +2495,7 @@
}
tmpreg = get_num (&opP->disp, tmpreg);
if (isvar (&opP->disp))
- add_fix (s[1], &opP->disp, 0, 0);
+ add_fix (s[1], &opP->disp, 0, 0, opP->disp.baserel);
switch (s[1])
{
case 'b': /* Danger: These do no check for
@@ -2504,10 +2565,10 @@
which is a char, and may therefore be unsigned. We
want to pass -1, but we pass 64 instead, and convert
back in md_pcrel_from. */
- add_fix ('B', &opP->disp, 1, 64);
+ add_fix ('B', &opP->disp, 1, 64, opP->disp.baserel);
break;
case 'W':
- add_fix ('w', &opP->disp, 1, 0);
+ add_fix ('w', &opP->disp, 1, 0, opP->disp.baserel);
addword (0);
break;
case 'L':
@@ -2515,7 +2576,7 @@
if (!HAVE_LONG_BRANCH(current_architecture))
as_warn (_("Can't use long branches on 68000/68010/5200"));
the_ins.opcode[the_ins.numo - 1] |= 0xff;
- add_fix ('l', &opP->disp, 1, 0);
+ add_fix ('l', &opP->disp, 1, 0, opP->disp.baserel);
addword (0);
addword (0);
break;
@@ -2560,19 +2621,19 @@
break;
}
#endif
- add_fix ('w', &opP->disp, 1, 0);
+ add_fix ('w', &opP->disp, 1, 0, opP->disp.baserel);
}
addword (0);
break;
case 'C': /* Fixed size LONG coproc branches */
- add_fix ('l', &opP->disp, 1, 0);
+ add_fix ('l', &opP->disp, 1, 0, opP->disp.baserel);
addword (0);
addword (0);
break;
case 'c': /* Var size Coprocesssor branches */
if (subs (&opP->disp))
{
- add_fix ('l', &opP->disp, 1, 0);
+ add_fix ('l', &opP->disp, 1, 0, opP->disp.baserel);
add_frag ((symbolS *) 0, (offsetT) 0, TAB (FBRANCH, LONG));
}
else if (adds (&opP->disp))
@@ -2583,7 +2644,7 @@
/* add_frag ((symbolS *) 0, offs (&opP->disp),
TAB(FBRANCH,SHORT)); */
the_ins.opcode[the_ins.numo - 1] |= 0x40;
- add_fix ('l', &opP->disp, 1, 0);
+ add_fix ('l', &opP->disp, 1, 0, opP->disp.baserel);
addword (0);
addword (0);
}
@@ -2944,7 +3005,7 @@
break;
case '_': /* used only for move16 absolute 32-bit address */
if (isvar (&opP->disp))
- add_fix ('l', &opP->disp, 0, 0);
+ add_fix ('l', &opP->disp, 0, 0, opP->disp.baserel);
tmpreg = get_num (&opP->disp, 80);
addword (tmpreg >> 16);
addword (tmpreg & 0xFFFF);
@@ -3279,8 +3340,8 @@
{ "a3", ADDR3 },
{ "a4", ADDR4 },
{ "a5", ADDR5 },
+ { "fp", ADDR5 },
{ "a6", ADDR6 },
- { "fp", ADDR6 },
{ "a7", ADDR7 },
{ "sp", ADDR7 },
{ "ssp", ADDR7 },
@@ -3597,7 +3658,8 @@
&the_ins.reloc[m].exp,
the_ins.reloc[m].pcrel,
get_reloc_code (n, the_ins.reloc[m].pcrel,
- the_ins.reloc[m].pic_reloc));
+ the_ins.reloc[m].pic_reloc),
+ the_ins.reloc[m].baserel);
fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix;
if (the_ins.reloc[m].wid == 'B')
fixP->fx_signed = 1;
@@ -3644,7 +3706,8 @@
&the_ins.reloc[m].exp,
the_ins.reloc[m].pcrel,
get_reloc_code (wid, the_ins.reloc[m].pcrel,
- the_ins.reloc[m].pic_reloc));
+ the_ins.reloc[m].pic_reloc),
+ the_ins.reloc[m].baserel);
fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix;
}
(void) frag_var (rs_machine_dependent, 10, 0,
@@ -3681,7 +3744,8 @@
&the_ins.reloc[m].exp,
the_ins.reloc[m].pcrel,
get_reloc_code (wid, the_ins.reloc[m].pcrel,
- the_ins.reloc[m].pic_reloc));
+ the_ins.reloc[m].pic_reloc),
+ the_ins.reloc[m].baserel);
fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix;
}
}
@@ -4319,7 +4383,11 @@
case TAB (ABRANCH, LONG):
if (!HAVE_LONG_BRANCH(current_architecture))
{
- if (fragP->fr_opcode[0] == 0x61)
+ if (flag_small_code)
+ {
+ as_bad("Long branch in small code model, not supported.");
+ }
+ else if (fragP->fr_opcode[0] == 0x61)
/* BSR */
{
fragP->fr_opcode[0] = 0x4E;
@@ -4331,7 +4399,7 @@
fragP->fr_symbol,
fragP->fr_offset,
0,
- NO_RELOC);
+ NO_RELOC, 0);
fragP->fr_fix += 4;
ext = 0;
@@ -4342,7 +4410,7 @@
fragP->fr_opcode[0] = 0x4E;
fragP->fr_opcode[1] = (char) 0xF9; /* JMP with ABSL LONG offset */
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
- fragP->fr_offset, 0, NO_RELOC);
+ fragP->fr_offset, 0, NO_RELOC, 0);
fragP->fr_fix += 4;
ext = 0;
}
@@ -4373,7 +4441,7 @@
*buffer_address++ = (char) 0xf9;
fragP->fr_fix += 2; /* account for jmp instruction */
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
- fragP->fr_offset, 0, NO_RELOC);
+ fragP->fr_offset, 0, NO_RELOC, 0);
fragP->fr_fix += 4;
ext = 0;
break;
@@ -4390,7 +4458,7 @@
fragP->fr_fix += 6; /* account for bra/jmp instructions */
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
- fragP->fr_offset, 0, NO_RELOC);
+ fragP->fr_offset, 0, NO_RELOC, 0);
fragP->fr_fix += 4;
ext = 0;
break;
@@ -4409,8 +4477,10 @@
/* The thing to do here is force it to ABSOLUTE LONG, since
PCREL is really trying to shorten an ABSOLUTE address anyway */
/* JF FOO This code has not been tested */
+ if (flag_small_code)
+ as_bad ("Trying to force a pcrel thing into absolute mode while in small code mode");
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
- 0, NO_RELOC);
+ 0, NO_RELOC, 0);
if ((fragP->fr_opcode[1] & 0x3F) != 0x3A)
as_bad (_("Internal error (long PC-relative operand) for insn 0x%04x at 0x%lx"),
(unsigned) fragP->fr_opcode[0],
@@ -4422,14 +4492,14 @@
break;
case TAB (PCLEA, SHORT):
fix_new (fragP, (int) (fragP->fr_fix), 2, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
+ fragP->fr_offset, 1, NO_RELOC, 0);
fragP->fr_opcode[1] &= ~0x3F;
fragP->fr_opcode[1] |= 0x3A; /* 072 - mode 7.2 */
ext = 2;
break;
case TAB (PCLEA, LONG):
fixP = fix_new (fragP, (int) (fragP->fr_fix) + 2, 4, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
+ fragP->fr_offset, 1, NO_RELOC, 0);
fixP->fx_pcrel_adjust = 2;
/* Already set to mode 7.3; this indicates: PC indirect with
suppressed index, 32-bit displacement. */
@@ -4459,7 +4529,7 @@
buffer_address[-1] = 0x20;
fixP = fix_new (fragP, (int) (fragP->fr_fix), 2, fragP->fr_symbol,
fragP->fr_offset, (fragP->fr_opcode[1] & 077) == 073,
- NO_RELOC);
+ NO_RELOC, 0);
fixP->fx_pcrel_adjust = 2;
ext = 2;
break;
@@ -4467,13 +4537,89 @@
disp += 2;
fixP = fix_new (fragP, (int) (fragP->fr_fix), 4, fragP->fr_symbol,
fragP->fr_offset, (fragP->fr_opcode[1] & 077) == 073,
- NO_RELOC);
+ NO_RELOC, 0);
fixP->fx_pcrel_adjust = 2;
assert (fragP->fr_fix >= 2);
buffer_address[-2] |= 0x1;
buffer_address[-1] = 0x30;
ext = 4;
break;
+ case TAB(ABSREL,BYTE):
+ as_bad ("ABSREL_BYTE: how the ** does this look ?? \n");
+ break;
+ case TAB(ABSREL,SHORT):
+ subseg_change (text_section, 0);
+ ext = 2;
+ fragP->fr_opcode[1] &= ~0x3f;
+ if ((S_GET_TYPE (fragP->fr_symbol)) == N_TEXT)
+ {
+ /* so this is really a pc-relative address */
+ fragP->fr_opcode[1] |= 0x3a;
+ fix_new(fragP,(int)(fragP->fr_fix),2,fragP->fr_symbol, fragP->fr_offset+2, 1, NO_RELOC, 0);
+ break;
+ }
+ /* in that case we have to generate base-relative code
+ * (note: if we're in N_UNDF, this could as well be pc-relative, but the linker
+ * will have to do the final patch in that case) */
+ fragP->fr_opcode[1] |= 0x2c; /* (a4) */
+ fix_new(fragP,(int)(fragP->fr_fix),2,fragP->fr_symbol,fragP->fr_offset, 0, NO_RELOC, 1);
+ break;
+ case TAB(ABSREL,LONG):
+ as_bad ("ABSREL_LONG: sorry, not supported.\n");
+ break;
+
+ case TAB(IMMREL,BYTE):
+ as_bad ("IMMREL_BYTE: how the ** does this look ?? \n");
+ break;
+ case TAB(IMMREL,SHORT):
+ subseg_change (text_section, 0);
+ ext = 0;
+ if ((S_GET_TYPE (fragP->fr_symbol)) == N_TEXT)
+ {
+ /* we can only fix operations on data registers, not on <ea> */
+ if ((fragP->fr_opcode[1] & 0x38) != 0)
+ {
+ /* use the normal reloc32, sigh... */
+ fix_new (fragP,(int)(fragP->fr_fix),4,fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC, 0);
+ fragP->fr_fix += 4;
+ break;
+ }
+
+ /* so this is really a pc-relative address
+ * What we have to do now is a VERY UGLY AND BIG KLUDGE. Basically do the
+ * following thing:
+ * turn
+ * addl #foo,d0 (foo is N_TEXT)
+ * into
+ * pea foo(pc)
+ * addl (sp)+,d0
+ */
+ *buffer_address++ = fragP->fr_opcode[0]; /* save the original command */
+ *buffer_address++ = fragP->fr_opcode[1];
+ fragP->fr_opcode[0] = 0x48; /* PEA */
+ fragP->fr_opcode[1] = 0x7a;
+ fix_new(fragP,(int)(fragP->fr_fix),2,fragP->fr_symbol, fragP->fr_offset+2, 1, NO_RELOC, 0);
+
+ *buffer_address++ = 0x9f; /* sp@+ */
+ fragP->fr_fix += 4; /* two byte fix, two byte code extension */
+ break;
+ }
+ /* in that case we have to generate base-relative code
+ * (note: if we're in N_UNDF, this could as well be pc-relative, but the linker
+ * will have to do the final patch in that case) */
+
+ /* analogous (more or less;-)) to above, the following conversion is done
+ * turn
+ * addl #bar,d0 (bar is N_DATA)
+ * into
+ * addl #<bar>,d0 where <bar> is a baserel-reloc
+ * addl a4,d0
+ */
+
+ fix_new(fragP,(int)(fragP->fr_fix), 4,fragP->fr_symbol,fragP->fr_offset, 0, NO_RELOC, 1);
+ *buffer_address++ = 0xd0;
+ *buffer_address++ = 0x8c;
+ break;
}
if (ext)
@@ -4535,31 +4681,73 @@
else if ((fragP->fr_symbol != NULL) && flag_short_refs)
{ /* Symbol is undefined and we want short ref */
fix_new (fragP, (int) (fragP->fr_fix), 2, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
+ fragP->fr_offset, 1, NO_RELOC, 0);
fragP->fr_fix += 2;
frag_wane (fragP);
break;
}
- else if ((fragP->fr_symbol == 0) || !HAVE_LONG_BRANCH(current_architecture))
+ else if ((fragP->fr_symbol == 0) || !HAVE_LONG_BRANCH(current_architecture) || !flag_small_code)
{
/* On 68000, or for absolute value, switch to abs long */
/* FIXME, we should check abs val, pick short or long */
- if (fragP->fr_opcode[0] == 0x61)
+ if (fragP->fr_opcode[0] == 0x61)
{
- fragP->fr_opcode[0] = 0x4E;
- fragP->fr_opcode[1] = (char) 0xB9; /* JBSR with ABSL LONG offset */
- fix_new (fragP, fragP->fr_fix, 4,
- fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC);
- fragP->fr_fix += 4;
+ if (flag_small_code)
+ {
+ /* leave the BSR, no need to change
+ * it into a JSR (PC,..) */
+ subseg_change(text_section, 0);
+ fix_new(fragP, fragP->fr_fix, 2,
+ fragP->fr_symbol, fragP->fr_offset, 1, NO_RELOC, 0);
+ fragP->fr_fix+=2;
+ fragP->fr_opcode[1]=0x00;
+ }
+ else if (flag_short_refs)
+ {
+ subseg_change(text_section, 0);
+ fix_new(fragP,(int)(fragP->fr_fix),2,fragP->fr_symbol,
+ fragP->fr_offset + 2, 0, NO_RELOC, 0);
+ fragP->fr_fix+=2;
+ fragP->fr_opcode[1]=0x00;
+ }
+ else
+ {
+ fragP->fr_opcode[0] = 0x4E;
+ fragP->fr_opcode[1] = (char) 0xB9; /* JBSR with ABSL LONG offset */
+ subseg_change (text_section, 0);
+ fix_new (fragP, fragP->fr_fix, 4,
+ fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC, 0);
+ fragP->fr_fix += 4;
+ }
frag_wane (fragP);
}
else if (fragP->fr_opcode[0] == 0x60)
{
- fragP->fr_opcode[0] = 0x4E;
- fragP->fr_opcode[1] = (char) 0xF9; /* JMP with ABSL LONG offset */
- fix_new (fragP, fragP->fr_fix, 4,
- fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC);
- fragP->fr_fix += 4;
+ if (flag_small_code)
+ {
+ subseg_change(text_section, 0);
+ fix_new(fragP, fragP->fr_fix, 2,
+ fragP->fr_symbol, fragP->fr_offset, 1, NO_RELOC, 0);
+ fragP->fr_fix+=2;
+ }
+ else if (flag_short_refs)
+ {
+ fragP->fr_opcode[0]= 0x4E;
+ fragP->fr_opcode[1]= 0xF8; /* JMP with ABSL WORD offset */
+ subseg_change(text_section, 0);
+ fix_new(fragP, fragP->fr_fix, 2,
+ fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC, 0);
+ fragP->fr_fix+=2;
+ }
+ else
+ {
+ fragP->fr_opcode[0] = 0x4E;
+ fragP->fr_opcode[1] = (char) 0xF9; /* JMP with ABSL LONG offset */
+ subseg_change (text_section, 0);
+ fix_new (fragP, fragP->fr_fix, 4,
+ fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC, 0);
+ fragP->fr_fix += 4;
+ }
frag_wane (fragP);
}
else
@@ -4573,7 +4761,7 @@
else
{ /* Symbol is still undefined. Make it simple */
fix_new (fragP, (int) (fragP->fr_fix), 4, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
+ fragP->fr_offset, 1, NO_RELOC, 0);
fragP->fr_fix += 4;
fragP->fr_opcode[1] = (char) 0xff;
frag_wane (fragP);
@@ -4595,7 +4783,7 @@
else
{
fix_new (fragP, (int) fragP->fr_fix, 4, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
+ fragP->fr_offset, 1, NO_RELOC, 0);
fragP->fr_fix += 4;
fragP->fr_opcode[1] |= 0x40; /* Turn on LONG bit */
frag_wane (fragP);
@@ -4634,7 +4822,7 @@
{
/* the user wants short refs, so emit one */
fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
+ fragP->fr_offset, 1, NO_RELOC, 0);
fragP->fr_fix += 2;
}
else
@@ -4647,7 +4835,7 @@
buffer_address[1] = (char) 0xf9;
fragP->fr_fix += 2; /* account for jmp instruction */
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
- fragP->fr_offset, 0, NO_RELOC);
+ fragP->fr_offset, 0, NO_RELOC, 0);
fragP->fr_fix += 4;
}
frag_wane (fragP);
@@ -4670,7 +4858,7 @@
{
/* the user wants short refs, so emit one */
fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
+ fragP->fr_offset, 1, NO_RELOC, 0);
fragP->fr_fix += 2;
}
else
@@ -4686,7 +4874,7 @@
buffer_address[5] = (char) 0xf9;
fragP->fr_fix += 6; /* account for bra/jmp instruction */
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
- fragP->fr_offset, 0, NO_RELOC);
+ fragP->fr_offset, 0, NO_RELOC, 0);
fragP->fr_fix += 4;
}
@@ -4728,6 +4916,16 @@
}
break;
+ case TAB(ABSREL,SZ_UNDEF):
+ if ((S_GET_SEGMENT (fragP->fr_symbol)) == segment || flag_short_refs || flag_small_code) {
+ fragP->fr_subtype = TAB(ABSREL, SHORT);
+ fragP->fr_var += 2;
+ } else {
+ fragP->fr_subtype = TAB(ABSREL, LONG);
+ fragP->fr_var += 6;
+ }
+ break;
+
default:
break;
}
@@ -4790,7 +4988,7 @@
the_bytes[5] = (ri->r_symbolnum >> 8) & 0x0ff;
the_bytes[6] = ri->r_symbolnum & 0x0ff;
the_bytes[7] = (((ri->r_pcrel << 7) & 0x80) | ((ri->r_length << 5) & 0x60) |
- ((ri->r_extern << 4) & 0x10));
+ ((ri->r_extern << 4) & 0x10) | ((ri->r_baserel << 3) & 0x08));
}
#endif /* comment */
@@ -4824,7 +5022,7 @@
where[5] = (r_symbolnum >> 8) & 0x0ff;
where[6] = r_symbolnum & 0x0ff;
where[7] = (((fixP->fx_pcrel << 7) & 0x80) | ((nbytes_r_length[fixP->fx_size] << 5) & 0x60) |
- (((!S_IS_DEFINED (fixP->fx_addsy)) << 4) & 0x10));
+ (((!S_IS_DEFINED (fixP->fx_addsy)) << 4) & 0x10) | ((fixP->tc_fix_data << 3) & 0x08));
}
#endif
@@ -4864,7 +5062,7 @@
md_number_to_chars (ptr, (valueT) 0x4EF9, 2);
md_number_to_chars (ptr + 2, (valueT) offset, 4);
fix_new (frag, (ptr + 2) - frag->fr_literal, 4, to_symbol, (offsetT) 0,
- 0, NO_RELOC);
+ 0, NO_RELOC, 0);
}
else
{
@@ -6754,7 +6952,7 @@
#ifdef OBJ_ELF
CONST char *md_shortopts = "lSA:m:kQ:V";
#else
-CONST char *md_shortopts = "lSA:m:k";
+CONST char *md_shortopts = "SA:m:s:k";
#endif
struct option md_longopts[] = {
@@ -6794,6 +6992,13 @@
flag_long_jumps = 1;
break;
+ case 's':
+ if (!strcmp(arg, "c") || !strcmp(arg, "mallcode"))
+ flag_small_code = 1;
+ else
+ return 0;
+ break;
+
case 'A':
if (*arg == 'm')
arg++;
@@ -6936,7 +7141,6 @@
{
fprintf(stream, _("\
680X0 options:\n\
--l use 1 word for refs to undefined symbols [default 2]\n\
-m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060\n\
| -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -m68360\n\
| -mcpu32 | -m5200\n\
@@ -6950,6 +7154,7 @@
[default yes for 68020 and up]\n\
-pic, -k generate position independent code\n\
-S turn jbsr into jsr\n\
+-smallcode, -sc small code model\n\
--register-prefix-optional\n\
recognize register names without prefix character\n\
--bitwise-or do not treat `|' as a comment character\n"));

View File

@ -0,0 +1,48 @@
--- binutils-2.10.1/gas/config/tc-m68k.h 2000-02-24 02:56:31.000000000 +0100
+++ binutils-2.10.1/gas/config/tc-m68k.h 2012-08-08 12:35:51.000000000 +0200
@@ -34,6 +34,9 @@
#ifdef TE_NetBSD
#define TARGET_FORMAT "a.out-m68k-netbsd"
#endif
+#ifdef TE_AMIGA
+#define TARGET_FORMAT "a.out-amiga"
+#endif
#ifdef TE_LINUX
#define TARGET_FORMAT "a.out-m68k-linux"
#endif
@@ -42,6 +45,10 @@
#endif
#endif
+#ifdef OBJ_AMIGAHUNK
+#define TARGET_FORMAT "amiga"
+#endif
+
#ifdef OBJ_ELF
#define TARGET_FORMAT "elf32-m68k"
#endif
@@ -73,13 +80,10 @@
#define TC_COFF_FIX2RTYPE(fixP) tc_coff_fix2rtype(fixP)
#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag)
extern int tc_coff_sizemachdep PARAMS ((struct frag *));
-#ifdef TE_SUN3
/* This variable contains the value to write out at the beginning of
- the a.out file. The 2<<16 means that this is a 68020 file instead
of an old-style 68000 file */
-#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (2<<16|OMAGIC); /* Magic byte for file header */
-#endif /* TE_SUN3 */
+#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (OMAGIC); /* Magic byte for file header */
#ifndef AOUT_MACHTYPE
#define AOUT_MACHTYPE m68k_aout_machtype
@@ -207,6 +211,9 @@
extern struct relax_type md_relax_table[];
#define TC_GENERIC_RELAX_TABLE md_relax_table
+#define TC_FIX_TYPE char
+#define TC_INIT_FIX_DATA(p)
+
/* Copied from write.c */
/* This was formerly called M68K_AIM_KLUDGE. */
#define md_prepare_relax_scan(fragP, address, aim, this_state, this_type) \

View File

@ -0,0 +1,14 @@
/*
* te-amiga.h -- Amiga target environment declarations.
*/
#define TE_AMIGA 1
#define LOCAL_LABELS_DOLLAR 1
#define LOCAL_LABELS_FB 1
#ifdef OBJ_HEADER
#include OBJ_HEADER
#else
#include "obj-format.h"
#endif

View File

@ -0,0 +1,20 @@
--- binutils-2.10.1/gas/configure 2000-10-16 13:27:25.000000000 +0200
+++ binutils-2.10.1/gas/configure 2012-08-08 12:35:51.000000000 +0200
@@ -1767,6 +1767,8 @@
m32r-*-*) fmt=elf bfd_gas=yes ;;
+ m68*-*-amigaoshunk) fmt=amigahunk em=amiga bfd_gas=yes ;;
+ m68*-*-amigaos*) fmt=aout em=amiga ;;
m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
fmt=aout em=sun3 ;;
m68k-motorola-sysv*) fmt=coff em=delta ;;
@@ -2317,7 +2319,7 @@
case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
yes-*-coff) need_bfd=yes ;;
- no-*-coff) need_bfd=yes
+ no-*-coff | yes-m68k-amigahunk | no-m68k-amigahunk) need_bfd=yes
cat >> confdefs.h <<\EOF
#define MANY_SEGMENTS 1
EOF

View File

@ -0,0 +1,20 @@
--- binutils-2.10.1/gas/configure.in 2000-10-16 13:27:28.000000000 +0200
+++ binutils-2.10.1/gas/configure.in 2012-08-08 12:35:51.000000000 +0200
@@ -245,6 +245,8 @@
m32r-*-*) fmt=elf bfd_gas=yes ;;
+ m68*-*-amigaoshunk) fmt=amigahunk em=amiga bfd_gas=yes ;;
+ m68*-*-amigaos*) fmt=aout em=amiga ;;
m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
fmt=aout em=sun3 ;;
m68k-motorola-sysv*) fmt=coff em=delta ;;
@@ -703,7 +705,7 @@
case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
yes-*-coff) need_bfd=yes ;;
- no-*-coff) need_bfd=yes
+ no-*-coff | yes-m68k-amigahunk | no-m68k-amigahunk) need_bfd=yes
AC_DEFINE(MANY_SEGMENTS, 1, [old COFF support?]) ;;
esac

View File

@ -0,0 +1,74 @@
--- binutils-2.10.1/gas/read.c 2000-03-26 16:47:33.000000000 +0200
+++ binutils-2.10.1/gas/read.c 2012-08-08 12:35:51.000000000 +0200
@@ -68,6 +68,10 @@
} while (0)
#endif
+#ifdef OBJ_AMIGAHUNK
+extern segT data_chip_section, bss_chip_section;
+#endif
+
/* The NOP_OPCODE is for the alignment fill value.
* fill it a nop instruction so that the disassembler does not choke
* on it
@@ -289,6 +293,9 @@
{"common", s_mri_common, 0},
{"common.s", s_mri_common, 1},
{"data", s_data, 0},
+#ifdef OBJ_AMIGAHUNK
+ {"datachip", s_data_chip, 0},
+#endif
{"dc", cons, 2},
{"dc.b", cons, 1},
{"dc.d", float_cons, 'd'},
@@ -1557,6 +1564,17 @@
demand_empty_rest_of_line ();
}
+#ifdef OBJ_AMIGAHUNK
+void
+s_data_chip (ignore)
+ int ignore;
+{
+ int temp = get_absolute_expression ();
+ subseg_set (data_chip_section, (subsegT) temp);
+ demand_empty_rest_of_line ();
+}
+#endif
+
/* Handle the .appfile pseudo-op. This is automatically generated by
do_scrub_chars when a preprocessor # line comment is seen with a
file name. This default definition may be overridden by the object
@@ -3664,7 +3682,7 @@
#ifdef BFD_ASSEMBLER
#ifdef TC_CONS_FIX_NEW
- TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
+ TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp, 0);
#else
{
bfd_reloc_code_real_type r;
@@ -3689,12 +3707,12 @@
break;
}
fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp,
- 0, r);
+ 0, r, 0);
}
#endif
#else
#ifdef TC_CONS_FIX_NEW
- TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
+ TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp, 0);
#else
/* Figure out which reloc number to use. Use TC_CONS_RELOC if
it is defined, otherwise use NO_RELOC if it is defined,
@@ -3707,7 +3725,7 @@
#endif
#endif
fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0,
- TC_CONS_RELOC);
+ TC_CONS_RELOC, 0);
#endif /* TC_CONS_FIX_NEW */
#endif /* BFD_ASSEMBLER */
}

View File

@ -0,0 +1,12 @@
--- binutils-2.10.1/gas/read.h 2000-02-08 20:06:00.000000000 +0100
+++ binutils-2.10.1/gas/read.h 2012-08-08 12:35:51.000000000 +0200
@@ -128,6 +128,9 @@
extern void s_app_line PARAMS ((int));
extern void s_comm PARAMS ((int));
extern void s_data PARAMS ((int));
+#ifdef OBJ_AMIGAHUNK
+extern void s_data_chip PARAMS ((int));
+#endif
extern void s_desc PARAMS ((int));
extern void s_else PARAMS ((int arg));
extern void s_elseif PARAMS ((int arg));

View File

@ -0,0 +1,28 @@
--- binutils-2.10.1/gas/tc.h 1999-05-03 09:28:41.000000000 +0200
+++ binutils-2.10.1/gas/tc.h 2012-08-08 12:35:51.000000000 +0200
@@ -23,25 +23,6 @@
extern const pseudo_typeS md_pseudo_table[];
-/* JF moved this here from as.h under the theory that nobody except MACHINE.c
- and write.c care about it anyway. */
-
-struct relax_type
-{
- /* Forward reach. Signed number. > 0. */
- long rlx_forward;
- /* Backward reach. Signed number. < 0. */
- long rlx_backward;
-
- /* Bytes length of this address. */
- unsigned char rlx_length;
-
- /* Next longer relax-state. 0 means there is no 'next' relax-state. */
- relax_substateT rlx_more;
-};
-
-typedef struct relax_type relax_typeS;
-
extern const int md_reloc_size; /* Size of a relocation record */
char *md_atof PARAMS ((int what_statement_type, char *literalP, int *sizeP));

View File

@ -0,0 +1,158 @@
--- binutils-2.10.1/gas/write.c 1999-09-12 05:44:41.000000000 +0200
+++ binutils-2.10.1/gas/write.c 2012-08-08 12:35:51.000000000 +0200
@@ -101,12 +101,12 @@
static fixS *fix_new_internal PARAMS ((fragS *, int where, int size,
symbolS *add, symbolS *sub,
offsetT offset, int pcrel,
- bfd_reloc_code_real_type r_type));
+ bfd_reloc_code_real_type r_type, int baserel));
#else
static fixS *fix_new_internal PARAMS ((fragS *, int where, int size,
symbolS *add, symbolS *sub,
offsetT offset, int pcrel,
- int r_type));
+ int r_type, int baserel));
#endif
#if defined (BFD_ASSEMBLER) || (!defined (BFD) && !defined (OBJ_VMS))
static long fixup_segment PARAMS ((fixS * fixP, segT this_segment_type));
@@ -140,7 +140,7 @@
*/
static fixS *
fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
- r_type)
+ r_type, baserel)
fragS *frag; /* Which frag? */
int where; /* Where in that frag? */
int size; /* 1, 2, or 4 usually. */
@@ -153,6 +153,7 @@
#else
int r_type; /* Relocation type */
#endif
+ int baserel; /* TRUE if base-relative data */
{
fixS *fixP;
@@ -192,6 +193,7 @@
#endif
#ifdef TC_FIX_TYPE
+ fixP->tc_fix_data = baserel;
TC_INIT_FIX_DATA(fixP);
#endif
@@ -238,7 +240,7 @@
/* Create a fixup relative to a symbol (plus a constant). */
fixS *
-fix_new (frag, where, size, add_symbol, offset, pcrel, r_type)
+fix_new (frag, where, size, add_symbol, offset, pcrel, r_type, baserel)
fragS *frag; /* Which frag? */
int where; /* Where in that frag? */
int size; /* 1, 2, or 4 usually. */
@@ -250,9 +252,10 @@
#else
int r_type; /* Relocation type */
#endif
+ int baserel;
{
return fix_new_internal (frag, where, size, add_symbol,
- (symbolS *) NULL, offset, pcrel, r_type);
+ (symbolS *) NULL, offset, pcrel, r_type, baserel);
}
/* Create a fixup for an expression. Currently we only support fixups
@@ -260,7 +263,7 @@
file formats support anyhow. */
fixS *
-fix_new_exp (frag, where, size, exp, pcrel, r_type)
+fix_new_exp (frag, where, size, exp, pcrel, r_type, baserel)
fragS *frag; /* Which frag? */
int where; /* Where in that frag? */
int size; /* 1, 2, or 4 usually. */
@@ -271,6 +274,7 @@
#else
int r_type; /* Relocation type */
#endif
+ int baserel;
{
symbolS *add = NULL;
symbolS *sub = NULL;
@@ -290,7 +294,7 @@
exp->X_op_symbol = 0;
exp->X_add_symbol = stmp;
exp->X_add_number = 0;
- return fix_new_exp (frag, where, size, exp, pcrel, r_type);
+ return fix_new_exp (frag, where, size, exp, pcrel, r_type, baserel);
}
case O_symbol_rva:
@@ -329,7 +333,7 @@
}
return fix_new_internal (frag, where, size, add, sub, off,
- pcrel, r_type);
+ pcrel, r_type, baserel);
}
/* Append a string onto another string, bumping the pointer along. */
@@ -1564,17 +1568,17 @@
#ifdef TC_CONS_FIX_NEW
TC_CONS_FIX_NEW (lie->frag,
lie->word_goes_here - lie->frag->fr_literal,
- 2, &exp);
+ 2, &exp, 0);
#else
fix_new_exp (lie->frag,
lie->word_goes_here - lie->frag->fr_literal,
- 2, &exp, 0, BFD_RELOC_16);
+ 2, &exp, 0, BFD_RELOC_16, 0);
#endif
#else
#if defined(TC_SPARC) || defined(TC_A29K) || defined(NEED_FX_R_TYPE)
fix_new_exp (lie->frag,
lie->word_goes_here - lie->frag->fr_literal,
- 2, &exp, 0, NO_RELOC);
+ 2, &exp, 0, NO_RELOC, 0);
#else
#ifdef TC_NS32K
fix_new_ns32k_exp (lie->frag,
@@ -1583,7 +1587,7 @@
#else
fix_new_exp (lie->frag,
lie->word_goes_here - lie->frag->fr_literal,
- 2, &exp, 0, 0);
+ 2, &exp, 0, 0, 0);
#endif /* TC_NS32K */
#endif /* TC_SPARC|TC_A29K|NEED_FX_R_TYPE */
#endif /* BFD_ASSEMBLER */
@@ -2423,6 +2427,7 @@
char *place;
long where;
int pcrel, plt;
+ char baserel = 0;
fragS *fragP;
segT add_symbol_segment = absolute_section;
@@ -2463,6 +2468,9 @@
add_number = fixP->fx_offset;
pcrel = fixP->fx_pcrel;
plt = fixP->fx_plt;
+#ifdef TC_FIX_TYPE
+ baserel = fixP->tc_fix_data;
+#endif
if (add_symbolP != NULL
&& symbol_mri_common_p (add_symbolP))
@@ -2731,6 +2739,11 @@
#endif
}
+#if !defined(BFD_ASSEMBLER) && !defined(MANY_SEGMENTS)
+ if (baserel && add_number)
+ add_number -= text_last_frag->fr_address;
+#endif
+
if (!fixP->fx_bit_fixP && !fixP->fx_no_overflow && size > 0)
{
if ((size_t) size < sizeof (valueT))

View File

@ -0,0 +1,25 @@
--- binutils-2.10.1/gas/write.h 1999-05-03 09:28:41.000000000 +0200
+++ binutils-2.10.1/gas/write.h 2012-08-08 12:35:51.000000000 +0200
@@ -189,17 +189,18 @@
#ifdef BFD_ASSEMBLER
extern fixS *fix_new
PARAMS ((fragS * frag, int where, int size, symbolS * add_symbol,
- offsetT offset, int pcrel, bfd_reloc_code_real_type r_type));
+ offsetT offset, int pcrel, bfd_reloc_code_real_type r_type,
+ int baserel));
extern fixS *fix_new_exp
PARAMS ((fragS * frag, int where, int size, expressionS *exp, int pcrel,
- bfd_reloc_code_real_type r_type));
+ bfd_reloc_code_real_type r_type, int baserel));
#else
extern fixS *fix_new
PARAMS ((fragS * frag, int where, int size, symbolS * add_symbol,
- offsetT offset, int pcrel, int r_type));
+ offsetT offset, int pcrel, int r_type, int baserel));
extern fixS *fix_new_exp
PARAMS ((fragS * frag, int where, int size, expressionS *exp, int pcrel,
- int r_type));
+ int r_type, int baserel));
#endif
extern void write_print_statistics PARAMS ((FILE *));

View File

@ -0,0 +1,12 @@
--- binutils-2.10.1/include/libiberty.h 2000-02-22 17:18:13.000000000 +0100
+++ binutils-2.10.1/include/libiberty.h 2012-08-08 12:35:51.000000000 +0200
@@ -16,6 +16,9 @@
#include "ansidecl.h"
+#include <string.h>
+#include <stdlib.h>
+
/* Build an argument vector from a string. Allocates memory using
malloc. Use freeargv to free the vector. */

View File

@ -0,0 +1,11 @@
--- binutils-2.10.1/include/objalloc.h 1999-05-03 09:29:02.000000000 +0200
+++ binutils-2.10.1/include/objalloc.h 2012-08-08 12:35:51.000000000 +0200
@@ -22,6 +22,8 @@
#include "ansidecl.h"
+#include <stdlib.h>
+
/* These routines allocate space for an object. The assumption is
that the object will want to allocate space as it goes along, but
will never want to free any particular block. There is a function

View File

@ -0,0 +1,24 @@
--- binutils-2.10.1/ld/Makefile.am 2000-11-07 09:44:12.000000000 +0100
+++ binutils-2.10.1/ld/Makefile.am 2012-08-08 12:35:51.000000000 +0200
@@ -99,6 +99,8 @@
ea29k.o \
eaixppc.o \
eaixrs6.o \
+ eamiga.o \
+ eamiga_bss.o \
ealpha.o \
earcelf.o \
earmelf.o \
@@ -283,6 +285,12 @@
GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
@TDIRS@
+eamiga.c: $(srcdir)/emulparams/amiga.sh\
+ $(srcdir)/emultempl/amiga.em $(srcdir)/scripttempl/amiga.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} amiga "$(tdir_amiga)"
+eamiga_bss.c: $(srcdir)/emulparams/amiga_bss.sh\
+ $(srcdir)/emultempl/amiga.em $(srcdir)/scripttempl/amiga_bss.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} amiga_bss "$(tdir_amiga_bss)"
ea29k.c: $(srcdir)/emulparams/a29k.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS}
${GENSCRIPTS} a29k "$(tdir_a29k)"

View File

@ -0,0 +1,24 @@
--- binutils-2.10.1/ld/Makefile.in 2000-11-07 09:44:12.000000000 +0100
+++ binutils-2.10.1/ld/Makefile.in 2012-08-08 12:35:51.000000000 +0200
@@ -202,6 +202,8 @@
ea29k.o \
eaixppc.o \
eaixrs6.o \
+ eamiga.o \
+ eamiga_bss.o \
ealpha.o \
earcelf.o \
earmelf.o \
@@ -982,6 +984,12 @@
cp ${srcdir}/emultempl/$(STRINGIFY) stringify.sed
@TDIRS@
+eamiga.c: $(srcdir)/emulparams/amiga.sh\
+ $(srcdir)/emultempl/amiga.em $(srcdir)/scripttempl/amiga.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} amiga "$(tdir_amiga)"
+eamiga_bss.c: $(srcdir)/emulparams/amiga_bss.sh\
+ $(srcdir)/emultempl/amiga.em $(srcdir)/scripttempl/amiga_bss.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} amiga_bss "$(tdir_amiga_bss)"
ea29k.c: $(srcdir)/emulparams/a29k.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS}
${GENSCRIPTS} a29k "$(tdir_a29k)"

View File

@ -0,0 +1,10 @@
--- binutils-2.10.1/ld/configure.tgt 2000-08-06 17:22:07.000000000 +0200
+++ binutils-2.10.1/ld/configure.tgt 2012-08-08 12:35:51.000000000 +0200
@@ -189,6 +189,7 @@
m68k-sony-*) targ_emul=news ;;
m68k-hp-bsd*) targ_emul=hp300bsd ;;
m68*-motorola-sysv*) targ_emul=delta68 ;;
+m68*-*-amigaos*) targ_emul=amiga ; targ_extra_emuls=amiga_bss;;
m68*-*-aout) targ_emul=m68kaout ;;
m68*-*-coff) targ_emul=m68kcoff ;;
m68*-*-elf) targ_emul=m68kelf ;;

View File

@ -0,0 +1,8 @@
SCRIPT_NAME=amiga
OUTPUT_FORMAT="amiga"
TEXT_START_ADDR=0x0
PAGE_SIZE=0x0
SEGMENT_SIZE=0x0
NONPAGED_TEXT_START_ADDR=0x0
TEMPLATE_NAME=amiga
ARCH=m68k

View File

@ -0,0 +1,8 @@
SCRIPT_NAME=amiga_bss
OUTPUT_FORMAT="amiga"
TEXT_START_ADDR=0x0
PAGE_SIZE=0x0
SEGMENT_SIZE=0x0
NONPAGED_TEXT_START_ADDR=0x0
TEMPLATE_NAME=amiga
ARCH=m68k

View File

@ -0,0 +1,280 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* emulate the original gld for the given ${EMULATION_NAME}
Copyright (C) 1991, 1993 Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
This file is part of GLD, the Gnu Linker.
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_${EMULATION_NAME}
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
#include "getopt.h"
#include "ld.h"
#include "config.h"
#include "ldmain.h"
#include "ldemul.h"
#include "ldfile.h"
#include "ldmisc.h"
#include "ldexp.h"
#include "ldlang.h"
#if defined(TARGET_IS_amiga)
#include "libamiga.h"
#else
extern int amiga_base_relative; /* defined in amigaoslink.c */
#endif
/* 1 means, write out debug hunk, when producing a load file */
extern int write_debug_hunk;
/* This is the attribute to use for the next file */
extern int amiga_attribute;
/* generate a resident executable */
extern int amiga_resident;
static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
static int gld${EMULATION_NAME}_parse_args PARAMS ((int, char **));
/* Handle amiga specific options */
static int
gld${EMULATION_NAME}_parse_args (argc, argv)
int argc;
char **argv;
{
int prevoptind = optind;
int prevopterr = opterr;
int indx;
int longind;
int optc;
long val;
char *end;
#define OPTION_IGNORE (300)
#define OPTION_AMIGA_CHIP (OPTION_IGNORE + 1)
#define OPTION_AMIGA_FAST (OPTION_AMIGA_CHIP + 1)
#define OPTION_AMIGA_ATTRIBUTE (OPTION_AMIGA_FAST + 1)
#define OPTION_AMIGA_DEBUG (OPTION_AMIGA_ATTRIBUTE + 1)
#define OPTION_AMIGA_DATADATA_RELOC (OPTION_AMIGA_DEBUG + 1)
#define OPTION_FLAVOR (OPTION_AMIGA_DATADATA_RELOC + 1)
static struct option longopts[] = {
{"amiga-datadata-reloc", no_argument, NULL, OPTION_AMIGA_DATADATA_RELOC},
/* '\0', NULL, "Relocate for resident program", ONE_DASH },*/
{"amiga-debug-hunk", no_argument, NULL, OPTION_AMIGA_DEBUG},
/* '\0', NULL, "Output encapsulated stabs in debug hunk", ONE_DASH },*/
{"attribute", required_argument, NULL, OPTION_AMIGA_ATTRIBUTE},
/*'\0', NULL, "Set section attributes", ONE_DASH },*/
{"chip", no_argument, NULL, OPTION_AMIGA_CHIP},
/*'\0', NULL, "Force sections in chip memory", ONE_DASH },*/
{"fast", no_argument, NULL, OPTION_AMIGA_FAST},
/*'\0', NULL, "Force sections in fast memory", ONE_DASH },*/
{"flavor", required_argument, NULL, OPTION_FLAVOR},
/*'\0', NULL, "Select a library flavor", ONE_DASH },*/
{NULL, no_argument, NULL, 0}
};
indx = optind;
if (indx == 0)
indx = 1;
opterr = 0;
optc = getopt_long_only (argc, argv, "-", longopts, &longind);
opterr = prevopterr;
switch (optc)
{
default:
optind = prevoptind;
return 0;
case 0:
/* Long option which just sets a flag. */
break;
case OPTION_AMIGA_CHIP:
amiga_attribute=2; /* We do not use MEMF_FAST, so we do not have to include exec/memory.h*/
break;
case OPTION_AMIGA_FAST:
amiga_attribute=4;
break;
case OPTION_AMIGA_ATTRIBUTE:
{
char *end;
amiga_attribute = strtoul (optarg, &end, 0);
if (*end)
einfo ("%P%F: invalid number \`%s\'\n", optarg);
}
break;
case OPTION_AMIGA_DEBUG:
write_debug_hunk=1; /* Write out debug hunk */
break;
case OPTION_AMIGA_DATADATA_RELOC:
amiga_resident=1; /* Write out datadata_reloc array */
break;
case OPTION_FLAVOR:
{
extern void ldfile_add_flavor (char*);
ldfile_add_flavor (optarg);
}
break;
}
return 1;
}
static void
gld${EMULATION_NAME}_before_parse()
{
#if defined(TARGET_IS_amiga_bss)
amiga_base_relative=1;
amiga_resident=0;
#endif
#ifndef TARGET_ /* I.e., if not generic. */
ldfile_output_architecture = bfd_arch_${ARCH};
#endif /* not TARGET_ */
}
static void
gld${EMULATION_NAME}_after_parse()
{
sort_flavors();
}
static void
gld${EMULATION_NAME}_after_open()
{
ldctor_build_sets ();
}
#if defined(TARGET_IS_amiga)
static void
amiga_assign_attribute(lang_input_statement_type *);
void
amiga_after_allocation()
{
#if 0 /* Does not work at the moment */
lang_for_each_input_file (amiga_assign_attribute);
#endif
}
static void
amiga_assign_attribute(inp)
lang_input_statement_type *inp;
{
asection *s;
if (inp->the_bfd->xvec->flavour==bfd_target_amiga_flavour)
{
for (s=inp->the_bfd->sections;s!=NULL;s=s->next)
amiga_per_section(s)->attribute=inp->amiga_attribute;
}
}
#else
extern void
amiga_after_allocation();
#endif
static char *
gld${EMULATION_NAME}_get_script(isfile)
int *isfile;
EOF
if test -n "$COMPILE_IN"
then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
sc="-f ${srcdir}/emultempl/stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 0;
if (link_info.relocateable == true && config.build_constructors == true)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
echo ' ; else return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 1;
if (link_info.relocateable == true && config.build_constructors == true)
return "ldscripts/${EMULATION_NAME}.xu";
else if (link_info.relocateable == true)
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
else if (!config.magic_demand_paged)
return "ldscripts/${EMULATION_NAME}.xn";
else
return "ldscripts/${EMULATION_NAME}.x";
}
EOF
fi
cat >>e${EMULATION_NAME}.c <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{
gld${EMULATION_NAME}_before_parse, /* before_parse */
syslib_default, /* syslib */
hll_default, /* hll */
gld${EMULATION_NAME}_after_parse,
gld${EMULATION_NAME}_after_open,
amiga_after_allocation, /* after_allocation */
set_output_arch_default, /* set_output_arch */
ldemul_default_target, /* choose_target */
before_allocation_default, /* before_allocation */
gld${EMULATION_NAME}_get_script, /* get_script */
"${EMULATION_NAME}", /* emulation_name */
"${OUTPUT_FORMAT}", /* target_name */
NULL, /* finish */
NULL, /* create_output_section_statements */
NULL, /* open_dynamic_library */
NULL, /* place_orphan */
NULL, /* set_symbols */
gld${EMULATION_NAME}_parse_args,
NULL, /* unrecognized file */
};
EOF

View File

@ -0,0 +1,41 @@
--- binutils-2.10.1/ld/ldctor.c 1999-05-03 09:29:06.000000000 +0200
+++ binutils-2.10.1/ld/ldctor.c 2012-08-08 12:35:51.000000000 +0200
@@ -266,8 +266,12 @@
/* If the symbol is defined, we may have been invoked from
collect, and the sets may already have been built, so we do
not do anything. */
- if (p->h->type == bfd_link_hash_defined
- || p->h->type == bfd_link_hash_defweak)
+ /* dgv -- libnix v1.1 uses absolute sets that are also explicitly
+ defined in the library so that the sets need to be build even
+ if the symbol is defined */
+ if ((output_bfd->xvec->flavour != bfd_target_amiga_flavour) &&
+ (p->h->type == bfd_link_hash_defined
+ || p->h->type == bfd_link_hash_defweak))
continue;
/* For each set we build:
@@ -362,14 +366,21 @@
if (e->name != NULL)
minfo ("%T\n", e->name);
else
- minfo ("%G\n", e->section->owner, e->section, e->value);
+ if (e->section->owner)
+ minfo ("%G\n", e->section->owner, e->section, e->value);
+ else
+ minfo ("%s\n", "** ABS **");
}
/* Need SEC_KEEP for --gc-sections */
if (! bfd_is_abs_section (e->section))
e->section->flags |= SEC_KEEP;
- if (link_info.relocateable)
+ /* dgv -- on the amiga, we want the constructors to be relocateable
+ objects. However, this should be arranged somewhere else (FIXME) */
+ if (link_info.relocateable ||
+ (output_bfd->xvec->flavour == bfd_target_amiga_flavour &&
+ e->section != bfd_abs_section_ptr))
lang_add_reloc (p->reloc, howto, e->section, e->name,
exp_intop (e->value));
else

View File

@ -0,0 +1,108 @@
--- binutils-2.10.1/ld/ldfile.c 2000-03-06 19:08:38.000000000 +0100
+++ binutils-2.10.1/ld/ldfile.c 2012-08-08 12:35:51.000000000 +0200
@@ -41,6 +41,9 @@
#include <ctype.h>
+static int n_flavors, flavors_len;
+char **flavors;
+
const char *ldfile_input_filename;
boolean ldfile_assumed_script = false;
const char *ldfile_output_machine_name = "";
@@ -78,6 +81,32 @@
static FILE *try_open PARAMS ((const char *name, const char *exten));
+static int flavors_cmp (f1, f2)
+ const void *f1, *f2;
+{
+ return strcmp (*(char**)f1, *(char**)f2);
+}
+
+void
+sort_flavors ()
+{
+ if (n_flavors > 1)
+ qsort ((void*)flavors, n_flavors, sizeof(char**), flavors_cmp);
+}
+
+void
+ldfile_add_flavor (name)
+ char *name;
+{
+ n_flavors++;
+ if (flavors)
+ flavors = (char**) xrealloc ((PTR)flavors, n_flavors*sizeof (char*));
+ else
+ flavors = (char**) xmalloc (sizeof (char*));
+ flavors [n_flavors-1] = name;
+ flavors_len += strlen (name);
+}
+
void
ldfile_add_library_path (name, cmdline)
const char *name;
@@ -160,6 +189,7 @@
const char *suffix;
{
search_dirs_type *search;
+ char *flavor_dir = (char *) alloca (flavors_len + n_flavors + 1);
/* If this is not an archive, try to open it in the current
directory first. */
@@ -174,6 +204,7 @@
search = search->next)
{
char *string;
+ int i, count=n_flavors;
if (entry->dynamic && ! link_info.relocateable)
{
@@ -203,15 +234,40 @@
else
sprintf (string, "%s%s%s", search->name, slash, entry->filename);
- if (ldfile_try_open_bfd (string, entry))
- {
- entry->filename = string;
- return true;
+ for (count = n_flavors; count>=0; count--) {
+ *flavor_dir = '\0';
+ for (i=0; i<count; i++) {
+ strcat (flavor_dir, flavors[i]);
+ strcat (flavor_dir, slash);
}
- free (string);
+ string = (char *) xmalloc (strlen (search->name)
+ + strlen (slash)
+ + strlen (flavor_dir)
+ + strlen (lib)
+ + strlen (entry->filename)
+ + strlen (arch)
+ + strlen (suffix)
+ + 1);
+
+ if (entry->is_archive)
+ sprintf (string, "%s%s%s%s%s%s%s", search->name, slash, flavor_dir,
+ lib, entry->filename, arch, suffix);
+ else if (entry->filename[0] == '/' || entry->filename[0] == '.')
+ strcpy (string, entry->filename);
+ else
+ sprintf (string, "%s%s%s%s", search->name, slash, flavor_dir,
+ entry->filename);
+
+ if (ldfile_try_open_bfd (string, entry))
+ {
+ entry->filename = string;
+ return true;
+ }
+
+ free (string);
+ }
}
-
return false;
}

View File

@ -0,0 +1,11 @@
--- binutils-2.10.1/ld/ldlang.h 2000-11-07 09:44:12.000000000 +0100
+++ binutils-2.10.1/ld/ldlang.h 2012-08-08 12:35:51.000000000 +0200
@@ -258,6 +258,8 @@
/* unsigned int globals_in_this_file;*/
const char *target;
boolean real;
+ /* Added for AMIGA support of section attributes */
+ int amiga_attribute;
} lang_input_statement_type;
typedef struct

View File

@ -0,0 +1,48 @@
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
${RELOCATING+${LIB_SEARCH_DIRS}}
${STACKZERO+${RELOCATING+${STACKZERO}}}
${SHLIB_PATH+${RELOCATING+${SHLIB_PATH}}}
SECTIONS
{
${RELOCATING+. = ${TEXT_START_ADDR};}
.text :
{
${RELOCATING+___machtype = ABSOLUTE(0x0);}
${RELOCATING+__stext = .;}
*(.text)
${RELOCATING+__etext = .;}
${RELOCATING+___text_size = ABSOLUTE(__etext - __stext);}
${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}}
}
${RELOCATING+. = ${DATA_ALIGNMENT};}
.data :
{
${RELOCATING+__sdata = .;}
${CONSTRUCTING+CONSTRUCTORS}
*(.data)
${RELOCATING+__edata = .;}
${RELOCATING+___data_size = ABSOLUTE(__edata - __sdata);}
}
${RELOCATING+. = ALIGN(0x0);}
.bss :
{
${RELOCATING+ __bss_start = .};
*(.bss)
*(COMMON)
${RELOCATING+__end = . };
${RELOCATING+___bss_size = ABSOLUTE(__end - __bss_start);}
}
.data_chip :
{
*(.data_chip)
}
.bss_chip :
{
*(.bss_chip)
}
}
EOF

View File

@ -0,0 +1,41 @@
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
${RELOCATING+${LIB_SEARCH_DIRS}}
${STACKZERO+${RELOCATING+${STACKZERO}}}
${SHLIB_PATH+${RELOCATING+${SHLIB_PATH}}}
SECTIONS
{
${RELOCATING+. = ${TEXT_START_ADDR};}
.text :
{
${RELOCATING+___machtype = ABSOLUTE(0x0);}
${RELOCATING+__stext = .;}
*(.text)
${RELOCATING+___datadata_relocs = .;}
${RELOCATING+__etext = .;}
${RELOCATING+___text_size = ABSOLUTE(__etext - __stext);}
${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}}
}
${RELOCATING+. = ${DATA_ALIGNMENT};}
.data :
{
${RELOCATING+__sdata = .;}
${CONSTRUCTING+CONSTRUCTORS}
*(.data)
${RELOCATING+___a4_init = 0x7ffe;}
${RELOCATING+___data_size = ABSOLUTE(__edata - __sdata);}
${RELOCATING+___bss_size = ABSOLUTE(0);}
}
.bss :
{
*(.bss)
*(COMMON)
${RELOCATING+__edata = .;}
${RELOCATING+__bss_start = .;}
${RELOCATING+__end = ALIGN(4) };
}
}
EOF

View File

@ -0,0 +1,11 @@
--- binutils-2.10.1/libiberty/argv.c 1999-07-14 19:32:01.000000000 +0200
+++ binutils-2.10.1/libiberty/argv.c 2012-08-08 12:35:51.000000000 +0200
@@ -40,7 +40,7 @@
#else /* !__STDC__ */
-#if !defined _WIN32 || defined __GNUC__
+#if !defined _WIN32 || !defined __APPLE__ || defined __GNUC__
extern char *memcpy (); /* Copy memory region */
extern int strlen (); /* Count length of string */
extern char *malloc (); /* Standard memory allocater */

View File

@ -0,0 +1,36 @@
--- binutils-2.10.1/libiberty/strerror.c 1999-05-03 09:28:54.000000000 +0200
+++ binutils-2.10.1/libiberty/strerror.c 2012-08-08 12:35:51.000000000 +0200
@@ -7,6 +7,8 @@
#include "config.h"
+#undef NEED_sys_errlist
+
#ifdef HAVE_SYS_ERRLIST
/* Note that errno.h (not sure what OS) or stdio.h (BSD 4.4, at least)
might declare sys_errlist in a way that the compiler might consider
@@ -27,8 +29,10 @@
#ifdef __STDC__
#include <stddef.h>
+#ifndef __APPLE__
extern void *malloc (size_t size); /* 4.10.3.3 */
extern void *memset (void *s, int c, size_t n); /* 4.11.6.1 */
+#endif
#else /* !__STDC__ */
extern char *malloc (); /* Standard memory allocater */
extern char *memset ();
@@ -462,8 +466,13 @@
#else
+#ifdef __APPLE__
+extern const int sys_nerr;
+extern const char *const sys_errlist[];
+#else
extern int sys_nerr;
extern char *sys_errlist[];
+#endif
#endif

View File

@ -0,0 +1,13 @@
--- binutils-2.10.1/libiberty/strsignal.c 1999-05-03 09:28:54.000000000 +0200
+++ binutils-2.10.1/libiberty/strsignal.c 2012-08-08 12:35:51.000000000 +0200
@@ -25,8 +25,10 @@
#ifdef __STDC__
#include <stddef.h>
+#ifndef __APPLE__
extern void *malloc (size_t size); /* 4.10.3.3 */
extern void *memset (void *s, int c, size_t n); /* 4.11.6.1 */
+#endif
#else /* !__STDC__ */
extern char *malloc (); /* Standard memory allocater */
extern char *memset ();

View File

@ -0,0 +1,13 @@
--- binutils-2.10.1/ltconfig 2000-02-27 17:46:19.000000000 +0100
+++ binutils-2.10.1/ltconfig 2012-08-08 12:35:51.000000000 +0200
@@ -679,10 +679,6 @@
# We can build DLLs from non-PIC.
;;
amigaos*)
- # FIXME: we need at least 68020 code to build shared libraries, but
- # adding the `-m68020' flag to GCC prevents building anything better,
- # like `-m68040'.
- pic_flag='-m68020 -resident32 -malways-restore-a4'
;;
sysv4*MP*)
if test -d /usr/nec; then

View File

@ -0,0 +1,11 @@
--- binutils-2.10.1/opcodes/m68k-dis.c 2000-05-06 16:49:26.000000000 +0200
+++ binutils-2.10.1/opcodes/m68k-dis.c 2012-08-08 12:35:51.000000000 +0200
@@ -51,7 +51,7 @@
static char *const reg_names[] = {
"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp",
+ "%a0", "%a1", "%a2", "%a3", "%a4", "%fp", "%a6", "%sp",
"%ps", "%pc"};
/* Sign-extend an (unsigned char). */