[binutils-gdb] Remove sh-symbianelf support

Alan Modra amodra@sourceware.org
Mon Apr 16 06:28:00 GMT 2018


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

commit 4db9937a27496d2f62ac1dde76565809acd4ecde
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Apr 16 15:27:45 2018 +0930

    Remove sh-symbianelf support
    
    bfd/
    	* Makefile.am: Remove sh-symbianelf support.
    	* config.bfd: Likewise.
    	* configure.ac: Likewise.
    	* targets.c: Likewise.
    	* elf32-sh-symbian.c: Delete.
    	* Makefile.in: Regenerate.
    	* configure: Regenerate.
    	* po/SRC-POTFILES.in: Regenerate.
    gas/
    	* config/tc-sh.c: Remove sh-symbianelf support.
    	* config/tc-sh.h: Likewise.
    	* configure.ac: Likewise.
    	* configure.tgt: Likewise.
    	* testsuite/gas/sh/reg-prefix.d: Likewise.
    	* testsuite/gas/sh/sh2a-pic.d: Likewise.
    	* config.in: Regenerate.
    	* configure: Regenerate.
    ld/
    	* Makefile.am: Remove sh-symbianelf support.
    	* configure.tgt: Likewise.
    	* emulparams/shlsymbian.sh: Delete.
    	* scripttempl/elf32sh-symbian.sc: Delete.
    	* Makefile.in: Regenerate.
    	* po/BLD-POTFILES.in: Regenerate.

Diff:
---
 bfd/ChangeLog                     |  11 +
 bfd/Makefile.am                   |   2 -
 bfd/Makefile.in                   |   3 -
 bfd/config.bfd                    |   7 +-
 bfd/configure                     |   1 -
 bfd/configure.ac                  |   1 -
 bfd/elf32-sh-symbian.c            | 615 --------------------------------------
 bfd/po/SRC-POTFILES.in            |   1 -
 bfd/targets.c                     |   2 -
 gas/ChangeLog                     |  11 +
 gas/config.in                     |   3 -
 gas/config/tc-sh.c                |   8 -
 gas/config/tc-sh.h                |   2 -
 gas/configure                     |   6 -
 gas/configure.ac                  |   4 -
 gas/configure.tgt                 |   1 -
 gas/testsuite/gas/sh/reg-prefix.d |   1 -
 gas/testsuite/gas/sh/sh2a-pic.d   |   1 -
 ld/ChangeLog                      |   9 +
 ld/Makefile.am                    |   5 -
 ld/Makefile.in                    |   6 -
 ld/configure.tgt                  |   1 -
 ld/emulparams/shlsymbian.sh       |  19 --
 ld/po/BLD-POTFILES.in             |   1 -
 ld/scripttempl/elf32sh-symbian.sc | 372 -----------------------
 25 files changed, 32 insertions(+), 1061 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 89bcf3d..f6e1e5c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,16 @@
 2018-04-16  Alan Modra  <amodra@gmail.com>
 
+	* Makefile.am: Remove sh-symbianelf support.
+	* config.bfd: Likewise.
+	* configure.ac: Likewise.
+	* targets.c: Likewise.
+	* elf32-sh-symbian.c: Delete.
+	* Makefile.in: Regenerate.
+	* configure: Regenerate.
+	* po/SRC-POTFILES.in: Regenerate.
+
+2018-04-16  Alan Modra  <amodra@gmail.com>
+
 	* Makefile.am: Remove vax-bsd and vax-ultrix support.
 	* config.bfd: Likewise.
 	* configure.ac: Likewise.
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index f9946bd..e250c41 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -348,7 +348,6 @@ BFD32_BACKENDS = \
 	elf32-rl78.lo \
 	elf32-rx.lo \
 	elf32-s390.lo \
-	elf32-sh-symbian.lo \
 	elf32-sh.lo \
 	elf32-sh64-com.lo \
 	elf32-sh64.lo \
@@ -522,7 +521,6 @@ BFD32_BACKENDS_CFILES = \
 	elf32-rl78.c \
 	elf32-rx.c \
 	elf32-s390.c \
-	elf32-sh-symbian.c \
 	elf32-sh.c \
 	elf32-sh64-com.c \
 	elf32-sh64.c \
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 6139e7d..0149d24 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -682,7 +682,6 @@ BFD32_BACKENDS = \
 	elf32-rl78.lo \
 	elf32-rx.lo \
 	elf32-s390.lo \
-	elf32-sh-symbian.lo \
 	elf32-sh.lo \
 	elf32-sh64-com.lo \
 	elf32-sh64.lo \
@@ -856,7 +855,6 @@ BFD32_BACKENDS_CFILES = \
 	elf32-rl78.c \
 	elf32-rx.c \
 	elf32-s390.c \
-	elf32-sh-symbian.c \
 	elf32-sh.c \
 	elf32-sh64-com.c \
 	elf32-sh64.c \
@@ -1452,7 +1450,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-s390.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-score.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-score7.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-sh-symbian.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-sh.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-sh64-com.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-sh64.Plo@am__quote@
diff --git a/bfd/config.bfd b/bfd/config.bfd
index f205fdc..2860d7a 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -94,7 +94,6 @@ case $targ in
  mips*-*-lnews* | \
  mips*-*-sysv* | mips*-*-riscos* | \
  powerpc-*-lynxos* | powerpc-*-windiss* | \
- sh*-*-symbianelf* | \
  sparclet-*-aout* | \
  sparc86x-*-aout* | \
  sparc*-*-chorus* | \
@@ -138,6 +137,7 @@ case $targ in
  m88*-*-* | \
  maxq-*-coff | \
  mips*el-*-rtems* | \
+ sh*-*-symbianelf* | \
  sparc-*-lynxos* | \
  tahoe-*-* | \
  vax-*-bsd* | vax-*-ultrix* | vax-*-vms* | \
@@ -1498,11 +1498,6 @@ case "${targ}" in
     targ_defvec=sh_elf32_nbsd_vec
     targ_selvecs="sh_elf32_nbsd_le_vec sh_coff_vec sh_coff_le_vec"
     ;;
-  sh*-*-symbianelf*)
-    targ_defvec=sh_elf32_symbian_le_vec
-    targ_selvecs="sh_coff_le_vec sh_coff_small_le_vec"
-    targ_underscore=yes
-    ;;
 
 #ifdef BFD64
   shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf* | shl*-*-kaos*)
diff --git a/bfd/configure b/bfd/configure
index 2275de8..d757d72 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -14571,7 +14571,6 @@ do
     sh_elf32_linux_be_vec)	 tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
     sh_elf32_nbsd_vec)		 tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
     sh_elf32_nbsd_le_vec)	 tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
-    sh_elf32_symbian_le_vec)	 tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
     sh_elf32_vxworks_vec)	 tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
     sh_elf32_vxworks_le_vec)	 tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
     sh_pe_le_vec)		 tb="$tb pe-sh.lo coff-sh.lo peigen.lo $coff" ;;
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 8e16d95..9a29386 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -648,7 +648,6 @@ do
     sh_elf32_linux_be_vec)	 tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
     sh_elf32_nbsd_vec)		 tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
     sh_elf32_nbsd_le_vec)	 tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
