public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Get rid of more bfd bloat
@ 2002-10-16  1:44 Alan Modra
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Modra @ 2002-10-16  1:44 UTC (permalink / raw)
  To: binutils

Gets rid of most of the cases where ELF targets #include a C file just
to make minor target variations.  The one case left is elf32-sh64.c
which includes elf32-sh.c.

	* Makefile.am (BFD32_BACKENDS): Remove elfarmqnx-nabi.lo,
	elf32-i386-fbsd.lo, elf32-i386qnx.lo, elf32-ppcqnx.lo, 
	elf32-sh-lin.lo, elf32-sh64-lin.lo, elf32-sh-nbsd.lo,
	elf32-sh64-nbsd.lo, elf32-shqnx.lo.  Add elf32-qnx.lo.
	(BFD32_BACKENDS_CFILES): Likewise for corresponding C files.
	(BFD64_BACKENDS): Remove elf64-sh64-lin.lo, elf64-sh64-nbsd.lo.
	(BFD64_BACKENDS_CFILES): Likewise for corresponding C files.
	(SOURCE_HFILES): Add elf32-qnx.h.
	(BUILD_HFILES): Add bfdver.h.
	Run "make dep-am".
	* Makefile.in: Regenerate.
	* configure.in Update bfd vector dependencies.
	* configure: Regenerate.
	* elf32-i386-fbsd.c: Delete.  Move code to elf32-i386.c.
	* elf32-i386qnx.c: Likewise.
	* elf32-ppcqnx.c: Delete.  Move code to elf32-ppc.c.
	* elf32-sh-nbsd.c: Delete.  Move code to elf32-sh.c.
	* elf32-sh-lin.c: Likewise.
	* elf32-shqnx.c: Likewise.
	* elf32-sh64-lin.c: Delete.  Move code to elf32-sh64.c.
	* elf32-sh64-nbsd.c: Likewise.
	* elf64-sh64-lin.c: Delete.  Move code to elf64-sh64.c.
	* elf64-sh64-nbsd.c: Likewise.
	* elfarmqnx-nabi.c: Delete.  Move code to elfarm-nabi.c.
	* elf32-arm.h (ELF_MAXPAGESIZE): Always define.
	* elf32-i386.c: Remove ELF_ARCH and ELF32_I386_C_INCLUDED tests.
	* elf32-ppc.c: Remove ELF32_PPC_C_INCLUDED tests.
	* elf32-qnx.h (elf_backend_set_nonloadable_filepos): Always define.
	(elf_backend_is_contained_by_filepos): Likewise.
	(elf_backend_copy_private_bfd_data_p): Likewise.
	Globalize and move functions to..
	* elf32-qnx.c: ..here.  New file.
	* elf32-sh.c: Remove ELF_ARCH and ELF32_SH_C_INCLUDED tests.  Don't
	emit target vectors when INCLUDE_SHMEDIA.
	* elf32-sh64.c: Remove ELF_ARCH test.  Move TARGET_* etc. defines to
	end of file.
	* elf64-sh64.c: Remove ELF_ARCH test.
	* elfarm-nabi.c: Remove ELFARM_NABI_C_INCLUDED test.
	* po/BLD-POTFILES.in: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.

Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.106
diff -u -p -r1.106 Makefile.am
--- bfd/Makefile.am	15 Oct 2002 17:14:50 -0000	1.106
+++ bfd/Makefile.am	16 Oct 2002 06:22:34 -0000
@@ -203,7 +203,6 @@ BFD32_BACKENDS = \
 	elf32-arc.lo \
 	elfarm-oabi.lo \
 	elfarm-nabi.lo \
-	elfarmqnx-nabi.lo \
 	elf32-avr.lo \
 	elf32-cris.lo \
 	elf32-d10v.lo \
@@ -216,8 +215,6 @@ BFD32_BACKENDS = \
 	elf32-hppa.lo \
 	elf32-i370.lo \
 	elf32-i386.lo \
-	elf32-i386-fbsd.lo \
-	elf32-i386qnx.lo \
 	elf32-i860.lo \
 	elf32-i960.lo \
 	elf32-ia64.lo \
@@ -236,16 +233,11 @@ BFD32_BACKENDS = \
 	elf32-or32.lo \
 	elf32-pj.lo \
 	elf32-ppc.lo \
-	elf32-ppcqnx.lo \
+	elf32-qnx.lo \
 	elf32-s390.lo \
 	elf32-sh.lo \
-	elf32-sh-lin.lo \
 	elf32-sh64.lo \
 	elf32-sh64-com.lo \
-	elf32-sh64-lin.lo \
-	elf32-sh-nbsd.lo \
-	elf32-sh64-nbsd.lo \
-	elf32-shqnx.lo \
 	elf32-sparc.lo \
 	elf32-v850.lo \
 	elf32-vax.lo \
@@ -367,7 +359,6 @@ BFD32_BACKENDS_CFILES = \
 	elf32-arc.c \
 	elfarm-oabi.c \
 	elfarm-nabi.c \
-	elfarmqnx-nabi.c \
 	elf32-avr.c \
 	elf32-cris.c \
 	elf32-d10v.c \
@@ -380,8 +371,6 @@ BFD32_BACKENDS_CFILES = \
 	elf32-hppa.c \
 	elf32-i370.c \
 	elf32-i386.c \
-	elf32-i386-fbsd.c \
-	elf32-i386qnx.c \
 	elf32-i860.c \
 	elf32-i960.c \
 	elf32-ip2k.c \
@@ -399,16 +388,11 @@ BFD32_BACKENDS_CFILES = \
 	elf32-or32.c \
 	elf32-pj.c \
 	elf32-ppc.c \
-	elf32-ppcqnx.c \
+	elf32-qnx.c \
 	elf32-sh64.c \
 	elf32-sh64-com.c \
-	elf32-sh64-lin.c \
 	elf32-s390.c \
 	elf32-sh.c \
-	elf32-sh-lin.c \
-	elf32-sh-nbsd.c \
-	elf32-sh64-nbsd.c \
-	elf32-shqnx.c \
 	elf32-sparc.c \
 	elf32-v850.c \
 	elf32-vax.c \
@@ -498,8 +482,6 @@ BFD64_BACKENDS = \
 	elf64-mips.lo \
 	elf64-mmix.lo \
 	elf64-sh64.lo \
-	elf64-sh64-lin.lo \
-	elf64-sh64-nbsd.lo \
 	elf64-ppc.lo \
 	elf64-s390.lo \
 	elf64-sparc.lo \
@@ -526,8 +508,6 @@ BFD64_BACKENDS_CFILES = \
 	elf64-ppc.c \
 	elf64-s390.c \
 	elf64-sh64.c \
-	elf64-sh64-lin.c \
-	elf64-sh64-nbsd.c \
 	elf64-sparc.c \
 	elf64.c \
 	mmo.c \
@@ -581,16 +561,17 @@ CFILES = $(SOURCE_CFILES) $(BUILD_CFILES
 ## This is a list of all .h files which are in the source tree.
 SOURCE_HFILES = \
 	aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
-	elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h elf64-hppa.h \
-	elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \
-	libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
-	libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \
-	nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h \
-	xcoff-target.h version.h
+	elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h elf32-qnx.h \
+	elf64-hppa.h elfcode.h elfcore.h elflink.h \
+	freebsd.h genlink.h go32stub.h \
+	libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \
+	libnlm.h liboasys.h libpei.h libxcoff.h \
+	netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h \
+	peicode.h som.h version.h vms.h xcoff-target.h
 
 ## ... and all .h files which are in the build tree.
 BUILD_HFILES = \
-	elf32-target.h elf64-target.h targmatch.h
+	bfdver.h elf32-target.h elf64-target.h targmatch.h
 
 HFILES = $(SOURCE_HFILES) $(BUILD_HFILES)
 
[snip dependency changes]

Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.117
diff -u -p -r1.117 configure.in
--- bfd/configure.in	15 Oct 2002 17:14:51 -0000	1.117
+++ bfd/configure.in	16 Oct 2002 06:22:43 -0000
@@ -557,8 +557,8 @@ do
     bfd_elf32_big_generic_vec) 	tb="$tb elf32-gen.lo elf32.lo $elf" ;;
     bfd_elf32_bigarc_vec)	tb="$tb elf32-arc.lo elf32.lo $elf" ;;
     bfd_elf32_bigarm_oabi_vec)	tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
-    bfd_elf32_bigarm_vec)	tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
-    bfd_elf32_bigarmqnx_vec)	tb="$tb elfarmqnx-nabi.lo elfarm-nabi.lo elf32.lo $elf" ;;
+    bfd_elf32_bigarm_vec)	tb="$tb elfarm-nabi.lo elf32-qnx.lo elf32.lo $elf" ;;
+    bfd_elf32_bigarmqnx_vec)	tb="$tb elfarm-nabi.lo elf32-qnx.lo elf32.lo $elf" ;;
     bfd_elf32_bigmips_vec) 	tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_cris_vec)		tb="$tb elf32-cris.lo elf32.lo $elf" ;;
     bfd_elf32_d10v_vec)		tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
