diff options
author | David O'Brien <obrien@FreeBSD.org> | 2002-09-17 02:24:40 +0000 |
---|---|---|
committer | David O'Brien <obrien@FreeBSD.org> | 2002-09-17 02:24:40 +0000 |
commit | 4ada7262d0ae846b2ece141e6c8e091d7b350832 (patch) | |
tree | b39dc8a5acedf43aaf393b002446936c19b875ac /bfd/elf32-i386-fbsd.c | |
parent | f184d8167ce62203049fda398042409cb4d83ef2 (diff) | |
download | gdb-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/elf32-i386-fbsd.c')
-rw-r--r-- | bfd/elf32-i386-fbsd.c | 57 |
1 files changed, 57 insertions, 0 deletions
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" |