-    sh_elf32_symbian_le_vec)	 tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
     sh_elf32_vxworks_vec)	 tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
     sh_elf32_vxworks_le_vec)	 tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
     sh_pe_le_vec)		 tb="$tb pe-sh.lo coff-sh.lo peigen.lo $coff" ;;
diff --git a/bfd/elf32-sh-symbian.c b/bfd/elf32-sh-symbian.c
deleted file mode 100644
index b0f519b..0000000
--- a/bfd/elf32-sh-symbian.c
+++ /dev/null
@@ -1,615 +0,0 @@
-/* Renesas / SuperH specific support for Symbian 32-bit ELF files
-   Copyright (C) 2004-2018 Free Software Foundation, Inc.
-   Contributed by Red Hat
-
-   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.  */
-
-
-/* Stop elf32-sh.c from defining any target vectors.  */
-#define SH_TARGET_ALREADY_DEFINED
-#define sh_find_elf_flags	    sh_symbian_find_elf_flags
-#define sh_elf_get_flags_from_mach  sh_symbian_elf_get_flags_from_mach
-#include "elf32-sh.c"
-
-
-//#define SYMBIAN_DEBUG 1
-#define SYMBIAN_DEBUG 0
-
-#define DIRECTIVE_HEADER	"#<SYMEDIT>#\n"
-#define DIRECTIVE_IMPORT	"IMPORT "
-#define DIRECTIVE_EXPORT	"EXPORT "
-#define DIRECTIVE_AS		"AS "
-
-/* Macro to advance 's' until either it reaches 'e' or the
-   character pointed to by 's' is equal to 'c'.  If 'e' is
-   reached and SYMBIAN_DEBUG is enabled then the error message 'm'
-   is displayed.  */
-#define SKIP_UNTIL(s,e,c,m)					\
-  do								\
-    {								\
-      while (s < e && *s != c)					\
-	++ s;							\
-      if (s >= e)						\
-	{							\
-	  if (SYMBIAN_DEBUG)					\
-	    fprintf (stderr, "Corrupt directive: %s\n", m);	\
-	  result = FALSE;					\
-	}							\
-    }								\
-  while (0);							\
-  if (!result)							\
-     break;
-
-/* Like SKIP_UNTIL except there are two terminator characters
-   c1 and c2.  */
-#define SKIP_UNTIL2(s,e,c1,c2,m)				\
-  do								\
-    {								\
-      while (s < e && *s != c1 && *s != c2)			\
-	++ s;							\
-      if (s >= e)						\
-	{							\
-	  if (SYMBIAN_DEBUG)					\
-	    fprintf (stderr, "Corrupt directive: %s\n", m);	\
-	  result = FALSE;					\
-	}							\
-    }								\
-  while (0);							\
-  if (!result)							\
-     break;
-
-/* Macro to advance 's' until either it reaches 'e' or the
-   character pointed to by 's' is not equal to 'c'.  If 'e'
-   is reached and SYMBIAN_DEBUG is enabled then the error message
-   'm' is displayed.  */
-#define SKIP_WHILE(s,e,c,m)					\
-  do								\
-    {								\
-      while (s < e && *s == c)					\
-	++ s;							\
-      if (s >= e)						\
-	{							\
-	  if (SYMBIAN_DEBUG)					\
-	    fprintf (stderr, "Corrupt directive: %s\n", m);	\
-	  result = FALSE;					\
-	}							\
-    }								\
-  while (0);							\
-  if (!result)							\
-     break;
-
-
-typedef struct symbol_rename
-{
-  struct symbol_rename *       next;
-  char *		       current_name;
-  char *		       new_name;
-  struct elf_link_hash_entry * current_hash;
-  unsigned long		       new_symndx;
-}
-symbol_rename;
-
-static symbol_rename * rename_list = NULL;
-
-/* Accumulate a list of symbols to be renamed.  */
-
-static bfd_boolean
-sh_symbian_import_as (struct bfd_link_info *info, bfd * abfd,
-		      char * current_name, char * new_name)
-{
-  struct elf_link_hash_entry * new_hash;
-  symbol_rename * node;
-
-  if (SYMBIAN_DEBUG)
-    fprintf (stderr, "IMPORT '%s' AS '%s'\n", current_name, new_name);
-
-  for (node = rename_list; node; node = node->next)
-    if (strcmp (node->current_name, current_name) == 0)
-      {
-	if (strcmp (node->new_name, new_name) == 0)
-	  /* Already added to rename list.  */
-	  return TRUE;
-
-	bfd_set_error (bfd_error_invalid_operation);
-	/* xgettext:c-format */
-	_bfd_error_handler (_("%pB: IMPORT AS directive for %s conceals previous IMPORT AS"),
-			    abfd, current_name);
-	return FALSE;
-      }
-
-  if ((node = bfd_malloc (sizeof * node)) == NULL)
-    {
-      if (SYMBIAN_DEBUG)
-	fprintf (stderr, "IMPORT AS: No mem for new rename node\n");
-      return FALSE;
-    }
-
-  if ((node->current_name = bfd_malloc (strlen (current_name) + 1)) == NULL)
-    {
-      if (SYMBIAN_DEBUG)
-	fprintf (stderr, "IMPORT AS: No mem for current name field in rename node\n");
-      free (node);
-      return FALSE;
-    }
-  else
-    strcpy (node->current_name, current_name);
-
-  if ((node->new_name = bfd_malloc (strlen (new_name) + 1)) == NULL)
-    {
-      if (SYMBIAN_DEBUG)
-	fprintf (stderr, "IMPORT AS: No mem for new name field in rename node\n");
-      free (node->current_name);
-      free (node);
-      return FALSE;
-    }
-  else
-    strcpy (node->new_name, new_name);
-
-  node->next = rename_list;
-  node->current_hash = NULL;
-  node->new_symndx = 0;
-  rename_list = node;
-
-  new_hash = elf_link_hash_lookup (elf_hash_table (info), node->new_name, TRUE, FALSE, TRUE);
-  bfd_elf_link_record_dynamic_symbol (info, new_hash);
-  if (new_hash->root.type == bfd_link_hash_new)
-    new_hash->root.type = bfd_link_hash_undefined;
-
-  return TRUE;
-}
-
-
-static bfd_boolean
-sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, char * name)
-{
-  if (SYMBIAN_DEBUG)
-    fprintf (stderr, "IMPORT '%s'\n", name);
-
-  /* XXX: Generate an import somehow ?  */
-
-  return TRUE;
-}
-
-static bfd_boolean
-sh_symbian_export (bfd * abfd ATTRIBUTE_UNUSED, char * name)
-{
-  if (SYMBIAN_DEBUG)
-    fprintf (stderr, "EXPORT '%s'\n", name);
-
-  /* XXX: Generate an export somehow ?  */
-
-  return TRUE;
-}
-
-/* Process any magic embedded commands in the .directive. section.
-   Returns TRUE upon sucecss, but if it fails it sets bfd_error and
-   returns FALSE.  */
-
-static bfd_boolean
-sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
-				      asection * sec, bfd_byte * contents)
-{
-  char *s;
-  char *e;
-  bfd_boolean result = TRUE;
-  bfd_size_type sz = sec->rawsize ? sec->rawsize : sec->size;
-
-  for (s = (char *) contents, e = s + sz; s < e;)
-    {
-      char * directive = s;
-
-      switch (*s)
-	{
-	  /* I want to use "case DIRECTIVE_HEADER [0]:" here but gcc won't let me :-(  */
-	case '#':
-	  if (strcmp (s, DIRECTIVE_HEADER))
-	    result = FALSE;
-	  else
-	    /* Just ignore the header.
-	       XXX: Strictly speaking we ought to check that the header
-	       is present and that it is the first thing in the file.  */
-	    s += strlen (DIRECTIVE_HEADER) + 1;
-	  break;
-
-	case 'I':
-	  if (! CONST_STRNEQ (s, DIRECTIVE_IMPORT))
-	    result = FALSE;
-	  else
-	    {
-	      char * new_name;
-	      char * new_name_end;
-	      char   name_end_char;
-
-	      /* Skip the IMPORT directive.  */
-	      s += strlen (DIRECTIVE_IMPORT);
-
-	      new_name = s;
-	      /* Find the end of the new name.  */
-	      while (s < e && *s != ' ' && *s != '\n')
-		++ s;
-	      if (s >= e)
-		{
-		  /* We have reached the end of the .directive section
-		     without encountering a string terminator.  This is
-		     allowed for IMPORT directives.  */
-		  new_name_end   = e - 1;
-		  name_end_char  = * new_name_end;
-		  * new_name_end = 0;
-		  result = sh_symbian_import (abfd, new_name);
-		  * new_name_end = name_end_char;
-		  break;
-		}
-
-	      /* Remember where the name ends.  */
-	      new_name_end = s;
-	      /* Skip any whitespace before the 'AS'.  */
-	      SKIP_WHILE (s, e, ' ', "IMPORT: Name just followed by spaces");
-	      /* Terminate the new name.  (Do this after skiping...)  */
-	      name_end_char = * new_name_end;
-	      * new_name_end = 0;
-
-	      /* Check to see if 'AS '... is present.  If so we have an
-		 IMPORT AS directive, otherwise we have an IMPORT directive.  */
-	      if (! CONST_STRNEQ (s, DIRECTIVE_AS))
-		{
-		  /* Skip the new-line at the end of the name.  */
-		  if (SYMBIAN_DEBUG && name_end_char != '\n')
-		    fprintf (stderr, "IMPORT: No newline at end of directive\n");
-		  else
-		    s ++;
-
-		  result = sh_symbian_import (abfd, new_name);
-
-		  /* Skip past the NUL character.  */
-		  if (* s ++ != 0)
-		    {
-		      if (SYMBIAN_DEBUG)
-			fprintf (stderr, "IMPORT: No NUL at end of directive\n");
-		    }
-		}
-	      else
-		{
-		  char * current_name;
-		  char * current_name_end;
-		  char   current_name_end_char;
-
-		  /* Skip the 'AS '.  */
-		  s += strlen (DIRECTIVE_AS);
-		  /* Skip any white space after the 'AS '.  */
-		  SKIP_WHILE (s, e, ' ', "IMPORT AS: Nothing after AS");
-		  current_name = s;
-		  /* Find the end of the current name.  */
-		  SKIP_UNTIL2 (s, e, ' ', '\n', "IMPORT AS: No newline at the end of the current name");
-		  /* Skip (backwards) over spaces at the end of the current name.  */
-		  current_name_end = s;
-		  current_name_end_char = * current_name_end;
-
-		  SKIP_WHILE (s, e, ' ', "IMPORT AS: Current name just followed by spaces");
-		  /* Skip past the newline character.  */
-		  if (* s ++ != '\n')
-		    if (SYMBIAN_DEBUG)
-		      fprintf (stderr, "IMPORT AS: No newline at end of directive\n");
-
-		  /* Terminate the current name after having performed the skips.  */
-		  * current_name_end = 0;
-
-		  result = sh_symbian_import_as (info, abfd, current_name, new_name);
-
-		  /* The next character should be a NUL.  */
-		  if (* s != 0)
-		    {
-		      if (SYMBIAN_DEBUG)
-			fprintf (stderr, "IMPORT AS: Junk at end of directive\n");
-		      result = FALSE;
-		    }
-		  s ++;
-
-		  * current_name_end = current_name_end_char;
-		}
-
-	      /* Restore the characters we overwrote, since
-		 the .directive section will be emitted.  */
-	      * new_name_end = name_end_char;
-	    }
-	  break;
-
-	case 'E':
-	  if (! CONST_STRNEQ (s, DIRECTIVE_EXPORT))
-	    result = FALSE;
-	  else
-	    {
-	      char * name;
-	      char * name_end;
-	      char   name_end_char;
-
-	      /* Skip the directive.  */
-	      s += strlen (DIRECTIVE_EXPORT);
-	      name = s;
-	      /* Find the end of the name to be exported.  */
-	      SKIP_UNTIL (s, e, '\n', "EXPORT: no newline at end of directive");
-	      /* Skip (backwards) over spaces at end of exported name.  */
-	      for (name_end = s; name_end[-1] == ' '; name_end --)
-		;
-	      /* name_end now points at the first character after the
-		 end of the exported name, so we can termiante it  */
-	      name_end_char = * name_end;
-	      * name_end = 0;
-	      /* Skip passed the newline character.  */
-	      s ++;
-
-	      result = sh_symbian_export (abfd, name);
-
-	      /* The next character should be a NUL.  */
-	      if (* s != 0)
-		{
-		  if (SYMBIAN_DEBUG)
-		    fprintf (stderr, "EXPORT: Junk at end of directive\n");
-		  result = FALSE;
-		}
-	      s++;
-
-	      /* Restore the character we deleted.  */
-	      * name_end = name_end_char;
-	    }
-	  break;
-
-	default:
-	  result = FALSE;
-	  break;
-	}
-
-      if (! result)
-	{
-	  if (SYMBIAN_DEBUG)
-	    fprintf (stderr, "offset into .directive section: %ld\n",
-		     (long) (directive - (char *) contents));
-
-	  bfd_set_error (bfd_error_invalid_operation);
-	  /* xgettext:c-format */
-	  _bfd_error_handler (_("%pB: unrecognized .directive command: %s"),
-			      abfd, directive);
-	  break;
-	}
-    }
-
-  return result;
-}
-
-
-/* Scan a bfd for a .directive section, and if found process it.
-   Returns TRUE upon success, FALSE otherwise.  */
-
-static bfd_boolean
-sh_symbian_process_directives (bfd *abfd, struct bfd_link_info *info)
-{
-  bfd_boolean result = FALSE;
-  bfd_byte *  contents;
-  asection *  sec = bfd_get_section_by_name (abfd, ".directive");
-  bfd_size_type sz;
-
-  if (!sec)
-    return TRUE;
-
-  sz = sec->rawsize ? sec->rawsize : sec->size;
-  contents = bfd_malloc (sz);
-
-  if (!contents)
-    bfd_set_error (bfd_error_no_memory);
-  else
-    {
-      if (bfd_get_section_contents (abfd, sec, contents, 0, sz))
-	result = sh_symbian_process_embedded_commands (info, abfd, sec, contents);
-      free (contents);
-    }
-
-  return result;
-}
-
-/* Intercept the normal sh_relocate_section() function
-   and magle the relocs to allow for symbol renaming.  */
-
-static bfd_boolean
-sh_symbian_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)
-{
-  /* When performing a final link we implement the IMPORT AS directives.  */
-  if (!bfd_link_relocatable (info))
-    {
-      Elf_Internal_Rela *	     rel;
-      Elf_Internal_Rela *	     relend;
-      Elf_Internal_Shdr *	     symtab_hdr;
-      struct elf_link_hash_entry **  sym_hashes;
-      struct elf_link_hash_entry **  sym_hashes_end;
-      struct elf_link_hash_table *   hash_table;
-      symbol_rename *		     ptr;
-      bfd_size_type		     num_global_syms;
-      unsigned long		     num_local_syms;
-
-      BFD_ASSERT (! elf_bad_symtab (input_bfd));
-
-      symtab_hdr       = & elf_tdata (input_bfd)->symtab_hdr;
-      hash_table       = elf_hash_table (info);
-      num_local_syms   = symtab_hdr->sh_info;
-      num_global_syms  = symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
-      num_global_syms -= num_local_syms;
-      sym_hashes       = elf_sym_hashes (input_bfd);
-      sym_hashes_end   = sym_hashes + num_global_syms;
-
-      /* First scan the rename table, caching the hash entry and the new index.  */
-      for (ptr = rename_list; ptr; ptr = ptr->next)
-	{
-	  struct elf_link_hash_entry *   new_hash;
-	  struct elf_link_hash_entry **  h;
-
-	  ptr->current_hash = elf_link_hash_lookup (hash_table, ptr->current_name, FALSE, FALSE, TRUE);
-
-	  if (ptr->current_hash == NULL)
-	    {
-	      if (SYMBIAN_DEBUG)
-		fprintf (stderr, "IMPORT AS: current symbol '%s' does not exist\n", ptr->current_name);
-	      continue;
-	    }
-
-	  new_hash = elf_link_hash_lookup (hash_table, ptr->new_name,
-					   FALSE, FALSE, TRUE);
-	  /* If we could not find the symbol then it is a new, undefined symbol.
-	     Symbian want this behaviour - ie they want to be able to rename the
-	     reference in a reloc from one undefined symbol to another, new and
-	     undefined symbol.  So we create that symbol here.  */
-	  if (new_hash == NULL)
-	    {
-	      struct bfd_link_hash_entry *bh = NULL;
-	      bfd_boolean collect = get_elf_backend_data (input_bfd)->collect;
-	      if (_bfd_generic_link_add_one_symbol (info, input_bfd,
-						    ptr->new_name, BSF_GLOBAL,
-						    bfd_und_section_ptr, 0,
-						    NULL, FALSE, collect,
-						    &bh))
-		{
-		  new_hash = (struct elf_link_hash_entry *) bh;
-		  new_hash->type = STT_FUNC;
-		  new_hash->non_elf = 0;
-
-		  if (SYMBIAN_DEBUG)
-		    fprintf (stderr, "Created new symbol %s\n", ptr->new_name);
-		}
-	    }
-
-	  if (new_hash == NULL)
-	    {
-	      /* xgettext:c-format */
-	      _bfd_error_handler (_("%pB: failed to add renamed symbol %s"),
-				  input_bfd, ptr->new_name);
-	      continue;
-	    }
-
-	  /* Convert the new_hash value into a index into the table of symbol hashes.  */
-	  for (h = sym_hashes; h < sym_hashes_end; h ++)
-	    {
-	      if (* h == new_hash)
-		{
-		  ptr->new_symndx = h - sym_hashes + num_local_syms;
-		  if (SYMBIAN_DEBUG)
-		    fprintf (stderr, "Converted new hash to index of %ld\n", ptr->new_symndx);
-		  break;
-		}
-	    }
-	  /* If the new symbol is not in the hash table then it must be
-	     because it is one of the newly created undefined symbols
-	     manufactured above.  So we extend the sym has table here to
-	     include this extra symbol.  */
-	  if (h == sym_hashes_end)
-	    {
-	      struct elf_link_hash_entry **  new_sym_hashes;
-
-	      /* This is not very efficient, but it works.  */
-	      ++ num_global_syms;
-	      new_sym_hashes = bfd_alloc (input_bfd, num_global_syms * sizeof * sym_hashes);
-	      if (new_sym_hashes == NULL)
-		{
-		  if (SYMBIAN_DEBUG)
-		    fprintf (stderr, "Out of memory extending hash table\n");
-		  continue;
-		}
-	      memcpy (new_sym_hashes, sym_hashes, (num_global_syms - 1) * sizeof * sym_hashes);
-	      new_sym_hashes[num_global_syms - 1] = new_hash;
-	      elf_sym_hashes (input_bfd) = sym_hashes = new_sym_hashes;
-	      sym_hashes_end = sym_hashes + num_global_syms;
-	      symtab_hdr->sh_size  = (num_global_syms + num_local_syms) * sizeof (Elf32_External_Sym);
-
-	      ptr->new_symndx = num_global_syms - 1 + num_local_syms;
-
-	      if (SYMBIAN_DEBUG)
-		fprintf (stderr, "Extended symbol hash table to insert new symbol as index %ld\n",
-			 ptr->new_symndx);
-	    }
-	}
-
-      /* Walk the reloc list looking for references to renamed symbols.
-	 When we find one, we alter the index in the reloc to point to the new symbol.  */
-      for (rel = relocs, relend = relocs + input_section->reloc_count;
-	   rel < relend;
-	   rel ++)
-	{
-	  int			       r_type;
-	  unsigned long		       r_symndx;
-	  struct elf_link_hash_entry * h;
-
-	  r_symndx = ELF32_R_SYM (rel->r_info);
-	  r_type = ELF32_R_TYPE (rel->r_info);
-
-	  /* Ignore unused relocs.  */
-	  if ((r_type >= (int) R_SH_GNU_VTINHERIT
-	       && r_type <= (int) R_SH_LABEL)
-	      || r_type == (int) R_SH_NONE
-	      || r_type < 0
-	      || r_type >= R_SH_max)
-	    continue;
-
-	  /* Ignore relocs against local symbols.  */
-	  if (r_symndx < num_local_syms)
-	    continue;
-
-	  BFD_ASSERT (r_symndx < (num_global_syms + num_local_syms));
-	  h = sym_hashes[r_symndx - num_local_syms];
-	  BFD_ASSERT (h != NULL);
-
-	  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 the symbol is defined there is no need to rename it.
-	     XXX - is this true ?  */
-	  if (   h->root.type == bfd_link_hash_defined
-	      || h->root.type == bfd_link_hash_defweak
-	      || h->root.type == bfd_link_hash_undefweak)
-	    continue;
-
-	  for (ptr = rename_list; ptr; ptr = ptr->next)
-	    if (h == ptr->current_hash)
-	      {
-		BFD_ASSERT (ptr->new_symndx);
-		if (SYMBIAN_DEBUG)
-		  fprintf (stderr, "convert reloc %lx from using index %ld to using index %ld\n",
-			   (unsigned long) rel->r_info,
-			   (long) ELF32_R_SYM (rel->r_info), ptr->new_symndx);
-		rel->r_info = ELF32_R_INFO (ptr->new_symndx, r_type);
-		break;
-	      }
-	}
-    }
-
-  return sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
-				  contents, relocs, local_syms, local_sections);
-}
-
-#define TARGET_LITTLE_SYM	sh_elf32_symbian_le_vec
-#define TARGET_LITTLE_NAME      "elf32-shl-symbian"
-
-#undef  elf_backend_relocate_section
-#define elf_backend_relocate_section	sh_symbian_relocate_section
-#undef  elf_backend_check_directives
-#define elf_backend_check_directives    sh_symbian_process_directives
-
-#include "elf32-target.h"
diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in
index 6426e4e..9738035 100644
--- a/bfd/po/SRC-POTFILES.in
+++ b/bfd/po/SRC-POTFILES.in
@@ -201,7 +201,6 @@ elf32-rx.c
 elf32-s390.c
 elf32-score.c
 elf32-score7.c