@@ -570,9 +570,9 @@ do
     bfd_elf32_hppa_linux_vec)	tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
     bfd_elf32_hppa_vec)		tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
     bfd_elf32_i370_vec)		tb="$tb elf32-i370.lo elf32.lo $elf" ;;
-    bfd_elf32_i386_freebsd_vec)	tb="$tb elf32-i386-fbsd.lo elf32.lo $elf" ;;
-    bfd_elf32_i386_vec)		tb="$tb elf32-i386.lo elf32.lo $elf" ;;
-    bfd_elf32_i386qnx_vec)	tb="$tb elf32-i386qnx.lo elf32.lo $elf" ;;
+    bfd_elf32_i386_freebsd_vec)	tb="$tb elf32-i386.lo elf32-qnx.lo elf32.lo $elf" ;;
+    bfd_elf32_i386_vec)		tb="$tb elf32-i386.lo elf32-qnx.lo elf32.lo $elf" ;;
+    bfd_elf32_i386qnx_vec)	tb="$tb elf32-i386.lo elf32-qnx.lo elf32.lo $elf" ;;
     bfd_elf32_i860_little_vec)	tb="$tb elf32-i860.lo elf32.lo $elf" ;;
     bfd_elf32_i860_vec)		tb="$tb elf32-i860.lo elf32.lo $elf" ;;
     bfd_elf32_i960_vec)		tb="$tb elf32-i960.lo elf32.lo $elf" ;;
@@ -582,8 +582,8 @@ do
     bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
     bfd_elf32_littlearc_vec)	tb="$tb elf32-arc.lo elf32.lo $elf" ;;
     bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
-    bfd_elf32_littlearm_vec)	tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
-    bfd_elf32_littlearmqnx_vec)	tb="$tb elfarmqnx-nabi.lo elfarm-nabi.lo elf32.lo $elf" ;;
+    bfd_elf32_littlearm_vec)	tb="$tb elfarm-nabi.lo elf32-qnx.lo elf32.lo $elf" ;;
+    bfd_elf32_littlearmqnx_vec)	tb="$tb elfarm-nabi.lo elf32-qnx.lo elf32.lo $elf" ;;
     bfd_elf32_littlemips_vec) 	tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_m32r_vec)		tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
     bfd_elf32_m68hc11_vec)	tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;;
@@ -602,28 +602,28 @@ do
     bfd_elf32_or32_big_vec)	tb="$tb elf32-or32.lo elf32.lo $elf" ;;
     bfd_elf32_pj_vec)           tb="$tb elf32-pj.lo elf32.lo $elf";;
     bfd_elf32_pjl_vec)          tb="$tb elf32-pj.lo elf32.lo $elf";;
-    bfd_elf32_powerpc_vec)	tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
-    bfd_elf32_powerpcle_vec)	tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
-    bfd_elf32_powerpcleqnx_vec)	tb="$tb elf32-ppcqnx.lo elf32-ppc.lo elf32.lo $elf" ;;
-    bfd_elf32_powerpcqnx_vec)	tb="$tb elf32-ppcqnx.lo elf32-ppc.lo elf32.lo $elf" ;;
+    bfd_elf32_powerpc_vec)	tb="$tb elf32-ppc.lo elf32-qnx.lo elf32.lo $elf" ;;
+    bfd_elf32_powerpcle_vec)	tb="$tb elf32-ppc.lo elf32-qnx.lo elf32.lo $elf" ;;
+    bfd_elf32_powerpcleqnx_vec)	tb="$tb elf32-ppc.lo elf32-qnx.lo elf32.lo $elf" ;;
+    bfd_elf32_powerpcqnx_vec)	tb="$tb elf32-ppc.lo elf32-qnx.lo elf32.lo $elf" ;;
     bfd_elf32_s390_vec)		tb="$tb elf32-s390.lo elf32.lo $elf" ;;
     # FIXME: We include cofflink.lo not because it's needed for
     # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec
     # which needs it but does not list it.  Should be fixed in right place.
     bfd_elf32_sh64_vec)		tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
     bfd_elf32_sh64l_vec)	tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
-    bfd_elf32_sh64lin_vec)	tb="$tb elf32-sh64-lin.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
-    bfd_elf32_sh64blin_vec)	tb="$tb elf32-sh64-lin.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
-    bfd_elf32_sh64lnbsd_vec)	tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
-    bfd_elf32_sh64nbsd_vec)	tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
-    bfd_elf32_sh_vec)		tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
-    bfd_elf32_shblin_vec)	tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.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_shlnbsd_vec)	tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
-    bfd_elf32_shlqnx_vec)	tb="$tb elf32-shqnx.lo elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
-    bfd_elf32_shnbsd_vec)	tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
-    bfd_elf32_shqnx_vec)	tb="$tb elf32-shqnx.lo elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
+    bfd_elf32_sh64lin_vec)	tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+    bfd_elf32_sh64blin_vec)	tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+    bfd_elf32_sh64lnbsd_vec)	tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
+    bfd_elf32_sh64nbsd_vec)	tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
+    bfd_elf32_sh_vec)		tb="$tb elf32-sh.lo elf32-qnx.lo elf32.lo $elf coff-sh.lo" ;;
+    bfd_elf32_shblin_vec)	tb="$tb elf32-sh.lo elf32-qnx.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+    bfd_elf32_shl_vec)		tb="$tb elf32-sh.lo elf32-qnx.lo elf32.lo elf32-qnx.lo $elf coff-sh.lo" ;;
+    bfd_elf32_shlin_vec)	tb="$tb elf32-sh.lo elf32-qnx.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+    bfd_elf32_shlnbsd_vec)	tb="$tb elf32-sh.lo elf32-qnx.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+    bfd_elf32_shlqnx_vec)	tb="$tb elf32-sh.lo elf32-qnx.lo elf32.lo $elf coff-sh.lo" ;;
+    bfd_elf32_shnbsd_vec)	tb="$tb elf32-sh.lo elf32-qnx.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+    bfd_elf32_shqnx_vec)	tb="$tb elf32-sh.lo elf32-qnx.lo elf32.lo $elf coff-sh.lo" ;;
     bfd_elf32_sparc_vec)	tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
     bfd_elf32_tradbigmips_vec)  tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
@@ -650,10 +650,10 @@ do
     bfd_elf64_s390_vec)		tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_sh64_vec)		tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
     bfd_elf64_sh64l_vec)	tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
-    bfd_elf64_sh64lin_vec)	tb="$tb elf64-sh64-lin.lo elf64.lo $elf" target_size=64 ;;
-    bfd_elf64_sh64blin_vec)	tb="$tb elf64-sh64-lin.lo elf64.lo $elf" target_size=64 ;;
-    bfd_elf64_sh64lnbsd_vec)	tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
-    bfd_elf64_sh64nbsd_vec)	tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
+    bfd_elf64_sh64lin_vec)	tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
+    bfd_elf64_sh64blin_vec)	tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
+    bfd_elf64_sh64lnbsd_vec)	tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
+    bfd_elf64_sh64nbsd_vec)	tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
     bfd_elf64_sparc_vec)	tb="$tb elf64-sparc.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_tradbigmips_vec)	tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
     bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.94
diff -u -p -r1.94 elf32-arm.h
--- bfd/elf32-arm.h	11 Oct 2002 08:33:11 -0000	1.94
+++ bfd/elf32-arm.h	16 Oct 2002 06:22:45 -0000
@@ -3649,9 +3649,7 @@ elf32_arm_reloc_type_class (rela)
 
 #define ELF_ARCH			bfd_arch_arm
 #define ELF_MACHINE_CODE		EM_ARM
-#ifndef ELF_MAXPAGESIZE
 #define ELF_MAXPAGESIZE			0x8000
-#endif
 
 #define bfd_elf32_bfd_copy_private_bfd_data	elf32_arm_copy_private_bfd_data
 #define bfd_elf32_bfd_merge_private_bfd_data	elf32_arm_merge_private_bfd_data
