1 /* ELF support for BFD.
2 Copyright (C) 1991 Free Software Foundation, Inc.
4 Written by Fred Fish @ Cygnus Support, from information published
5 in "UNIX System V Release 4, Programmers Guide: ANSI C and
6 Programming Support Tools".
8 This file is part of BFD, the Binary File Descriptor library.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
25 /****************************************
29 This is only a partial ELF implementation,
30 incorporating only those parts that are
31 required to get gdb up and running. It is
32 expected that it will be expanded to a full
33 ELF implementation at some future date.
35 Unimplemented stubs call abort() to ensure
36 that they get proper attention if they are
37 ever called. The stubs are here since
38 this version was hacked from the COFF
39 version, and thus they will probably
40 go away or get expanded appropriately in a
45 *****************************************/
48 /* Problems and other issues to resolve.
50 (1) BFD expects there to be some fixed number of "sections" in
51 the object file. I.E. there is a "section_count" variable in the
52 bfd structure which contains the number of sections. However, ELF
53 supports multiple "views" of a file. In particular, with current
54 implementations, executable files typically have two tables, a
55 program header table and a section header table, both of which
56 partition the executable.
58 In ELF-speak, the "linking view" of the file uses the section header
59 table to access "sections" within the file, and the "execution view"
60 uses the program header table to access "segments" within the file.
61 "Segments" typically may contain all the data from one or more
64 Note that the section header table is optional in ELF executables,
65 but it is this information that is most useful to gdb. If the
66 section header table is missing, then gdb should probably try
67 to make do with the program header table. (FIXME)
75 #include "elf-common.h"
76 #include "elf-internal.h"
77 #include "elf-external.h"
79 /* Forward data declarations */
80 extern bfd_target elf_little_vec
, elf_big_vec
;
82 /* Translate an ELF header in external format into an ELF header in internal
86 DEFUN(bfd_swap_ehdr_in
,(abfd
, src
, dst
),
88 Elf_External_Ehdr
*src AND
89 Elf_Internal_Ehdr
*dst
)
91 bcopy (src
-> e_ident
, dst
-> e_ident
, EI_NIDENT
);
92 dst
-> e_type
= bfd_h_get_16 (abfd
, (bfd_byte
*) src
-> e_type
);
93 dst
-> e_machine
= bfd_h_get_16 (abfd
, (bfd_byte
*) src
-> e_machine
);
94 dst
-> e_version
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> e_version
);
95 dst
-> e_entry
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> e_entry
);
96 dst
-> e_phoff
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> e_phoff
);
97 dst
-> e_shoff
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> e_shoff
);
98 dst
-> e_flags
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> e_flags
);
99 dst
-> e_ehsize
= bfd_h_get_16 (abfd
, (bfd_byte
*) src
-> e_ehsize
);
100 dst
-> e_phentsize
= bfd_h_get_16 (abfd
, (bfd_byte
*) src
-> e_phentsize
);
101 dst
-> e_phnum
= bfd_h_get_16 (abfd
, (bfd_byte
*) src
-> e_phnum
);
102 dst
-> e_shentsize
= bfd_h_get_16 (abfd
, (bfd_byte
*) src
-> e_shentsize
);
103 dst
-> e_shnum
= bfd_h_get_16 (abfd
, (bfd_byte
*) src
-> e_shnum
);
104 dst
-> e_shstrndx
= bfd_h_get_16 (abfd
, (bfd_byte
*) src
-> e_shstrndx
);
108 /* Translate an ELF section header table entry in external format into an
109 ELF section header table entry in internal format. */
112 DEFUN(bfd_swap_shdr_in
,(abfd
, src
, dst
),
114 Elf_External_Shdr
*src AND
115 Elf_Internal_Shdr
*dst
)
117 dst
-> sh_name
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> sh_name
);
118 dst
-> sh_type
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> sh_type
);
119 dst
-> sh_flags
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> sh_flags
);
120 dst
-> sh_addr
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> sh_addr
);
121 dst
-> sh_offset
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> sh_offset
);
122 dst
-> sh_size
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> sh_size
);
123 dst
-> sh_link
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> sh_link
);
124 dst
-> sh_info
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> sh_info
);
125 dst
-> sh_addralign
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> sh_addralign
);
126 dst
-> sh_entsize
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> sh_entsize
);
130 /* Translate an ELF program header table entry in external format into an
131 ELF program header table entry in internal format. */
134 DEFUN(bfd_swap_phdr_in
,(abfd
, src
, dst
),
136 Elf_External_Phdr
*src AND
137 Elf_Internal_Phdr
*dst
)
139 dst
-> p_type
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> p_type
);
140 dst
-> p_offset
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> p_offset
);
141 dst
-> p_vaddr
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> p_vaddr
);
142 dst
-> p_paddr
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> p_paddr
);
143 dst
-> p_filesz
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> p_filesz
);
144 dst
-> p_memsz
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> p_memsz
);
145 dst
-> p_flags
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> p_flags
);
146 dst
-> p_align
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
-> p_align
);
150 /* Create a new bfd section from an ELF section header. */
153 DEFUN(bfd_section_from_shdr
, (abfd
, hdr
, shstrtab
),
155 Elf_Internal_Shdr
*hdr AND
161 name
= hdr
-> sh_name
? shstrtab
+ hdr
-> sh_name
: "unnamed";
162 newsect
= bfd_make_section (abfd
, name
);
163 newsect
-> vma
= hdr
-> sh_addr
;
164 newsect
-> size
= hdr
-> sh_size
;
165 if (!(hdr
-> sh_type
== SHT_NOBITS
))
167 newsect
-> filepos
= hdr
-> sh_offset
;
168 newsect
-> flags
|= SEC_HAS_CONTENTS
;
170 if (hdr
-> sh_flags
& SHF_ALLOC
)
172 newsect
-> flags
|= SEC_ALLOC
;
173 if (hdr
-> sh_type
!= SHT_NOBITS
)
175 newsect
-> flags
|= SEC_LOAD
;
178 if (!(hdr
-> sh_flags
& SHF_WRITE
))
180 newsect
-> flags
|= SEC_READONLY
;
182 if (hdr
-> sh_flags
& SHF_EXECINSTR
)
184 newsect
-> flags
|= SEC_CODE
; /* FIXME: may only contain SOME code */
186 if (hdr
-> sh_type
== SHT_SYMTAB
)
188 abfd
-> flags
|= HAS_SYMS
;
194 /* Create a new bfd section from an ELF program header.
196 Since program segments have no names, we generate a synthetic name
197 of the form segment<NUM>, where NUM is generally the index in the
198 program header table. For segments that are split (see below) we
199 generate the names segment<NUM>a and segment<NUM>b.
201 Note that some program segments may have a file size that is different than
202 (less than) the memory size. All this means is that at execution the
203 system must allocate the amount of memory specified by the memory size,
204 but only initialize it with the first "file size" bytes read from the
205 file. This would occur for example, with program segments consisting
206 of combined data+bss.
208 To handle the above situation, this routine generates TWO bfd sections
209 for the single program segment. The first has the length specified by
210 the file size of the segment, and the second has the length specified
211 by the difference between the two sizes. In effect, the segment is split
212 into it's initialized and uninitialized parts.
217 DEFUN(bfd_section_from_phdr
, (abfd
, hdr
, index
),
219 Elf_Internal_Phdr
*hdr AND
227 split
= ((hdr
-> p_memsz
> 0) &&
228 (hdr
-> p_filesz
> 0) &&
229 (hdr
-> p_memsz
> hdr
-> p_filesz
));
230 sprintf (namebuf
, split
? "segment%da" : "segment%d", index
);
231 name
= bfd_alloc (abfd
, strlen (namebuf
) + 1);
232 (void) strcpy (name
, namebuf
);
233 newsect
= bfd_make_section (abfd
, name
);
234 newsect
-> vma
= hdr
-> p_vaddr
;
235 newsect
-> size
= hdr
-> p_filesz
;
236 newsect
-> filepos
= hdr
-> p_offset
;
237 newsect
-> flags
|= SEC_HAS_CONTENTS
;
238 if (hdr
-> p_type
== PT_LOAD
)
240 newsect
-> flags
|= SEC_ALLOC
;
241 newsect
-> flags
|= SEC_LOAD
;
242 if (hdr
-> p_flags
& PF_X
)
244 /* FIXME: all we known is that it has execute PERMISSION,
246 newsect
-> flags
|= SEC_CODE
;
249 if (!(hdr
-> p_flags
& PF_W
))
251 newsect
-> flags
|= SEC_READONLY
;
256 sprintf (namebuf
, "segment%db", index
);
257 name
= bfd_alloc (abfd
, strlen (namebuf
) + 1);
258 (void) strcpy (name
, namebuf
);
259 newsect
= bfd_make_section (abfd
, name
);
260 newsect
-> vma
= hdr
-> p_vaddr
+ hdr
-> p_filesz
;
261 newsect
-> size
= hdr
-> p_memsz
- hdr
-> p_filesz
;
262 if (hdr
-> p_type
== PT_LOAD
)
264 newsect
-> flags
|= SEC_ALLOC
;
265 if (hdr
-> p_flags
& PF_X
)
267 newsect
-> flags
|= SEC_CODE
;
270 if (!(hdr
-> p_flags
& PF_W
))
272 newsect
-> flags
|= SEC_READONLY
;
279 /* Begin processing a given object.
281 First we validate the file by reading in the ELF header and checking
287 DEFUN (elf_object_p
, (abfd
), bfd
*abfd
)
289 Elf_External_Ehdr x_ehdr
; /* Elf file header, external form */
290 Elf_Internal_Ehdr i_ehdr
; /* Elf file header, internal form */
291 Elf_External_Shdr
*x_shdr
; /* Section header table, external form */
292 Elf_Internal_Shdr
*i_shdr
; /* Section header table, internal form */
294 char *shstrtab
; /* Internal copy of section header stringtab */
295 int shstrtabsize
; /* Size of section header string table */
297 /* Read in the ELF header in external format. */
299 if (bfd_read ((PTR
) &x_ehdr
, sizeof (x_ehdr
), 1, abfd
) != sizeof (x_ehdr
))
301 bfd_error
= system_call_error
;
305 /* Now check to see if we have a valid ELF file, and one that BFD can
306 make use of. The magic number must match, the address size ('class')
307 and byte-swapping must match our XVEC entry, and it must have a
308 section header table (FIXME: See comments re sections at top of this
311 if (x_ehdr
.e_ident
[EI_MAG0
] != ELFMAG0
||
312 x_ehdr
.e_ident
[EI_MAG1
] != ELFMAG1
||
313 x_ehdr
.e_ident
[EI_MAG2
] != ELFMAG2
||
314 x_ehdr
.e_ident
[EI_MAG3
] != ELFMAG3
)
317 bfd_error
= wrong_format
;
321 /* FIXME, Check EI_VERSION here ! */
323 switch (x_ehdr
.e_ident
[EI_CLASS
]) {
324 case ELFCLASSNONE
: /* address size not specified */
325 goto wrong
; /* No support if can't tell address size */
326 case ELFCLASS32
: /* 32-bit addresses */
328 case ELFCLASS64
: /* 64-bit addresses */
329 goto wrong
; /* FIXME: 64 bits not yet supported */
331 goto wrong
; /* No support if unknown address class */
334 /* Switch xvec to match the specified byte order. */
335 switch (x_ehdr
.e_ident
[EI_DATA
]) {
336 case ELFDATA2MSB
: /* Big-endian */
337 abfd
->xvec
= &elf_big_vec
;
339 case ELFDATA2LSB
: /* Little-endian */
340 abfd
->xvec
= &elf_little_vec
;
341 case ELFDATANONE
: /* No data encoding specified */
342 default: /* Unknown data encoding specified */
346 /* Now that we know the byte order, swap in the rest of the header */
347 bfd_swap_ehdr_in (abfd
, &x_ehdr
, &i_ehdr
);
349 /* If there is no section header table, we're hosed. */
350 if (i_ehdr
.e_shoff
== 0)
353 if (i_ehdr
.e_type
== ET_EXEC
|| i_ehdr
.e_type
== ET_DYN
)
355 abfd
-> flags
|= EXEC_P
;
358 /* Allocate space for copies of the section header table in external
359 and internal form, seek to the section header table in the file,
360 read it in, and convert it to internal form. As a simple sanity
361 check, verify that the what BFD thinks is the size of each section
362 header table entry actually matches the size recorded in the file. */
364 if (i_ehdr
.e_shentsize
!= sizeof (*x_shdr
))
366 if ((x_shdr
= (Elf_External_Shdr
*)
367 bfd_alloc (abfd
, sizeof (*x_shdr
) * i_ehdr
.e_shnum
)) == NULL
)
369 bfd_error
= no_memory
;
372 if ((i_shdr
= (Elf_Internal_Shdr
*)
373 bfd_alloc (abfd
, sizeof (*i_shdr
) * i_ehdr
.e_shnum
)) == NULL
)
375 bfd_error
= no_memory
;
378 if (bfd_seek (abfd
, i_ehdr
.e_shoff
, SEEK_SET
) == -1)
380 bfd_error
= system_call_error
;
383 for (shindex
= 0; shindex
< i_ehdr
.e_shnum
; shindex
++)
385 if (bfd_read ((PTR
) (x_shdr
+ shindex
), sizeof (*x_shdr
), 1, abfd
)
388 bfd_error
= system_call_error
;
391 bfd_swap_shdr_in (abfd
, x_shdr
+ shindex
, i_shdr
+ shindex
);
394 /* Read in the string table containing the names of the sections. We
395 will need the base pointer to this table later. */
397 shstrtabsize
= i_shdr
[i_ehdr
.e_shstrndx
].sh_size
;
398 if ((shstrtab
= bfd_alloc (abfd
, shstrtabsize
)) == NULL
)
400 bfd_error
= no_memory
;
403 if (bfd_seek (abfd
, i_shdr
[i_ehdr
.e_shstrndx
].sh_offset
, SEEK_SET
) == -1)
405 bfd_error
= system_call_error
;
408 if (bfd_read ((PTR
) shstrtab
, shstrtabsize
, 1, abfd
) != shstrtabsize
)
410 bfd_error
= system_call_error
;
414 /* Once all of the section headers have been read and converted, we
415 can start processing them. Note that the first section header is
416 a dummy placeholder entry, so we ignore it. */
418 for (shindex
= 1; shindex
< i_ehdr
.e_shnum
; shindex
++)
420 bfd_section_from_shdr (abfd
, i_shdr
+ shindex
, shstrtab
);
426 /* Core files are simply standard ELF formatted files that partition
427 the file using the execution view of the file (program header table)
428 rather than the linking view. In fact, there is no section header
429 table in a core file.
433 DEFUN (elf_core_file_p
, (abfd
), bfd
*abfd
)
435 Elf_External_Ehdr x_ehdr
; /* Elf file header, external form */
436 Elf_Internal_Ehdr i_ehdr
; /* Elf file header, internal form */
437 Elf_External_Phdr
*x_phdr
; /* Program header table, external form */
438 Elf_Internal_Phdr
*i_phdr
; /* Program header table, internal form */
441 /* Read in the ELF header in external format. */
443 if (bfd_read ((PTR
) &x_ehdr
, sizeof (x_ehdr
), 1, abfd
) != sizeof (x_ehdr
))
445 bfd_error
= system_call_error
;
449 /* Now check to see if we have a valid ELF file, and one that BFD can
450 make use of. The magic number must match, the address size ('class')
451 and byte-swapping must match our XVEC entry, and it must have a
452 program header table (FIXME: See comments re segments at top of this
455 if (x_ehdr
.e_ident
[EI_MAG0
] != ELFMAG0
||
456 x_ehdr
.e_ident
[EI_MAG1
] != ELFMAG1
||
457 x_ehdr
.e_ident
[EI_MAG2
] != ELFMAG2
||
458 x_ehdr
.e_ident
[EI_MAG3
] != ELFMAG3
)
461 bfd_error
= wrong_format
;
465 /* FIXME, Check EI_VERSION here ! */
467 switch (x_ehdr
.e_ident
[EI_CLASS
]) {
468 case ELFCLASSNONE
: /* address size not specified */
469 goto wrong
; /* No support if can't tell address size */
470 case ELFCLASS32
: /* 32-bit addresses */
472 case ELFCLASS64
: /* 64-bit addresses */
473 goto wrong
; /* FIXME: 64 bits not yet supported */
475 goto wrong
; /* No support if unknown address class */
478 /* Switch xvec to match the specified byte order. */
479 switch (x_ehdr
.e_ident
[EI_DATA
]) {
480 case ELFDATA2MSB
: /* Big-endian */
481 abfd
->xvec
= &elf_big_vec
;
483 case ELFDATA2LSB
: /* Little-endian */
484 abfd
->xvec
= &elf_little_vec
;
485 case ELFDATANONE
: /* No data encoding specified */
486 default: /* Unknown data encoding specified */
490 /* Now that we know the byte order, swap in the rest of the header */
491 bfd_swap_ehdr_in (abfd
, &x_ehdr
, &i_ehdr
);
493 /* If there is no program header, or the type is not a core file, then
495 if (i_ehdr
.e_phoff
== 0 || i_ehdr
.e_type
!= ET_CORE
)
498 /* Allocate space for copies of the program header table in external
499 and internal form, seek to the program header table in the file,
500 read it in, and convert it to internal form. As a simple sanity
501 check, verify that the what BFD thinks is the size of each program
502 header table entry actually matches the size recorded in the file. */
504 if (i_ehdr
.e_phentsize
!= sizeof (*x_phdr
))
506 if ((x_phdr
= (Elf_External_Phdr
*)
507 bfd_alloc (abfd
, sizeof (*x_phdr
) * i_ehdr
.e_phnum
)) == NULL
)
509 bfd_error
= no_memory
;
512 if ((i_phdr
= (Elf_Internal_Phdr
*)
513 bfd_alloc (abfd
, sizeof (*i_phdr
) * i_ehdr
.e_phnum
)) == NULL
)
515 bfd_error
= no_memory
;
518 if (bfd_seek (abfd
, i_ehdr
.e_phoff
, SEEK_SET
) == -1)
520 bfd_error
= system_call_error
;
523 for (phindex
= 0; phindex
< i_ehdr
.e_phnum
; phindex
++)
525 if (bfd_read ((PTR
) (x_phdr
+ phindex
), sizeof (*x_phdr
), 1, abfd
)
528 bfd_error
= system_call_error
;
531 bfd_swap_phdr_in (abfd
, x_phdr
+ phindex
, i_phdr
+ phindex
);
534 /* Once all of the program headers have been read and converted, we
535 can start processing them. */
537 for (phindex
= 0; phindex
< i_ehdr
.e_phnum
; phindex
++)
539 bfd_section_from_phdr (abfd
, i_phdr
+ phindex
, phindex
);
546 DEFUN (elf_mkobject
, (abfd
), bfd
*abfd
)
548 fprintf (stderr
, "elf_mkobject unimplemented\n");
555 DEFUN (elf_write_object_contents
, (abfd
), bfd
*abfd
)
557 fprintf (stderr
, "elf_write_object_contents unimplemented\n");
564 elf_get_symtab_upper_bound(abfd
)
567 fprintf (stderr
, "elf_get_symtab_upper_bound unimplemented\n");
574 elf_get_reloc_upper_bound (abfd
, asect
)
578 fprintf (stderr
, "elf_get_reloc_upper_bound unimplemented\n");
585 elf_canonicalize_reloc (abfd
, section
, relptr
, symbols
)
591 fprintf (stderr
, "elf_canonicalize_reloc unimplemented\n");
598 elf_get_symtab (abfd
, alocation
)
602 fprintf (stderr
, "elf_get_symtab unimplemented\n");
609 elf_make_empty_symbol(abfd
)
612 fprintf (stderr
, "elf_make_empty_symbol unimplemented\n");
619 DEFUN (elf_print_symbol
,(ignore_abfd
, filep
, symbol
, how
),
623 bfd_print_symbol_type how
)
625 fprintf (stderr
, "elf_print_symbol unimplemented\n");
631 DEFUN (elf_get_lineno
,(ignore_abfd
, symbol
),
635 fprintf (stderr
, "elf_get_lineno unimplemented\n");
642 DEFUN (elf_set_arch_mach
,(abfd
, arch
, machine
),
644 enum bfd_architecture arch AND
645 unsigned long machine
)
647 fprintf (stderr
, "elf_set_arch_mach unimplemented\n");
649 /* Allow any architecture to be supported by the elf backend */
650 return bfd_default_set_arch_mach(abfd
, arch
, machine
);
654 DEFUN (elf_find_nearest_line
,(abfd
,
662 asection
*section AND
663 asymbol
**symbols AND
665 CONST
char **filename_ptr AND
666 CONST
char **functionname_ptr AND
667 unsigned int *line_ptr
)
669 fprintf (stderr
, "elf_find_nearest_line unimplemented\n");
676 DEFUN (elf_sizeof_headers
, (abfd
, reloc
),
680 fprintf (stderr
, "elf_sizeof_headers unimplemented\n");
686 /* This structure contains everything that BFD knows about a target.
687 It includes things like its byte order, name, what routines to call
688 to do various operations, etc. Every BFD points to a target structure
689 with its "xvec" member.
691 There are two such structures here: one for big-endian machines and
692 one for little-endian machines. */
694 #define elf_core_file_failing_command _bfd_dummy_core_file_failing_command
695 #define elf_core_file_failing_signal _bfd_dummy_core_file_failing_signal
696 #define elf_core_file_matches_executable_p _bfd_dummy_core_file_matches_executable_p
698 /* Archives are generic or unimplemented. */
699 #define elf_slurp_armap bfd_false
700 #define elf_slurp_extended_name_table _bfd_slurp_extended_name_table
701 #define elf_truncate_arname bfd_dont_truncate_arname
702 #define elf_openr_next_archived_file bfd_generic_openr_next_archived_file
703 #define elf_generic_stat_arch_elt bfd_generic_stat_arch_elt
704 #define elf_write_armap (PROTO (boolean, (*), \
705 (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, \
706 int stridx))) bfd_false
708 /* Ordinary section reading and writing */
709 #define elf_new_section_hook _bfd_dummy_new_section_hook
710 #define elf_get_section_contents bfd_generic_get_section_contents
711 #define elf_set_section_contents bfd_generic_set_section_contents
712 #define elf_close_and_cleanup bfd_generic_close_and_cleanup
714 #define elf_bfd_debug_info_start bfd_void
715 #define elf_bfd_debug_info_end bfd_void
716 #define elf_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
718 bfd_target elf_big_vec
=
720 /* name: identify kind of target */
723 /* flavour: general indication about file */
724 bfd_target_elf_flavour
,
726 /* byteorder_big_p: data is big endian */
729 /* header_byteorder_big_p: header is also big endian */
732 /* object_flags: mask of all file flags */
733 (HAS_RELOC
| EXEC_P
| HAS_LINENO
| HAS_DEBUG
| HAS_SYMS
| HAS_LOCALS
|
736 /* section_flags: mask of all section flags */
737 (SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
| SEC_READONLY
|
740 /* ar_pad_char: pad character for filenames within an archive header
741 FIXME: this really has nothing to do with ELF, this is a characteristic
742 of the archiver and/or os and should be independently tunable */
745 /* ar_max_namelen: maximum number of characters in an archive header
746 FIXME: this really has nothing to do with ELF, this is a characteristic
747 of the archiver and should be independently tunable. This value is
748 a WAG (wild a** guess) */
751 /* align_power_min: minimum alignment restriction for any section
752 FIXME: this value may be target machine dependent */
755 /* Routines to byte-swap various sized integers from the data sections */
756 _do_getb64
, _do_putb64
, _do_getb32
, _do_putb32
, _do_getb16
, _do_putb16
,
758 /* Routines to byte-swap various sized integers from the file headers */
759 _do_getb64
, _do_putb64
, _do_getb32
, _do_putb32
, _do_getb16
, _do_putb16
,
761 /* bfd_check_format: check the format of a file being read */
762 { _bfd_dummy_target
, /* unknown format */
763 elf_object_p
, /* assembler/linker output (object file) */
764 bfd_generic_archive_p
, /* an archive */
765 elf_core_file_p
/* a core file */
768 /* bfd_set_format: set the format of a file being written */
771 _bfd_generic_mkarchive
,
775 /* bfd_write_contents: write cached information into a file being written */
777 elf_write_object_contents
,
778 _bfd_write_archive_contents
,
782 /* Initialize a jump table with the standard macro. All names start
790 bfd_target elf_little_vec
=
792 /* name: identify kind of target */
795 /* flavour: general indication about file */
796 bfd_target_elf_flavour
,
798 /* byteorder_big_p: data is big endian */
799 false, /* Nope -- this one's little endian */
801 /* header_byteorder_big_p: header is also big endian */
802 false, /* Nope -- this one's little endian */
804 /* object_flags: mask of all file flags */
805 (HAS_RELOC
| EXEC_P
| HAS_LINENO
| HAS_DEBUG
| HAS_SYMS
| HAS_LOCALS
|
808 /* section_flags: mask of all section flags */
809 (SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
| SEC_READONLY
|
812 /* ar_pad_char: pad character for filenames within an archive header
813 FIXME: this really has nothing to do with ELF, this is a characteristic
814 of the archiver and/or os and should be independently tunable */
817 /* ar_max_namelen: maximum number of characters in an archive header
818 FIXME: this really has nothing to do with ELF, this is a characteristic
819 of the archiver and should be independently tunable. This value is
820 a WAG (wild a** guess) */
823 /* align_power_min: minimum alignment restriction for any section
824 FIXME: this value may be target machine dependent */
827 /* Routines to byte-swap various sized integers from the data sections */
828 _do_getl64
, _do_putl64
, _do_getl32
, _do_putl32
, _do_getl16
, _do_putl16
,
830 /* Routines to byte-swap various sized integers from the file headers */
831 _do_getl64
, _do_putl64
, _do_getl32
, _do_putl32
, _do_getl16
, _do_putl16
,
833 /* bfd_check_format: check the format of a file being read */
834 { _bfd_dummy_target
, /* unknown format */
835 elf_object_p
, /* assembler/linker output (object file) */
836 bfd_generic_archive_p
, /* an archive */
837 elf_core_file_p
/* a core file */
840 /* bfd_set_format: set the format of a file being written */
843 _bfd_generic_mkarchive
,
847 /* bfd_write_contents: write cached information into a file being written */
849 elf_write_object_contents
,
850 _bfd_write_archive_contents
,
854 /* Initialize a jump table with the standard macro. All names start