-elf32-sh-symbian.c
 elf32-sh.c
 elf32-sh64-com.c
 elf32-sh64.c
diff --git a/bfd/targets.c b/bfd/targets.c
index 883398a..64e3178 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -829,7 +829,6 @@ extern const bfd_target sh_elf32_linux_vec;
 extern const bfd_target sh_elf32_linux_be_vec;
 extern const bfd_target sh_elf32_nbsd_vec;
 extern const bfd_target sh_elf32_nbsd_le_vec;
-extern const bfd_target sh_elf32_symbian_le_vec;
 extern const bfd_target sh_elf32_vxworks_vec;
 extern const bfd_target sh_elf32_vxworks_le_vec;
 extern const bfd_target sh_pe_le_vec;
@@ -1322,7 +1321,6 @@ static const bfd_target * const _bfd_target_vector[] =
 	&sh_elf32_linux_be_vec,
 	&sh_elf32_nbsd_vec,
 	&sh_elf32_nbsd_le_vec,
-	&sh_elf32_symbian_le_vec,
 	&sh_elf32_vxworks_vec,
 	&sh_elf32_vxworks_le_vec,
 	&sh_pe_le_vec,
diff --git a/gas/ChangeLog b/gas/ChangeLog
index d63b6d6..2f21bd5 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,16 @@
 2018-04-16  Alan Modra  <amodra@gmail.com>
 