Index: bfd/elf32-i386-fbsd.c
===================================================================
RCS file: bfd/elf32-i386-fbsd.c
diff -N bfd/elf32-i386-fbsd.c
--- bfd/elf32-i386-fbsd.c	17 Sep 2002 19:49:04 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,56 +0,0 @@
-/* Intel IA-32 specific support for 32-bit ELF on FreeBSD.
-   Copyright 2002 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_LITTLE_SYM	bfd_elf32_i386_freebsd_vec
-#define TARGET_LITTLE_NAME	"elf32-i386-freebsd"
-#define ELF_ARCH		bfd_arch_i386
-#define ELF_MACHINE_CODE	EM_386
-#define ELF_MAXPAGESIZE		0x1000
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "elf-bfd.h"
-
-/* The kernel recognizes executables as valid only if they carry a
-   "FreeBSD" label in the ELF header.  So we put this label on all
-   executables and (for simplicity) also all other object files.  */
-
-static void elf_i386_post_process_headers
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-static void
-elf_i386_post_process_headers (abfd, link_info)
-     bfd * abfd;
-     struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
-{
-  Elf_Internal_Ehdr * i_ehdrp;	/* ELF file header, internal form.  */
-
-  i_ehdrp = elf_elfheader (abfd);
-
-  /* Put an ABI label supported by FreeBSD >= 4.1.  */
-  i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
-#ifdef OLD_FREEBSD_ABI_LABEL
-  /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard.  */
-  memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
-#endif
-}
-
-#define elf_backend_post_process_headers	elf_i386_post_process_headers
-
-#include "elf32-i386.c"
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.87
diff -u -p -r1.87 elf32-i386.c
--- bfd/elf32-i386.c	8 Oct 2002 16:11:07 -0000	1.87
+++ bfd/elf32-i386.c	16 Oct 2002 06:22:53 -0000
@@ -3348,13 +3348,11 @@ elf_i386_finish_dynamic_sections (output
   return true;
 }
 
-#ifndef ELF_ARCH
 #define TARGET_LITTLE_SYM		bfd_elf32_i386_vec
 #define TARGET_LITTLE_NAME		"elf32-i386"
 #define ELF_ARCH			bfd_arch_i386
 #define ELF_MACHINE_CODE		EM_386
 #define ELF_MAXPAGESIZE			0x1000
-#endif /* ELF_ARCH */
 
 #define elf_backend_can_gc_sections	1
 #define elf_backend_can_refcount	1
