This is the mail archive of the binutils@sources.redhat.com 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]

Re: [PATCH] linux support for SH


Here's a patch for binutils support of GNU/Linux/SH.  Ok to install?

Note the weirdness in BFD in order to correctly drop the leading
underscores from symbol names, which the SH-Linux guys decided to do.
Ugh :-(

Index: bfd/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config.bfd (sh-*-linux*): Added.
	* configure.in (bfd_elf32_shlin_vec, bfd_elf32_shblin_vec): New.
	* targets.c: Declare them.
	* elf32-sh-lin.c: New file.
	* Makefile.am: Compile it.
	* elf32-sh.c: Don't override defines from elf32-sh-lin.c.
	* configure, Makefile.in: Rebuilt.

Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.38
diff -u -p -r1.38 Makefile.am
--- bfd/Makefile.am	2000/07/20 16:21:06	1.38
+++ bfd/Makefile.am	2000/09/02 04:56:50
@@ -198,6 +198,7 @@ BFD32_BACKENDS = \
 	elf32-pj.lo \
 	elf32-ppc.lo \
 	elf32-sh.lo \
+	elf32-sh-lin.lo \
 	elf32-sparc.lo \
 	elf32-v850.lo \
 	elf32.lo \
@@ -335,6 +336,7 @@ BFD32_BACKENDS_CFILES = \
 	elf32-pj.c \
 	elf32-ppc.c \
 	elf32-sh.c \
+	elf32-sh-lin.c \
 	elf32-sparc.c \
 	elf32-v850.c \
 	elf32.c \
@@ -1009,6 +1011,11 @@ elf32-sh.lo: elf32-sh.c $(INCDIR)/filena
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
+# Keep this one in sync with the one above
+elf32-sh-lin.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h elf32-sh-lin.c
 elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
   $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
Index: bfd/config.bfd
===================================================================
RCS file: /cvs/src/src/bfd/config.bfd,v
retrieving revision 1.38
diff -u -p -r1.38 config.bfd
--- bfd/config.bfd	2000/07/28 21:10:19	1.38
+++ bfd/config.bfd	2000/09/02 04:56:51
@@ -683,6 +683,11 @@ case "${targ}" in
     targ_defvec=rs6000coff_vec
     ;;
 
+  sh-*-linux*)
+    targ_defvec=bfd_elf32_shblin_vec
+    targ_selvecs=bfd_elf32_shlin_vec
+    ;;
+
   sh-*-elf* | sh-*-rtemself*)
     targ_defvec=bfd_elf32_sh_vec
     targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.30
diff -u -p -r1.30 configure.in
--- bfd/configure.in	2000/08/30 18:12:03	1.30
+++ bfd/configure.in	2000/09/02 04:56:52
@@ -522,6 +522,8 @@ do
     bfd_elf32_powerpcle_vec)	tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
     bfd_elf32_sh_vec)		tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
     bfd_elf32_shl_vec)		tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
+    bfd_elf32_shlin_vec)	tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+    bfd_elf32_shblin_vec)	tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
     bfd_elf32_sparc_vec)	tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
     bfd_elf32_tradbigmips_vec)  tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
Index: bfd/elf32-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.17
diff -u -p -r1.17 elf32-sh.c
--- bfd/elf32-sh.c	2000/09/02 02:33:26	1.17
+++ bfd/elf32-sh.c	2000/09/02 04:56:53
@@ -4154,6 +4154,7 @@ sh_elf_finish_dynamic_sections (output_b
   return true;
 }
 
+#ifndef ELF_ARCH
 #define TARGET_BIG_SYM		bfd_elf32_sh_vec
 #define TARGET_BIG_NAME		"elf32-sh"
 #define TARGET_LITTLE_SYM	bfd_elf32_shl_vec