+	* config/tc-sh.c: Remove sh-symbianelf support.
+	* config/tc-sh.h: Likewise.
+	* configure.ac: Likewise.
+	* configure.tgt: Likewise.
+	* testsuite/gas/sh/reg-prefix.d: Likewise.
+	* testsuite/gas/sh/sh2a-pic.d: Likewise.
+	* config.in: Regenerate.
+	* configure: Regenerate.
+
+2018-04-16  Alan Modra  <amodra@gmail.com>
+
 	* configure.ac: Remove m88k support.
 	* config.in: Regenerate.
 	* configure: Regenerate.
diff --git a/gas/config.in b/gas/config.in
index 068de06..779208b 100644
--- a/gas/config.in
+++ b/gas/config.in
@@ -309,9 +309,6 @@
 /* Define if default target is PowerPC Solaris. */
 #undef TARGET_SOLARIS_COMMENT
 
-/* Define if target is Symbian OS. */
-#undef TARGET_SYMBIAN
-
 /* Target vendor. */
 #undef TARGET_VENDOR
 
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index d5a18c0..2704457 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -3898,14 +3898,6 @@ sh_elf_final_processing (void)
   if (sh64_isa_mode != sh64_isa_unspecified)
     val = EF_SH5;
   else
-#elif defined TARGET_SYMBIAN
-    if (1)
-      {
-	extern int sh_symbian_find_elf_flags (unsigned int);
-
-	val = sh_symbian_find_elf_flags (valid_arch);
-      }
-    else
 #endif /* HAVE_SH64 */
     val = sh_find_elf_flags (valid_arch);
 
diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h
index d0e7916..a2f1702 100644
--- a/gas/config/tc-sh.h
+++ b/gas/config/tc-sh.h
@@ -160,8 +160,6 @@ extern int target_big_endian;
 #define TARGET_FORMAT (!target_big_endian ? "elf32-sh-linux" : "elf32-shbig-linux")
 #elif defined(TE_NetBSD)
 #define TARGET_FORMAT (!target_big_endian ? "elf32-shl-nbsd" : "elf32-sh-nbsd")
-#elif defined TARGET_SYMBIAN
-#define TARGET_FORMAT (!target_big_endian ? "elf32-shl-symbian" : "elf32-sh-symbian")
 #elif defined (TE_VXWORKS)
 #define TARGET_FORMAT (!target_big_endian ? "elf32-shl-vxworks" : "elf32-sh-vxworks")
 #elif defined (TE_UCLINUX)
diff --git a/gas/configure b/gas/configure
index 2d05050..53fa7a6 100755
--- a/gas/configure
+++ b/gas/configure
@@ -12268,12 +12268,6 @@ $as_echo "#define TARGET_SOLARIS_COMMENT 1" >>confdefs.h
 	  as_fn_error "Solaris must be configured little endian" "$LINENO" 5
 	fi
 	;;
-
-      sh*-*-symbianelf*)
-
-$as_echo "#define TARGET_SYMBIAN 1" >>confdefs.h
-
-	;;
     esac
 
     if test ${this_target} = $target ; then
diff --git a/gas/configure.ac b/gas/configure.ac
index c453398..a3f3bf1 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -231,10 +231,6 @@ changequote([,])dnl
 	  AC_MSG_ERROR(Solaris must be configured little endian)
 	fi
 	;;
-
-      sh*-*-symbianelf*)
-	AC_DEFINE(TARGET_SYMBIAN, 1, [Define if target is Symbian OS.])
-	;;
     esac
 
     if test ${this_target} = $target ; then
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 24a68ec..c93f7b9 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -414,7 +414,6 @@ case ${generic_target} in
       sh*l*)	endian=little ;;
       *)	endian=big ;;
     esac ;;
-  sh*-*-symbianelf*)			fmt=elf endian=little ;;
   sh-*-elf*)				fmt=elf ;;
   sh-*-uclinux* | sh[12]-*-uclinux*)	fmt=elf em=uclinux ;;
   sh-*-coff*)				fmt=coff ;;
diff --git a/gas/testsuite/gas/sh/reg-prefix.d b/gas/testsuite/gas/sh/reg-prefix.d
index a42e8c4..13c708c 100644
--- a/gas/testsuite/gas/sh/reg-prefix.d
+++ b/gas/testsuite/gas/sh/reg-prefix.d
@@ -1,7 +1,6 @@
 #objdump: -dr --prefix-addresses --show-raw-insn
 #as: --allow-reg-prefix -big
 #name: SH --allow-reg-prefix option
