This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Remove i370 support


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6793974daae8ff3f8ad4e856a9f0e3bbe4fdf9a3

commit 6793974daae8ff3f8ad4e856a9f0e3bbe4fdf9a3
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Apr 16 15:21:56 2018 +0930

    Remove i370 support
    
    include/
    	* elf/i370.h: Delete.
    	* opcode/i370.h: Delete.
    bfd/
    	* Makefile.am: Remove i370 support.
    	* archures.c: Likewise.
    	* config.bfd: Likewise.
    	* configure.ac: Likewise.
    	* targets.c: Likewise.
    	* cpu-i370.c: Delete.
    	* elf32-i370.c: Delete.
    	* Makefile.in: Regenerate.
    	* bfd-in2.h: Regenerate.
    	* configure: Regenerate.
    	* po/SRC-POTFILES.in: Regenerate.
    opcodes/
    	* Makefile.am: Remove i370 support.
    	* configure.ac: Likewise.
    	* disassemble.c: Likewise.
    	* disassemble.h: Likewise.
    	* i370-dis.c: Delete.
    	* i370-opc.c: Delete.
    	* Makefile.in: Regenerate.
    	* configure: Regenerate.
    	* po/POTFILES.in: Regenerate.
    binutils/
    	* readelf.c: Remove i370 support.
    	* testsuite/binutils-all/objdump.exp: Likewise.
    gas/
    	* Makefile.am: Remove i370 support.
    	* app.c: Likewise.
    	* config/obj-elf.c: Likewise.
    	* configure.tgt: Likewise.
    	* doc/Makefile.am: Likewise.
    	* doc/as.texinfo: Likewise.
    	* testsuite/gas/all/gas.exp: Likewise.
    	* testsuite/gas/elf/warn-2.s: Likewise.
    	* testsuite/gas/lns/lns.exp: Likewise.
    	* config/tc-i370.c: Delete.
    	* config/tc-i370.h: Delete.
    	* doc/c-i370.texi: Delete.
    	* Makefile.in: Regenerate.
    	* doc/Makefile.in: Regenerate.
    	* po/POTFILES.in: Regenerate.
    ld/
    	* Makefile.am: Remove i370 support.
    	* configure.tgt: Likewise.
    	* testsuite/ld-elf/compressed1d.d: Likewise.
    	* testsuite/ld-elf/group8a.d: Likewise.
    	* testsuite/ld-elf/group8b.d: Likewise.
    	* testsuite/ld-elf/group9a.d: Likewise.
    	* testsuite/ld-elf/group9b.d: Likewise.
    	* testsuite/ld-elf/merge.d: Likewise.
    	* testsuite/ld-elf/pr12851.d: Likewise.
    	* testsuite/ld-elf/pr12975.d: Likewise.
    	* testsuite/ld-elf/pr13177.d: Likewise.
    	* testsuite/ld-elf/pr13195.d: Likewise.
    	* testsuite/ld-elf/pr17615.d: Likewise.
    	* testsuite/ld-elf/pr21562a.d: Likewise.
    	* testsuite/ld-elf/pr21562b.d: Likewise.
    	* testsuite/ld-elf/pr21562c.d: Likewise.
    	* testsuite/ld-elf/pr21562d.d: Likewise.
    	* testsuite/ld-elf/pr21562i.d: Likewise.
    	* testsuite/ld-elf/pr21562j.d: Likewise.
    	* testsuite/ld-elf/pr21562k.d: Likewise.
    	* testsuite/ld-elf/pr21562l.d: Likewise.
    	* testsuite/ld-elf/pr21562m.d: Likewise.
    	* testsuite/ld-elf/pr21562n.d: Likewise.
    	* testsuite/ld-elf/pr22677.d: Likewise.
    	* testsuite/lib/ld-lib.exp: Likewise.
    	* emulparams/elf32i370.sh: Delete.
    	* scripttempl/elfi370.sc: Delete.
    	* Makefile.in: Regenerate.
    	* po/BLD-POTFILES.in: Regenerate.

Diff:
---
 bfd/ChangeLog                               |   14 +
 bfd/Makefile.am                             |    4 -
 bfd/Makefile.in                             |    6 -
 bfd/archures.c                              |    3 -
 bfd/bfd-in2.h                               |    1 -
 bfd/config.bfd                              |    8 +-
 bfd/configure                               |    6 -
 bfd/configure.ac                            |    6 -
 bfd/cpu-i370.c                              |   77 -
 bfd/elf32-i370.c                            | 1404 --------------
 bfd/po/SRC-POTFILES.in                      |    2 -
 bfd/targets.c                               |    3 -
 binutils/ChangeLog                          |    5 +
 binutils/readelf.c                          |    7 -
 binutils/testsuite/binutils-all/objdump.exp |    1 -
 gas/ChangeLog                               |   18 +
 gas/Makefile.am                             |    2 -
 gas/Makefile.in                             |   17 -
 gas/app.c                                   |    3 +-
 gas/config/obj-elf.c                        |    6 -
 gas/config/tc-i370.c                        | 2669 ---------------------------
 gas/config/tc-i370.h                        |   63 -
 gas/configure.tgt                           |    2 -
 gas/doc/Makefile.am                         |    1 -
 gas/doc/Makefile.in                         |    1 -
 gas/doc/as.texinfo                          |    7 -
 gas/doc/c-i370.texi                         |  200 --
 gas/po/POTFILES.in                          |    2 -
 gas/testsuite/gas/all/gas.exp               |    3 -
 gas/testsuite/gas/elf/warn-2.s              |    7 +-
 gas/testsuite/gas/lns/lns.exp               |    5 +-
 include/ChangeLog                           |    5 +
 include/elf/i370.h                          |   61 -
 include/opcode/i370.h                       |  266 ---
 ld/ChangeLog                                |   32 +
 ld/Makefile.am                              |    4 -
 ld/Makefile.in                              |    5 -
 ld/configure.tgt                            |    2 -
 ld/emulparams/elf32i370.sh                  |    8 -
 ld/po/BLD-POTFILES.in                       |    1 -
 ld/scripttempl/elfi370.sc                   |  206 ---
 ld/testsuite/ld-elf/compressed1d.d          |    2 +-
 ld/testsuite/ld-elf/group8a.d               |    2 +-
 ld/testsuite/ld-elf/group8b.d               |    2 +-
 ld/testsuite/ld-elf/group9a.d               |    2 +-
 ld/testsuite/ld-elf/group9b.d               |    2 +-
 ld/testsuite/ld-elf/merge.d                 |    2 +-
 ld/testsuite/ld-elf/pr12851.d               |    2 +-
 ld/testsuite/ld-elf/pr12975.d               |    2 +-
 ld/testsuite/ld-elf/pr13177.d               |    2 +-
 ld/testsuite/ld-elf/pr13195.d               |    2 +-
 ld/testsuite/ld-elf/pr17615.d               |    2 +-
 ld/testsuite/ld-elf/pr21562a.d              |    2 +-
 ld/testsuite/ld-elf/pr21562b.d              |    2 +-
 ld/testsuite/ld-elf/pr21562c.d              |    2 +-
 ld/testsuite/ld-elf/pr21562d.d              |    2 +-
 ld/testsuite/ld-elf/pr21562i.d              |    2 +-
 ld/testsuite/ld-elf/pr21562j.d              |    2 +-
 ld/testsuite/ld-elf/pr21562k.d              |    2 +-
 ld/testsuite/ld-elf/pr21562l.d              |    2 +-
 ld/testsuite/ld-elf/pr21562m.d              |    2 +-
 ld/testsuite/ld-elf/pr21562n.d              |    2 +-
 ld/testsuite/ld-elf/pr22677.d               |    2 +-
 ld/testsuite/lib/ld-lib.exp                 |    1 -
 opcodes/ChangeLog                           |   12 +
 opcodes/Makefile.am                         |    2 -
 opcodes/Makefile.in                         |    4 -
 opcodes/configure                           |    1 -
 opcodes/configure.ac                        |    1 -
 opcodes/disassemble.c                       |    6 -
 opcodes/disassemble.h                       |    1 -
 opcodes/i370-dis.c                          |  161 --
 opcodes/i370-opc.c                          |  935 ----------
 opcodes/po/POTFILES.in                      |    2 -
 74 files changed, 112 insertions(+), 6201 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 160779a..def5b5a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,19 @@
 2018-04-16  Alan Modra  <amodra@gmail.com>
 
+	* Makefile.am: Remove i370 support.
+	* archures.c: Likewise.
+	* config.bfd: Likewise.
+	* configure.ac: Likewise.
+	* targets.c: Likewise.
+	* cpu-i370.c: Delete.
+	* elf32-i370.c: Delete.
+	* Makefile.in: Regenerate.
+	* bfd-in2.h: Regenerate.
+	* configure: Regenerate.
+	* po/SRC-POTFILES.in: Regenerate.
+
+2018-04-16  Alan Modra  <amodra@gmail.com>
+
 	* Makefile.am: Remove h8500 support.
 	* archures.c: Likewise.
 	* coffcode.h: Likewise.
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 2b06d0a..9e583df 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -108,7 +108,6 @@ ALL_MACHINES = \
 	cpu-ft32.lo \
 	cpu-h8300.lo \
 	cpu-hppa.lo \
-	cpu-i370.lo \
 	cpu-i386.lo \
 	cpu-iamcu.lo \
 	cpu-l1om.lo \
@@ -195,7 +194,6 @@ ALL_MACHINES_CFILES = \
 	cpu-ft32.c \
 	cpu-h8300.c \
 	cpu-hppa.c \
-	cpu-i370.c \
 	cpu-i386.c \
 	cpu-iamcu.c \
 	cpu-l1om.c \
@@ -332,7 +330,6 @@ BFD32_BACKENDS = \
 	elf32-gen.lo \
 	elf32-h8300.lo \
 	elf32-hppa.lo \
-	elf32-i370.lo \
 	elf32-i386.lo \
 	elfxx-x86.lo \
 	elf32-ip2k.lo \
@@ -514,7 +511,6 @@ BFD32_BACKENDS_CFILES = \
 	elf32-gen.c \
 	elf32-h8300.c \
 	elf32-hppa.c \
-	elf32-i370.c \
 	elf32-i386.c \
 	elfxx-x86.c \
 	elf32-ip2k.c \
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 657d62a..6e89ed8 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -441,7 +441,6 @@ ALL_MACHINES = \
 	cpu-ft32.lo \
 	cpu-h8300.lo \
 	cpu-hppa.lo \
-	cpu-i370.lo \
 	cpu-i386.lo \
 	cpu-iamcu.lo \
 	cpu-l1om.lo \
@@ -528,7 +527,6 @@ ALL_MACHINES_CFILES = \
 	cpu-ft32.c \
 	cpu-h8300.c \
 	cpu-hppa.c \
-	cpu-i370.c \
 	cpu-i386.c \
 	cpu-iamcu.c \
 	cpu-l1om.c \
@@ -666,7 +664,6 @@ BFD32_BACKENDS = \
 	elf32-gen.lo \
 	elf32-h8300.lo \
 	elf32-hppa.lo \
-	elf32-i370.lo \
 	elf32-i386.lo \
 	elfxx-x86.lo \
 	elf32-ip2k.lo \
@@ -848,7 +845,6 @@ BFD32_BACKENDS_CFILES = \
 	elf32-gen.c \
 	elf32-h8300.c \
 	elf32-hppa.c \
-	elf32-i370.c \
 	elf32-i386.c \
 	elfxx-x86.c \
 	elf32-ip2k.c \
@@ -1351,7 +1347,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-ft32.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-h8300.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-hppa.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-i370.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-i386.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-ia64.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-iamcu.Plo@am__quote@
@@ -1452,7 +1447,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-gen.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-h8300.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-hppa.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-i370.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-i386.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-ia64.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-ip2k.Plo@am__quote@
diff --git a/bfd/archures.c b/bfd/archures.c
index d333379..fce2f4b 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -218,7 +218,6 @@ DESCRIPTION
 .#define bfd_mach_i386_iamcu		(bfd_mach_i386_i386 | bfd_mach_iamcu)
 .#define bfd_mach_i386_iamcu_intel_syntax (bfd_mach_i386_iamcu | bfd_mach_i386_intel_syntax)
 .  bfd_arch_we32k,     {* AT&T WE32xxx.  *}
-.  bfd_arch_i370,      {* IBM 360/370 Mainframes.  *}
 .  bfd_arch_romp,      {* IBM ROMP PC/RT.  *}
 .  bfd_arch_convex,    {* Convex.  *}
 .  bfd_arch_m88k,      {* Motorola 88xxx.  *}
@@ -578,7 +577,6 @@ extern const bfd_arch_info_type bfd_fr30_arch;
 extern const bfd_arch_info_type bfd_frv_arch;
 extern const bfd_arch_info_type bfd_h8300_arch;
 extern const bfd_arch_info_type bfd_hppa_arch;
-extern const bfd_arch_info_type bfd_i370_arch;
 extern const bfd_arch_info_type bfd_i386_arch;
 extern const bfd_arch_info_type bfd_iamcu_arch;
 extern const bfd_arch_info_type bfd_ia64_arch;
@@ -670,7 +668,6 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
     &bfd_frv_arch,
     &bfd_h8300_arch,
     &bfd_hppa_arch,
-    &bfd_i370_arch,
     &bfd_i386_arch,
     &bfd_iamcu_arch,
     &bfd_ia64_arch,
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index e291e55..3cb11ff 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2093,7 +2093,6 @@ enum bfd_architecture
 #define bfd_mach_i386_iamcu            (bfd_mach_i386_i386 | bfd_mach_iamcu)
 #define bfd_mach_i386_iamcu_intel_syntax (bfd_mach_i386_iamcu | bfd_mach_i386_intel_syntax)
   bfd_arch_we32k,     /* AT&T WE32xxx.  */
