aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorDavid O'Brien <obrien@FreeBSD.org>2002-09-17 02:24:40 +0000
committerDavid O'Brien <obrien@FreeBSD.org>2002-09-17 02:24:40 +0000
commit4ada7262d0ae846b2ece141e6c8e091d7b350832 (patch)
treeb39dc8a5acedf43aaf393b002446936c19b875ac /bfd
parentf184d8167ce62203049fda398042409cb4d83ef2 (diff)
downloadgdb-4ada7262d0ae846b2ece141e6c8e091d7b350832.zip
gdb-4ada7262d0ae846b2ece141e6c8e091d7b350832.tar.gz
gdb-4ada7262d0ae846b2ece141e6c8e091d7b350832.tar.bz2
2002-09-16 Bruno Haible <bruno@clisp.org>
* elf32-i386.c: Don't defined ELF_ARCH etc. if this file is included by a target variant implementation. * elf64-alpha.c: Likewise. * elf32-i386-fbsd.c: New file. * elf64-alpha-fbsd.c: New file. * targets.c: Support bfd_elf32_i386_freebsd_vec and bfd_elf64_alpha_freebsd_vec. * configure.in: Accept the vectors bfd_elf32_i386_freebsd_vec, bfd_elf64_alpha_freebsd_vec. * Makefile.am (BFD32_BACKENDS): Add elf32-i386-fbsd.lo. (BFD32_BACKENDS_CFILES): Add elf32-i386-fbsd.c. (BFD64_BACKENDS): Add elf64-alpha-fbsd.lo. (BFD64_BACKENDS_CFILES): Add elf64-alpha-fbsd.c. (elf32-i386-fbsd.lo, elf64-alpha-fbsd.lo): Add dependencies. * config.bfd: For FreeBSD targets, set targ_defvec to a FreeBSD specific targets. Define OLD_FREEBSD_ABI_LABEL if appropriate. * config/tc-i386.h (ELF_TARGET_FORMAT): New macro. (TARGET_FORMAT): Use ELF_TARGET_FORMAT instead of "elf32-i386". * config/tc-i386.c (i386_target_format): Likewise. * config/tc-alpha.h (ELF_TARGET_FORMAT): New macro. (TARGET_FORMAT): Use ELF_TARGET_FORMAT instead of "elf64-alpha". * emulparams/elf_i386_fbsd.sh: Set OUTPUT_FORMAT to elf32-i386-freebsd. * emulparams/elf64alpha_fbsd.sh: Set OUTPUT_FORMAT to elf64-alpha-freebsd. Approved by: Alan Modra <amodra@bigpond.net.au> Message-ID: <20020715021113.GJ30362@bubble.sa.bigpond.net.au>
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog19
-rw-r--r--bfd/Makefile.am15
-rw-r--r--bfd/config.bfd18
-rw-r--r--bfd/configure.in2
-rw-r--r--bfd/elf32-i386-fbsd.c57
-rw-r--r--bfd/elf32-i386.c2
-rw-r--r--bfd/elf64-alpha-fbsd.c57
-rw-r--r--bfd/elf64-alpha.c2
-rw-r--r--bfd/targets.c4
9 files changed, 174 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 959c7c2..dd06968 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,22 @@
+2002-09-16 Bruno Haible <bruno@clisp.org>
+
+ * elf32-i386.c: Don't defined ELF_ARCH etc. if this file is included
+ by a target variant implementation.
+ * elf64-alpha.c: Likewise.
+ * elf32-i386-fbsd.c: New file.
+ * elf64-alpha-fbsd.c: New file.
+ * targets.c: Support bfd_elf32_i386_freebsd_vec and
+ bfd_elf64_alpha_freebsd_vec.
+ * configure.in: Accept the vectors bfd_elf32_i386_freebsd_vec,
+ bfd_elf64_alpha_freebsd_vec.
+ * Makefile.am (BFD32_BACKENDS): Add elf32-i386-fbsd.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-i386-fbsd.c.
+ (BFD64_BACKENDS): Add elf64-alpha-fbsd.lo.
+ (BFD64_BACKENDS_CFILES): Add elf64-alpha-fbsd.c.
+ (elf32-i386-fbsd.lo, elf64-alpha-fbsd.lo): Add dependencies.
+ * config.bfd: For FreeBSD targets, set targ_defvec to a FreeBSD
+ specific targets. Define OLD_FREEBSD_ABI_LABEL if appropriate.
+
2002-09-12 Jakub Jelinek <jakub@redhat.com>
* elf32-i386.c (dtpoff_base, tpoff): Don't crash if tls_segment is
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 4b5551e..cb57074 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -216,6 +216,7 @@ BFD32_BACKENDS = \
elf32-hppa.lo \
elf32-i370.lo \
elf32-i386.lo \
+ elf32-i386-fbsd.lo \
elf32-i386qnx.lo \
elf32-i860.lo \
elf32-i960.lo \
@@ -378,6 +379,7 @@ 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 \
@@ -487,6 +489,7 @@ BFD64_BACKENDS = \
efi-app-ia64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
+ elf64-alpha-fbsd.lo \
elf64-hppa.lo \
elf64-ia64.lo \
elf64-gen.lo \
@@ -513,6 +516,7 @@ BFD64_BACKENDS_CFILES = \
efi-app-ia64.c \
elf64-x86-64.c \
elf64-alpha.c \
+ elf64-alpha-fbsd.c \
elf64-hppa.c \
elf64-gen.c \
elfn32-mips.c \
@@ -1164,6 +1168,10 @@ elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
+elf32-i386-fbsd.lo: elf32-i386-fbsd.c elf32-i386.c $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-i386qnx.lo: elf32-i386qnx.c elf32-i386.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
@@ -1525,6 +1533,13 @@ elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
$(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
libecoff.h ecoffswap.h elf64-target.h
+elf64-alpha-fbsd.lo: elf64-alpha-fbsd.c elf64-alpha.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/alpha.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
+ $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
+ libecoff.h ecoffswap.h elf64-target.h
elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \
$(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 39b09ff..c76157f 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -71,7 +71,16 @@ esac
case "${targ}" in
# START OF targmatch.h
#ifdef BFD64
- alpha*-*-netbsd* | alpha*-*-freebsd* | alpha*-*-openbsd*)
+ alpha*-*-freebsd*)
+ targ_defvec=bfd_elf64_alpha_freebsd_vec
+ targ_selvecs=ecoffalpha_little_vec
+ # FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
+ case "${targ}" in
+ alpha*-*-freebsd3* | alpha*-*-freebsd4 | alpha*-*-freebsd4.0*)
+ targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;;
+ esac
+ ;;
+ alpha*-*-netbsd* | alpha*-*-openbsd*)
targ_defvec=bfd_elf64_alpha_vec
targ_selvecs=ecoffalpha_little_vec
;;
@@ -399,8 +408,13 @@ case "${targ}" in
targ_underscore=yes
;;
i[3456]86-*-freebsd*)
- targ_defvec=bfd_elf32_i386_vec
+ targ_defvec=bfd_elf32_i386_freebsd_vec
targ_selvecs=i386coff_vec
+ # FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
+ case "${targ}" in
+ i[3456]86-*-freebsd3* | i[3456]86-*-freebsd4 | i[3456]86-*-freebsd4.0*)
+ targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;;
+ esac
;;
i[3456]86-*-netbsdelf*)
targ_defvec=bfd_elf32_i386_vec
diff --git a/bfd/configure.in b/bfd/configure.in
index abc2aee..ba38dd4 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -576,6 +576,7 @@ 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_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
@@ -634,6 +635,7 @@ do
bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;;
bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
+ bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha-fbsd.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
diff --git a/bfd/elf32-i386-fbsd.c b/bfd/elf32-i386-fbsd.c
new file mode 100644
index 0000000..9420829
--- /dev/null
+++ b/bfd/elf32-i386-fbsd.c
@@ -0,0 +1,57 @@
+/* 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);
+
+#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);
+#else
+ /* Put an ABI label supported by FreeBSD >= 4.1. */
+ i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+#endif
+}
+
+#define elf_backend_post_process_headers elf_i386_post_process_headers
+
+#include "elf32-i386.c"
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 492f0e0..ac9f98e 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -3122,11 +3122,13 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
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
diff --git a/bfd/elf64-alpha-fbsd.c b/bfd/elf64-alpha-fbsd.c
new file mode 100644
index 0000000..00cdf72
--- /dev/null
+++ b/bfd/elf64-alpha-fbsd.c
@@ -0,0 +1,57 @@
+/* Alpha specific support for 64-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_elf64_alpha_freebsd_vec
+#define TARGET_LITTLE_NAME "elf64-alpha-freebsd"
+#define ELF_ARCH bfd_arch_alpha
+#define ELF_MACHINE_CODE EM_ALPHA
+#define ELF_MAXPAGESIZE 0x10000
+
+#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_alpha_post_process_headers
+ PARAMS ((bfd *, struct bfd_link_info *));
+
+static void
+elf_alpha_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);
+
+#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);
+#else
+ /* Put an ABI label supported by FreeBSD >= 4.1. */
+ i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+#endif
+}
+
+#define elf_backend_post_process_headers elf_alpha_post_process_headers
+
+#include "elf64-alpha.c"
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 4aeb32d..719381b 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -5509,11 +5509,13 @@ const struct elf_size_info alpha_elf_size_info =
NULL
};
+#ifndef ELF_ARCH
#define TARGET_LITTLE_SYM bfd_elf64_alpha_vec
#define TARGET_LITTLE_NAME "elf64-alpha"
#define ELF_ARCH bfd_arch_alpha
#define ELF_MACHINE_CODE EM_ALPHA
#define ELF_MAXPAGESIZE 0x10000
+#endif /* ELF_ARCH */
#define bfd_elf64_bfd_link_hash_table_create \
elf64_alpha_bfd_link_hash_table_create
diff --git a/bfd/targets.c b/bfd/targets.c
index 8d893eb..b9be8e7 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -520,6 +520,7 @@ extern const bfd_target bfd_elf32_h8300_vec;
extern const bfd_target bfd_elf32_hppa_linux_vec;
extern const bfd_target bfd_elf32_hppa_vec;
extern const bfd_target bfd_elf32_i370_vec;
+extern const bfd_target bfd_elf32_i386_freebsd_vec;
extern const bfd_target bfd_elf32_i386_vec;
extern const bfd_target bfd_elf32_i386qnx_vec;
extern const bfd_target bfd_elf32_i860_little_vec;
@@ -575,6 +576,7 @@ extern const bfd_target bfd_elf32_us_cris_vec;
extern const bfd_target bfd_elf32_v850_vec;
extern const bfd_target bfd_elf32_vax_vec;
extern const bfd_target bfd_elf32_xstormy16_vec;
+extern const bfd_target bfd_elf64_alpha_freebsd_vec;
extern const bfd_target bfd_elf64_alpha_vec;
extern const bfd_target bfd_elf64_big_generic_vec;
extern const bfd_target bfd_elf64_bigmips_vec;
@@ -798,6 +800,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_hppa_linux_vec,
&bfd_elf32_hppa_vec,
&bfd_elf32_i370_vec,
+ &bfd_elf32_i386_freebsd_vec,
&bfd_elf32_i386_vec,
&bfd_elf32_i386qnx_vec,
&bfd_elf32_i860_little_vec,
@@ -857,6 +860,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_vax_vec,
&bfd_elf32_xstormy16_vec,
#ifdef BFD64
+ &bfd_elf64_alpha_freebsd_vec,
&bfd_elf64_alpha_vec,
&bfd_elf64_big_generic_vec,
&bfd_elf64_bigmips_vec,