-#skip: sh*-*-symbian*
 # Test SH register names prefixed with $:
 
 .*:     file format elf.*sh.*
diff --git a/gas/testsuite/gas/sh/sh2a-pic.d b/gas/testsuite/gas/sh/sh2a-pic.d
index c7fe12b..504d411 100644
--- a/gas/testsuite/gas/sh/sh2a-pic.d
+++ b/gas/testsuite/gas/sh/sh2a-pic.d
@@ -1,7 +1,6 @@
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: SH2a PIC relocations
 #as: -isa=sh2a
-#skip: sh*-*-symbian*
 
 dump.o:     file format elf32-sh.*
 
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a4c5c35..d62ca5e 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,14 @@
 2018-04-16  Alan Modra  <amodra@gmail.com>
 
+	* Makefile.am: Remove sh-symbianelf support.
+	* configure.tgt: Likewise.
+	* emulparams/shlsymbian.sh: Delete.
+	* scripttempl/elf32sh-symbian.sc: Delete.
+	* Makefile.in: Regenerate.
+	* po/BLD-POTFILES.in: Regenerate.
+
+2018-04-16  Alan Modra  <amodra@gmail.com>
+
 	* Makefile.am: Remove vax-bsd and vax-ultrix support.
 	* configure.tgt: Likewise.
 	* emulparams/vax.sh: Delete.
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 81a8d19..c09cd3c 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -387,7 +387,6 @@ ALL_EMULATION_SOURCES = \
 	eshlelf_nbsd.c \
 	eshlelf_nto.c \
 	eshlelf_vxworks.c \
-	eshlsymbian.c \
 	eshpe.c \
 	esparcaout.c \
 	esparclinux.c \
@@ -1735,10 +1734,6 @@ eshlelf_vxworks.c: $(srcdir)/emulparams/shlelf_vxworks.sh \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc $(srcdir)/emultempl/vxworks.em \
   ${GEN_DEPENDS}
 
-eshlsymbian.c: $(srcdir)/emulparams/shlsymbian.sh \
-  $(srcdir)/emulparams/shelf.sh \
-  $(ELF_DEPS) $(srcdir)/scripttempl/elf32sh-symbian.sc ${GEN_DEPENDS}
-
 eshpe.c: $(srcdir)/emulparams/shpe.sh \
   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
 
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 843c269..4d9023b 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -756,7 +756,6 @@ ALL_EMULATION_SOURCES = \
 	eshlelf_nbsd.c \
 	eshlelf_nto.c \
 	eshlelf_vxworks.c \
-	eshlsymbian.c \
 	eshpe.c \
 	esparcaout.c \
 	esparclinux.c \
@@ -1405,7 +1404,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eshlelf_nbsd.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eshlelf_nto.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eshlelf_vxworks.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eshlsymbian.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eshpe.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/esparcaout.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/esparclinux.Po@am__quote@
@@ -3273,10 +3271,6 @@ eshlelf_vxworks.c: $(srcdir)/emulparams/shlelf_vxworks.sh \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc $(srcdir)/emultempl/vxworks.em \
   ${GEN_DEPENDS}
 
-eshlsymbian.c: $(srcdir)/emulparams/shlsymbian.sh \
-  $(srcdir)/emulparams/shelf.sh \
-  $(ELF_DEPS) $(srcdir)/scripttempl/elf32sh-symbian.sc ${GEN_DEPENDS}
-
 eshpe.c: $(srcdir)/emulparams/shpe.sh \
   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
 
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 6e30ecc..96e3f44 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -724,7 +724,6 @@ sh*l*-*-netbsdelf*)	targ_emul=shlelf_nbsd
 			targ_extra_emuls=shelf_nbsd ;;
 sh*-*-netbsdelf*)	targ_emul=shelf_nbsd
 			targ_extra_emuls=shlelf_nbsd ;;
-sh*-*-symbianelf*)	targ_emul=shlsymbian ;;
 shle*-*-elf* | sh[1234]*le*-*-elf | shle*-*-kaos*)
 			targ_emul=shlelf
 			targ_extra_emuls="shelf shl sh"	;;
diff --git a/ld/emulparams/shlsymbian.sh b/ld/emulparams/shlsymbian.sh
deleted file mode 100644
index f729bb5..0000000
--- a/ld/emulparams/shlsymbian.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-TEXT_START_ADDR=0x8000
-SHLIB_TEXT_START_ADDR=0x8000
-SHLIB_DATA_ADDR=0x400000
-
-. ${srcdir}/emulparams/shelf.sh
-
-# Use only two underscores for the constructor/destructor symbols
-CTOR_START='__ctors = .;'
-CTOR_END='__ctors_end = .;'
-DTOR_START='__dtors = .;'
-DTOR_END='__dtors_end = .;'
-
-# Suppress the .stack section.
-unset STACK_ADDR
-OTHER_SYMBOLS="PROVIDE (_stack = 0x30000);"
-test -n "$CREATE_SHLIB" && unset OTHER_SYMBOLS
-
-OUTPUT_FORMAT="elf32-shl-symbian"
-SCRIPT_NAME=elf32sh-symbian
diff --git a/ld/po/BLD-POTFILES.in b/ld/po/BLD-POTFILES.in
index 79c1991..4ba06cf 100644
--- a/ld/po/BLD-POTFILES.in
+++ b/ld/po/BLD-POTFILES.in
@@ -309,7 +309,6 @@ eshlelf_linux.c
 eshlelf_nbsd.c
 eshlelf_nto.c
 eshlelf_vxworks.c
-eshlsymbian.c
 eshpe.c
 esparcaout.c
 esparclinux.c
