elf32-i386-fbsd.c revision 104871
1234370Sjasone/* Intel IA-32 specific support for 32-bit ELF on FreeBSD.
2234370Sjasone   Copyright 2002 Free Software Foundation, Inc.
3234370Sjasone
4251300SjasoneThis file is part of BFD, the Binary File Descriptor library.
5251300Sjasone
6251300SjasoneThis program is free software; you can redistribute it and/or modify
7234370Sjasoneit under the terms of the GNU General Public License as published by
8234370Sjasonethe Free Software Foundation; either version 2 of the License, or
9234370Sjasone(at your option) any later version.
10234370Sjasone
11234370SjasoneThis program is distributed in the hope that it will be useful,
12234370Sjasonebut WITHOUT ANY WARRANTY; without even the implied warranty of
13234370SjasoneMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14251300SjasoneGNU General Public License for more details.
15251300Sjasone
16251300SjasoneYou should have received a copy of the GNU General Public License
17251300Sjasonealong with this program; if not, write to the Free Software
18251300SjasoneFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
19251300Sjasone
20251300Sjasone#define TARGET_LITTLE_SYM	bfd_elf32_i386_freebsd_vec
21251300Sjasone#define TARGET_LITTLE_NAME	"elf32-i386-freebsd"
22251300Sjasone#define ELF_ARCH		bfd_arch_i386
23251300Sjasone#define ELF_MACHINE_CODE	EM_386
24251300Sjasone#define ELF_MAXPAGESIZE		0x1000
25251300Sjasone
26251300Sjasone#include "bfd.h"
27251300Sjasone#include "sysdep.h"
28234370Sjasone#include "elf-bfd.h"
29234370Sjasone
30234370Sjasone/* The kernel recognizes executables as valid only if they carry a
31234370Sjasone   "FreeBSD" label in the ELF header.  So we put this label on all
32251300Sjasone   executables and (for simplicity) also all other object files.  */
33234370Sjasone
34251300Sjasonestatic void elf_i386_post_process_headers
35234370Sjasone  PARAMS ((bfd *, struct bfd_link_info *));
36234370Sjasone
37234370Sjasonestatic void
38234370Sjasoneelf_i386_post_process_headers (abfd, link_info)
39234370Sjasone     bfd * abfd;
40234370Sjasone     struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
41251300Sjasone{
42251300Sjasone  Elf_Internal_Ehdr * i_ehdrp;	/* ELF file header, internal form.  */
43251300Sjasone
44251300Sjasone  i_ehdrp = elf_elfheader (abfd);
45251300Sjasone
46251300Sjasone  /* Put an ABI label supported by FreeBSD >= 4.1.  */
47251300Sjasone  i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
48251300Sjasone#ifdef OLD_FREEBSD_ABI_LABEL
49251300Sjasone  /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard.  */
50251300Sjasone  memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
51251300Sjasone#endif
52251300Sjasone}
53251300Sjasone
54251300Sjasone#define elf_backend_post_process_headers	elf_i386_post_process_headers
55251300Sjasone
56251300Sjasone#include "elf32-i386.c"
57251300Sjasone