@@ -3389,6 +3387,62 @@ elf_i386_finish_dynamic_sections (output
 #define elf_backend_relocate_section	      elf_i386_relocate_section
 #define elf_backend_size_dynamic_sections     elf_i386_size_dynamic_sections
 
-#ifndef ELF32_I386_C_INCLUDED
 #include "elf32-target.h"
+
+/* FreeBSD support.  */
+
+#undef	TARGET_LITTLE_SYM
+#define	TARGET_LITTLE_SYM		bfd_elf32_i386_freebsd_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME		"elf32-i386-freebsd"
+
+/* The kernel recognizes executables as valid only if they carry a
+   "FreeBSD" label in the ELF header.  So we put this label on all
+   executables and (for simplicity) also all other object files.  */
+
+static void elf_i386_post_process_headers
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+static void
+elf_i386_post_process_headers (abfd, link_info)
+     bfd *abfd;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+{
+  Elf_Internal_Ehdr *i_ehdrp;
+
+  i_ehdrp = elf_elfheader (abfd);
+
+  /* Put an ABI label supported by FreeBSD >= 4.1.  */
+  i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+#ifdef OLD_FREEBSD_ABI_LABEL
+  /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard.  */
+  memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
 #endif
+}
+
+#undef	elf_backend_post_process_headers
+#define	elf_backend_post_process_headers      elf_i386_post_process_headers
+
+#define	elf32_bed			elf32_i386_fbsd_bed
+
+#include "elf32-target.h"
+
+#undef	elf_backend_post_process_headers
+#undef	elf32_bed
+
+/* QNX support.  */
+#include "elf32-qnx.h"
+
+#undef	TARGET_LITTLE_SYM
+#define	TARGET_LITTLE_SYM		bfd_elf32_i386qnx_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME		"elf32-i386-nto"
+
+#define	elf32_bed			elf32_i386_qnx_bed
+
+#include "elf32-target.h"
+
+#undef	elf_backend_set_nonloadable_filepos
+#undef	elf_backend_is_contained_by_filepos
+#undef	elf_backend_copy_private_bfd_data_p
+#undef	elf32_bed
Index: bfd/elf32-i386qnx.c
===================================================================
RCS file: bfd/elf32-i386qnx.c
diff -N bfd/elf32-i386qnx.c
--- bfd/elf32-i386qnx.c	16 Oct 2002 00:56:41 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-/* Intel 80386/80486 QNX specific support for 32-bit ELF
-   Copyright 2002
-   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 ELF32_I386_C_INCLUDED
-#include "elf32-i386.c"
-
-#include "elf32-qnx.h"
-
-#undef  TARGET_LITTLE_SYM
-#define TARGET_LITTLE_SYM		bfd_elf32_i386qnx_vec
-#undef  TARGET_LITTLE_NAME
-#define TARGET_LITTLE_NAME		"elf32-i386-nto"
-
-#include "elf32-target.h"
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.52
diff -u -p -r1.52 elf32-ppc.c
--- bfd/elf32-ppc.c	21 Sep 2002 10:09:13 -0000	1.52
+++ bfd/elf32-ppc.c	16 Oct 2002 06:22:57 -0000
@@ -3849,7 +3849,25 @@ ppc_elf_grok_psinfo (abfd, note)
 #define elf_backend_grok_psinfo			ppc_elf_grok_psinfo
 #define elf_backend_reloc_type_class		ppc_elf_reloc_type_class
 
-#ifndef ELF32_PPC_C_INCLUDED
 #include "elf32-target.h"
-#endif
 
+/* QNX support.  */
+#include "elf32-qnx.h"
+
+#undef	TARGET_LITTLE_SYM 
+#define	TARGET_LITTLE_SYM		bfd_elf32_powerpcleqnx_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME		"elf32-powerpcle-nto"
+#undef	TARGET_BIG_SYM
+#define	TARGET_BIG_SYM			bfd_elf32_powerpcqnx_vec
+#undef	TARGET_BIG_NAME
+#define	TARGET_BIG_NAME			"elf32-powerpc-nto"
+
+#define	elf32_bed			elf32_ppc_qnx_bed
+
+#include "elf32-target.h"
+
+#undef	elf_backend_set_nonloadable_filepos
+#undef	elf_backend_is_contained_by_filepos
+#undef	elf_backend_copy_private_bfd_data_p
+#undef	elf32_bed
Index: bfd/elf32-ppcqnx.c
===================================================================
RCS file: bfd/elf32-ppcqnx.c
diff -N bfd/elf32-ppcqnx.c
--- bfd/elf32-ppcqnx.c	16 Oct 2002 00:56:41 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,35 +0,0 @@
-/* PowerPC QNX specific support for 32-bit ELF
-   Copyright 2002 
-   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 ELF32_PPC_C_INCLUDED
-#include "elf32-ppc.c"
-
-#include "elf32-qnx.h"
-
-#undef  TARGET_LITTLE_SYM 
-#define TARGET_LITTLE_SYM       bfd_elf32_powerpcleqnx_vec
-#undef  TARGET_LITTLE_NAME
-#define TARGET_LITTLE_NAME	"elf32-powerpcle-nto"
-#undef  TARGET_BIG_SYM
-#define TARGET_BIG_SYM          bfd_elf32_powerpcqnx_vec
-#undef  TARGET_BIG_NAME
-#define TARGET_BIG_NAME		"elf32-powerpc-nto"
-
-#include "elf32-target.h"
Index: bfd/elf32-qnx.c
===================================================================
RCS file: bfd/elf32-qnx.c
diff -N bfd/elf32-qnx.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ bfd/elf32-qnx.c	16 Oct 2002 06:22:57 -0000
@@ -0,0 +1,92 @@
+/* QNX specific support for 32-bit ELF
+   Copyright 2002  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.  */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "elf-bfd.h"
+#include "elf32-qnx.h"
+
+/* Returns the end address of the segment + 1.  */
+#define SEGMENT_END(segment, start)                     \
+  (start + (segment->p_memsz > segment->p_filesz        \
+   ? segment->p_memsz : segment->p_filesz))
+
+boolean
+elf_qnx_copy_private_bfd_data_p (ibfd, isec, obfd, osec)
+     bfd *ibfd ATTRIBUTE_UNUSED;
+     asection *isec;
+     bfd *obfd ATTRIBUTE_UNUSED;
+     asection *osec ATTRIBUTE_UNUSED;
+{
+  return isec->next == NULL;
+}
+
+boolean
+elf_qnx_is_contained_by_filepos (section, segment)
+     asection *section;
+     Elf_Internal_Phdr *segment;
+{
+  return ((bfd_vma) section->filepos >= segment->p_offset
+          && ((bfd_vma) section->filepos + section->_raw_size
+	      <= SEGMENT_END (segment, segment->p_offset)));
+}
+
+void
+elf_qnx_set_nonloadable_filepos (abfd, phdrs)
+     bfd *abfd;
+     Elf_Internal_Phdr *phdrs;
+{
+  struct elf_segment_map *m;
+  Elf_Internal_Phdr *p;
+  file_ptr off = 0;
+
+  for (m = elf_tdata (abfd)->segment_map, p = phdrs;
+       m != NULL;
+       m = m->next, p++)
+    {
+      unsigned int i;
+      asection **secpp;
+
+      for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
+        {
+          asection *sec;
+
+          sec = *secpp;
+
+          if (p->p_type == PT_LOAD)
+	    off = sec->filepos;
+          else
+            {
+              if (i == 0)
+                {
+                  if (sec->filepos)
+                    p->p_offset = sec->filepos;
+                  else
+                    p->p_offset = off;
+                }
+              if (!sec->filepos)
+                {
+                  off += sec->_raw_size;
+                  p->p_filesz += sec->_raw_size;
+                }
+            }
+        }
+    }
+  return;
+}
Index: bfd/elf32-qnx.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-qnx.h,v
retrieving revision 1.2
diff -u -p -r1.2 elf32-qnx.h
--- bfd/elf32-qnx.h	22 Aug 2002 17:27:19 -0000	1.2
+++ bfd/elf32-qnx.h	16 Oct 2002 06:22:57 -0000
@@ -14,98 +14,19 @@
    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.  */
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-  /* Returns the end address of the segment + 1.  */
-#define SEGMENT_END(segment, start)                     \
-  (start + (segment->p_memsz > segment->p_filesz        \
-   ? segment->p_memsz : segment->p_filesz))
-
-static boolean elf_qnx_copy_private_bfd_data_p
+boolean elf_qnx_copy_private_bfd_data_p
   PARAMS ((bfd *, asection *, bfd *, asection *));
-static boolean elf_qnx_is_contained_by_filepos
+boolean elf_qnx_is_contained_by_filepos
   PARAMS ((asection *, Elf_Internal_Phdr *));
-static void elf_qnx_set_nonloadable_filepos
+void elf_qnx_set_nonloadable_filepos
   PARAMS ((bfd *, Elf_Internal_Phdr *));
 
-static boolean
-elf_qnx_copy_private_bfd_data_p (ibfd, isec, obfd, osec)
-     bfd *ibfd;
-     asection *isec;
-     bfd *obfd;
-     asection *osec;
-{
-  /* We don't use these parameters, but another target might.  */
-  ibfd = ibfd;
-  obfd = obfd;
-  osec = osec;
-
-  return isec->next == NULL;
-}
-
-static boolean
-elf_qnx_is_contained_by_filepos (section, segment)
-     asection *section;
-     Elf_Internal_Phdr *segment;
-{
-  return ((bfd_vma) section->filepos >= segment->p_offset
-          && ((bfd_vma) section->filepos + section->_raw_size
-	      <= SEGMENT_END (segment, segment->p_offset)));
-}
-
-static void
-elf_qnx_set_nonloadable_filepos (abfd, phdrs)
-     bfd *abfd;
-     Elf_Internal_Phdr *phdrs;
-{
-  struct elf_segment_map *m;
-  Elf_Internal_Phdr *p;
-  file_ptr off = 0;
-
-  for (m = elf_tdata (abfd)->segment_map, p = phdrs;
-       m != NULL;
-       m = m->next, p++)
-    {
-      unsigned int i;
-      asection **secpp;
-
-      for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
-        {
-          asection *sec;
-
-          sec = *secpp;
-
-          if (p->p_type == PT_LOAD)
-	    off = sec->filepos;
-          else
-            {
-              if (i == 0)
-                {
-                  if (sec->filepos)
-                    p->p_offset = sec->filepos;
-                  else
-                    p->p_offset = off;
-                }
-              if (!sec->filepos)
-                {
-                  off += sec->_raw_size;
-                  p->p_filesz += sec->_raw_size;
-                }
-            }
-        }
-    }
-  return;
-}
-
-#ifndef elf_backend_set_nonloadable_filepos
-#define elf_backend_set_nonloadable_filepos elf_qnx_set_nonloadable_filepos
-#endif
-
-#ifndef elf_backend_is_contained_by_filepos
-#define elf_backend_is_contained_by_filepos elf_qnx_is_contained_by_filepos
-#endif
-
-#ifndef elf_backend_copy_private_bfd_data_p
-#define elf_backend_copy_private_bfd_data_p elf_qnx_copy_private_bfd_data_p
-#endif
+#undef	elf_backend_set_nonloadable_filepos
+#define	elf_backend_set_nonloadable_filepos elf_qnx_set_nonloadable_filepos
+#undef	elf_backend_is_contained_by_filepos
+#define	elf_backend_is_contained_by_filepos elf_qnx_is_contained_by_filepos
+#undef	elf_backend_copy_private_bfd_data_p
+#define	elf_backend_copy_private_bfd_data_p elf_qnx_copy_private_bfd_data_p
Index: bfd/elf32-sh-lin.c
===================================================================
RCS file: bfd/elf32-sh-lin.c
diff -N bfd/elf32-sh-lin.c
--- bfd/elf32-sh-lin.c	18 Sep 2001 09:57:24 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,110 +0,0 @@
-/* Hitachi SH specific support for 32-bit Linux
-   Copyright 2000, 2001 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 "bfd.h"
-#include "sysdep.h"
-#include "elf/internal.h"
-#include "elf-bfd.h"
-
-static boolean elf32_shlin_grok_prstatus
-  PARAMS ((bfd *abfd, Elf_Internal_Note *note));
-static boolean elf32_shlin_grok_psinfo
-  PARAMS ((bfd *abfd, Elf_Internal_Note *note));
-
-/* Support for core dump NOTE sections */
-static boolean
-elf32_shlin_grok_prstatus (abfd, note)
-     bfd *abfd;
-     Elf_Internal_Note *note;
-{
-  int offset;
-  unsigned int raw_size;
-
-  switch (note->descsz)
-    {
-      default:
-	return false;
-
-      case 168:		/* Linux/SH */
-	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
-
-	/* pr_pid */
-	elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
-
-	/* pr_reg */
-	offset = 72;
-	raw_size = 92;
-
-	break;
-    }
-
-  /* Make a ".reg/999" section.  */
-  return _bfd_elfcore_make_pseudosection (abfd, ".reg",
-					  raw_size, note->descpos + offset);
-}
-
-static boolean
-elf32_shlin_grok_psinfo (abfd, note)
-     bfd *abfd;
-     Elf_Internal_Note *note;
-{
-  switch (note->descsz)
-    {
-      default:
-	return false;
-
-      case 124:		/* Linux/SH elf_prpsinfo */
-	elf_tdata (abfd)->core_program
-	 = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-	elf_tdata (abfd)->core_command
-	 = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
-    }
-
-  /* Note that for some reason, a spurious space is tacked
-     onto the end of the args in some (at least one anyway)
-     implementations, so strip it off if it exists.  */
-
-  {
-    char *command = elf_tdata (abfd)->core_command;
-    int n = strlen (command);
-
-    if (0 < n && command[n - 1] == ' ')
-      command[n - 1] = '\0';
-  }
-
-  return true;
-}
-\f
-
-#define elf_backend_grok_prstatus	elf32_shlin_grok_prstatus
-#define elf_backend_grok_psinfo		elf32_shlin_grok_psinfo
-
-
-
-#include "elf32-sh.c"
Index: bfd/elf32-sh-nbsd.c
===================================================================
RCS file: bfd/elf32-sh-nbsd.c
diff -N bfd/elf32-sh-nbsd.c
--- bfd/elf32-sh-nbsd.c	8 Jan 2002 04:22:52 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-/* Hitachi SH specific support for 32-bit NetBSD
-   Copyright 2002 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_shnbsd_vec
-#define TARGET_BIG_NAME "elf32-sh-nbsd"
-#define TARGET_LITTLE_SYM bfd_elf32_shlnbsd_vec
-#define TARGET_LITTLE_NAME "elf32-shl-nbsd"
-#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: bfd/elf32-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.63
diff -u -p -r1.63 elf32-sh.c
--- bfd/elf32-sh.c	14 Oct 2002 19:29:54 -0000	1.63
+++ bfd/elf32-sh.c	16 Oct 2002 08:18:43 -0000
@@ -105,6 +105,10 @@ static enum elf_reloc_type_class sh_elf_
 #ifdef INCLUDE_SHMEDIA
 inline static void movi_shori_putval PARAMS ((bfd *, unsigned long, char *));
 #endif
+static boolean elf32_shlin_grok_prstatus
+  PARAMS ((bfd *abfd, Elf_Internal_Note *note));
+static boolean elf32_shlin_grok_psinfo
+  PARAMS ((bfd *abfd, Elf_Internal_Note *note));
 
 /* The name of the dynamic interpreter.  This is put in the .interp
    section.  */
@@ -7324,7 +7328,71 @@ sh_elf_reloc_type_class (rela)
     }
 }
 