-  bfd_arch_i370,      /* IBM 360/370 Mainframes.  */
   bfd_arch_romp,      /* IBM ROMP PC/RT.  */
   bfd_arch_convex,    /* Convex.  */
   bfd_arch_m88k,      /* Motorola 88xxx.  */
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 434b377..47ddb4c 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -107,7 +107,6 @@ case $targ in
  vax-*-bsd* | vax-*-ultrix* | \
  we32k-*-* | \
  w65-*-* | \
- i370-* | \
  sh5*-*-* | sh64*-*-* | \
  null)
     if test "x$enable_obsolete" != xyes; then
@@ -133,6 +132,7 @@ case $targ in
  h8300*-*-coff | \
  h8500*-*-coff | \
  hppa*-*-rtems* | \
+ i370-* | \
  i860-*-* | \
  i960-*-* | \
  m68*-*-lynxos* | \
@@ -169,7 +169,6 @@ dlx*)		 targ_archs=bfd_dlx_arch ;;
 fido*)		 targ_archs=bfd_m68k_arch ;;
 hppa*)		 targ_archs=bfd_hppa_arch ;;
 i[3-7]86)	 targ_archs=bfd_i386_arch ;;
-i370)		 targ_archs=bfd_i370_arch ;;
 ia16)		 targ_archs=bfd_i386_arch ;;
 lm32)	         targ_archs=bfd_lm32_arch ;;
 m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
@@ -604,11 +603,6 @@ case "${targ}" in
     targ_selvecs=hppa_elf32_vec
     ;;
 
-  i370-*-*)
-    targ_defvec=i370_elf32_vec
-    targ_selvecs="i370_elf32_vec"
-    ;;
-
   i[3-7]86-*-sco3.2v5*coff)
     targ_defvec=i386_coff_vec
     targ_selvecs=i386_elf32_vec
diff --git a/bfd/configure b/bfd/configure
index 66a2425..1947228 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -14400,7 +14400,6 @@ do
     hppa_elf64_vec)		 tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
     hppa_elf64_linux_vec)	 tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
     hppa_som_vec)		 tb="$tb som.lo" ;;
-    i370_elf32_vec)		 tb="$tb elf32-i370.lo elf32.lo $elf" ;;
     i386_aout_vec)		 tb="$tb i386aout.lo aout32.lo" ;;
     i386_aout_bsd_vec)		 tb="$tb i386bsd.lo aout32.lo" ;;
     i386_aout_dynix_vec)	 tb="$tb i386dynix.lo aout32.lo" ;;
@@ -14820,11 +14819,6 @@ if test "${target}" = "${host}"; then
 	COREFILE=netbsd-core.lo
 	;;
 
-  i370-*-*)
-	COREFILE=trad-core.lo
-	TRAD_HEADER='"hosts/i370linux.h"'
-	;;
-
   i[3-7]86-sequent-bsd*)
 	COREFILE=trad-core.lo
 	TRAD_HEADER='"hosts/symmetry.h"'
diff --git a/bfd/configure.ac b/bfd/configure.ac
index a6c6387..6ccd582 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -477,7 +477,6 @@ do
     hppa_elf64_vec)		 tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
     hppa_elf64_linux_vec)	 tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
     hppa_som_vec)		 tb="$tb som.lo" ;;
-    i370_elf32_vec)		 tb="$tb elf32-i370.lo elf32.lo $elf" ;;
     i386_aout_vec)		 tb="$tb i386aout.lo aout32.lo" ;;
     i386_aout_bsd_vec)		 tb="$tb i386bsd.lo aout32.lo" ;;
     i386_aout_dynix_vec)	 tb="$tb i386dynix.lo aout32.lo" ;;
@@ -882,11 +881,6 @@ if test "${target}" = "${host}"; then
 	COREFILE=netbsd-core.lo
 	;;
 
-  i370-*-*)
-	COREFILE=trad-core.lo
-	TRAD_HEADER='"hosts/i370linux.h"'
-	;;
-
 changequote(,)dnl
   i[3-7]86-sequent-bsd*)
 changequote([,])dnl