@@ -4163,6 +4164,7 @@ sh_elf_finish_dynamic_sections (output_b
 #define ELF_MAXPAGESIZE		0x1
 
 #define elf_symbol_leading_char '_'
+#endif /* ELF_ARCH */
 
 #define bfd_elf32_bfd_reloc_type_lookup	sh_elf_reloc_type_lookup
 #define elf_info_to_howto		sh_elf_info_to_howto
Index: bfd/targets.c
===================================================================
RCS file: /cvs/src/src/bfd/targets.c,v
retrieving revision 1.26
diff -u -p -r1.26 targets.c
--- bfd/targets.c	2000/07/28 21:10:19	1.26
+++ bfd/targets.c	2000/09/02 04:56:53
@@ -547,6 +547,8 @@ extern const bfd_target bfd_elf32_powerp
 extern const bfd_target bfd_elf32_powerpcle_vec;
 extern const bfd_target bfd_elf32_sh_vec;
 extern const bfd_target bfd_elf32_shl_vec;
+extern const bfd_target bfd_elf32_shlin_vec;
+extern const bfd_target bfd_elf32_shblin_vec;
 extern const bfd_target bfd_elf32_sparc_vec;
 extern const bfd_target bfd_elf32_tradbigmips_vec;
 extern const bfd_target bfd_elf32_tradlittlemips_vec;
Index: bfd/elf32-sh-lin.c
===================================================================
RCS file: elf32-sh-lin.c
diff -N elf32-sh-lin.c
--- bfd/elf32-sh-lin.c	Tue May  5 13:32:27 1998
+++ bfd/elf32-sh-lin.c	Fri Sep  1 22:00:31 2000
@@ -0,0 +1,29 @@
+/* Hitachi SH specific support for 32-bit Linux
+   Copyright 2000 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#define TARGET_BIG_SYM bfd_elf32_shblin_vec
+#define TARGET_BIG_NAME "elf32-shbig-linux"
+#define TARGET_LITTLE_SYM bfd_elf32_shlin_vec
+#define TARGET_LITTLE_NAME "elf32-sh-linux"
+#define ELF_ARCH bfd_arch_sh
+#define ELF_MACHINE_CODE EM_SH
+#define ELF_MAXPAGESIZE 0x10000
+#define elf_symbol_leading_char 0
+
+#include "elf32-sh.c"
Index: gas/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/tc-sh.h (TARGET_FORMAT): Use sh-linux targets.
	* configure.in (sh-*-linux*): Added.
	* configure: Rebuilt.

Index: gas/configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.39
diff -u -p -r1.39 configure.in
--- gas/configure.in	2000/08/22 19:14:30	1.39
+++ gas/configure.in	2000/09/02 04:57:51
@@ -367,6 +367,7 @@ changequote([,])dnl
       ppc-*-netware*)       fmt=elf em=ppcnw ;;
       ppc-*-vxworks*)       fmt=elf ;;
 
+      sh-*-linux*)	    fmt=elf em=linux ;;
       sh-*-elf*)	    fmt=elf ;;
       sh-*-coff*)           fmt=coff ;;
       sh-*-pe*)             fmt=coff em=pe bfd_gas=yes;;
Index: gas/config/tc-sh.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.h,v
retrieving revision 1.7
diff -u -p -r1.7 tc-sh.h
--- gas/config/tc-sh.h	2000/09/02 02:36:27	1.7
+++ gas/config/tc-sh.h	2000/09/02 04:57:51
@@ -160,7 +160,11 @@ extern int tc_coff_sizemachdep PARAMS ((
 /* Whether or not the target is big endian */
 extern int target_big_endian;
 
+#ifdef TE_LINUX
+#define TARGET_FORMAT (shl ? "elf32-sh-linux" : "elf32-shbig-linux")
+#else
 #define TARGET_FORMAT (shl ? "elf32-shl" : "elf32-sh")
+#endif
 
 #define elf_tc_final_processing sh_elf_final_processing
 extern void sh_elf_final_processing PARAMS ((void));
Index: ld/ChangeLog
from  Niibe Yutaka  <gniibe@m17n.org>, Kaz Kojima  <kkojima@rr.iij4u.or.jp>, Alexandre Oliva  <aoliva@redhat.com>

	* configure.tgt (sh-*-linux*): Added.
	* Makefile.am: Added eshelf_linux and eshlelf_linux.
	* Makefile.in: Rebuilt.
	* emulparams/shelf_linux.sh: New file.
	* emulparams/shlelf_linux.sh: New file.

Index: ld/Makefile.am
===================================================================
RCS file: /cvs/src/src/ld/Makefile.am,v
retrieving revision 1.43
diff -u -p -r1.43 Makefile.am
--- ld/Makefile.am	2000/08/10 20:40:39	1.43
+++ ld/Makefile.am	2000/09/02 04:59:04
@@ -216,6 +216,8 @@ ALL_EMULATIONS = \
 	esa29200.o \
 	esh.o \
 	eshelf.o \
+	eshelf_linux.o \
+	eshlelf_linux.o \
 	eshl.o \
 	eshlelf.o \
 	eshpe.o \
@@ -691,6 +693,12 @@ esh.c: $(srcdir)/emulparams/sh.sh \
 eshelf.c: $(srcdir)/emulparams/shelf.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} shelf "$(tdir_shelf)"