-#ifndef ELF_ARCH
+/* Support for Linux core dump NOTE sections */
+static boolean
+elf32_shlin_grok_prstatus (abfd, note)
+     bfd *abfd;
+     Elf_Internal_Note *note;
+{
+  int offset;
+  unsigned int raw_size;
+
+  switch (note->descsz)
+    {
+      default:
+	return false;
+
+      case 168:		/* Linux/SH */
+	/* pr_cursig */
+	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+	/* pr_pid */
+	elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+	/* pr_reg */
+	offset = 72;
+	raw_size = 92;
+
+	break;
+    }
+
+  /* Make a ".reg/999" section.  */
+  return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+					  raw_size, note->descpos + offset);
+}
+
+static boolean
+elf32_shlin_grok_psinfo (abfd, note)
+     bfd *abfd;
+     Elf_Internal_Note *note;
+{
+  switch (note->descsz)
+    {
+      default:
+	return false;
+
+      case 124:		/* Linux/SH elf_prpsinfo */
+	elf_tdata (abfd)->core_program
+	 = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
+	elf_tdata (abfd)->core_command
+	 = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+    }
+
+  /* Note that for some reason, a spurious space is tacked
+     onto the end of the args in some (at least one anyway)
+     implementations, so strip it off if it exists.  */
+
+  {
+    char *command = elf_tdata (abfd)->core_command;
+    int n = strlen (command);
+
+    if (0 < n && command[n - 1] == ' ')
+      command[n - 1] = '\0';
+  }
+
+  return true;
+}
+
 #define TARGET_BIG_SYM		bfd_elf32_sh_vec
 #define TARGET_BIG_NAME		"elf32-sh"
 #define TARGET_LITTLE_SYM	bfd_elf32_shl_vec
@@ -7334,7 +7402,6 @@ sh_elf_reloc_type_class (rela)
 #define ELF_MAXPAGESIZE		128
 
 #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
@@ -7378,7 +7445,74 @@ sh_elf_reloc_type_class (rela)
 #define elf_backend_got_header_size	12
 #define elf_backend_plt_header_size	PLT_ENTRY_SIZE
 
-#ifndef ELF32_SH_C_INCLUDED
+#ifndef INCLUDE_SHMEDIA
+
 #include "elf32-target.h"
-#endif
 
+/* QNX support.  */
+#include "elf32-qnx.h"
+
+#undef	TARGET_LITTLE_SYM 
+#define	TARGET_LITTLE_SYM		bfd_elf32_shlqnx_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME		"elf32-shl-nto"
+#undef	TARGET_BIG_SYM
+#define	TARGET_BIG_SYM			bfd_elf32_shqnx_vec
+#undef	TARGET_BIG_NAME
+#define	TARGET_BIG_NAME			"elf32-sh-nto"
+#undef	ELF_MAXPAGESIZE
+#define	ELF_MAXPAGESIZE			0x1000
+
+#define	elf32_bed			elf32_sh_qnx_bed
+
+#include "elf32-target.h"
+
+#undef	elf_backend_set_nonloadable_filepos
+#undef	elf_backend_is_contained_by_filepos
+#undef	elf_backend_copy_private_bfd_data_p
+#undef	elf32_bed
+
+/* NetBSD support.  */
+#undef	TARGET_BIG_SYM
+#define	TARGET_BIG_SYM			bfd_elf32_shnbsd_vec
+#undef	TARGET_BIG_NAME
+#define	TARGET_BIG_NAME			"elf32-sh-nbsd"
+#undef	TARGET_LITTLE_SYM
+#define	TARGET_LITTLE_SYM		bfd_elf32_shlnbsd_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME		"elf32-shl-nbsd"
+#undef	ELF_MAXPAGESIZE
+#define	ELF_MAXPAGESIZE			0x10000
+#undef	elf_symbol_leading_char
+#define	elf_symbol_leading_char		0
+
+#define	elf32_bed			elf32_sh_nbsd_bed
+
+#include "elf32-target.h"
+
+#undef	elf32_bed
+
+/* Linux support.  */
+#undef	TARGET_BIG_SYM
+#define	TARGET_BIG_SYM			bfd_elf32_shblin_vec
+#undef	TARGET_BIG_NAME
+#define	TARGET_BIG_NAME			"elf32-shbig-linux"
+#undef	TARGET_LITTLE_SYM
+#define	TARGET_LITTLE_SYM		bfd_elf32_shlin_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME		"elf32-sh-linux"
+
+#undef	elf_backend_grok_prstatus
+#define	elf_backend_grok_prstatus	elf32_shlin_grok_prstatus
+#undef	elf_backend_grok_psinfo
+#define	elf_backend_grok_psinfo		elf32_shlin_grok_psinfo
+
+#define	elf32_bed			elf32_sh_lin_bed
+
+#include "elf32-target.h"
+
+#undef	elf_backend_grok_prstatus
+#undef	elf_backend_grok_psinfo
+#undef	elf32_bed
+
+#endif /* INCLUDE_SHMEDIA */
Index: bfd/elf32-sh64-lin.c
===================================================================
RCS file: bfd/elf32-sh64-lin.c
diff -N bfd/elf32-sh64-lin.c
--- bfd/elf32-sh64-lin.c	9 Oct 2002 19:03:57 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-/* Hitachi SH specific support for 64-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_sh64blin_vec
-#define TARGET_BIG_NAME "elf32-sh64big-linux"
-#define TARGET_LITTLE_SYM bfd_elf32_sh64lin_vec
-#define TARGET_LITTLE_NAME "elf32-sh64-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-sh64.c"
Index: bfd/elf32-sh64-nbsd.c
===================================================================
RCS file: bfd/elf32-sh64-nbsd.c
diff -N bfd/elf32-sh64-nbsd.c
--- bfd/elf32-sh64-nbsd.c	4 Jun 2002 02:57:38 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-/* SuperH SH64 specific support for 32-bit NetBSD
-   Copyright 2002 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_sh64nbsd_vec
-#define TARGET_BIG_NAME		"elf32-sh64-nbsd"
-#define TARGET_LITTLE_SYM	bfd_elf32_sh64lnbsd_vec
-#define TARGET_LITTLE_NAME	"elf32-sh64l-nbsd"
-#define ELF_ARCH		bfd_arch_sh
-#define ELF_MACHINE_CODE	EM_SH
-#define ELF_MAXPAGESIZE		0x10000
-#define elf_symbol_leading_char	0
-
-#include "elf32-sh64.c"
Index: bfd/elf32-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh64.c,v
retrieving revision 1.8
diff -u -p -r1.8 elf32-sh64.c
--- bfd/elf32-sh64.c	11 Oct 2002 08:33:11 -0000	1.8
+++ bfd/elf32-sh64.c	16 Oct 2002 06:23:03 -0000
@@ -89,18 +89,6 @@ static void sh64_find_section_for_addres
    define it true here.  */
 #define _bfd_sh_align_load_span(a,b,c,d,e,f,g,h,i,j) true
 
-#ifndef ELF_ARCH
-#define TARGET_BIG_SYM		bfd_elf32_sh64_vec
-#define TARGET_BIG_NAME		"elf32-sh64"
-#define TARGET_LITTLE_SYM	bfd_elf32_sh64l_vec
-#define TARGET_LITTLE_NAME	"elf32-sh64l"
-#define ELF_ARCH		bfd_arch_sh
-#define ELF_MACHINE_CODE	EM_SH
-#define ELF_MAXPAGESIZE		128
-
-#define elf_symbol_leading_char '_'
-#endif /* ELF_ARCH */
-
 #define GOT_BIAS (-((long)-32768))
 #define INCLUDE_SHMEDIA
 #include "elf32-sh.c"
@@ -745,3 +733,50 @@ sh64_elf_final_write_processing (abfd, l
 	}
     }
 }