diff --git a/ld/scripttempl/elf32sh-symbian.sc b/ld/scripttempl/elf32sh-symbian.sc
deleted file mode 100644
index 3d4572d..0000000
--- a/ld/scripttempl/elf32sh-symbian.sc
+++ /dev/null
@@ -1,372 +0,0 @@
-# Copyright (C) 2014-2018 Free Software Foundation, Inc.
-#
-# Copying and distribution of this file, with or without modification,
-# are permitted in any medium without royalty provided the copyright
-# notice and this notice are preserved.
-#
-# Unusual variables checked by this code:
-#	NOP - four byte opcode for no-op (defaults to 0)
-#	DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
-#	INITIAL_READONLY_SECTIONS - at start of text segment
-#	OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
-#		(e.g., .PARISC.milli)
-#	OTHER_TEXT_SECTIONS - these get put in .text when relocating
-#	OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
-#		(e.g., .PARISC.global)
-#	ATTRS_SECTIONS - at the end
-#	OTHER_SECTIONS - at the end
-#	EXECUTABLE_SYMBOLS - symbols that must be defined for an
-#		executable (e.g., _DYNAMIC_LINK)
-#	TEXT_START_SYMBOLS - symbols that appear at the start of the
-#		.text section.
-#	DATA_START_SYMBOLS - symbols that appear at the start of the
-#		.data section.
-#	OTHER_GOT_SYMBOLS - symbols defined just before .got.
-#	OTHER_GOT_SECTIONS - sections just after .got.
-#	OTHER_SDATA_SECTIONS - sections just after .sdata.
-#	OTHER_BSS_SYMBOLS - symbols that appear at the start of the
-#		.bss section besides __bss_start.
-#	DATA_PLT - .plt should be in data segment, not text segment.
-#	BSS_PLT - .plt should be in bss segment
-#	TEXT_DYNAMIC - .dynamic in text segment, not data segment.
-#	EMBEDDED - whether this is for an embedded system.
-#	SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
-#		start address of shared library.
-#	INPUT_FILES - INPUT command of files to always include
-#	WRITABLE_RODATA - if set, the .rodata section should be writable
-#	INIT_START, INIT_END -  statements just before and just after
-#	combination of .init sections.
-#	FINI_START, FINI_END - statements just before and just after
-#	combination of .fini sections.
-#	STACK_ADDR - start of a .stack section.
-#	OTHER_SYMBOLS - symbols to place right at the end of the script.
-#
-# When adding sections, do note that the names of some sections are used
-# when specifying the start address of the next.
-#
-
-#  Many sections come in three flavours.  There is the 'real' section,
-#  like ".data".  Then there are the per-procedure or per-variable
-#  sections, generated by -ffunction-sections and -fdata-sections in GCC,
-#  and useful for --gc-sections, which for a variable "foo" might be
-#  ".data.foo".  Then there are the linkonce sections, for which the linker
-#  eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
-#  The exact correspondences are:
-#
-#  Section	Linkonce section
-#  .text	.gnu.linkonce.t.foo
-#  .rodata	.gnu.linkonce.r.foo
-#  .data	.gnu.linkonce.d.foo
-#  .bss		.gnu.linkonce.b.foo
-#  .sdata	.gnu.linkonce.s.foo
-#  .sbss	.gnu.linkonce.sb.foo
-#  .sdata2	.gnu.linkonce.s2.foo
-#  .sbss2	.gnu.linkonce.sb2.foo
-#  .debug_info	.gnu.linkonce.wi.foo
-#  .tdata	.gnu.linkonce.td.foo
-#  .tbss	.gnu.linkonce.tb.foo
-#
-#  Each of these can also have corresponding .rel.* and .rela.* sections.
-
-test -z "$ENTRY" && ENTRY=_start
-test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
-test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
-if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
-test -z "${ELFSIZE}" && ELFSIZE=32
-test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
-test "$LD_FLAG" = "N" && DATA_ADDR=.
-test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
-test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
-test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }"
-DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
-DATA_SEGMENT_END=""
-if test -n "${COMMONPAGESIZE}"; then
-  DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
-  DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
-fi
- INTERP=".interp    ALIGN(4) : { *(.interp) }"
-    PLT=".plt            : { *(.plt) } :dynamic :dyn"
-DYNAMIC=".dynamic        : { *(.dynamic) } :dynamic :dyn"
- RODATA=".rodata    ALIGN(4) : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
-DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.directive)  *(.gnu.lto_*) }"
-test -z "$GOT" && GOT=".got          ${RELOCATING-0} : { *(.got.plt) *(.got) } :dynamic :dyn"
-INIT_ARRAY=".init_array   ${RELOCATING-0} :
-  {
-     ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_start = .);}}
-     KEEP (*(SORT(.init_array.*)))
-     KEEP (*(.init_array))
-     ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_end = .);}}
-  }"
-FINI_ARRAY=".fini_array   ${RELOCATING-0} :
-  {
-    ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_start = .);}}
-    KEEP (*(SORT(.fini_array.*)))
-    KEEP (*(.fini_array))
-    ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}}
-  }"
-CTOR=".ctors     ALIGN(4) :
-  {
-    ${CONSTRUCTING+${CTOR_START}}
-    /* gcc uses crtbegin.o to find the start of
-       the constructors, so we make sure it is
-       first.  Because this is a wildcard, it
-       doesn't matter if the user does not
-       actually link against crtbegin.o; the
-       linker won't look for a file to match a
-       wildcard.  The wildcard also means that it
-       doesn't matter which directory crtbegin.o
-       is in.  */
-
-    KEEP (*crtbegin.o(.ctors))
-    KEEP (*crtbegin?.o(.ctors))
-
-    /* We don't want to include the .ctor section from
-       the crtend.o file until after the sorted ctors.
-       The .ctor section from the crtend file contains the
-       end of ctors marker and it must be last */
-
-    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
-    KEEP (*(SORT(.ctors.*)))
-    KEEP (*(.ctors))
-    ${CONSTRUCTING+${CTOR_END}}
-  } :text"
-DTOR=".dtors        ALIGN(4) :
-  {
-    ${CONSTRUCTING+${DTOR_START}}
-    KEEP (*crtbegin.o(.dtors))
-    KEEP (*crtbegin?.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
-    KEEP (*(SORT(.dtors.*)))
-    KEEP (*(.dtors))
-    ${CONSTRUCTING+${DTOR_END}}
-  } :text"
-STACK="  .stack        ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
-  {
-    ${RELOCATING+_stack = .;}
-    *(.stack)
-  } :data"
-
-# If this is for an embedded system, don't add SIZEOF_HEADERS.
-if [ -z "$EMBEDDED" ]; then
-   test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
-else
-   test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
-fi
-
-cat <<EOF
-/* Copyright (C) 2014-2018 Free Software Foundation, Inc.
-
-   Copying and distribution of this script, with or without modification,
-   are permitted in any medium without royalty provided the copyright
-   notice and this notice are preserved.  */
-
-OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
-	      "${LITTLE_OUTPUT_FORMAT}")
-OUTPUT_ARCH(${OUTPUT_ARCH})
-${RELOCATING+ENTRY(${ENTRY})}
-
-${RELOCATING+${LIB_SEARCH_DIRS}}
-${RELOCATING+/* Do we need any of these for elf?
-   __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
-${RELOCATING+${EXECUTABLE_SYMBOLS}}
-${RELOCATING+${INPUT_FILES}}
-${RELOCATING- /* For some reason, the Solaris linker makes bad executables
-  if gld -r is used and the intermediate file has sections starting
-  at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
-  bug.  But for now assigning the zero vmas works.  */}
-
-PHDRS
-{
-  headers PT_PHDR PHDRS ;
-  text    PT_LOAD ;
-  data    PT_LOAD ;
-  dyn     PT_LOAD FLAGS (0) ;
-  dynamic PT_DYNAMIC ;
-}
-
-SECTIONS
-{
-  /* Read-only sections, merged into text segment: */
-  ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${TEXT_BASE_ADDRESS};}}}
-  ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0};}}
-  ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0};}}
-  ${CREATE_SHLIB-${INTERP}}
-
-  ${INITIAL_READONLY_SECTIONS}
-
-  .init ALIGN(4) :
-  {
-    ${RELOCATING+${INIT_START}}
-    KEEP (*(.init))
-    ${RELOCATING+${INIT_END}}
-  } :text =${NOP-0}
-
-  .text ALIGN(4) :
-  {
-    ${RELOCATING+${TEXT_START_SYMBOLS}}
-    *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
-    /* .gnu.warning sections are handled specially by elf32.em.  */
-    *(.gnu.warning)
-    ${RELOCATING+${OTHER_TEXT_SECTIONS}}
-  } =${NOP-0}
-
-  ${RELOCATING+${CTOR}}
-  ${RELOCATING+${DTOR}}
-
-  .fini ALIGN(4) :
-  {
-    ${RELOCATING+${FINI_START}}
-    KEEP (*(.fini))
-    ${RELOCATING+${FINI_END}}
-  } =${NOP-0}
-
-  ${RELOCATING+PROVIDE (__etext = .);}
-  ${RELOCATING+PROVIDE (_etext = .);}
-  ${RELOCATING+PROVIDE (etext = .);}
-
-  ${WRITABLE_RODATA-${RODATA}}
-  .rodata1 ALIGN(4) : { *(.rodata1) }
-
-  ExportTable  ALIGN(4) : { KEEP (*(ExportTable)) }
-  .eh_frame_hdr ALIGN(4) : { *(.eh_frame_hdr) } :text
-
-  /* Adjust the address for the data segment.  We want to adjust up to
-     the same address within the page on the next page up.  */
-  . = ALIGN(128) + (. & (128 - 1));
-  .preinit_array   ${RELOCATING-0} :
-  {
-    ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__preinit_array_start = .);}}
-    KEEP (*(.preinit_array))
-    ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__preinit_array_end = .);}}
-  }
-  ${RELOCATING+${INIT_ARRAY}}
-  ${RELOCATING+${FINI_ARRAY}}
-
-  ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
-  ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
-  ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
-
-  .data  ALIGN(4) :
-  {
-    ${RELOCATING+${DATA_START_SYMBOLS}}
-    *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
-    ${CONSTRUCTING+SORT(CONSTRUCTORS)}
-  } :data
-
-  .data1            ALIGN(4) : { *(.data1) } :data
-  .tdata	    ALIGN(4) : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } :data
-  .tbss		    ALIGN(4) : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} } :data
-  .eh_frame         ALIGN(4) : { KEEP (*(.eh_frame)) } :data
-  .gcc_except_table ALIGN(4) : { *(.gcc_except_table) } :data
-  ${WRITABLE_RODATA+${RODATA}}
-  ${OTHER_READWRITE_SECTIONS}
-  ${SDATA}
-  ${OTHER_SDATA_SECTIONS}
-  ${RELOCATING+_edata = .;}
-  ${RELOCATING+PROVIDE (edata = .);}
-  ${RELOCATING+__bss_start = .;}
-  ${RELOCATING+${OTHER_BSS_SYMBOLS}}
-  ${BSS_PLT+${PLT}}
-  .bss  ALIGN(4) :
-  {
-   *(.dynbss)
-   *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
-   *(COMMON)
-   /* Align here to ensure that the .bss section occupies space up to
-      _end.  Align after .bss to ensure correct alignment even if the
-      .bss section disappears because there are no input sections.  */
-   ${RELOCATING+. = ALIGN(${ALIGNMENT});}
-  } :data
-  ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
-  ${RELOCATING+. = ALIGN(${ALIGNMENT});}
-  ${RELOCATING+${OTHER_END_SYMBOLS}}
-  ${RELOCATING+_end = .;}
-  ${RELOCATING+PROVIDE (end = .);}
-  ${RELOCATING+${DATA_SEGMENT_END}}
-
-  ${TEXT_DYNAMIC-${DYNAMIC}}
-  ${TEXT_DYNAMIC+${DYNAMIC}}
-  .hash         ${RELOCATING-0} : { *(.hash) } :dynamic :dyn
-  .dynsym       ${RELOCATING-0} : { *(.dynsym) } :dynamic :dyn
-  .dynstr       ${RELOCATING-0} : { *(.dynstr) } :dynamic :dyn
-  ${DATA_PLT-${BSS_PLT-${PLT}}}
-  .got.plt	  : { *(.got.plt) } :dynamic :dyn
-  .gnu.version  ${RELOCATING-0} : { *(.gnu.version) }
-  .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
-  .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
-EOF
-if [ "x$COMBRELOC" = x ]; then
-  COMBRELOCCAT=cat
-else
-  COMBRELOCCAT="cat > $COMBRELOC"
-fi
-eval $COMBRELOCCAT <<EOF
-  .rel.init     ${RELOCATING-0} : { *(.rel.init) }
-  .rela.init    ${RELOCATING-0} : { *(.rela.init) }
-  .rel.text     ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
-  .rela.text    ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
-  .rel.fini     ${RELOCATING-0} : { *(.rel.fini) }
-  .rela.fini    ${RELOCATING-0} : { *(.rela.fini) }
-  .rel.rodata   ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) }
-  .rela.rodata  ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) }
-  ${OTHER_READONLY_RELOC_SECTIONS}
-  .rel.data     ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
-  .rela.data    ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
-  .rel.tdata	${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
-  .rela.tdata	${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
-  .rel.tbss	${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
-  .rela.tbss	${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) }
-  .rel.ctors    ${RELOCATING-0} : { *(.rel.ctors) }
-  .rela.ctors   ${RELOCATING-0} : { *(.rela.ctors) }
-  .rel.dtors    ${RELOCATING-0} : { *(.rel.dtors) }
-  .rela.dtors   ${RELOCATING-0} : { *(.rela.dtors) }
-  .rel.got      ${RELOCATING-0} : { *(.rel.got) }
-  .rela.got     ${RELOCATING-0} : { *(.rela.got) }
-  ${OTHER_GOT_RELOC_SECTIONS}
-  .rel.bss      ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) }
-  .rela.bss     ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) }
-EOF
-if [ -n "$COMBRELOC" ]; then
-cat <<EOF
-  .rel.dyn      ${RELOCATING-0} :
-    {
-EOF
-sed -e '/^[	 ]*[{}][	 ]*$/d;/:[	 ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/      \1/' $COMBRELOC
-cat <<EOF
-    }
-  .rela.dyn     ${RELOCATING-0} :
-    {
-EOF
-sed -e '/^[	 ]*[{}][	 ]*$/d;/:[	 ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/      \1/' $COMBRELOC
-cat <<EOF
-    }
-EOF
-fi
-cat <<EOF
-  .rel.plt      ${RELOCATING-0} : { *(.rel.plt) }
-  .rela.plt     ${RELOCATING-0} : { *(.rela.plt) }
-  ${OTHER_PLT_RELOC_SECTIONS}
-
-
-  /* Stabs debugging sections.  */
-  .stab          0 : { *(.stab) }
-  .stabstr       0 : { *(.stabstr) }
-  .stab.excl     0 : { *(.stab.excl) }
-  .stab.exclstr  0 : { *(.stab.exclstr) }
-  .stab.index    0 : { *(.stab.index) }
-  .stab.indexstr 0 : { *(.stab.indexstr) }
-
-  .comment       0 : { *(.comment) }
-
-EOF
-
-. $srcdir/scripttempl/DWARF.sc
-
-cat <<EOF
-  ${STACK_ADDR+${STACK}}
-  ${ATTRS_SECTIONS}
-  ${OTHER_SECTIONS}
-  ${RELOCATING+${OTHER_SYMBOLS}}
-  ${RELOCATING+${DISCARDED}}
-}
-EOF



More information about the Binutils-cvs mailing list