+eshelf_linux.c: $(srcdir)/emulparams/shelf_linux.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} shelf_linux "$(tdir_shelf_linux)"
+eshlelf_linux.c: $(srcdir)/emulparams/shlelf_linux.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} shlelf_linux "$(tdir_shlelf_linux)"
 eshlelf.c: $(srcdir)/emulparams/shlelf.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} shlelf "$(tdir_shlelf)"
Index: ld/configure.tgt
===================================================================
RCS file: /cvs/src/src/ld/configure.tgt,v
retrieving revision 1.37
diff -u -p -r1.37 configure.tgt
--- ld/configure.tgt	2000/08/10 20:40:39	1.37
+++ ld/configure.tgt	2000/09/02 04:59:05
@@ -184,6 +184,10 @@ h8500-*-hms* | h8500-*-coff*)
 			targ_emul=h8500
 			targ_extra_emuls="h8500s h8500b h8500m h8500c"
 			;;
+sh-*-linux*)
+			targ_emul=shelf_linux
+			targ_extra_emuls=shlelf_linux
+			;;
 sh-*-elf* | sh-*-rtemself*)
 			targ_emul=shelf
 			targ_extra_emuls="shlelf sh shl"
Index: ld/emulparams/shelf_linux.sh
===================================================================
RCS file: shelf_linux.sh
diff -N shelf_linux.sh
--- ld/emulparams/shelf_linux.sh	Tue May  5 13:32:27 1998
+++ ld/emulparams/shelf_linux.sh	Fri Sep  1 22:02:20 2000
@@ -0,0 +1,14 @@
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-shbig-linux"
+TEXT_START_ADDR=0x400000
+MAXPAGESIZE=0x10000
+ARCH=sh
+MACHINE=
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+
+DATA_START_SYMBOLS='__data_start = . ;';
+
+OTHER_READWRITE_SECTIONS='
+  .note.ABI-tag : { *(.note.ABI-tag) }
+'
Index: ld/emulparams/shlelf_linux.sh
===================================================================
RCS file: shlelf_linux.sh
diff -N shlelf_linux.sh
--- ld/emulparams/shlelf_linux.sh	Tue May  5 13:32:27 1998
+++ ld/emulparams/shlelf_linux.sh	Fri Sep  1 22:02:20 2000
@@ -0,0 +1,14 @@
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-sh-linux"
+TEXT_START_ADDR=0x400000
+MAXPAGESIZE=0x10000
+ARCH=sh
+MACHINE=
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+
+DATA_START_SYMBOLS='__data_start = . ;';
+
+OTHER_READWRITE_SECTIONS='
+  .note.ABI-tag : { *(.note.ABI-tag) }
+'

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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