+
+#undef	TARGET_BIG_SYM
+#define	TARGET_BIG_SYM		bfd_elf32_sh64_vec
+#undef	TARGET_BIG_NAME
+#define	TARGET_BIG_NAME		"elf32-sh64"
+#undef	TARGET_LITTLE_SYM
+#define	TARGET_LITTLE_SYM	bfd_elf32_sh64l_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME	"elf32-sh64l"
+
+#include "elf32-target.h"
+
+/* NetBSD support.  */
+#undef	TARGET_BIG_SYM
+#define	TARGET_BIG_SYM		bfd_elf32_sh64nbsd_vec
+#undef	TARGET_BIG_NAME
+#define	TARGET_BIG_NAME		"elf32-sh64-nbsd"
+#undef	TARGET_LITTLE_SYM
+#define	TARGET_LITTLE_SYM	bfd_elf32_sh64lnbsd_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME	"elf32-sh64l-nbsd"
+#undef	ELF_MAXPAGESIZE
+#define	ELF_MAXPAGESIZE		0x10000
+#undef	elf_symbol_leading_char
+#define	elf_symbol_leading_char	0
+
+#define	elf32_bed		elf32_sh64_nbsd_bed
+
+#include "elf32-target.h"
+
+#undef	elf32_bed
+
+/* Linux support.  */
+#undef	TARGET_BIG_SYM
+#define	TARGET_BIG_SYM		bfd_elf32_sh64blin_vec
+#undef	TARGET_BIG_NAME
+#define	TARGET_BIG_NAME		"elf32-sh64big-linux"
+#undef	TARGET_LITTLE_SYM
+#define	TARGET_LITTLE_SYM	bfd_elf32_sh64lin_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME	"elf32-sh64-linux"
+
+#define	elf32_bed		elf32_sh64_lin_bed
+
+#include "elf32-target.h"
+
+#undef	elf32_bed
Index: bfd/elf32-shqnx.c
===================================================================
RCS file: bfd/elf32-shqnx.c
diff -N bfd/elf32-shqnx.c
--- bfd/elf32-shqnx.c	16 Oct 2002 00:56:41 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,34 +0,0 @@
-/* Hitachi SH QNX specific support for 32-bit ELF
-   Copyright 2002   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 ELF32_SH_C_INCLUDED
-#include "elf32-sh.c"
-
-#include "elf32-qnx.h"
-
-#undef  TARGET_LITTLE_SYM 
-#define TARGET_LITTLE_SYM       bfd_elf32_shlqnx_vec
-#undef  TARGET_LITTLE_NAME
-#define TARGET_LITTLE_NAME	"elf32-shl-nto"
-#undef  TARGET_BIG_SYM
-#define TARGET_BIG_SYM          bfd_elf32_shqnx_vec
-#undef  TARGET_BIG_NAME
-#define TARGET_BIG_NAME		"elf32-sh-nto"
-
-#include "elf32-target.h"
Index: bfd/elf64-sh64-lin.c
===================================================================
RCS file: bfd/elf64-sh64-lin.c
diff -N bfd/elf64-sh64-lin.c
--- bfd/elf64-sh64-lin.c	9 Oct 2002 19:03:57 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-/* Hitachi SH specific support for 64-bit Linux
-   Copyright 2002 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_elf64_sh64blin_vec
-#define TARGET_BIG_NAME "elf64-sh64big-linux"
-#define TARGET_LITTLE_SYM bfd_elf64_sh64lin_vec
-#define TARGET_LITTLE_NAME "elf64-sh64-linux"
-#define ELF_ARCH bfd_arch_sh
-#define ELF_MACHINE_CODE EM_SH
-#define ELF_MAXPAGESIZE 0x10000
-#define elf_symbol_leading_char 0
-
-#include "elf64-sh64.c"
Index: bfd/elf64-sh64-nbsd.c
===================================================================
RCS file: bfd/elf64-sh64-nbsd.c
diff -N bfd/elf64-sh64-nbsd.c
--- bfd/elf64-sh64-nbsd.c	4 Jun 2002 02:57:38 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-/* SuperH SH64 specific support for 64-bit NetBSD
-   Copyright 2002 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_elf64_sh64nbsd_vec
-#define TARGET_BIG_NAME		"elf64-sh64-nbsd"
-#define TARGET_LITTLE_SYM	bfd_elf64_sh64lnbsd_vec
-#define TARGET_LITTLE_NAME	"elf64-sh64l-nbsd"
-#define ELF_ARCH		bfd_arch_sh
-#define ELF_MACHINE_CODE	EM_SH
-#define ELF_MAXPAGESIZE		0x10000
-#define elf_symbol_leading_char	0
-
-#include "elf64-sh64.c"
Index: bfd/elf64-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sh64.c,v
retrieving revision 1.21
diff -u -p -r1.21 elf64-sh64.c
--- bfd/elf64-sh64.c	11 Oct 2002 08:33:11 -0000	1.21
+++ bfd/elf64-sh64.c	16 Oct 2002 06:23:14 -0000
@@ -4129,8 +4129,6 @@ sh64_elf64_finish_dynamic_sections (outp
   return true;
 }
 
-
-#ifndef ELF_ARCH
 #define TARGET_BIG_SYM		bfd_elf64_sh64_vec
 #define TARGET_BIG_NAME		"elf64-sh64"
 #define TARGET_LITTLE_SYM	bfd_elf64_sh64l_vec
@@ -4140,7 +4138,6 @@ sh64_elf64_finish_dynamic_sections (outp
 #define ELF_MAXPAGESIZE		128
 
 #define elf_symbol_leading_char '_'
-#endif /* ELF_ARCH */
 
 #define bfd_elf64_bfd_reloc_type_lookup	sh_elf64_reloc_type_lookup
 #define elf_info_to_howto		sh_elf64_info_to_howto
@@ -4194,4 +4191,35 @@ sh64_elf64_finish_dynamic_sections (outp
 #define elf_backend_got_header_size	24
 #define elf_backend_plt_header_size	PLT_ENTRY_SIZE
 
+#include "elf64-target.h"
+
+/* NetBSD support.  */
+#undef	TARGET_BIG_SYM
+#define	TARGET_BIG_SYM			bfd_elf64_sh64nbsd_vec
+#undef	TARGET_BIG_NAME
+#define	TARGET_BIG_NAME			"elf64-sh64-nbsd"
+#undef	TARGET_LITTLE_SYM
+#define	TARGET_LITTLE_SYM		bfd_elf64_sh64lnbsd_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME		"elf64-sh64l-nbsd"
+#undef	ELF_MAXPAGESIZE
+#define	ELF_MAXPAGESIZE			0x10000
+#undef	elf_symbol_leading_char
+#define	elf_symbol_leading_char		0
+
+#define	elf64_bed			elf64_sh64_nbsd_bed
+
+#include "elf64-target.h"
+
+/* Linux support.  */
+#undef	TARGET_BIG_SYM
+#define	TARGET_BIG_SYM			bfd_elf64_sh64blin_vec
+#undef	TARGET_BIG_NAME
+#define	TARGET_BIG_NAME			"elf64-sh64big-linux"
+#undef	TARGET_LITTLE_SYM
+#define	TARGET_LITTLE_SYM		bfd_elf64_sh64lin_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME		"elf64-sh64-linux"
+
+#define	INCLUDED_TARGET_FILE
 #include "elf64-target.h"
Index: bfd/elfarm-nabi.c
===================================================================
RCS file: /cvs/src/src/bfd/elfarm-nabi.c,v
retrieving revision 1.12
diff -u -p -r1.12 elfarm-nabi.c
--- bfd/elfarm-nabi.c	30 Jul 2002 17:32:26 -0000	1.12
+++ bfd/elfarm-nabi.c	16 Oct 2002 06:23:14 -0000
@@ -749,6 +749,27 @@ elf32_arm_nabi_grok_psinfo (abfd, note)
 #define elf_backend_grok_prstatus	elf32_arm_nabi_grok_prstatus
 #define elf_backend_grok_psinfo		elf32_arm_nabi_grok_psinfo
 
-#ifndef ELFARM_NABI_C_INCLUDED
 #include "elf32-arm.h"
-#endif
+
+/* QNX support.  */
+#include "elf32-qnx.h"
+
+#undef	TARGET_LITTLE_SYM 
+#define	TARGET_LITTLE_SYM		bfd_elf32_littlearmqnx_vec
+#undef	TARGET_LITTLE_NAME
+#define	TARGET_LITTLE_NAME		"elf32-littlearm-nto"
+#undef	TARGET_BIG_SYM
+#define	TARGET_BIG_SYM			bfd_elf32_bigarmqnx_vec
+#undef	TARGET_BIG_NAME
+#define	TARGET_BIG_NAME			"elf32-bigarm-nto"
+#undef	ELF_MAXPAGESIZE
+#define	ELF_MAXPAGESIZE			0x1000
+
+#define	elf32_bed			elf32_arm_qnx_bed
+
+#include "elf32-target.h"
+
+#undef	elf_backend_set_nonloadable_filepos
+#undef	elf_backend_is_contained_by_filepos
+#undef	elf_backend_copy_private_bfd_data_p
+#undef	elf32_bed
Index: bfd/elfarmqnx-nabi.c
===================================================================
RCS file: bfd/elfarmqnx-nabi.c
diff -N bfd/elfarmqnx-nabi.c
--- bfd/elfarmqnx-nabi.c	16 Oct 2002 00:56:41 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,38 +0,0 @@
-/* ARM new abi QNX specific support for 32-bit ELF
-   Copyright 2002   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 ELFARM_NABI_C_INCLUDED
-#include "elfarm-nabi.c"
-
-#include "elf32-qnx.h"
-
-#undef  TARGET_LITTLE_SYM 
-#define TARGET_LITTLE_SYM       bfd_elf32_littlearmqnx_vec
-#undef  TARGET_LITTLE_NAME
-#define TARGET_LITTLE_NAME	"elf32-littlearm-nto"
-#undef  TARGET_BIG_SYM
-#define TARGET_BIG_SYM          bfd_elf32_bigarmqnx_vec
-#undef  TARGET_BIG_NAME
-#define TARGET_BIG_NAME		"elf32-bigarm-nto"
-
-/* QNX Neutrino for ARM has a max pagesize of 0x1000.  */
-#undef  ELF_MAXPAGESIZE
-#define ELF_MAXPAGESIZE 	0x1000
-
-#include "elf32-arm.h"

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get rid of more bfd bloat
  2002-10-17  2:43   ` Andreas Schwab
@ 2002-10-17  3:49     ` Alan Modra
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Modra @ 2002-10-17  3:49 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: binutils

On Thu, Oct 17, 2002 at 11:43:24AM +0200, Andreas Schwab wrote:
> Alan Modra <amodra@bigpond.net.au> writes:
> 
> |> -#define USE_REL
> |> +#define USE_REL	1
> |> +
> |> +#ifndef USE_REL
> |> +#define USE_REL	0
> |> +#endif
> 
> The last three lines are useless. :-)