diff --git a/bfd/cpu-i370.c b/bfd/cpu-i370.c
deleted file mode 100644
index 7ca4f7f..0000000
--- a/bfd/cpu-i370.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* BFD i370 CPU definition
-   Copyright (C) 1994-2018 Free Software Foundation, Inc.
-   Contributed by Ian Lance Taylor, Cygnus Support.
-   Hacked by Linas Vepstas <linas@linas.org> in 1998, 1999
-
-   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 3 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., 51 Franklin Street - Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-
-static const bfd_arch_info_type arch_info_struct[] =
-{
-  /* Hack alert: old old machines are really 16 and 24 bit arch ...  */
-  {
-    32,		/* 32 bits in a word.  */
-    32,		/* 32 bits in an address.  */
-    8,		/* 8 bits in a byte.  */
-    bfd_arch_i370,
-    360,	/* For the 360.  */
-    "i370",
-    "i370:360",
-    3,
-    FALSE,	/* Not the default.  */
-    bfd_default_compatible,
-    bfd_default_scan,
-    bfd_arch_default_fill,
-    &arch_info_struct[1]
-  },
-  {
-    32,		/* 32 bits in a word.  */
-    32,		/* 32 bits in an address.  */
-    8,		/* 8 bits in a byte.  */
-    bfd_arch_i370,
-    370,	/* For the 370.  */
-    "i370",
-    "i370:370",
-    3,
-    FALSE,	/* Not the default.  */
-    bfd_default_compatible,
-    bfd_default_scan,
-    bfd_arch_default_fill,
-    0
-  },
-};
-
-const bfd_arch_info_type bfd_i370_arch =
-{
-  32,		/* 32 bits in a word.  */
-  32,		/* 32 bits in an address.  */
-  8,		/* 8 bits in a byte.  */
-  bfd_arch_i370,
-  0,		/* For the 360/370 common architecture.  */
-  "i370",
-  "i370:common",
-  3,
-  TRUE,		/* The default.  */
-  bfd_default_compatible,
-  bfd_default_scan,
-  bfd_arch_default_fill,
-  & arch_info_struct[0]
-};
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
deleted file mode 100644
index 2c6a30d..0000000
--- a/bfd/elf32-i370.c
+++ /dev/null
@@ -1,1404 +0,0 @@
-/* i370-specific support for 32-bit ELF
-   Copyright (C) 1994-2018 Free Software Foundation, Inc.
-   Written by Ian Lance Taylor, Cygnus Support.
-   Hacked by Linas Vepstas for i370 linas@linas.org
-
-   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 3 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., 51 Franklin Street - Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
-
-/* This file is based on a preliminary PowerPC ELF ABI.
-   But its been hacked on for the IBM 360/370 architectures.
-   Basically, the 31bit relocation works, and just about everything
-   else is a wild card.  In particular, don't expect shared libs or
-   dynamic loading to work ...  its never been tested.  */
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-#include "elf/i370.h"
-
-static reloc_howto_type *i370_elf_howto_table[ (int)R_I370_max ];
-
-static reloc_howto_type i370_elf_howto_raw[] =
-{
-  /* This reloc does nothing.  */
-  HOWTO (R_I370_NONE,		/* type */
-	 0,			/* rightshift */
-	 3,			/* size (0 = byte, 1 = short, 2 = long) */
-	 0,			/* bitsize */
-	 FALSE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_I370_NONE",		/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0,			/* dst_mask */
-	 FALSE),		/* pcrel_offset */
-
-  /* A standard 31 bit relocation.  */
-  HOWTO (R_I370_ADDR31,		/* type */
-	 0,			/* rightshift */
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
-	 31,			/* bitsize */
-	 FALSE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_I370_ADDR31",	/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0x7fffffff,		/* dst_mask */
-	 FALSE),		/* pcrel_offset */
-
-  /* A standard 32 bit relocation.  */
-  HOWTO (R_I370_ADDR32,		/* type */
-	 0,			/* rightshift */
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
-	 32,			/* bitsize */
-	 FALSE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_I370_ADDR32",	/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0xffffffff,		/* dst_mask */
-	 FALSE),		/* pcrel_offset */
-
-  /* A standard 16 bit relocation.  */
-  HOWTO (R_I370_ADDR16,		/* type */
-	 0,			/* rightshift */
-	 1,			/* size (0 = byte, 1 = short, 2 = long) */
-	 16,			/* bitsize */
-	 FALSE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_I370_ADDR16",	/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0xffff,		/* dst_mask */
-	 FALSE),		/* pcrel_offset */
-
-  /* 31-bit PC relative.  */
-  HOWTO (R_I370_REL31,		/* type */
-	 0,			/* rightshift */
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
-	 31,			/* bitsize */
-	 TRUE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_I370_REL31",	/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0x7fffffff,		/* dst_mask */
-	 TRUE),			/* pcrel_offset */
-
-  /* 32-bit PC relative.  */
-  HOWTO (R_I370_REL32,		/* type */
-	 0,			/* rightshift */
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
-	 32,			/* bitsize */
-	 TRUE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_I370_REL32",	/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0xffffffff,		/* dst_mask */
-	 TRUE),			/* pcrel_offset */
-
-  /* A standard 12 bit relocation.  */
-  HOWTO (R_I370_ADDR12,		/* type */
-	 0,			/* rightshift */
-	 1,			/* size (0 = byte, 1 = short, 2 = long) */
-	 12,			/* bitsize */
-	 FALSE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_I370_ADDR12",	/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0xfff,			/* dst_mask */
-	 FALSE),		/* pcrel_offset */
-
-  /* 12-bit PC relative.  */
-  HOWTO (R_I370_REL12,		/* type */
-	 0,			/* rightshift */
-	 1,			/* size (0 = byte, 1 = short, 2 = long) */
-	 12,			/* bitsize */
-	 TRUE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_I370_REL12",	/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0xfff,			/* dst_mask */
-	 TRUE),			/* pcrel_offset */
-
-  /* A standard 8 bit relocation.  */
-  HOWTO (R_I370_ADDR8,		/* type */
-	 0,			/* rightshift */
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
-	 8,			/* bitsize */
-	 FALSE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_I370_ADDR8",	/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0xff,			/* dst_mask */
-	 FALSE),		/* pcrel_offset */
-
-  /* 8-bit PC relative.  */
-  HOWTO (R_I370_REL8,		/* type */
-	 0,			/* rightshift */
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
-	 8,			/* bitsize */
-	 TRUE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_I370_REL8",		/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0xff,			/* dst_mask */
-	 TRUE),			/* pcrel_offset */
-
-  /* This is used only by the dynamic linker.  The symbol should exist
-     both in the object being run and in some shared library.  The
-     dynamic linker copies the data addressed by the symbol from the
-     shared library into the object, because the object being
-     run has to have the data at some particular address.  */
-  HOWTO (R_I370_COPY,		/* type */
-	 0,			/* rightshift */
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
-	 32,			/* bitsize */
-	 FALSE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	 /* special_function */
-	 "R_I370_COPY",		/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0,			/* dst_mask */
-	 FALSE),		/* pcrel_offset */
-
-  /* Used only by the dynamic linker.  When the object is run, this
-     longword is set to the load address of the object, plus the
-     addend.  */
-  HOWTO (R_I370_RELATIVE,	/* type */
-	 0,			/* rightshift */
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
-	 32,			/* bitsize */
-	 FALSE,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	 /* special_function */
-	 "R_I370_RELATIVE",	/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0xffffffff,		/* dst_mask */
-	 FALSE),		/* pcrel_offset */
-
-};
-
-/* Initialize the i370_elf_howto_table, so that linear accesses can be done.  */
-
-static void
-i370_elf_howto_init (void)
-{
-  unsigned int i, type;
-
-  for (i = 0; i < sizeof (i370_elf_howto_raw) / sizeof (i370_elf_howto_raw[0]); i++)
-    {
-      type = i370_elf_howto_raw[i].type;
-      BFD_ASSERT (type < sizeof (i370_elf_howto_table) / sizeof (i370_elf_howto_table[0]));
-      i370_elf_howto_table[type] = &i370_elf_howto_raw[i];
-    }
-}
-
-static reloc_howto_type *
-i370_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
-			    bfd_reloc_code_real_type code)
-{
-  enum i370_reloc_type i370_reloc = R_I370_NONE;
-
-  if (!i370_elf_howto_table[ R_I370_ADDR31 ])
-    /* Initialize howto table if needed.  */
-    i370_elf_howto_init ();
-
-  switch ((int) code)
-    {
-    default:
-      return NULL;
-
-    case BFD_RELOC_NONE:	i370_reloc = R_I370_NONE;	break;
-    case BFD_RELOC_32:		i370_reloc = R_I370_ADDR31;	break;
-    case BFD_RELOC_16:		i370_reloc = R_I370_ADDR16;	break;
-    case BFD_RELOC_32_PCREL:	i370_reloc = R_I370_REL31;	break;
-    case BFD_RELOC_CTOR:	i370_reloc = R_I370_ADDR31;	break;
-    case BFD_RELOC_I370_D12:	i370_reloc = R_I370_ADDR12;	break;
-    }
-
-  return i370_elf_howto_table[ (int)i370_reloc ];
-};
-
-static reloc_howto_type *
-i370_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
-			    const char *r_name)
-{
-  unsigned int i;
-
-  for (i = 0;
-       i < sizeof (i370_elf_howto_raw) / sizeof (i370_elf_howto_raw[0]);
-       i++)
-    if (i370_elf_howto_raw[i].name != NULL
-	&& strcasecmp (i370_elf_howto_raw[i].name, r_name) == 0)
-      return &i370_elf_howto_raw[i];
-
-  return NULL;
-}
-
-/* The name of the dynamic interpreter.  This is put in the .interp
-    section.  */
-
-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so"
-
-/* Set the howto pointer for an i370 ELF reloc.  */
-
-static bfd_boolean
-i370_elf_info_to_howto (bfd *abfd,
-			arelent *cache_ptr,
-			Elf_Internal_Rela *dst)
-{
-  unsigned int r_type;
-
-  if (!i370_elf_howto_table[ R_I370_ADDR31 ])
-    /* Initialize howto table.  */
-    i370_elf_howto_init ();
-
-  r_type = ELF32_R_TYPE (dst->r_info);
-  if (r_type >= R_I370_max)
-    {
-      /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
-			  abfd, r_type);
-      bfd_set_error (bfd_error_bad_value);
-      return FALSE;
-    }
-  cache_ptr->howto = i370_elf_howto_table[r_type];
-  return TRUE;
-}
-
-/* Hack alert --  the following several routines look generic to me ...
-   why are we bothering with them ?  */
-/* Function to set whether a module needs the -mrelocatable bit set.  */
-
-static bfd_boolean
-i370_elf_set_private_flags (bfd *abfd, flagword flags)
-{
-  BFD_ASSERT (!elf_flags_init (abfd)
-	      || elf_elfheader (abfd)->e_flags == flags);
-
-  elf_elfheader (abfd)->e_flags = flags;
-  elf_flags_init (abfd) = TRUE;
-  return TRUE;
-}
-
-/* Merge backend specific data from an object file to the output
-   object file when linking.  */
-
-static bfd_boolean
-i370_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
-{
-  bfd *obfd = info->output_bfd;
-  flagword old_flags;
-  flagword new_flags;
-
-  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
-      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
-    return TRUE;
-
-  new_flags = elf_elfheader (ibfd)->e_flags;
-  old_flags = elf_elfheader (obfd)->e_flags;
-  if (!elf_flags_init (obfd))	/* First call, no flags set.  */
-    {
-      elf_flags_init (obfd) = TRUE;
-      elf_elfheader (obfd)->e_flags = new_flags;
-    }
-
-  else if (new_flags == old_flags)	/* Compatible flags are ok.  */
-    ;
-
-  else					/* Incompatible flags.  */
-    {
-      _bfd_error_handler
-	/* xgettext:c-format */
-	(_("%pB: uses different e_flags (%#x) fields than previous modules (%#x)"),
-	 ibfd, new_flags, old_flags);
-
-      bfd_set_error (bfd_error_bad_value);
-      return FALSE;
-    }
-
-  return TRUE;
-}
-
-/* Handle an i370 specific section when reading an object file.  This
-   is called when elfcode.h finds a section with an unknown type.  */
-/* XXX hack alert bogus This routine is mostly all junk and almost
-   certainly does the wrong thing.  Its here simply because it does
-   just enough to allow glibc-2.1 ld.so to compile & link.  */
-
-static bfd_boolean
-i370_elf_section_from_shdr (bfd *abfd,
-			    Elf_Internal_Shdr *hdr,
-			    const char *name,
-			    int shindex)
-{
-  asection *newsect;
-  flagword flags;
-
-  if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
-    return FALSE;
-
-  newsect = hdr->bfd_section;
-  flags = bfd_get_section_flags (abfd, newsect);
-  if (hdr->sh_type == SHT_ORDERED)
-    flags |= SEC_SORT_ENTRIES;
-
-  bfd_set_section_flags (abfd, newsect, flags);
-  return TRUE;
-}
-
-/* Set up any other section flags and such that may be necessary.  */
-/* XXX hack alert bogus This routine is mostly all junk and almost
-   certainly does the wrong thing.  Its here simply because it does
-   just enough to allow glibc-2.1 ld.so to compile & link.  */
-
-static bfd_boolean
-i370_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
-			Elf_Internal_Shdr *shdr,
-			asection *asect)
-{
-  if ((asect->flags & (SEC_GROUP | SEC_EXCLUDE)) == SEC_EXCLUDE)
-    shdr->sh_flags |= SHF_EXCLUDE;
-
-  if ((asect->flags & SEC_SORT_ENTRIES) != 0)
-    shdr->sh_type = SHT_ORDERED;
-
-  return TRUE;
-}
-
-/* We have to create .dynsbss and .rela.sbss here so that they get mapped
-   to output sections (just like _bfd_elf_create_dynamic_sections has
-   to create .dynbss and .rela.bss).  */
-/* XXX hack alert bogus This routine is mostly all junk and almost
-   certainly does the wrong thing.  Its here simply because it does
-   just enough to allow glibc-2.1 ld.so to compile & link.  */
-
-static bfd_boolean
-i370_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
-{
-  asection *s;
-  flagword flags;
-
-  if (!_bfd_elf_create_dynamic_sections(abfd, info))
-    return FALSE;
-
-  flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
-	   | SEC_LINKER_CREATED);
-
-  s = bfd_make_section_anyway_with_flags (abfd, ".dynsbss",
-					  SEC_ALLOC | SEC_LINKER_CREATED);
-  if (s == NULL)
-    return FALSE;
-
-  if (! bfd_link_pic (info))
-    {
-      s = bfd_make_section_anyway_with_flags (abfd, ".rela.sbss",
-					      flags | SEC_READONLY);
-      if (s == NULL
-	  || ! bfd_set_section_alignment (abfd, s, 2))
-	return FALSE;
-    }
-
-   /* XXX beats me, seem to need a rela.text ...  */
-   s = bfd_make_section_anyway_with_flags (abfd, ".rela.text",
-					   flags | SEC_READONLY);
-   if (s == NULL
-      || ! bfd_set_section_alignment (abfd, s, 2))
-    return FALSE;
-  return TRUE;
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
-   regular object.  The current definition is in some section of the
-   dynamic object, but we're not including those sections.  We have to
-   change the definition to something the rest of the link can
-   understand.  */
-/* XXX hack alert bogus This routine is mostly all junk and almost
-   certainly does the wrong thing.  Its here simply because it does
-   just enough to allow glibc-2.1 ld.so to compile & link.  */
-
-static bfd_boolean
-i370_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
-				struct elf_link_hash_entry *h)
-{
-  bfd *dynobj = elf_hash_table (info)->dynobj;
-  asection *s;
-
-#ifdef DEBUG
-  fprintf (stderr, "i370_elf_adjust_dynamic_symbol called for %s\n",
-	   h->root.root.string);
-#endif
-
-  /* Make sure we know what is going on here.  */
-  BFD_ASSERT (dynobj != NULL
-	      && (h->needs_plt
-		  || h->is_weakalias
-		  || (h->def_dynamic
-		      && h->ref_regular
-		      && !h->def_regular)));
-
-  s = bfd_get_linker_section (dynobj, ".rela.text");
-  BFD_ASSERT (s != NULL);
-  s->size += sizeof (Elf32_External_Rela);
-
-  /* If this is a weak symbol, and there is a real definition, the
-     processor independent code will have arranged for us to see the
-     real definition first, and we can just use the same value.  */
-  if (h->is_weakalias)
-    {
-      struct elf_link_hash_entry *def = weakdef (h);
-      BFD_ASSERT (def->root.type == bfd_link_hash_defined);
-      h->root.u.def.section = def->root.u.def.section;
-      h->root.u.def.value = def->root.u.def.value;
-      return TRUE;
-    }
-
-  /* This is a reference to a symbol defined by a dynamic object which
-     is not a function.  */
-
-  /* If we are creating a shared library, we must presume that the
-     only references to the symbol are via the global offset table.
-     For such cases we need not do anything here; the relocations will
-     be handled correctly by relocate_section.  */
-  if (bfd_link_pic (info))
-    return TRUE;
-
-  /* We must allocate the symbol in our .dynbss section, which will
-     become part of the .bss section of the executable.  There will be
-     an entry for this symbol in the .dynsym section.  The dynamic
-     object will contain position independent code, so all references
-     from the dynamic object to this symbol will go through the global
-     offset table.  The dynamic linker will use the .dynsym entry to
-     determine the address it must put in the global offset table, so
-     both the dynamic object and the regular object will refer to the
-     same memory location for the variable.
-
-     Of course, if the symbol is sufficiently small, we must instead
-     allocate it in .sbss.  FIXME: It would be better to do this if and
-     only if there were actually SDAREL relocs for that symbol.  */
-
-  if (h->size <= elf_gp_size (dynobj))
-    s = bfd_get_linker_section (dynobj, ".dynsbss");
-  else
-    s = bfd_get_linker_section (dynobj, ".dynbss");
-  BFD_ASSERT (s != NULL);
-
-  /* We must generate a R_I370_COPY reloc to tell the dynamic linker to
-     copy the initial value out of the dynamic object and into the
-     runtime process image.  We need to remember the offset into the
-     .rela.bss section we are going to use.  */
-  if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
-    {
-      asection *srel;
-
-      if (h->size <= elf_gp_size (dynobj))
-	srel = bfd_get_linker_section (dynobj, ".rela.sbss");
-      else
-	srel = bfd_get_linker_section (dynobj, ".rela.bss");
-      BFD_ASSERT (srel != NULL);
-      srel->size += sizeof (Elf32_External_Rela);
-      h->needs_copy = 1;
-    }
-
-  return _bfd_elf_adjust_dynamic_copy (info, h, s);
-}
-
-/* Increment the index of a dynamic symbol by a given amount.  Called
-   via elf_link_hash_traverse.  */
-/* XXX hack alert bogus This routine is mostly all junk and almost
-   certainly does the wrong thing.  Its here simply because it does
-   just enough to allow glibc-2.1 ld.so to compile & link.  */
-
-static bfd_boolean
-i370_elf_adjust_dynindx (struct elf_link_hash_entry *h, void * cparg)
-{
-  int *cp = (int *) cparg;
-
-#ifdef DEBUG
-  fprintf (stderr,
-	   "i370_elf_adjust_dynindx called, h->dynindx = %ld, *cp = %d\n",
-	   h->dynindx, *cp);
-#endif
-
-  if (h->dynindx != -1)
-    h->dynindx += *cp;
-
-  return TRUE;
-}
-
-/* Set the sizes of the dynamic sections.  */
-/* XXX hack alert bogus This routine is mostly all junk and almost
-   certainly does the wrong thing.  Its here simply because it does
-   just enough to allow glibc-2.1 ld.so to compile & link.  */
-
-static bfd_boolean
-i370_elf_size_dynamic_sections (bfd *output_bfd,
-				struct bfd_link_info *info)
-{
-  bfd *dynobj;
-  asection *s;
-  bfd_boolean plt;
-  bfd_boolean relocs;
-  bfd_boolean reltext;
-
-#ifdef DEBUG
-  fprintf (stderr, "i370_elf_size_dynamic_sections called\n");
-#endif
-
-  dynobj = elf_hash_table (info)->dynobj;
-  BFD_ASSERT (dynobj != NULL);
-
-  if (elf_hash_table (info)->dynamic_sections_created)
-    {
-      /* Set the contents of the .interp section to the interpreter.  */
-      if (bfd_link_executable (info) && !info->nointerp)
-	{
-	  s = bfd_get_linker_section (dynobj, ".interp");
-	  BFD_ASSERT (s != NULL);
-	  s->size = sizeof ELF_DYNAMIC_INTERPRETER;
-	  s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
-	}
-    }
-  else
-    {
-      /* We may have created entries in the .rela.got, .rela.sdata, and
-	 .rela.sdata2 sections.  However, if we are not creating the
-	 dynamic sections, we will not actually use these entries.  Reset
-	 the size of .rela.got, et al, which will cause it to get
-	 stripped from the output file below.  */
-      static char *rela_sections[] = { ".rela.got", ".rela.sdata",
-				       ".rela.sdata2", ".rela.sbss",
-				       NULL };
-      char **p;
-
-      for (p = rela_sections; *p != NULL; p++)
-	{
-	  s = bfd_get_linker_section (dynobj, *p);
-	  if (s != NULL)
-	    s->size = 0;
-	}
-    }
-
-  /* The check_relocs and adjust_dynamic_symbol entry points have
-     determined the sizes of the various dynamic sections.  Allocate
-     memory for them.  */
-  plt = FALSE;
-  relocs = FALSE;
-  reltext = FALSE;
-  for (s = dynobj->sections; s != NULL; s = s->next)
-    {
-      const char *name;
-
-      if ((s->flags & SEC_LINKER_CREATED) == 0)
-	continue;
-
-      /* It's OK to base decisions on the section name, because none
-	 of the dynobj section names depend upon the input files.  */
-      name = bfd_get_section_name (dynobj, s);
-
-      if (strcmp (name, ".plt") == 0)
-	{
-	  /* Remember whether there is a PLT.  */
-	  plt = s->size != 0;
-	}
-      else if (CONST_STRNEQ (name, ".rela"))
-	{
-	  if (s->size != 0)
-	    {
-	      asection *target;
-	      const char *outname;
-
-	      /* Remember whether there are any relocation sections.  */
-	      relocs = TRUE;
-
-	      /* If this relocation section applies to a read only
-		 section, then we probably need a DT_TEXTREL entry.  */
-	      outname = bfd_get_section_name (output_bfd,
-					      s->output_section);
-	      target = bfd_get_section_by_name (output_bfd, outname + 5);
-	      if (target != NULL
-		  && (target->flags & SEC_READONLY) != 0
-		  && (target->flags & SEC_ALLOC) != 0)
-		reltext = TRUE;
-
-	      /* We use the reloc_count field as a counter if we need
-		 to copy relocs into the output file.  */
-	      s->reloc_count = 0;
-	    }
-	}
-      else if (strcmp (name, ".got") != 0
-	       && strcmp (name, ".sdata") != 0
-	       && strcmp (name, ".sdata2") != 0
-	       && strcmp (name, ".dynbss") != 0
-	       && strcmp (name, ".dynsbss") != 0)
-	{
-	  /* It's not one of our sections, so don't allocate space.  */
-	  continue;
-	}
-
-      if (s->size == 0)
-	{
-	  /* If we don't need this section, strip it from the
-	     output file.  This is mostly to handle .rela.bss and
-	     .rela.plt.  We must create both sections in
-	     create_dynamic_sections, because they must be created
-	     before the linker maps input sections to output
-	     sections.  The linker does that before
-	     adjust_dynamic_symbol is called, and it is that
-	     function which decides whether anything needs to go
-	     into these sections.  */
-	  s->flags |= SEC_EXCLUDE;
-	  continue;
-	}
-
-      if ((s->flags & SEC_HAS_CONTENTS) == 0)
-	continue;
-
-      /* Allocate memory for the section contents.  */
-      s->contents = bfd_zalloc (dynobj, s->size);
-      if (s->contents == NULL)
-	return FALSE;
-    }
-
-  if (elf_hash_table (info)->dynamic_sections_created)
-    {
-      /* Add some entries to the .dynamic section.  We fill in the
-	 values later, in i370_elf_finish_dynamic_sections, but we
-	 must add the entries now so that we get the correct size for
-	 the .dynamic section.  The DT_DEBUG entry is filled in by the
-	 dynamic linker and used by the debugger.  */
-#define add_dynamic_entry(TAG, VAL) \
-  _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
-      if (!bfd_link_pic (info))
-	{
-	  if (!add_dynamic_entry (DT_DEBUG, 0))
-	    return FALSE;
-	}
-
-      if (plt)
-	{
-	  if (!add_dynamic_entry (DT_PLTGOT, 0)
-	      || !add_dynamic_entry (DT_PLTRELSZ, 0)
-	      || !add_dynamic_entry (DT_PLTREL, DT_RELA)
-	      || !add_dynamic_entry (DT_JMPREL, 0))
-	    return FALSE;
-	}
-
-      if (relocs)
-	{
-	  if (!add_dynamic_entry (DT_RELA, 0)
-	      || !add_dynamic_entry (DT_RELASZ, 0)
-	      || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
-	    return FALSE;
-	}
-
-      if (reltext)
-	{
-	  if (!add_dynamic_entry (DT_TEXTREL, 0))
-	    return FALSE;
-	  info->flags |= DF_TEXTREL;
-	}
-    }
-#undef add_dynamic_entry
-
-  /* If we are generating a shared library, we generate a section
-     symbol for each output section.  These are local symbols, which
-     means that they must come first in the dynamic symbol table.
-     That means we must increment the dynamic symbol index of every
-     other dynamic symbol.
-
-     FIXME: We assume that there will never be relocations to
-     locations in linker-created sections that do not have
-     externally-visible names. Instead, we should work out precisely
-     which sections relocations are targeted at.  */
-  if (bfd_link_pic (info))
-    {
-      int c;
-
-      for (c = 0, s = output_bfd->sections; s != NULL; s = s->next)
-	{
-	  if ((s->flags & SEC_LINKER_CREATED) != 0
-	      || (s->flags & SEC_ALLOC) == 0)
-	    {
-	      elf_section_data (s)->dynindx = -1;
-	      continue;
-	    }
-
-	  /* These symbols will have no names, so we don't need to
-	     fiddle with dynstr_index.  */
-
-	  elf_section_data (s)->dynindx = c + 1;
-
-	  c++;
-	}
-
-      elf_link_hash_traverse (elf_hash_table (info),
-			      i370_elf_adjust_dynindx, & c);
-      elf_hash_table (info)->dynsymcount += c;
-    }
-
-  return TRUE;
-}
-
-/* Look through the relocs for a section during the first phase, and
-   allocate space in the global offset table or procedure linkage
-   table.  */
-/* XXX hack alert bogus This routine is mostly all junk and almost
-   certainly does the wrong thing.  Its here simply because it does
-   just enough to allow glibc-2.1 ld.so to compile & link.  */
-
-static bfd_boolean
-i370_elf_check_relocs (bfd *abfd,
-		       struct bfd_link_info *info,
-		       asection *sec,
-		       const Elf_Internal_Rela *relocs)
-{
-  bfd *dynobj;
-  Elf_Internal_Shdr *symtab_hdr;
-  struct elf_link_hash_entry **sym_hashes;
-  const Elf_Internal_Rela *rel;
-  const Elf_Internal_Rela *rel_end;
-  asection *sreloc;
-
-  if (bfd_link_relocatable (info))
-    return TRUE;
-
-#ifdef DEBUG
-  _bfd_error_handler ("i370_elf_check_relocs called for section %pA in %pB",
-		      sec, abfd);
-#endif
-
-  dynobj = elf_hash_table (info)->dynobj;
-  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-  sym_hashes = elf_sym_hashes (abfd);
-
-  sreloc = NULL;
-
-  rel_end = relocs + sec->reloc_count;
-  for (rel = relocs; rel < rel_end; rel++)
-    {
-      unsigned long r_symndx;
-      struct elf_link_hash_entry *h;
-
-      r_symndx = ELF32_R_SYM (rel->r_info);
-      if (r_symndx < symtab_hdr->sh_info)
-	h = NULL;
-      else
-	{
-	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-	  while (h->root.type == bfd_link_hash_indirect
-		 || h->root.type == bfd_link_hash_warning)
-	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-	}
-
-      if (bfd_link_pic (info))
-	{
-#ifdef DEBUG
-	  fprintf (stderr,
-		   "i370_elf_check_relocs needs to create relocation for %s\n",
-		   (h && h->root.root.string)
-		   ? h->root.root.string : "<unknown>");
-#endif
-	  if (sreloc == NULL)
-	    {
-	      sreloc = _bfd_elf_make_dynamic_reloc_section
-		(sec, dynobj, 2, abfd, /*rela?*/ TRUE);
-
-	      if (sreloc == NULL)
-		return FALSE;
-	    }
-
-	  sreloc->size += sizeof (Elf32_External_Rela);
-
-	  /* FIXME: We should here do what the m68k and i386
-	     backends do: if the reloc is pc-relative, record it
-	     in case it turns out that the reloc is unnecessary
-	     because the symbol is forced local by versioning or
-	     we are linking with -Bdynamic.  Fortunately this
-	     case is not frequent.  */
-	}
-    }
-
-  return TRUE;
-}
-
-/* Finish up the dynamic sections.  */
-/* XXX hack alert bogus This routine is mostly all junk and almost
-   certainly does the wrong thing.  Its here simply because it does
-   just enough to allow glibc-2.1 ld.so to compile & link.  */
-
-static bfd_boolean
-i370_elf_finish_dynamic_sections (bfd *output_bfd,
-				  struct bfd_link_info *info)
-{
-  asection *sdyn;
-  bfd *dynobj = elf_hash_table (info)->dynobj;
-  asection *sgot = elf_hash_table (info)->sgot;
-
-#ifdef DEBUG
-  fprintf (stderr, "i370_elf_finish_dynamic_sections called\n");
-#endif
-
-  sdyn = bfd_get_linker_section (dynobj, ".dynamic");
-
-  if (elf_hash_table (info)->dynamic_sections_created)
-    {
-      asection *splt;
-      Elf32_External_Dyn *dyncon, *dynconend;
-
-      splt = elf_hash_table (info)->splt;
-      BFD_ASSERT (splt != NULL && sdyn != NULL);
-
-      dyncon = (Elf32_External_Dyn *) sdyn->contents;
-      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
-      for (; dyncon < dynconend; dyncon++)
-	{
-	  Elf_Internal_Dyn dyn;
-	  asection *s;
-	  bfd_boolean size;
-
-	  bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
-
-	  switch (dyn.d_tag)
-	    {
-	    case DT_PLTGOT:
-	      s = elf_hash_table (info)->splt;
-	      size = FALSE;
-	      break;
-	    case DT_PLTRELSZ:
-	      s = elf_hash_table (info)->srelplt;
-	      size = TRUE;
-	      break;
-	    case DT_JMPREL:
-	      s = elf_hash_table (info)->srelplt;
-	      size = FALSE;
-	      break;
-	    default:
-	      continue;
-	    }
-
-	  if (s == NULL)
-	    dyn.d_un.d_val = 0;
-	  else
-	    {
-	      if (!size)
-		dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
-	      else
-		dyn.d_un.d_val = s->size;
-	    }
-	  bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
-	}
-    }
-
-  if (sgot && sgot->size != 0)
-    {
-      unsigned char *contents = sgot->contents;
-
-      if (sdyn == NULL)
-	bfd_put_32 (output_bfd, (bfd_vma) 0, contents);
-      else
-	bfd_put_32 (output_bfd,
-		    sdyn->output_section->vma + sdyn->output_offset,
-		    contents);
-
-      elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
-    }
-
-  if (bfd_link_pic (info))
-    {
-      asection *sdynsym;
-      asection *s;
-      Elf_Internal_Sym sym;
-      int maxdindx = 0;
-
-      /* Set up the section symbols for the output sections.  */
-
-      sdynsym = bfd_get_linker_section (dynobj, ".dynsym");
-      BFD_ASSERT (sdynsym != NULL);
-
-      sym.st_size = 0;
-      sym.st_name = 0;
-      sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
-      sym.st_other = 0;
-      sym.st_target_internal = 0;
-
-      for (s = output_bfd->sections; s != NULL; s = s->next)
-	{
-	  int indx, dindx;
-	  Elf32_External_Sym *esym;
-
-	  sym.st_value = s->vma;
-
-	  indx = elf_section_data (s)->this_idx;
-	  dindx = elf_section_data (s)->dynindx;
-	  if (dindx != -1)
-	    {
-	      BFD_ASSERT(indx > 0);
-	      BFD_ASSERT(dindx > 0);
-
-	      if (dindx > maxdindx)
-		maxdindx = dindx;
-
-	      sym.st_shndx = indx;
-
-	      esym = (Elf32_External_Sym *) sdynsym->contents + dindx;
-	      bfd_elf32_swap_symbol_out (output_bfd, &sym, esym, NULL);
-	    }
-	}
-
-      /* Set the sh_info field of the output .dynsym section to the
-	 index of the first global symbol.  */
-      elf_section_data (sdynsym->output_section)->this_hdr.sh_info =
-	maxdindx + 1;
-    }
-
-  return TRUE;
-}
-
-/* The RELOCATE_SECTION function is called by the ELF backend linker
-   to handle the relocations for a section.
-
-   The relocs are always passed as Rela structures; if the section
-   actually uses Rel structures, the r_addend field will always be
-   zero.
-
-   This function is responsible for adjust the section contents as
-   necessary, and (if using Rela relocs and generating a
-   relocatable output file) adjusting the reloc addend as
-   necessary.
-
-   This function does not have to worry about setting the reloc
-   address or the reloc symbol index.
-
-   LOCAL_SYMS is a pointer to the swapped in local symbols.
-
-   LOCAL_SECTIONS is an array giving the section in the input file
-   corresponding to the st_shndx field of each local symbol.
-
-   The global hash table entry for the global symbols can be found
-   via elf_sym_hashes (input_bfd).
-
-   When generating relocatable output, this function must handle
-   STB_LOCAL/STT_SECTION symbols specially.  The output symbol is
-   going to be the section symbol corresponding to the output
-   section, which means that the addend must be adjusted
-   accordingly.  */
-
-static bfd_boolean
-i370_elf_relocate_section (bfd *output_bfd,
-			   struct bfd_link_info *info,
-			   bfd *input_bfd,
-			   asection *input_section,
-			   bfd_byte *contents,
-			   Elf_Internal_Rela *relocs,
-			   Elf_Internal_Sym *local_syms,
-			   asection **local_sections)
-{
-  Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
-  struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
-  Elf_Internal_Rela *rel = relocs;
-  Elf_Internal_Rela *relend = relocs + input_section->reloc_count;
-  asection *sreloc = NULL;
-  bfd_boolean ret = TRUE;
-
-#ifdef DEBUG
-  _bfd_error_handler ("i370_elf_relocate_section called for %pB section %pA, %u relocations%s",
-		      input_bfd, input_section,
-		      input_section->reloc_count,
-		      (bfd_link_relocatable (info)) ? " (relocatable)" : "");
-#endif
-
-  if (!i370_elf_howto_table[ R_I370_ADDR31 ])
-    /* Initialize howto table if needed.  */
-    i370_elf_howto_init ();
-
-  for (; rel < relend; rel++)
-    {
-      enum i370_reloc_type r_type    = (enum i370_reloc_type) ELF32_R_TYPE (rel->r_info);
-      bfd_vma offset		     = rel->r_offset;
-      bfd_vma addend		     = rel->r_addend;
-      bfd_reloc_status_type r	     = bfd_reloc_other;
-      Elf_Internal_Sym *sym	     = NULL;
-      asection *sec		     = NULL;
-      struct elf_link_hash_entry * h = NULL;
-      reloc_howto_type *howto;
-      unsigned long r_symndx;
-      bfd_vma relocation;
-
-      /* Unknown relocation handling.  */
-      if ((unsigned) r_type >= (unsigned) R_I370_max
-	  || !i370_elf_howto_table[(int)r_type])
-	{
-	  /* xgettext:c-format */
-	  _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
-			      input_bfd, (int) r_type);
-
-	  bfd_set_error (bfd_error_bad_value);
-	  ret = FALSE;
-	  continue;
-	}
-
-      howto = i370_elf_howto_table[(int) r_type];
-      r_symndx = ELF32_R_SYM (rel->r_info);
-      relocation = 0;
-
-      if (r_symndx < symtab_hdr->sh_info)
-	{
-	  sym = local_syms + r_symndx;
-	  sec = local_sections[r_symndx];
-
-	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, & sec, rel);
-	  addend = rel->r_addend;
-	}
-      else
-	{
-	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
-	  if (info->wrap_hash != NULL
-	      && (input_section->flags & SEC_DEBUGGING) != 0)
-	    h = ((struct elf_link_hash_entry *)
-		 unwrap_hash_lookup (info, input_bfd, &h->root));
-
-	  while (h->root.type == bfd_link_hash_indirect
-		 || h->root.type == bfd_link_hash_warning)
-	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-	  if (h->root.type == bfd_link_hash_defined
-	      || h->root.type == bfd_link_hash_defweak)
-	    {
-	      sec = h->root.u.def.section;
-	      if (bfd_link_pic (info)
-		  && ((! info->symbolic && h->dynindx != -1)
-		      || !h->def_regular)
-		  && (input_section->flags & SEC_ALLOC) != 0
-		  && (r_type == R_I370_ADDR31
-		      || r_type == R_I370_COPY
-		      || r_type == R_I370_ADDR16
-		      || r_type == R_I370_RELATIVE))
-		/* In these cases, we don't need the relocation
-		   value.  We check specially because in some
-		   obscure cases sec->output_section will be NULL.  */
-		;
-	      else
-		relocation = (h->root.u.def.value
-			      + sec->output_section->vma
-			      + sec->output_offset);
-	    }
-	  else if (h->root.type == bfd_link_hash_undefweak)
-	    ;
-	  else if (info->unresolved_syms_in_objects == RM_IGNORE
-		   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
-	    ;
-	  else if (!bfd_link_relocatable (info))
-	    {
-	      (*info->callbacks->undefined_symbol)
-		(info, h->root.root.string, input_bfd,
-		 input_section, rel->r_offset,
-		 (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
-		  || ELF_ST_VISIBILITY (h->other)));
-	      ret = FALSE;
-	      continue;
-	    }
-	}
-
-      if (sec != NULL && discarded_section (sec))
-	RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
-					 rel, 1, relend, howto, 0, contents);
-
-      if (bfd_link_relocatable (info))
-	continue;
-
-      switch ((int) r_type)
-	{
-	default:
-	  _bfd_error_handler
-	    (_("%pB: unsupported relocation type %#x"),
-	     input_bfd, (int) r_type);
-
-	  bfd_set_error (bfd_error_bad_value);
-	  ret = FALSE;
-	  continue;
-
-	case (int) R_I370_NONE:
-	  continue;
-
-	/* Relocations that may need to be propagated if this is a shared
-	   object.  */
-	case (int) R_I370_REL31:
-	  /* If these relocations are not to a named symbol, they can be
-	     handled right here, no need to bother the dynamic linker.  */
-	  if (h == NULL
-	      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
-	    break;
-	/* Fall through.  */
-
-	/* Relocations that always need to be propagated if this is a shared
-	   object.  */
-	case (int) R_I370_ADDR31:
-	case (int) R_I370_ADDR16:
-	  if (bfd_link_pic (info)
-	      && r_symndx != STN_UNDEF)
-	    {
-	      Elf_Internal_Rela outrel;
-	      bfd_byte *loc;
-	      int skip;
-
-#ifdef DEBUG
-	      fprintf (stderr,
-		       "i370_elf_relocate_section needs to create relocation for %s\n",
-		       (h && h->root.root.string) ? h->root.root.string : "<unknown>");
-#endif
-
-	      /* When generating a shared object, these relocations
-		 are copied into the output file to be resolved at run
-		 time.  */
-
-	      if (sreloc == NULL)
-		{
-		  sreloc = _bfd_elf_get_dynamic_reloc_section
-		    (input_bfd, input_section, /*rela?*/ TRUE);
-		  if (sreloc == NULL)
-		    return FALSE;
-		}
-
-	      skip = 0;
-
-	      outrel.r_offset =
-		_bfd_elf_section_offset (output_bfd, info, input_section,
-					 rel->r_offset);
-	      if (outrel.r_offset == (bfd_vma) -1
-		  || outrel.r_offset == (bfd_vma) -2)
-		skip = (int) outrel.r_offset;
-	      outrel.r_offset += (input_section->output_section->vma
-				  + input_section->output_offset);
-
-	      if (skip)
-		memset (&outrel, 0, sizeof outrel);
-	      /* h->dynindx may be -1 if this symbol was marked to
-		 become local.  */
-	      else if (h != NULL
-		       && ((! info->symbolic && h->dynindx != -1)
-			   || !h->def_regular))
-		{
-		  BFD_ASSERT (h->dynindx != -1);
-		  outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
-		  outrel.r_addend = rel->r_addend;
-		}
-	      else
-		{
-		  if (r_type == R_I370_ADDR31)
-		    {
-		      outrel.r_info = ELF32_R_INFO (0, R_I370_RELATIVE);
-		      outrel.r_addend = relocation + rel->r_addend;
-		    }
-		  else
-		    {
-		      long indx;
-
-		      if (bfd_is_abs_section (sec))
-			indx = 0;
-		      else if (sec == NULL || sec->owner == NULL)
-			{
-			  bfd_set_error (bfd_error_bad_value);
-			  return FALSE;
-			}
-		      else
-			{
-			  asection *osec;
-
-			  /* We are turning this relocation into one
-			     against a section symbol.  It would be
-			     proper to subtract the symbol's value,
-			     osec->vma, from the emitted reloc addend,
-			     but ld.so expects buggy relocs.  */
-			  osec = sec->output_section;
-			  indx = elf_section_data (osec)->dynindx;
-			  if (indx == 0)
-			    {
-			      struct elf_link_hash_table *htab;
-			      htab = elf_hash_table (info);
-			      osec = htab->text_index_section;
-			      indx = elf_section_data (osec)->dynindx;
-			    }
-			  BFD_ASSERT (indx != 0);
-#ifdef DEBUG
-			  if (indx <= 0)
-			    {
-			      printf ("indx=%ld section=%s flags=%08x name=%s\n",
-				      indx, osec->name, osec->flags,
-				      h->root.root.string);
-			    }
-#endif
-			}
-
-		      outrel.r_info = ELF32_R_INFO (indx, r_type);
-		      outrel.r_addend = relocation + rel->r_addend;
-		    }
-		}
-
-	      loc = sreloc->contents;
-	      loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
-	      bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
-
-	      /* This reloc will be computed at runtime, so there's no
-		 need to do anything now, unless this is a RELATIVE
-		 reloc in an unallocated section.  */
-	      if (skip == -1
-		  || (input_section->flags & SEC_ALLOC) != 0
-		  || ELF32_R_TYPE (outrel.r_info) != R_I370_RELATIVE)
-		continue;
-	    }
-	  break;
-
-	case (int) R_I370_COPY:
-	case (int) R_I370_RELATIVE:
-	  /* xgettext:c-format */
-	  _bfd_error_handler (_("%pB: %s unsupported"),
-			      input_bfd,
-			      i370_elf_howto_table[(int) r_type]->name);
-	  bfd_set_error (bfd_error_invalid_operation);
-	  ret = FALSE;
-	  continue;
-	}
-
-      r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents,
-				    offset, relocation, addend);
-
-      if (r != bfd_reloc_ok)
-	{
-	  ret = FALSE;
-	  switch (r)
-	    {
-	    default:
-	      break;
-
-	    case bfd_reloc_overflow:
-	      {
-		const char *name;
-
-		if (h != NULL)
-		  name = NULL;
-		else
-		  {
-		    name = bfd_elf_string_from_elf_section (input_bfd,
-							    symtab_hdr->sh_link,
-							    sym->st_name);
-		    if (name == NULL)
-		      break;
-
-		    if (*name == '\0')
-		      name = bfd_section_name (input_bfd, sec);
-		  }
-
-		(*info->callbacks->reloc_overflow) (info,
-						    (h ? &h->root : NULL),
-						    name,
-						    howto->name,
-						    (bfd_vma) 0,
-						    input_bfd,
-						    input_section,
-						    offset);
-	      }
-	      break;
-	    }
-	}
-    }
-
-#ifdef DEBUG
-  fprintf (stderr, "\n");
-#endif
-
-  return ret;
-}
-
-#define TARGET_BIG_SYM		i370_elf32_vec
-#define TARGET_BIG_NAME		"elf32-i370"
-#define ELF_ARCH		bfd_arch_i370
-#define ELF_MACHINE_CODE	EM_S370
-#ifdef EM_I370_OLD
-#define ELF_MACHINE_ALT1	EM_I370_OLD
-#endif
-#define ELF_MAXPAGESIZE		0x1000
-#define ELF_OSABI		ELFOSABI_GNU
-
-#define elf_info_to_howto	i370_elf_info_to_howto
-
-#define elf_backend_plt_not_loaded 1
-#define elf_backend_rela_normal    1
-
-#define bfd_elf32_bfd_reloc_type_lookup		i370_elf_reloc_type_lookup
-#define bfd_elf32_bfd_reloc_name_lookup	i370_elf_reloc_name_lookup
-#define bfd_elf32_bfd_set_private_flags		i370_elf_set_private_flags
-#define bfd_elf32_bfd_merge_private_bfd_data	i370_elf_merge_private_bfd_data
-#define elf_backend_relocate_section		i370_elf_relocate_section
-
-/* Dynamic loader support is mostly broken; just enough here to be able to
-   link glibc's ld.so without errors.  */
-#define elf_backend_create_dynamic_sections	i370_elf_create_dynamic_sections
-#define elf_backend_size_dynamic_sections	i370_elf_size_dynamic_sections
-#define elf_backend_init_index_section		_bfd_elf_init_1_index_section
-#define elf_backend_finish_dynamic_sections	i370_elf_finish_dynamic_sections
-#define elf_backend_fake_sections		i370_elf_fake_sections
-#define elf_backend_section_from_shdr		i370_elf_section_from_shdr
-#define elf_backend_adjust_dynamic_symbol	i370_elf_adjust_dynamic_symbol
-#define elf_backend_check_relocs		i370_elf_check_relocs
-
-static bfd_boolean
-i370_noop (bfd * abfd ATTRIBUTE_UNUSED, ...)
-{
-  return TRUE;
-}
-
-#define elf_backend_finish_dynamic_symbol \
-  (bfd_boolean (*) \
-     (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, \
-      Elf_Internal_Sym *)) i370_noop
-
-#include "elf32-target.h"
diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in
index c79a477..6c6a6d5 100644
--- a/bfd/po/SRC-POTFILES.in
+++ b/bfd/po/SRC-POTFILES.in
@@ -74,7 +74,6 @@ cpu-frv.c
 cpu-ft32.c
 cpu-h8300.c
 cpu-hppa.c
