aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-10-16 08:39:38 +0000
committerAlan Modra <amodra@gmail.com>2002-10-16 08:39:38 +0000
commit2bc3c89ab374cc07ce4781d37a662030d6fb4a58 (patch)
tree966a7b1e22575ac5ff940c62a4268d72b62e58e9 /bfd/elf32-i386.c
parent366f2964afea873fe9e9e81c9d0ab2435e05ef7d (diff)
downloadfsf-binutils-gdb-2bc3c89ab374cc07ce4781d37a662030d6fb4a58.zip
fsf-binutils-gdb-2bc3c89ab374cc07ce4781d37a662030d6fb4a58.tar.gz
fsf-binutils-gdb-2bc3c89ab374cc07ce4781d37a662030d6fb4a58.tar.bz2
* 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.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c60
1 files changed, 57 insertions, 3 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 483b8a5..e26ee79 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -3348,13 +3348,11 @@ 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
@@ -3389,6 +3387,62 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
#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