Well, yes.  Documents the two possible values of USE_REL.  :)

Actually, I was going to go through the file and change
"#if USE_REL" to "if (USE_REL)" but didn't get around to it.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get rid of more bfd bloat
  2002-10-16 19:57 ` Alan Modra
@ 2002-10-17  2:43   ` Andreas Schwab
  2002-10-17  3:49     ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2002-10-17  2:43 UTC (permalink / raw)
  To: binutils

Alan Modra <amodra@bigpond.net.au> writes:

|> Index: bfd/elf32-m32r.c
|> ===================================================================
|> RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
|> retrieving revision 1.27
|> diff -u -p -r1.27 elf32-m32r.c
|> --- bfd/elf32-m32r.c	11 Oct 2002 08:33:11 -0000	1.27
|> +++ bfd/elf32-m32r.c	17 Oct 2002 02:43:13 -0000
|> @@ -88,7 +88,11 @@ asection * m32r_elf_gc_mark_hook
|>     This only saves space in libraries and object files, but perhaps
|>     relocs will be put in ROM?  All in all though, REL relocs are a pain
|>     to work with.  */
|> -#define USE_REL
|> +#define USE_REL	1
|> +
|> +#ifndef USE_REL
|> +#define USE_REL 0
|> +#endif

The last three lines are useless. :-)

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get rid of more bfd bloat
  2002-10-16 18:44 Stephen Clarke
