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. */
417 for (shindex
= 0; shindex
< i_ehdr
.e_shnum
; shindex
++)
419 bfd_section_from_shdr (abfd
, i_shdr
+ shindex
, shstrtab
);
425 /* Core files are simply standard ELF formatted files that partition
426 the file using the execution view of the file (program header table)
427 rather than the linking view. In fact, there is no section header
428 table in a core file.
432 DEFUN (elf_core_file_p
, (abfd
), bfd
*abfd
)
434 Elf_External_Ehdr x_ehdr
; /* Elf file header, external form */
435 Elf_Internal_Ehdr i_ehdr
; /* Elf file header, internal form */
436 Elf_External_Phdr
*x_phdr
; /* Program header table, external form */
437 Elf_Internal_Phdr
*i_phdr
; /* Program header table, internal form */
440 /* Read in the ELF header in external format. */
442 if (bfd_read ((PTR
) &x_ehdr
, sizeof (x_ehdr
), 1, abfd
) != sizeof (x_ehdr
))
444 bfd_error
= system_call_error
;
448 /* Now check to see if we have a valid ELF file, and one that BFD can
449 make use of. The magic number must match, the address size ('class')
450 and byte-swapping must match our XVEC entry, and it must have a
451 program header table (FIXME: See comments re segments at top of this
454 if (x_ehdr
.e_ident
[EI_MAG0
] != ELFMAG0
||
455 x_ehdr
.e_ident
[EI_MAG1
] != ELFMAG1
||
456 x_ehdr
.e_ident
[EI_MAG2
] != ELFMAG2
||
457 x_ehdr
.e_ident
[EI_MAG3
] != ELFMAG3
)
460 bfd_error
= wrong_format
;
464 /* FIXME, Check EI_VERSION here ! */
466 switch (x_ehdr
.e_ident
[EI_CLASS
]) {
467 case ELFCLASSNONE
: /* address size not specified */
468 goto wrong
; /* No support if can't tell address size */
469 case ELFCLASS32
: /* 32-bit addresses */
471 case ELFCLASS64
: /* 64-bit addresses */
472 goto wrong
; /* FIXME: 64 bits not yet supported */
474 goto wrong
; /* No support if unknown address class */
477 /* Switch xvec to match the specified byte order. */
478 switch (x_ehdr
.e_ident
[EI_DATA
]) {
479 case ELFDATA2MSB
: /* Big-endian */
480 abfd
->xvec
= &elf_big_vec
;
482 case ELFDATA2LSB
: /* Little-endian */
483 abfd
->xvec
= &elf_little_vec
;
484 case ELFDATANONE
: /* No data encoding specified */
485 default: /* Unknown data encoding specified */
489 /* Now that we know the byte order, swap in the rest of the header */
490 bfd_swap_ehdr_in (abfd
, &x_ehdr
, &i_ehdr
);
492 /* If there is no program header, or the type is not a core file, then
494 if (i_ehdr
.e_phoff
== 0 || i_ehdr
.e_type
!= ET_CORE
)
497 /* Allocate space for copies of the program header table in external
498 and internal form, seek to the program header table in the file,
499 read it in, and convert it to internal form. As a simple sanity
500 check, verify that the what BFD thinks is the size of each program
501 header table entry actually matches the size recorded in the file. */
503 if (i_ehdr
.e_phentsize
!= sizeof (*x_phdr
))
505 if ((x_phdr
= (Elf_External_Phdr
*)
506 bfd_alloc (abfd
, sizeof (*x_phdr
) * i_ehdr
.e_phnum
)) == NULL
)
508 bfd_error
= no_memory
;
511 if ((i_phdr
= (Elf_Internal_Phdr
*)
512 bfd_alloc (abfd
, sizeof (*i_phdr
) * i_ehdr
.e_phnum
)) == NULL
)
514 bfd_error
= no_memory
;
517 if (bfd_seek (abfd
, i_ehdr
.e_phoff
, SEEK_SET
) == -1)
519 bfd_error
= system_call_error
;
522 for (phindex
= 0; phindex
< i_ehdr
.e_phnum
; phindex
++)
524 if (bfd_read ((PTR
) (x_phdr
+ phindex
), sizeof (*x_phdr
), 1, abfd
)
527 bfd_error
= system_call_error
;
530 bfd_swap_phdr_in (abfd
, x_phdr
+ phindex
, i_phdr
+ phindex
);
533 /* Once all of the program headers have been read and converted, we
534 can start processing them. */
536 for (phindex
= 0; phindex
< i_ehdr
.e_phnum
; phindex
++)
538 bfd_section_from_phdr (abfd
, i_phdr
+ phindex
, phindex
);
545 DEFUN (elf_mkobject
, (abfd
), bfd
*abfd
)
547 fprintf (stderr
, "elf_mkobject unimplemented\n");
554 DEFUN (elf_write_object_contents
, (abfd
), bfd
*abfd
)
556 fprintf (stderr
, "elf_write_object_contents unimplemented\n");
563 elf_get_symtab_upper_bound(abfd
)
566 fprintf (stderr
, "elf_get_symtab_upper_bound unimplemented\n");
573 elf_get_reloc_upper_bound (abfd
, asect
)
577 fprintf (stderr
, "elf_get_reloc_upper_bound unimplemented\n");
584 elf_canonicalize_reloc (abfd
, section
, relptr
, symbols
)
590 fprintf (stderr
, "elf_canonicalize_reloc unimplemented\n");
597 elf_get_symtab (abfd
, alocation
)
601 fprintf (stderr
, "elf_get_symtab unimplemented\n");
608 elf_make_empty_symbol(abfd
)
611 fprintf (stderr
, "elf_make_empty_symbol unimplemented\n");
618 DEFUN (elf_print_symbol
,(ignore_abfd
, filep
, symbol
, how
),
622 bfd_print_symbol_type how
)
624 fprintf (stderr
, "elf_print_symbol unimplemented\n");
630 DEFUN (elf_get_lineno
,(ignore_abfd
, symbol
),
634 fprintf (stderr
, "elf_get_lineno unimplemented\n");
641 DEFUN (elf_set_arch_mach
,(abfd
, arch
, machine
),
643 enum bfd_architecture arch AND
644 unsigned long machine
)
646 fprintf (stderr
, "elf_set_arch_mach unimplemented\n");
648 /* Allow any architecture to be supported by the elf backend */
649 return bfd_default_set_arch_mach(abfd
, arch
, machine
);
653 DEFUN (elf_find_nearest_line
,(abfd
,
661 asection
*section AND
662 asymbol
**symbols AND
664 CONST
char **filename_ptr AND
665 CONST
char **functionname_ptr AND
666 unsigned int *line_ptr
)
668 fprintf (stderr
, "elf_find_nearest_line unimplemented\n");
675 DEFUN (elf_sizeof_headers
, (abfd
, reloc
),
679 fprintf (stderr
, "elf_sizeof_headers unimplemented\n");
685 /* This structure contains everything that BFD knows about a target.
686 It includes things like its byte order, name, what routines to call
687 to do various operations, etc. Every BFD points to a target structure
688 with its "xvec" member.
690 There are two such structures here: one for big-endian machines and
691 one for little-endian machines. */
693 #define elf_core_file_failing_command _bfd_dummy_core_file_failing_command
694 #define elf_core_file_failing_signal _bfd_dummy_core_file_failing_signal
695 #define elf_core_file_matches_executable_p _bfd_dummy_core_file_matches_executable_p
697 /* Archives are generic or unimplemented. */
698 #define elf_slurp_armap bfd_false
699 #define elf_slurp_extended_name_table _bfd_slurp_extended_name_table
700 #define elf_truncate_arname bfd_dont_truncate_arname
701 #define elf_openr_next_archived_file bfd_generic_openr_next_archived_file
702 #define elf_generic_stat_arch_elt bfd_generic_stat_arch_elt
703 #define elf_write_armap (PROTO (boolean, (*), \
704 (bfd *arch, unsigned int elength, struct orl *map, int orl_count, \
705 int stridx))) bfd_false
707 /* Ordinary section reading and writing */
708 #define elf_new_section_hook _bfd_dummy_new_section_hook
709 #define elf_get_section_contents bfd_generic_get_section_contents
710 #define elf_set_section_contents bfd_generic_set_section_contents
711 #define elf_close_and_cleanup bfd_generic_close_and_cleanup
713 #define elf_bfd_debug_info_start bfd_void
714 #define elf_bfd_debug_info_end bfd_void
715 #define elf_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
717 bfd_target elf_big_vec
=
719 /* name: identify kind of target */
722 /* flavour: general indication about file */
723 bfd_target_elf_flavour
,
725 /* byteorder_big_p: data is big endian */
728 /* header_byteorder_big_p: header is also big endian */
731 /* object_flags: mask of all file flags */
732 (HAS_RELOC
| EXEC_P
| HAS_LINENO
| HAS_DEBUG
| HAS_SYMS
| HAS_LOCALS
|
735 /* section_flags: mask of all section flags */
736 (SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
| SEC_READONLY
|
739 /* ar_pad_char: pad character for filenames within an archive header
740 FIXME: this really has nothing to do with ELF, this is a characteristic
741 of the archiver and/or os and should be independently tunable */
744 /* ar_max_namelen: maximum number of characters in an archive header
745 FIXME: this really has nothing to do with ELF, this is a characteristic
746 of the archiver and should be independently tunable. This value is
747 a WAG (wild a** guess) */
750 /* align_power_min: minimum alignment restriction for any section
751 FIXME: this value may be target machine dependent */
754 /* Routines to byte-swap various sized integers from the data sections */
755 _do_getb64
, _do_putb64
, _do_getb32
, _do_putb32
, _do_getb16
, _do_putb16
,
757 /* Routines to byte-swap various sized integers from the file headers */
758 _do_getb64
, _do_putb64
, _do_getb32
, _do_putb32
, _do_getb16
, _do_putb16
,
760 /* bfd_check_format: check the format of a file being read */
761 { _bfd_dummy_target
, /* unknown format */
762 elf_object_p
, /* assembler/linker output (object file) */
763 bfd_generic_archive_p
, /* an archive */
764 elf_core_file_p
/* a core file */
767 /* bfd_set_format: set the format of a file being written */
770 _bfd_generic_mkarchive
,
774 /* bfd_write_contents: write cached information into a file being written */
776 elf_write_object_contents
,
777 _bfd_write_archive_contents
,
781 /* Initialize a jump table with the standard macro. All names start
789 bfd_target elf_little_vec
=
791 /* name: identify kind of target */
794 /* flavour: general indication about file */
795 bfd_target_elf_flavour
,
797 /* byteorder_big_p: data is big endian */
798 false, /* Nope -- this one's little endian */
800 /* header_byteorder_big_p: header is also big endian */
801 false, /* Nope -- this one's little endian */
803 /* object_flags: mask of all file flags */
804 (HAS_RELOC
| EXEC_P
| HAS_LINENO
| HAS_DEBUG
| HAS_SYMS
| HAS_LOCALS
|
807 /* section_flags: mask of all section flags */
808 (SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
| SEC_READONLY
|
811 /* ar_pad_char: pad character for filenames within an archive header
812 FIXME: this really has nothing to do with ELF, this is a characteristic
813 of the archiver and/or os and should be independently tunable */
816 /* ar_max_namelen: maximum number of characters in an archive header
817 FIXME: this really has nothing to do with ELF, this is a characteristic
818 of the archiver and should be independently tunable. This value is
819 a WAG (wild a** guess) */
822 /* align_power_min: minimum alignment restriction for any section
823 FIXME: this value may be target machine dependent */
826 /* Routines to byte-swap various sized integers from the data sections */
827 _do_getl64
, _do_putl64
, _do_getl32
, _do_putl32
, _do_getl16
, _do_putl16
,
829 /* Routines to byte-swap various sized integers from the file headers */
830 _do_getl64
, _do_putl64
, _do_getl32
, _do_putl32
, _do_getl16
, _do_putl16
,
832 /* bfd_check_format: check the format of a file being read */
833 { _bfd_dummy_target
, /* unknown format */
834 elf_object_p
, /* assembler/linker output (object file) */
835 bfd_generic_archive_p
, /* an archive */
836 elf_core_file_p
/* a core file */
839 /* bfd_set_format: set the format of a file being written */
842 _bfd_generic_mkarchive
,
846 /* bfd_write_contents: write cached information into a file being written */
848 elf_write_object_contents
,
849 _bfd_write_archive_contents
,
853 /* Initialize a jump table with the standard macro. All names start