-cpu-i370.c
 cpu-i386.c
 cpu-ia64.c
 cpu-iamcu.c
@@ -179,7 +178,6 @@ elf32-gen.c
 elf32-h8300.c
 elf32-hppa.c
 elf32-hppa.h
-elf32-i370.c
 elf32-i386.c
 elf32-ip2k.c
 elf32-iq2000.c
diff --git a/bfd/targets.c b/bfd/targets.c
index de50da6..b505c97 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -655,7 +655,6 @@ extern const bfd_target hppa_elf32_nbsd_vec;
 extern const bfd_target hppa_elf64_vec;
 extern const bfd_target hppa_elf64_linux_vec;
 extern const bfd_target hppa_som_vec;
-extern const bfd_target i370_elf32_vec;
 extern const bfd_target i386_aout_vec;
 extern const bfd_target i386_aout_bsd_vec;
 extern const bfd_target i386_aout_dynix_vec;
@@ -1067,8 +1066,6 @@ static const bfd_target * const _bfd_target_vector[] =
 #endif
 	&hppa_som_vec,
 
-	&i370_elf32_vec,
-
 	&i386_aout_vec,
 	&i386_aout_bsd_vec,
 #if 0
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e27e99d..27744d6 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,10 @@
 2018-04-16  Alan Modra  <amodra@gmail.com>
 