@ 2002-10-16 19:57 ` Alan Modra
  2002-10-17  2:43   ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra @ 2002-10-16 19:57 UTC (permalink / raw)
  To: Stephen Clarke; +Cc: binutils

On Wed, Oct 16, 2002 at 06:43:48PM -0700, Stephen Clarke wrote:
> It looks rather like the ifndef USE_REL etc. in elfxx-target.h
> doesn't do the right thing if you include that file more than once.

Huh!

bfd/ChangeLog
	* elfxx-target.h (USE_REL): Don't define as 1.
	* elf32-arm.h (USE_REL): Provide a default define of 0.
	Use #if rather than #ifdef when testing USE_REL.
	* elf32-m32r.c: Likewise.

	* elf32-arc.c (USE_REL): Define as 1.
	* elf32-d10v.c (USE_REL): Likewise.
	* elf32-m32r.c (USE_REL): Likewise.
	* elf32-m68hc11.c (USE_REL): Likewise.
	* elf32-m68hc12.c (USE_REL): Likewise.
	* elf32-or32.c (USE_REL): Likewise.
	* elfarm-nabi.c (USE_REL): Likewise.

Index: bfd/elf32-arc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arc.c,v
retrieving revision 1.11
diff -u -p -r1.11 elf32-arc.c
--- bfd/elf32-arc.c	3 Jun 2002 01:57:09 -0000	1.11
+++ bfd/elf32-arc.c	17 Oct 2002 02:43:09 -0000
@@ -39,7 +39,7 @@ static bfd_reloc_status_type arc_elf_b22
 /* Try to minimize the amount of space occupied by relocation tables
    on the ROM (not that the ROM won't be swamped by other ELF overhead).  */
 
-#define USE_REL
+#define USE_REL	1
 
 static reloc_howto_type elf_arc_howto_table[] =
 {
Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.95
diff -u -p -r1.95 elf32-arm.h
--- bfd/elf32-arm.h	16 Oct 2002 08:39:37 -0000	1.95
+++ bfd/elf32-arm.h	17 Oct 2002 02:43:12 -0000
@@ -17,6 +17,10 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
+#ifndef USE_REL
+#define USE_REL	0
+#endif
+
 typedef unsigned long int insn32;
 typedef unsigned short int insn16;
 
@@ -76,7 +80,7 @@ static boolean elf32_arm_finish_dynamic_
   PARAMS ((bfd *, struct bfd_link_info *));
 static struct bfd_hash_entry * elf32_arm_link_hash_newfunc
   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-#ifdef USE_REL
+#if USE_REL
 static void arm_add_to_rel
   PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma));
 #endif
@@ -1094,7 +1098,7 @@ elf32_arm_final_link_relocate (howto, in
   local_got_offsets = elf_local_got_offsets (input_bfd);
   r_symndx = ELF32_R_SYM (rel->r_info);
 
-#ifdef USE_REL
+#if USE_REL
   addend = bfd_get_32 (input_bfd, hit_data) & howto->src_mask;
 
   if (addend & ((howto->src_mask + 1) >> 1))
@@ -1370,7 +1374,7 @@ elf32_arm_final_link_relocate (howto, in
 
     case R_ARM_THM_ABS5:
       /* Support ldr and str instructions for the thumb.  */
-#ifdef USE_REL
+#if USE_REL
       /* Need to refetch addend.  */
       addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask;
       /* ??? Need to determine shift amount from operand size.  */
@@ -1402,7 +1406,7 @@ elf32_arm_final_link_relocate (howto, in
 	bfd_vma        check;
 	bfd_signed_vma signed_check;
 
-#ifdef USE_REL
+#if USE_REL
 	/* Need to refetch the addend and squish the two 11 bit pieces
 	   together.  */
 	{
@@ -1507,7 +1511,7 @@ elf32_arm_final_link_relocate (howto, in
 	bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
 	bfd_signed_vma signed_check;
 
-#ifdef USE_REL
+#if USE_REL
 	/* Need to refetch addend.  */
 	addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask;
 	if (addend & ((howto->src_mask + 1) >> 1))
@@ -1745,7 +1749,7 @@ elf32_arm_final_link_relocate (howto, in
     }
 }
 
-#ifdef USE_REL
+#if USE_REL
 /* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS.  */
 static void
 arm_add_to_rel (abfd, address, howto, increment)
@@ -1837,7 +1841,7 @@ elf32_arm_relocate_section (output_bfd, 
   Elf_Internal_Rela *           relend;
   const char *                  name;
 
-#ifndef USE_REL
+#if !USE_REL
   if (info->relocateable)
     return true;
 #endif
@@ -1866,7 +1870,7 @@ elf32_arm_relocate_section (output_bfd, 
           || r_type == R_ARM_GNU_VTINHERIT)
         continue;
 
-#ifdef USE_REL
+#if USE_REL
       elf32_arm_info_to_howto (input_bfd, & bfd_reloc,
 			       (Elf_Internal_Rel *) rel);
 #else
@@ -1874,7 +1878,7 @@ elf32_arm_relocate_section (output_bfd, 
 #endif
       howto = bfd_reloc.howto;
 
-#ifdef USE_REL
+#if USE_REL
       if (info->relocateable)
 	{
 	  /* This is a relocateable link.  We don't have to change
@@ -1907,7 +1911,7 @@ elf32_arm_relocate_section (output_bfd, 
 	{
 	  sym = local_syms + r_symndx;
 	  sec = local_sections[r_symndx];
-#ifdef USE_REL
+#if USE_REL
 	  relocation = (sec->output_section->vma
 			+ sec->output_offset
 			+ sym->st_value);
@@ -3676,7 +3680,7 @@ elf32_arm_reloc_type_class (rela)
 #define elf_backend_plt_readonly    1
 #define elf_backend_want_got_plt    1
 #define elf_backend_want_plt_sym    0
-#ifndef USE_REL
+#if !USE_REL
 #define elf_backend_rela_normal     1
 #endif
 
Index: bfd/elf32-d10v.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-d10v.c,v
retrieving revision 1.16
diff -u -p -r1.16 elf32-d10v.c
--- bfd/elf32-d10v.c	1 Jul 2002 08:06:43 -0000	1.16
+++ bfd/elf32-d10v.c	17 Oct 2002 02:43:12 -0000
@@ -43,7 +43,7 @@ static boolean elf32_d10v_relocate_secti
 	   asection **));
 
 /* Use REL instead of RELA to save space.  */
-#define USE_REL
+#define USE_REL	1
 
 static reloc_howto_type elf_d10v_howto_table[] =
   {
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.27
diff -u -p -r1.27 elf32-m32r.c
--- bfd/elf32-m32r.c	11 Oct 2002 08:33:11 -0000	1.27
+++ bfd/elf32-m32r.c	17 Oct 2002 02:43:13 -0000
@@ -88,7 +88,11 @@ asection * m32r_elf_gc_mark_hook
    This only saves space in libraries and object files, but perhaps
    relocs will be put in ROM?  All in all though, REL relocs are a pain
    to work with.  */
-#define USE_REL
+#define USE_REL	1
+
+#ifndef USE_REL
+#define USE_REL 0
+#endif
 
 static reloc_howto_type m32r_elf_howto_table[] =
 {
@@ -982,7 +986,7 @@ m32r_elf_relocate_section (output_bfd, i
   /* Assume success.  */
   boolean ret = true;
 
-#ifndef USE_REL
+#if !USE_REL
   if (info->relocateable)
     return true;
 #endif
@@ -1026,7 +1030,7 @@ m32r_elf_relocate_section (output_bfd, i
       howto = m32r_elf_howto_table + r_type;
       r_symndx = ELF32_R_SYM (rel->r_info);
 
-#ifdef USE_REL
+#if USE_REL
       if (info->relocateable)
 	{
 	  /* This is a relocateable link.  We don't have to change
@@ -1102,7 +1106,7 @@ m32r_elf_relocate_section (output_bfd, i
 	      sym = local_syms + r_symndx;
 	      sec = local_sections[r_symndx];
 	      sym_name = "<local symbol>";
-#ifndef USE_REL
+#if !USE_REL
 	      relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
 	      addend = rel->r_addend;
 #else
@@ -1507,7 +1511,7 @@ m32r_elf_relax_section (abfd, sec, link_
 	     will be at least 4 bytes closer if we can relax.  It'll actually
 	     be 4 or 8 bytes closer, but we don't know which just yet and
 	     the difference isn't significant enough to worry about.  */
-#ifndef USE_REL /* put in for learning purposes */
+#if !USE_REL /* put in for learning purposes */
 	  pcrel_value += irel->r_addend;
 #else
 	  addend = bfd_get_signed_16 (abfd, contents + irel->r_offset + 2);
@@ -1536,7 +1540,7 @@ m32r_elf_relax_section (abfd, sec, link_
 		     We OR in CODE just in case it's not a nop (technically,
 		     CODE currently must be a nop, but for cleanness we
 		     allow it to be anything).  */
-#ifndef USE_REL /* put in for learning purposes */
+#if !USE_REL /* put in for learning purposes */
 		  code = 0x7e000000 | MAKE_PARALLEL (code);
 #else
 		  code = (0x7e000000 + (((addend >> 2) & 0xff) << 16)) | MAKE_PARALLEL (code);
@@ -1546,7 +1550,7 @@ m32r_elf_relax_section (abfd, sec, link_
 	      else
 		{
 		  /* Change the seth rN,foo to a bl24 foo.  */
-#ifndef USE_REL /* put in for learning purposes */
+#if !USE_REL /* put in for learning purposes */
 		  code = 0xfe000000;
 #else
 		  code = 0xfe000000 + ((addend >> 2) & 0xffffff);
@@ -2107,7 +2111,7 @@ m32r_elf_check_relocs (abfd, info, sec, 
 #define elf_backend_check_relocs                m32r_elf_check_relocs
 
 #define elf_backend_can_gc_sections             1
-#ifndef USE_REL
+#if !USE_REL
 #define elf_backend_rela_normal			1
 #endif
 #if 0 /* not yet */
Index: bfd/elf32-m68hc11.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68hc11.c,v
retrieving revision 1.11
diff -u -p -r1.11 elf32-m68hc11.c
--- bfd/elf32-m68hc11.c	12 Oct 2002 14:00:55 -0000	1.11
+++ bfd/elf32-m68hc11.c	17 Oct 2002 02:43:15 -0000
@@ -62,7 +62,7 @@ boolean _bfd_m68hc11_elf_set_private_fla
 boolean _bfd_m68hc11_elf_print_private_bfd_data PARAMS ((bfd *, PTR));
 
 /* Use REL instead of RELA to save space */
-#define USE_REL
+#define USE_REL	1
 
 /* The Motorola 68HC11 microcontroler only addresses 64Kb.
    We must handle 8 and 16-bit relocations.  The 32-bit relocation
Index: bfd/elf32-m68hc12.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68hc12.c,v
retrieving revision 1.8
diff -u -p -r1.8 elf32-m68hc12.c
--- bfd/elf32-m68hc12.c	22 Aug 2002 05:41:53 -0000	1.8
+++ bfd/elf32-m68hc12.c	17 Oct 2002 02:43:16 -0000
@@ -54,7 +54,7 @@ boolean _bfd_m68hc12_elf_print_private_b
 
 
 /* Use REL instead of RELA to save space */
-#define USE_REL
+#define USE_REL	1
 
 /* The Motorola 68HC11 microcontroler only addresses 64Kb.
    We must handle 8 and 16-bit relocations.  The 32-bit relocation
Index: bfd/elf32-or32.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-or32.c,v
retrieving revision 1.2
diff -u -p -r1.2 elf32-or32.c
--- bfd/elf32-or32.c	3 Jun 2002 01:57:09 -0000	1.2
+++ bfd/elf32-or32.c	17 Oct 2002 02:50:06 -0000
@@ -38,7 +38,7 @@ static bfd_reloc_status_type  or32_elf_j
 
 /* Try to minimize the amount of space occupied by relocation tables
    on the ROM (not that the ROM won't be swamped by other ELF overhead).  */
-#define USE_REL
+#define USE_REL	1
 
 static reloc_howto_type elf_or32_howto_table[] =
 {
Index: bfd/elfarm-nabi.c
===================================================================
RCS file: /cvs/src/src/bfd/elfarm-nabi.c,v
retrieving revision 1.13
diff -u -p -r1.13 elfarm-nabi.c
--- bfd/elfarm-nabi.c	16 Oct 2002 08:39:37 -0000	1.13
+++ bfd/elfarm-nabi.c	17 Oct 2002 02:43:16 -0000
@@ -27,7 +27,7 @@
 #define NUM_ELEM(a)  (sizeof (a) / (sizeof (a)[0]))
 #endif
 
-#define USE_REL
+#define USE_REL	1
 
 #define TARGET_LITTLE_SYM               bfd_elf32_littlearm_vec
 #define TARGET_LITTLE_NAME              "elf32-littlearm"
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.45
diff -u -p -r1.45 elfxx-target.h
--- bfd/elfxx-target.h	23 Jul 2002 11:15:06 -0000	1.45
+++ bfd/elfxx-target.h	17 Oct 2002 02:43:16 -0000
@@ -407,9 +407,6 @@
    For backwards compatibility, we still support this usage.  */
 #ifndef USE_REL
 #define USE_REL 0
-#else
-#undef USE_REL
-#define USE_REL 1
 #endif
 
 /* Use these in new code.  */


-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get rid of more bfd bloat
@ 2002-10-16 18:44 Stephen Clarke
  2002-10-16 19:57 ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Clarke @ 2002-10-16 18:44 UTC (permalink / raw)
  To: amodra; +Cc: binutils

> Gets rid of most of the cases where ELF targets #include a C file just
> to make minor target variations.  The one case left is elf32-sh64.c
> which includes elf32-sh.c.

sh-linux and sh64-linux (at least) are broken following this patch: they
are now generating .rel relocations where they used generate .rela
sections.
It looks rather like the ifndef USE_REL etc. in elfxx-target.h
doesn't do the right thing if you include that file more than once.

Steve.


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-10-17 10:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-16  1:44 Get rid of more bfd bloat Alan Modra
2002-10-16 18:44 Stephen Clarke
2002-10-16 19:57 ` Alan Modra
2002-10-17  2:43   ` Andreas Schwab
2002-10-17  3:49     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).