+	* readelf.c: Remove i370 support.
+	* testsuite/binutils-all/objdump.exp: Likewise.
+
+2018-04-16  Alan Modra  <amodra@gmail.com>
+
 	* testsuite/binutils-all/objcopy.exp: Remove h8500 support.
 	* testsuite/lib/binutils-common.exp: Likewise.
 
diff --git a/binutils/readelf.c b/binutils/readelf.c
index cfd35d2..2031ebe 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -108,7 +108,6 @@
 #include "elf/h8.h"
 #include "elf/hppa.h"
 #include "elf/i386.h"
-#include "elf/i370.h"
 #include "elf/ia64.h"
 #include "elf/ip2k.h"
 #include "elf/lm32.h"
@@ -1426,10 +1425,6 @@ dump_relocations (Filedata *          filedata,
 	  rtype = elf_x86_64_reloc_type (type);
 	  break;
 
-	case EM_S370:
-	  rtype = i370_reloc_type (type);
-	  break;
-
 	case EM_S390_OLD:
 	case EM_S390:
 	  rtype = elf_s390_reloc_type (type);
@@ -12298,8 +12293,6 @@ is_32bit_abs_reloc (Filedata * filedata, unsigned int reloc_type)
       return reloc_type == 1; /* R_RL78_DIR32.  */
     case EM_RX:
       return reloc_type == 1; /* R_RX_DIR32.  */
-    case EM_S370:
-      return reloc_type == 1; /* R_I370_ADDR31.  */
     case EM_S390_OLD:
     case EM_S390:
       return reloc_type == 4; /* R_S390_32.  */
diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp
index ca9473d..6bbe652 100644
--- a/binutils/testsuite/binutils-all/objdump.exp
+++ b/binutils/testsuite/binutils-all/objdump.exp
@@ -278,7 +278,6 @@ if { ![is_elf_format] } then {
 
 if { ![is_elf_format]
      || [istarget "hppa64*-*-hpux*"]
-     || [istarget "i370-*-*"]
      || [istarget "ia64*-*-*"]
      || [istarget "mcore-*-*"]
      || [istarget "moxie-*-*"]
diff --git a/gas/ChangeLog b/gas/ChangeLog
index c776dbd..ed55aa7 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,23 @@
 2018-04-16  Alan Modra  <amodra@gmail.com>
 
+	* Makefile.am: Remove i370 support.
+	* app.c: Likewise.
+	* config/obj-elf.c: Likewise.
+	* configure.tgt: Likewise.
+	* doc/Makefile.am: Likewise.
+	* doc/as.texinfo: Likewise.
+	* testsuite/gas/all/gas.exp: Likewise.
+	* testsuite/gas/elf/warn-2.s: Likewise.
+	* testsuite/gas/lns/lns.exp: Likewise.
+	* config/tc-i370.c: Delete.
+	* config/tc-i370.h: Delete.
+	* doc/c-i370.texi: Delete.
+	* Makefile.in: Regenerate.
+	* doc/Makefile.in: Regenerate.
+	* po/POTFILES.in: Regenerate.
+
+2018-04-16  Alan Modra  <amodra@gmail.com>
+
 	* config/obj-coff.h: Remove h8500 support.
 
 2018-04-16  Alan Modra  <amodra@gmail.com>
diff --git a/gas/Makefile.am b/gas/Makefile.am
index 2b34227..a6d3caa 100644
--- a/gas/Makefile.am
+++ b/gas/Makefile.am
@@ -148,7 +148,6 @@ TARGET_CPU_CFILES = \
 	config/tc-h8300.c \
 	config/tc-hppa.c \
 	config/tc-ia64.c \
-	config/tc-i370.c \
 	config/tc-i386.c \
 	config/tc-ip2k.c \
 	config/tc-iq2000.c \
@@ -223,7 +222,6 @@ TARGET_CPU_HFILES = \
 	config/tc-h8300.h \
 	config/tc-hppa.h \
 	config/tc-ia64.h \
-	config/tc-i370.h \
 	config/tc-i386.h \
 	config/tc-ip2k.h \
 	config/tc-iq2000.h \
diff --git a/gas/Makefile.in b/gas/Makefile.in
index 4683a44..a95f74e 100644
--- a/gas/Makefile.in
+++ b/gas/Makefile.in
@@ -444,7 +444,6 @@ TARGET_CPU_CFILES = \
 	config/tc-h8300.c \
 	config/tc-hppa.c \
 	config/tc-ia64.c \
-	config/tc-i370.c \
 	config/tc-i386.c \
 	config/tc-ip2k.c \
 	config/tc-iq2000.c \
@@ -519,7 +518,6 @@ TARGET_CPU_HFILES = \
 	config/tc-h8300.h \
 	config/tc-hppa.h \
 	config/tc-ia64.h \
-	config/tc-i370.h \
 	config/tc-i386.h \
 	config/tc-ip2k.h \
 	config/tc-iq2000.h \
@@ -875,7 +873,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-ft32.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-h8300.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-hppa.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-i370.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-i386.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-ia64.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-ip2k.Po@am__quote@
@@ -1220,20 +1217,6 @@ tc-ia64.obj: config/tc-ia64.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-ia64.obj `if test -f 'config/tc-ia64.c'; then $(CYGPATH_W) 'config/tc-ia64.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-ia64.c'; fi`
 
-tc-i370.o: config/tc-i370.c
-@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tc-i370.o -MD -MP -MF $(DEPDIR)/tc-i370.Tpo -c -o tc-i370.o `test -f 'config/tc-i370.c' || echo '$(srcdir)/'`config/tc-i370.c
-@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/tc-i370.Tpo $(DEPDIR)/tc-i370.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='config/tc-i370.c' object='tc-i370.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-i370.o `test -f 'config/tc-i370.c' || echo '$(srcdir)/'`config/tc-i370.c
-
-tc-i370.obj: config/tc-i370.c
-@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tc-i370.obj -MD -MP -MF $(DEPDIR)/tc-i370.Tpo -c -o tc-i370.obj `if test -f 'config/tc-i370.c'; then $(CYGPATH_W) 'config/tc-i370.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-i370.c'; fi`
-@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/tc-i370.Tpo $(DEPDIR)/tc-i370.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='config/tc-i370.c' object='tc-i370.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-i370.obj `if test -f 'config/tc-i370.c'; then $(CYGPATH_W) 'config/tc-i370.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-i370.c'; fi`
-
 tc-i386.o: config/tc-i386.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tc-i386.o -MD -MP -MF $(DEPDIR)/tc-i386.Tpo -c -o tc-i386.o `test -f 'config/tc-i386.c' || echo '$(srcdir)/'`config/tc-i386.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/tc-i386.Tpo $(DEPDIR)/tc-i386.Po
diff --git a/gas/app.c b/gas/app.c
index 64541c4..a66ab6a 100644
--- a/gas/app.c
+++ b/gas/app.c
@@ -120,8 +120,7 @@ do_scrub_begin (int m68k_mri ATTRIBUTE_UNUSED)
     {
       lex['"'] = LEX_IS_STRINGQUOTE;
 
-#if ! defined (TC_HPPA) && ! defined (TC_I370)
-      /* I370 uses single-quotes to delimit integer, float constants.  */
+#if ! defined (TC_HPPA)
       lex['\''] = LEX_IS_ONECHAR_QUOTE;
 #endif
 
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index cac3c39..38b79f8 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -48,10 +48,6 @@
 #include "elf/ppc.h"
 #endif
 
-#ifdef TC_I370
-#include "elf/i370.h"
-#endif
-
 #ifdef TC_I386
 #include "elf/x86-64.h"
 #endif
@@ -1019,7 +1015,6 @@ obj_elf_section (int push)
   subsegT new_subsection = -1;
   unsigned int info = 0;
 
-#ifndef TC_I370
   if (flag_mri)
     {
       char mri_type;
@@ -1039,7 +1034,6 @@ obj_elf_section (int push)
 
       return;
     }
-#endif /* ! defined (TC_I370) */
 
   name = obj_elf_section_name ();
   if (name == NULL)
diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c
deleted file mode 100644
index bd24390..0000000
--- a/gas/config/tc-i370.c
+++ /dev/null
@@ -1,2669 +0,0 @@
-/* tc-i370.c -- Assembler for the IBM 360/370/390 instruction set.
-   Loosely based on the ppc files by Linas Vepstas <linas@linas.org> 1998, 99
-   Copyright (C) 1994-2018 Free Software Foundation, Inc.
-   Written by Ian Lance Taylor, Cygnus Support.
-
-   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 3, 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, 51 Franklin Street - Fifth Floor, Boston, MA
-   02110-1301, USA.  */
-
-/* This assembler implements a very hacked version of an elf-like thing
-   that gcc emits (when gcc is suitably hacked).  To make it behave more
-   HLASM-like, try turning on the -M or --mri flag (as there are various
-   similarities between HLASM and the MRI assemblers, such as section
-   names, lack of leading . in pseudo-ops, DC and DS, etc.  */
-
-#include "as.h"
-#include "safe-ctype.h"
-#include "subsegs.h"
-#include "struc-symbol.h"
-
-#include "opcode/i370.h"
-
-#ifdef OBJ_ELF
-#include "elf/i370.h"
-#endif
-
-/* This is the assembler for the System/390 Architecture.  */
-
-/* Tell the main code what the endianness is.  */
-extern int target_big_endian;
-
-
-/* Generic assembler global variables which must be defined by all
-   targets.  */
-
-#ifdef OBJ_ELF
-/* 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
-   usual comment_chars, so that we can switch for Solaris conventions.  */
-static const char i370_eabi_comment_chars[] = "#";
-
-const char *i370_comment_chars = i370_eabi_comment_chars;
-#else
-const char comment_chars[] = "#";
-#endif
-
-/* Characters which start a comment at the beginning of a line.  */
-const char line_comment_chars[] = "#*";
-
-/* Characters which may be used to separate multiple commands on a
-   single line.  */
-const char line_separator_chars[] = ";";
-
-/* Characters which are used to indicate an exponent in a floating
-   point number.  */
-const char EXP_CHARS[] = "eE";
-
-/* Characters which mean that a number is a floating point constant,
-   as in 0d1.0.  */
-const char FLT_CHARS[] = "dD";
-
-void
-md_show_usage (FILE *stream)
-{
-  fprintf (stream, "\
-S/370 options: (these have not yet been tested and may not work) \n\
--u        		ignored\n\
--mregnames        	Allow symbolic names for registers\n\
--mno-regnames        	Do not allow symbolic names for registers\n");
-#ifdef OBJ_ELF
-  fprintf (stream, "\
--mrelocatable        	support for GCC's -mrelocatble option\n\
--mrelocatable-lib       support for GCC's -mrelocatble-lib option\n\
--V        		print assembler version number\n");
-#endif
-}
-
-/* Whether to use user friendly register names.  */
-#define TARGET_REG_NAMES_P TRUE
-
-static bfd_boolean reg_names_p = TARGET_REG_NAMES_P;
-
-
-/* Predefined register names if -mregnames
-   In general, there are lots of them, in an attempt to be compatible
-   with a number of assemblers.  */
-
-/* Structure to hold information about predefined registers.  */
-struct pd_reg
-  {
-    const char *name;
-    int value;
-  };
-
-/* List of registers that are pre-defined:
-
-   Each general register has predefined names of the form:
-   1. r<reg_num> which has the value <reg_num>.
-   2. r.<reg_num> which has the value <reg_num>.
-
-   Each floating point register has predefined names of the form:
-   1. f<reg_num> which has the value <reg_num>.
-   2. f.<reg_num> which has the value <reg_num>.
-
-   There are only four floating point registers, and these are
-   commonly labelled 0,2,4 and 6.  Thus, there is no f1, f3, etc.
-
-   There are individual registers as well:
-   rbase or r.base has the value  3  (base register)
-   rpgt or r.pgt   has the value  4  (page origin table pointer)
-   rarg or r.arg   has the value 11  (argument pointer)
-   rtca or r.tca   has the value 12  (table of contents pointer)
-   rtoc or r.toc   has the value 12  (table of contents pointer)
-   sp or r.sp      has the value 13  (stack pointer)
-   dsa or r.dsa    has the value 13  (stack pointer)
-   lr              has the value 14  (link reg)
-
-   The table is sorted. Suitable for searching by a binary search.  */
-
-static const struct pd_reg pre_defined_registers[] =
-{
-  { "arg", 11 },   /* Argument Pointer.  */
-  { "base", 3 },   /* Base Reg.  */
-
-  { "f.0", 0 },    /* Floating point registers.  */
-  { "f.2", 2 },
-  { "f.4", 4 },
-  { "f.6", 6 },
-
-  { "f0", 0 },
-  { "f2", 2 },
-  { "f4", 4 },
-  { "f6", 6 },
-
-  { "dsa",13 },    /* Stack pointer.  */
-  { "lr", 14 },    /* Link Register.  */
-  { "pgt", 4 },    /* Page Origin Table Pointer.  */
-
-  { "r.0", 0 },    /* General Purpose Registers.  */
-  { "r.1", 1 },
-  { "r.10", 10 },
-  { "r.11", 11 },
-  { "r.12", 12 },
-  { "r.13", 13 },
-  { "r.14", 14 },
-  { "r.15", 15 },
-  { "r.2", 2 },
-  { "r.3", 3 },
-  { "r.4", 4 },
-  { "r.5", 5 },
-  { "r.6", 6 },
-  { "r.7", 7 },
-  { "r.8", 8 },
-  { "r.9", 9 },
-
-  { "r.arg", 11 },  /* Argument Pointer.  */
-  { "r.base", 3 },  /* Base Reg.  */
-  { "r.dsa", 13 },  /* Stack Pointer.  */
-  { "r.pgt", 4 },   /* Page Origin Table Pointer.  */
-  { "r.sp", 13 },   /* Stack Pointer.  */
-
-  { "r.tca", 12 },  /* Pointer to the table of contents.  */
-  { "r.toc", 12 },  /* Pointer to the table of contents.  */
-
-  { "r0", 0 },      /* More general purpose registers.  */
-  { "r1", 1 },
-  { "r10", 10 },
-  { "r11", 11 },
-  { "r12", 12 },
-  { "r13", 13 },
-  { "r14", 14 },
-  { "r15", 15 },
-  { "r2", 2 },
-  { "r3", 3 },
-  { "r4", 4 },
-  { "r5", 5 },
-  { "r6", 6 },
-  { "r7", 7 },
-  { "r8", 8 },
-  { "r9", 9 },
-
-  { "rbase", 3 },  /* Base Reg.  */
-
-  { "rtca", 12 },  /* Pointer to the table of contents.  */
-  { "rtoc", 12 },  /* Pointer to the table of contents.  */
-
-  { "sp", 13 },   /* Stack Pointer.  */
-
-};
-
-#define REG_NAME_CNT        (sizeof (pre_defined_registers) / sizeof (struct pd_reg))
-
-/* Given NAME, find the register number associated with that name, return
-   the integer value associated with the given name or -1 on failure.  */
-
-static int
-reg_name_search (const struct pd_reg *regs,
-		 int regcount,
-		 const char *name)
-{
-  int middle, low, high;
-  int cmp;
-
-  low = 0;
-  high = regcount - 1;
-
-  do
-    {
-      middle = (low + high) / 2;
-      cmp = strcasecmp (name, regs[middle].name);
-      if (cmp < 0)
-        high = middle - 1;
-      else if (cmp > 0)
-        low = middle + 1;
-      else
-        return regs[middle].value;
-    }
-  while (low <= high);
-
-  return -1;
-}
-
-/* Summary of register_name().
-
-   in:        Input_line_pointer points to 1st char of operand.
-
-   out:        An expressionS.
-        The operand may have been a register: in this case, X_op == O_register,
-        X_add_number is set to the register number, and truth is returned.
-          Input_line_pointer->(next non-blank) char after operand, or is in its
-        original state.  */
-
-static bfd_boolean
-register_name (expressionS *expressionP)
-{
-  int reg_number;
-  char *name;
-  char *start;
-  char c;
-
-  /* Find the spelling of the operand.  */
-  start = name = input_line_pointer;
-  if (name[0] == '%' && ISALPHA (name[1]))
-    name = ++input_line_pointer;
-
-  else if (!reg_names_p)
-    return FALSE;
-
-  while (' ' == *name)
-    name = ++input_line_pointer;
-
-  /* If it's a number, treat it as a number.  If it's alpha, look to
-     see if it's in the register table.  */
-  if (!ISALPHA (name[0]))
-    reg_number = get_single_number ();
-  else
-    {
-      c = get_symbol_name (&name);
-      reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name);
-
-      /* Put back the delimiting char.  */
-      (void) restore_line_pointer (c);
-    }
-
-  /* If numeric, make sure it's not out of bounds.  */
-  if ((0 <= reg_number) && (16 >= reg_number))
-    {
-      expressionP->X_op = O_register;
-      expressionP->X_add_number = reg_number;
-
-      /* Make the rest nice.  */
-      expressionP->X_add_symbol = NULL;
-      expressionP->X_op_symbol = NULL;
-      return TRUE;
-    }
-
-  /* Reset the line as if we had not done anything.  */
-  input_line_pointer = start;
-  return FALSE;
-}
-
-/* Local variables.  */
-
-/* The type of processor we are assembling for.  This is one or more
-   of the I370_OPCODE flags defined in opcode/i370.h.  */
-static int i370_cpu = 0;
-
-/* The base register to use for opcode with optional operands.
-   We define two of these: "text" and "other".  Normally, "text"
-   would get used in the .text section for branches, while "other"
-   gets used in the .data section for address constants.
-
-   The idea of a second base register in a different section
-   is foreign to the usual HLASM-style semantics; however, it
-   allows us to provide support for dynamically loaded libraries,
-   by allowing us to place address constants in a section other
-   than the text section. The "other" section need not be the
-   .data section, it can be any section that isn't the .text section.
-
-   Note that HLASM defines a multiple, concurrent .using semantic
-   that we do not: in calculating offsets, it uses either the most
-   recent .using directive, or the one with the smallest displacement.
-   This allows HLASM to support a quasi-block-scope-like behaviour.
-   Handy for people writing assembly by hand ... but not supported
-   by us.  */
-static int i370_using_text_regno = -1;
-static int i370_using_other_regno = -1;
-
-/* The base address for address literals.  */
-static expressionS i370_using_text_baseaddr;
-static expressionS i370_using_other_baseaddr;
-
-/* the "other" section, used only for syntax error detection.  */
-static segT i370_other_section = undefined_section;
-
-/* Opcode hash table.  */
-static struct hash_control *i370_hash;
-
-/* Macro hash table.  */
-static struct hash_control *i370_macro_hash;
-
-#ifdef OBJ_ELF
-/* What type of shared library support to use.  */
-static enum { SHLIB_NONE, SHLIB_PIC, SHILB_MRELOCATABLE } shlib = SHLIB_NONE;
-#endif
-
-/* Flags to set in the elf header.  */
-static flagword i370_flags = 0;
-
-#ifndef WORKING_DOT_WORD
-int md_short_jump_size = 4;
-int md_long_jump_size = 4;
-#endif
-
-#ifdef OBJ_ELF
-const char *md_shortopts = "l:um:K:VQ:";
-#else
-const char *md_shortopts = "um:";
-#endif
-struct option md_longopts[] =
-{
-  {NULL, no_argument, NULL, 0}
-};
-size_t md_longopts_size = sizeof (md_longopts);
-
-int
-md_parse_option (int c, const char *arg)
-{
-  switch (c)
-    {
-    case 'u':
-      /* -u means that any undefined symbols should be treated as
-         external, which is the default for gas anyhow.  */
-      break;
-
-#ifdef OBJ_ELF
-    case 'K':
-      /* Recognize -K PIC */
-      if (strcmp (arg, "PIC") == 0 || strcmp (arg, "pic") == 0)
-        {
-          shlib = SHLIB_PIC;
-          i370_flags |= EF_I370_RELOCATABLE_LIB;
-        }
-      else
-        return 0;
-
-      break;
-#endif
-
-    case 'm':
-
-      /* -m360 mean to assemble for the ancient 360 architecture.  */
-      if (strcmp (arg, "360") == 0 || strcmp (arg, "i360") == 0)
-	i370_cpu = I370_OPCODE_360;
-      /* -mxa means to assemble for the IBM 370 XA.  */
-      else if (strcmp (arg, "xa") == 0)
-	i370_cpu = I370_OPCODE_370_XA;
-      /* -many means to assemble for any architecture (370/XA).  */
-      else if (strcmp (arg, "any") == 0)
-	i370_cpu = I370_OPCODE_370;
-
-      else if (strcmp (arg, "regnames") == 0)
-	reg_names_p = TRUE;
-
-      else if (strcmp (arg, "no-regnames") == 0)
-	reg_names_p = FALSE;
-
-#ifdef OBJ_ELF
-      /* -mrelocatable/-mrelocatable-lib -- warn about
-	 initializations that require relocation.  */
-      else if (strcmp (arg, "relocatable") == 0)
-        {
-          shlib = SHILB_MRELOCATABLE;
-          i370_flags |= EF_I370_RELOCATABLE;
-        }
-      else if (strcmp (arg, "relocatable-lib") == 0)
-        {
-          shlib = SHILB_MRELOCATABLE;
-          i370_flags |= EF_I370_RELOCATABLE_LIB;
-        }
-#endif
-      else
-        {
-          as_bad (_("invalid switch -m%s"), arg);
-          return 0;
-        }
-      break;
-
-#ifdef OBJ_ELF
-      /* -V: SVR4 argument to print version ID.  */
-    case 'V':
-      print_version_id ();
-      break;
-
-      /* -Qy, -Qn: SVR4 arguments controlling whether a .comment section
-         should be emitted or not.  FIXME: Not implemented.  */
-    case 'Q':
-      break;
-
-#endif
-
-    default:
-      return 0;
-    }
-
-  return 1;
-}
-
-
-/* Set i370_cpu if it is not already set.
-   Currently defaults to the reasonable superset;
-   but can be made more fine grained if desired.  */
-
-static void
-i370_set_cpu (void)
-{
-  const char *default_os  = TARGET_OS;
-  const char *default_cpu = TARGET_CPU;
-
-  /* Override with the superset for the moment.  */
-  i370_cpu = I370_OPCODE_ESA390_SUPERSET;
-  if (i370_cpu == 0)
-    {
-      if (strcmp (default_cpu, "i360") == 0)
-        i370_cpu = I370_OPCODE_360;
-      else if (strcmp (default_cpu, "i370") == 0)
-        i370_cpu = I370_OPCODE_370;
-      else if (strcmp (default_cpu, "XA") == 0)
-        i370_cpu = I370_OPCODE_370_XA;
-      else
-        as_fatal ("Unknown default cpu = %s, os = %s", default_cpu, default_os);
-    }
-}
-
-/* Figure out the BFD architecture to use.
-   FIXME: specify the different 370 architectures.  */
-
-enum bfd_architecture
-i370_arch (void)
-{
-   return bfd_arch_i370;
-}
-
-/* This function is called when the assembler starts up.  It is called
-   after the options have been parsed and the output file has been
-   opened.  */
-
-void
-md_begin (void)
-{
-  const struct i370_opcode *op;
-  const struct i370_opcode *op_end;
-  const struct i370_macro *macro;
-  const struct i370_macro *macro_end;
-  bfd_boolean dup_insn = FALSE;
-
-  i370_set_cpu ();
-
-#ifdef OBJ_ELF
-  /* Set the ELF flags if desired.  */
-  if (i370_flags)
-    bfd_set_private_flags (stdoutput, i370_flags);
-#endif
-
-  /* Insert the opcodes into a hash table.  */
-  i370_hash = hash_new ();
-
-   op_end = i370_opcodes + i370_num_opcodes;
-   for (op = i370_opcodes; op < op_end; op++)
-     {
-       know ((op->opcode.i[0] & op->mask.i[0]) == op->opcode.i[0]
-	     && (op->opcode.i[1] & op->mask.i[1]) == op->opcode.i[1]);
-
-       if ((op->flags & i370_cpu) != 0)
-         {
-           const char *retval;
-
-           retval = hash_insert (i370_hash, op->name, (void *) op);
-           if (retval != (const char *) NULL)
-             {
-               as_bad (_("Internal assembler error for instruction %s"), op->name);
-               dup_insn = TRUE;
-             }
-         }
-     }
-
-  /* Insert the macros into a hash table.  */
-  i370_macro_hash = hash_new ();
-
-  macro_end = i370_macros + i370_num_macros;
-  for (macro = i370_macros; macro < macro_end; macro++)
-    {
-      if ((macro->flags & i370_cpu) != 0)
-        {
-          const char *retval;
-
-          retval = hash_insert (i370_macro_hash, macro->name, (void *) macro);
-          if (retval != (const char *) NULL)
-            {
-              as_bad (_("Internal assembler error for macro %s"), macro->name);
-              dup_insn = TRUE;
-            }
-        }
-    }
-
-  if (dup_insn)
-    abort ();
-}
-
-/* Insert an operand value into an instruction.  */
-
-static i370_insn_t
-i370_insert_operand (i370_insn_t insn,
-		     const struct i370_operand *operand,
-		     offsetT val)
-{
-  if (operand->insert)
-    {
-      const char *errmsg;
-
-      /* Used for 48-bit insn's.  */
-      errmsg = NULL;
-      insn = (*operand->insert) (insn, (long) val, &errmsg);
-      if (errmsg)
-        as_bad ("%s", errmsg);
-    }
-  else
-    /* This is used only for 16, 32 bit insn's.  */
-    insn.i[0] |= (((long) val & ((1 << operand->bits) - 1))
-		  << operand->shift);
-
-  return insn;
-}
-
-
-#ifdef OBJ_ELF
-/* Parse @got, etc. and return the desired relocation.
-   Currently, i370 does not support (don't really need to support) any
-   of these fancier markups ... for example, no one is going to
-   write 'L 6,=V(bogus)@got' it just doesn't make sense (at least to me).
-   So basically, we could get away with this routine returning
-   BFD_RELOC_UNUSED in all circumstances.  However, I'll leave
-   in for now in case someone ambitious finds a good use for this stuff ...
-   this routine was pretty much just copied from the powerpc code ...  */
-
-static bfd_reloc_code_real_type
-i370_elf_suffix (char **str_p, expressionS *exp_p)
-{
-  struct map_bfd
-  {
-    const char *string;
-    int length;
-    bfd_reloc_code_real_type reloc;
-  };
-
-  char ident[20];
-  char *str = *str_p;
-  char *str2;
-  int ch;
-  int len;
-  struct map_bfd *ptr;
-
-#define MAP(str,reloc) { str, sizeof (str) - 1, reloc }
-
-  static struct map_bfd mapping[] =
-  {
-    /* warnings with -mrelocatable.  */
-    MAP ("fixup",	BFD_RELOC_CTOR),
-    { (char *)0, 0,	BFD_RELOC_UNUSED }
-  };
-
-  if (*str++ != '@')
-    return BFD_RELOC_UNUSED;
-
-  for (ch = *str, str2 = ident;
-       (str2 < ident + sizeof (ident) - 1
-        && (ISALNUM (ch) || ch == '@'));
-       ch = *++str)
-    *str2++ = TOLOWER (ch);
-
-  *str2 = '\0';
-  len = str2 - ident;
-
-  ch = ident[0];
-  for (ptr = &mapping[0]; ptr->length > 0; ptr++)
-    if (ch == ptr->string[0]
-        && len == ptr->length
-        && memcmp (ident, ptr->string, ptr->length) == 0)
-      {
-        if (exp_p->X_add_number != 0
-            && (ptr->reloc == BFD_RELOC_16_GOTOFF
-        	|| ptr->reloc == BFD_RELOC_LO16_GOTOFF
-        	|| ptr->reloc == BFD_RELOC_HI16_GOTOFF
-        	|| ptr->reloc == BFD_RELOC_HI16_S_GOTOFF))
-          as_warn (_("identifier+constant@got means identifier@got+constant"));
-
-        /* Now check for identifier@suffix+constant */
-        if (*str == '-' || *str == '+')
-          {
-            char *orig_line = input_line_pointer;
-            expressionS new_exp;
-
-            input_line_pointer = str;
-            expression (&new_exp);
-            if (new_exp.X_op == O_constant)
-              {
-        	exp_p->X_add_number += new_exp.X_add_number;
-        	str = input_line_pointer;
-              }
-
-            if (&input_line_pointer != str_p)
-              input_line_pointer = orig_line;
-          }
-
-        *str_p = str;
-        return ptr->reloc;
-      }
-
-  return BFD_RELOC_UNUSED;
-}
-
-/* Like normal .long/.short/.word, except support @got, etc.
-   Clobbers input_line_pointer, checks end-of-line.  */
-
-static void
-i370_elf_cons (int nbytes)   /* 1=.byte, 2=.word, 4=.long.  */
-{
-  expressionS exp;
-  bfd_reloc_code_real_type reloc;
-
-  if (is_it_end_of_statement ())
-    {
-      demand_empty_rest_of_line ();
-      return;
-    }
-
-  do
-    {
-      expression (&exp);
-
-      if (exp.X_op == O_symbol
-          && *input_line_pointer == '@'
-          && (reloc = i370_elf_suffix (&input_line_pointer, &exp)) != BFD_RELOC_UNUSED)
-        {
-          reloc_howto_type *reloc_howto = bfd_reloc_type_lookup (stdoutput, reloc);
-          int size = bfd_get_reloc_size (reloc_howto);
-
-          if (size > nbytes)
-	    as_bad (ngettext ("%s relocations do not fit in %u byte",
-			      "%s relocations do not fit in %u bytes",
-			      nbytes),
-		    reloc_howto->name, nbytes);
-          else
-            {
-              char *p = frag_more ((int) nbytes);
-              int offset = nbytes - size;
-
-              fix_new_exp (frag_now, p - frag_now->fr_literal + offset, size, &exp, 0, reloc);
-            }
-        }
-      else
-        emit_expr (&exp, (unsigned int) nbytes);
-    }
-  while (*input_line_pointer++ == ',');
-
-  input_line_pointer--;        	/* Put terminator back into stream.  */
-  demand_empty_rest_of_line ();
-}
-
-
-/* ASCII to EBCDIC conversion table.  */
-static unsigned char ascebc[256] =
-{
- /*00  NL    SH    SX    EX    ET    NQ    AK    BL */
-     0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F,
- /*08  BS    HT    LF    VT    FF    CR    SO    SI */
-     0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- /*10  DL    D1    D2    D3    D4    NK    SN    EB */
-     0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26,
- /*18  CN    EM    SB    EC    FS    GS    RS    US */
-     0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F,
- /*20  SP     !     "     #     $     %     &     ' */
-     0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D,
- /*28   (     )     *     +     ,     -    .      / */
-     0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61,
- /*30   0     1     2     3     4     5     6     7 */
-     0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
- /*38   8     9     :     ;     <     =     >     ? */
-     0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F,
- /*40   @     A     B     C     D     E     F     G */
-     0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
- /*48   H     I     J     K     L     M     N     O */
-     0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
- /*50   P     Q     R     S     T     U     V     W */
-     0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6,
- /*58   X     Y     Z     [     \     ]     ^     _ */
-     0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D,
- /*60   `     a     b     c     d     e     f     g */
-     0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- /*68   h     i     j     k     l     m     n     o */
-     0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
- /*70   p     q     r     s     t     u     v     w */
-     0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
- /*78   x     y     z     {     |     }     ~    DL */
-     0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF
-};
-
-/* EBCDIC to ASCII conversion table.  */
-unsigned char ebcasc[256] =
-{
- /*00  NU    SH    SX    EX    PF    HT    LC    DL */
-     0x00, 0x01, 0x02, 0x03, 0x00, 0x09, 0x00, 0x7F,
- /*08              SM    VT    FF    CR    SO    SI */
-     0x00, 0x00, 0x00, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- /*10  DE    D1    D2    TM    RS    NL    BS    IL */
-     0x10, 0x11, 0x12, 0x13, 0x14, 0x0A, 0x08, 0x00,
- /*18  CN    EM    CC    C1    FS    GS    RS    US */
-     0x18, 0x19, 0x00, 0x00, 0x1C, 0x1D, 0x1E, 0x1F,
- /*20  DS    SS    FS          BP    LF    EB    EC */
-     0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x17, 0x1B,
- /*28              SM    C2    EQ    AK    BL       */
-     0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x07, 0x00,
- /*30              SY          PN    RS    UC    ET */
-     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
- /*38                    C3    D4    NK          SU */
-     0x00, 0x00, 0x00, 0x00, 0x14, 0x15, 0x00, 0x1A,
- /*40  SP                                           */
-     0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*48                     .     <     (     +     | */
-     0x00, 0x00, 0x00, 0x2E, 0x3C, 0x28, 0x2B, 0x7C,
- /*50   &                                           */
-     0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*58               !     $     *     )     ;     ^ */
-     0x00, 0x00, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E,
- /*60   -     /                                     */
-     0x2D, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*68                     ,     %     _     >     ? */
-     0x00, 0x00, 0x00, 0x2C, 0x25, 0x5F, 0x3E, 0x3F,
- /*70                                               */
-     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*78         `     :     #     @     '     =     " */
-     0x00, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22,
- /*80         a     b     c     d     e     f     g */
-     0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- /*88   h     i           {                         */
-     0x68, 0x69, 0x00, 0x7B, 0x00, 0x00, 0x00, 0x00,
- /*90         j     k     l     m     n     o     p */
-     0x00, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70,
- /*98   q     r           }                         */
-     0x71, 0x72, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x00,
- /*A0         ~     s     t     u     v     w     x */
-     0x00, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
- /*A8   y     z                       [             */
-     0x79, 0x7A, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00,
- /*B0                                               */
-     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*B8                                 ]             */
-     0x00, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00,
- /*C0   {     A     B     C     D     E     F     G */
-     0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- /*C8   H     I                                     */
-     0x48, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*D0   }     J     K     L     M     N     O     P */
-     0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
- /*D8   Q     R                                     */
-     0x51, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*E0   \           S     T     U     V     W     X */
-     0x5C, 0x00, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- /*E8   Y     Z                                     */
-     0x59, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*F0   0     1     2     3     4     5     6     7 */
-     0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- /*F8   8     9                                     */
-     0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF
-};
-
-/* EBCDIC translation tables needed for 3270 support.  */
-
-static void
-i370_ebcdic (int unused ATTRIBUTE_UNUSED)
-{
-  char *p, *end;
-  char delim = 0;
-  size_t nbytes;
-
-  nbytes = strlen (input_line_pointer);
-  end = input_line_pointer + nbytes;
-  while ('\r' == *end) end --;
-  while ('\n' == *end) end --;
-
-  delim = *input_line_pointer;
-  if (('\'' == delim) || ('\"' == delim))
-    {
-      input_line_pointer ++;
-      end = rindex (input_line_pointer, delim);
-    }
-
-  if (end > input_line_pointer)
-    {
-      nbytes = end - input_line_pointer +1;
-      p = frag_more (nbytes);
-      while (end > input_line_pointer)
-	{
-	  *p = ascebc [(unsigned char) (*input_line_pointer)];
-	  ++p; ++input_line_pointer;
-	}
-      *p = '\0';
-    }
-  if (delim == *input_line_pointer) ++input_line_pointer;
-}
-
-
-/* Stub out a couple of routines.  */
-
-static void
-i370_rmode (int unused ATTRIBUTE_UNUSED)
-{
-  as_tsktsk ("rmode ignored");
-}
-
-static void
-i370_dsect (int sect)
-{
-  char *save_line = input_line_pointer;
-  static char section[] = ".data\n";
-
-  /* Just pretend this is .section .data.  */
-  input_line_pointer = section;
-  obj_elf_section (sect);
-
-  input_line_pointer = save_line;
-}
-
-static void
-i370_csect (int unused ATTRIBUTE_UNUSED)
-{
-  as_tsktsk ("csect not supported");
-}
-
-
-/* DC Define Const  is only partially supported.
-   For sample code on what to do, look at i370_elf_cons() above.
-   This code handles pseudoops of the style
-   DC   D'3.141592653'   # in sysv4, .double 3.14159265
-   DC   F'1'             # in sysv4, .long   1.  */
-
-static void
-i370_dc (int unused ATTRIBUTE_UNUSED)
-{
-  char * p, tmp[50];
-  int nbytes=0;
-  expressionS exp;
-  char type=0;
-  char * clse;
-
-  if (is_it_end_of_statement ())
-    {
-      demand_empty_rest_of_line ();
-      return;
-    }
-
-  /* Figure out the size.  */
-  type = *input_line_pointer++;
-  switch (type)
-    {
-    case 'H':  /* 16-bit */
-      nbytes = 2;
-      break;
-    case 'E':  /* 32-bit */
-    case 'F':  /* 32-bit */
-      nbytes = 4;
-      break;
-    case 'D':  /* 64-bit */
-      nbytes = 8;
-      break;
-    default:
-      as_bad (_("unsupported DC type"));
-      return;
-    }
-
-  /* Get rid of pesky quotes.  */
-  if ('\'' == *input_line_pointer)
-    {
-      ++input_line_pointer;
-      clse = strchr (input_line_pointer, '\'');
-      if (clse)
-	*clse= ' ';
-      else
-	as_bad (_("missing end-quote"));
-    }
-
-  if ('\"' == *input_line_pointer)
-    {
-      ++input_line_pointer;
-      clse = strchr (input_line_pointer, '\"');
-      if (clse)
-	*clse= ' ';
-      else
-	as_bad (_("missing end-quote"));
-    }
-
-  switch (type)
-    {
-    case 'H':  /* 16-bit */
-    case 'F':  /* 32-bit */
-      expression (&exp);
-      emit_expr (&exp, nbytes);
-      break;
-    case 'E':  /* 32-bit */
-      type = 'f';
-      /* Fall through.  */
-    case 'D':  /* 64-bit */
-      md_atof (type, tmp, &nbytes);
-      p = frag_more (nbytes);
-      memcpy (p, tmp, nbytes);
-      break;
-    default:
-      as_bad (_("unsupported DC type"));
-      return;
-    }
-
-  demand_empty_rest_of_line ();
-}
-
-
-/* Provide minimal support for DS Define Storage.  */
-
-static void
-i370_ds (int unused ATTRIBUTE_UNUSED)
-{
-  /* DS 0H or DS 0F or DS 0D.  */
-  if ('0' == *input_line_pointer)
-    {
-      int alignment = 0;  /* Left shift 1 << align.  */
-      input_line_pointer ++;
-      switch (*input_line_pointer++)
-	{
-	case 'H':  /* 16-bit */
-	  alignment = 1;
-	  break;
-	case 'F':  /* 32-bit */
-	  alignment = 2;
-	  break;
-	case 'D':  /* 64-bit */
-	  alignment = 3;
-	  break;
-	default:
-	  as_bad (_("unsupported alignment"));
-	  return;
-	}
-      frag_align (alignment, 0, 0);
-      record_alignment (now_seg, alignment);
-    }
-  else
-    as_bad (_("this DS form not yet supported"));
-}
-
-/* Solaris pseudo op to change to the .rodata section.  */
-
-static void
-i370_elf_rdata (int sect)
-{
-  char *save_line = input_line_pointer;
-  static char section[] = ".rodata\n";
-
-  /* Just pretend this is .section .rodata.  */
-  input_line_pointer = section;
-  obj_elf_section (sect);
-
-  input_line_pointer = save_line;
-}
-
-/* Pseudo op to make file scope bss items.  */
-
-static void
-i370_elf_lcomm (int unused ATTRIBUTE_UNUSED)
-{
-  char *name;
-  char c;
-  char *p;
-  offsetT size;
-  symbolS *symbolP;
-  offsetT align;
-  segT old_sec;
-  int old_subsec;
-  char *pfrag;
-  int align2;
-
-  c = get_symbol_name (&name);
-
-  /* Just after name is now '\0'.  */
-  p = input_line_pointer;
-  (void) restore_line_pointer (c);
-  SKIP_WHITESPACE ();
-  if (*input_line_pointer != ',')
-    {
-      as_bad (_("Expected comma after symbol-name: rest of line ignored."));
-      ignore_rest_of_line ();
-      return;
-    }
-
-  /* Skip ','.  */
-  input_line_pointer++;
-  if ((size = get_absolute_expression ()) < 0)
-    {
-      as_warn (_(".COMMon length (%ld.) <0! Ignored."), (long) size);
-      ignore_rest_of_line ();
-      return;
-    }
-
-  /* The third argument to .lcomm is the alignment.  */
-  if (*input_line_pointer != ',')
-    align = 8;
-  else
-    {
-      ++input_line_pointer;
-      align = get_absolute_expression ();
-      if (align <= 0)
-        {
-          as_warn (_("ignoring bad alignment"));
-          align = 8;
-        }
-    }
-
-  *p = 0;
-  symbolP = symbol_find_or_make (name);
-  *p = c;
-
-  if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP))
-    {
-      as_bad (_("Ignoring attempt to re-define symbol `%s'."),
-              S_GET_NAME (symbolP));
-      ignore_rest_of_line ();
-      return;
-    }
-
-  if (S_GET_VALUE (symbolP) && S_GET_VALUE (symbolP) != (valueT) size)
-    {
-      as_bad (_("Length of .lcomm \"%s\" is already %ld. Not changed to %ld."),
-              S_GET_NAME (symbolP),
-              (long) S_GET_VALUE (symbolP),
-              (long) size);
-
-      ignore_rest_of_line ();
-      return;
-    }
-
-  /* Allocate_bss:  */
-  old_sec = now_seg;
-  old_subsec = now_subseg;
-  if (align)
-    {
-      /* Convert to a power of 2 alignment.  */
-      for (align2 = 0; (align & 1) == 0; align >>= 1, ++align2)
-	;
-      if (align != 1)
-        {
-          as_bad (_("Common alignment not a power of 2"));
-          ignore_rest_of_line ();
-          return;
-        }
-    }
-  else
-    align2 = 0;
-
-  record_alignment (bss_section, align2);
-  subseg_set (bss_section, 0);
-  if (align2)
-    frag_align (align2, 0, 0);
-  if (S_GET_SEGMENT (symbolP) == bss_section)
-    symbol_get_frag (symbolP)->fr_symbol = 0;
- [...]

[diff truncated at 100000 bytes]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]