986f078366
bfd_size_type was invented a long time ago in the K&R days. Many places in binutils ought to be using size_t instead (and there are lots of places that use long or unsigned long that really ought to use size_t too). Note that you can't change everything over to size_t: A 32-bit host needs a larger type than size_t to support reading and processing of 64-bit ELF object files. This patch just tidies some of the more obvious uses of bfd_size_type that could be size_t. There no doubt are more lurking in the source. Incidentally, practically all functions used for output of object files can use size_t and don't need to worry about overflow of size expressions. If you have something like symcount * sizeof (void *) when symcount is counting symbols already in memory then you know that this expression can't overflow since the size of a symbol in memory is larger by far than that of a pointer. * aix386-core.c (aix386_core_file_p): Use size_t for "amt". * aout-target.h (object_p): Likewise. * aout-tic30.c (tic30_aout_object_p): Likewise. * aoutx.h (some_aout_object_p, mkobject, make_empty_symbol), (emit_stringtab, write_syms, link_hash_table_create), (aout_link_write_other_symbol): Likewise. * archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p), (bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents), (_bfd_compute_and_write_armap): Likewise. * archures.c (bfd_arch_list): Likewise. * bfd.c (bfd_record_phdr): Likewise. * binary.c (binary_canonicalize_symtab): Likewise. * cisco-core.c (cisco_core_file_validate): Likewise. * coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue), (find_arm_glue, record_arm_to_thumb_glue), (record_thumb_to_arm_glue): Likewise. * coff-ppc.c (ppc_coff_link_hash_table_create, record_toc), (ppc_allocate_toc_section): Likewise. * coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise. * coff-sh.c (sh_relax_section): Likewise. * coff64-rs6000.c (xcoff64_archive_p): Likewise. * coffcode.h (handle_COMDAT, coff_new_section_hook), (coff_set_alignment_hook, coff_mkobject), (coff_compute_section_file_positions): Likewise. * coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol), (coff_find_nearest_line_with_names), ( bfd_coff_set_symbol_class): Likewise. * cofflink.c (_bfd_coff_link_hash_table_create), (_bfd_coff_link_input_bfd): Likewise. * dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise. * dwarf2.c (read_abbrevs, read_attribute_value, add_line_info), (build_line_info_table, sort_line_sequences), (line_info_add_include_dir, line_info_add_file_name), (decode_line_info, scan_unit_for_symbols, parse_comp_unit), (place_sections, _bfd_dwarf2_slurp_debug_info): Likewise. * ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol), (_bfd_ecoff_find_nearest_line), (_bfd_ecoff_bfd_link_hash_table_create): Likewise. * ecofflink.c (bfd_ecoff_debug_init): Likewise. * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise. * elf-m10300.c (mn10300_elf_relax_section), (elf32_mn10300_link_hash_table_create): Likewise. * elf-strtab.c (_bfd_elf_strtab_init): Likewise. * elf.c (make_mapping, copy_elf_program_header): Likewise. * elf32-arm.c (elf32_arm_link_hash_table_create), (elf32_arm_setup_section_lists, elf32_arm_check_relocs), (elf32_arm_new_section_hook): Likewise. * elf32-avr.c (elf_avr_new_section_hook), (elf32_avr_link_hash_table_create, get_local_syms), (elf32_avr_setup_section_lists): Likewise. * elf32-bfin.c (bfinfdpic_elf_link_hash_table_create), (bfin_link_hash_table_create): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise. * elf32-cris.c (elf_cris_link_hash_table_create): Likewise. * elf32-csky.c (csky_elf_link_hash_table_create), (csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise. * elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_create), (elf32_hppa_setup_section_lists, get_local_syms): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise. * elf32-m32r.c (m32r_elf_link_hash_table_create), (m32r_elf_check_relocs): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_create), (elf32_m68hc11_setup_section_lists), (elf32_m68hc11_size_stubs): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise. * elf32-metag.c (elf_metag_link_hash_table_create), (elf_metag_setup_section_lists): Likewise. * elf32-microblaze.c (microblaze_elf_link_hash_table_create), (microblaze_elf_check_relocs): Likewise. * elf32-nds32.c (nds32_elf_link_hash_table_create), (nds32_elf_check_relocs): Likewise. * elf32-nios2.c (nios2_elf32_setup_section_lists), (get_local_syms, nios2_elf32_check_relocs), (nios2_elf32_link_hash_table_create): Likewise. * elf32-or1k.c (or1k_elf_link_hash_table_create), (or1k_elf_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise. * elf32-pru.c (pru_elf32_link_hash_table_create): Likewise. * elf32-s390.c (elf_s390_link_hash_table_create), (elf_s390_check_relocs): Likewise. * elf32-score.c (score_elf_create_got_section), (s3_elf32_score_new_section_hook), (elf32_score_link_hash_table_create): Likewise. * elf32-score7.c (score_elf_create_got_section), (s7_elf32_score_new_section_hook): Likewise. * elf32-sh.c (sh_elf_link_hash_table_create), (sh_elf_check_relocs): Likewise. * elf32-tic6x.c (elf32_tic6x_link_hash_table_create), (elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise. * elf32-tilepro.c (tilepro_elf_link_hash_table_create), (tilepro_elf_check_relocs): Likewise. * elf32-v850.c (remember_hi16s_reloc): Likewise. * elf32-vax.c (elf_vax_link_hash_table_create): Likewise. * elf32-xtensa.c (elf_xtensa_link_hash_table_create), (elf_xtensa_new_section_hook): Likewise. * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create), (get_got_entry, elf64_alpha_check_relocs): Likewise. * elf64-hppa.c (elf64_hppa_hash_table_create): Likewise. * elf64-ia64-vms.c (elf64_ia64_object_p): Likewise. * elf64-mmix.c (mmix_elf_new_section_hook): Likewise. * elf64-ppc.c (ppc64_elf_new_section_hook), (ppc64_elf_link_hash_table_create, update_local_sym_info), (update_plt_info, ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_link_hash_table_create), (elf_s390_check_relocs): Likewise. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elflink.c (bfd_elf_link_record_local_dynamic_symbol), (_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols), (elf_link_add_archive_symbols, compute_bucket_count), (bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create), (bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out), (bfd_elf_final_link): Likewise. * elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create), (elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs), (elfNN_aarch64_new_section_hook): Likewise. * elfnn-ia64.c (elfNN_ia64_object_p): Likewise. * elfnn-riscv.c (riscv_elf_link_hash_table_create), (riscv_elf_check_relocs): Likewise. * elfxx-mips.c (_bfd_mips_elf_new_section_hook), (_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs), (_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents), (_bfd_mips_elf_link_hash_table_create): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create), (_bfd_sparc_elf_check_relocs), (_bfd_sparc_elf_new_section_hook): Likewise. * elfxx-tilegx.c (tilegx_elf_link_hash_table_create), (tilegx_elf_check_relocs): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise. * format.c (bfd_check_format_matches): Likewise. * hash.c (_bfd_stringtab_init): Likewise. * ihex.c (ihex_scan): Likewise. * irix-core.c (irix_core_core_file_p): Likewise. * linker.c (bfd_wrapped_link_hash_lookup), (_bfd_generic_link_hash_table_create), (_bfd_generic_reloc_link_order): Likewise. * lynx-core.c (lynx_core_file_p): Likewise. * netbsd-core.c (netbsd_core_file_p): Likewise. * osf-core.c (osf_core_core_file_p): Likewise. * pdp11.c (some_aout_object_p, mkobject, make_empty_symbol), (link_hash_table_create, aout_link_write_other_symbol): Likewise. * peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise. * peicode.h (pe_mkobject): Likewise. * ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise. * ptrace-core.c (ptrace_unix_core_file_p): Likewise. * sco5-core.c (read_uarea): Likewise. * som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers), (som_write_fixups, som_write_space_strings, som_write_symbol_strings), (som_finish_writing, som_canonicalize_symtab, som_new_section_hook), (som_bfd_copy_private_section_data, bfd_som_set_section_attributes), (bfd_som_attach_aux_hdr, som_write_armap): Likewise. * srec.c (srec_scan): Likewise. * syms.c (_bfd_generic_make_empty_symbol): Likewise. * targets.c (bfd_target_list): Likewise. * tekhex.c (first_phase, tekhex_sizeof_headers): Likewise. * trad-core.c (trad_unix_core_file_p): Likewise. * vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create), (vms_new_section_hook): Likewise. * wasm-module.c (wasm_make_empty_symbol): Likewise. * xcofflink.c (xcoff_get_section_contents), (_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path), (xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym), (bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise.
377 lines
11 KiB
C
377 lines
11 KiB
C
/* BFD back-end for binary objects.
|
|
Copyright (C) 1994-2020 Free Software Foundation, Inc.
|
|
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
|
|
|
|
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
|
MA 02110-1301, USA. */
|
|
|
|
/* This is a BFD backend which may be used to write binary objects.
|
|
It may only be used for output, not input. The intention is that
|
|
this may be used as an output format for objcopy in order to
|
|
generate raw binary data.
|
|
|
|
This is very simple. The only complication is that the real data
|
|
will start at some address X, and in some cases we will not want to
|
|
include X zeroes just to get to that point. Since the start
|
|
address is not meaningful for this object file format, we use it
|
|
instead to indicate the number of zeroes to skip at the start of
|
|
the file. objcopy cooperates by specially setting the start
|
|
address to zero by default. */
|
|
|
|
#include "sysdep.h"
|
|
#include "bfd.h"
|
|
#include "safe-ctype.h"
|
|
#include "libbfd.h"
|
|
|
|
/* Any bfd we create by reading a binary file has three symbols:
|
|
a start symbol, an end symbol, and an absolute length symbol. */
|
|
#define BIN_SYMS 3
|
|
|
|
/* Create a binary object. Invoked via bfd_set_format. */
|
|
|
|
static bfd_boolean
|
|
binary_mkobject (bfd *abfd ATTRIBUTE_UNUSED)
|
|
{
|
|
return TRUE;
|
|
}
|
|
|
|
/* Any file may be considered to be a binary file, provided the target
|
|
was not defaulted. That is, it must be explicitly specified as
|
|
being binary. */
|
|
|
|
static const bfd_target *
|
|
binary_object_p (bfd *abfd)
|
|
{
|
|
struct stat statbuf;
|
|
asection *sec;
|
|
flagword flags;
|
|
|
|
if (abfd->target_defaulted)
|
|
{
|
|
bfd_set_error (bfd_error_wrong_format);
|
|
return NULL;
|
|
}
|
|
|
|
abfd->symcount = BIN_SYMS;
|
|
|
|
/* Find the file size. */
|
|
if (bfd_stat (abfd, &statbuf) < 0)
|
|
{
|
|
bfd_set_error (bfd_error_system_call);
|
|
return NULL;
|
|
}
|
|
|
|
/* One data section. */
|
|
flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
|
|
sec = bfd_make_section_with_flags (abfd, ".data", flags);
|
|
if (sec == NULL)
|
|
return NULL;
|
|
sec->vma = 0;
|
|
sec->size = statbuf.st_size;
|
|
sec->filepos = 0;
|
|
|
|
abfd->tdata.any = (void *) sec;
|
|
|
|
return abfd->xvec;
|
|
}
|
|
|
|
#define binary_close_and_cleanup _bfd_generic_close_and_cleanup
|
|
#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
|
#define binary_new_section_hook _bfd_generic_new_section_hook
|
|
|
|
/* Get contents of the only section. */
|
|
|
|
static bfd_boolean
|
|
binary_get_section_contents (bfd *abfd,
|
|
asection *section ATTRIBUTE_UNUSED,
|
|
void * location,
|
|
file_ptr offset,
|
|
bfd_size_type count)
|
|
{
|
|
if (bfd_seek (abfd, offset, SEEK_SET) != 0
|
|
|| bfd_bread (location, count, abfd) != count)
|
|
return FALSE;
|
|
return TRUE;
|
|
}
|
|
|
|
/* Return the amount of memory needed to read the symbol table. */
|
|
|
|
static long
|
|
binary_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED)
|
|
{
|
|
return (BIN_SYMS + 1) * sizeof (asymbol *);
|
|
}
|
|
|
|
/* Create a symbol name based on the bfd's filename. */
|
|
|
|
static char *
|
|
mangle_name (bfd *abfd, char *suffix)
|
|
{
|
|
bfd_size_type size;
|
|
char *buf;
|
|
char *p;
|
|
|
|
size = (strlen (bfd_get_filename (abfd))
|
|
+ strlen (suffix)
|
|
+ sizeof "_binary__");
|
|
|
|
buf = (char *) bfd_alloc (abfd, size);
|
|
if (buf == NULL)
|
|
return "";
|
|
|
|
sprintf (buf, "_binary_%s_%s", bfd_get_filename (abfd), suffix);
|
|
|
|
/* Change any non-alphanumeric characters to underscores. */
|
|
for (p = buf; *p; p++)
|
|
if (! ISALNUM (*p))
|
|
*p = '_';
|
|
|
|
return buf;
|
|
}
|
|
|
|
/* Return the symbol table. */
|
|
|
|
static long
|
|
binary_canonicalize_symtab (bfd *abfd, asymbol **alocation)
|
|
{
|
|
asection *sec = (asection *) abfd->tdata.any;
|
|
asymbol *syms;
|
|
unsigned int i;
|
|
size_t amt = BIN_SYMS * sizeof (asymbol);
|
|
|
|
syms = (asymbol *) bfd_alloc (abfd, amt);
|
|
if (syms == NULL)
|
|
return -1;
|
|
|
|
/* Start symbol. */
|
|
syms[0].the_bfd = abfd;
|
|
syms[0].name = mangle_name (abfd, "start");
|
|
syms[0].value = 0;
|
|
syms[0].flags = BSF_GLOBAL;
|
|
syms[0].section = sec;
|
|
syms[0].udata.p = NULL;
|
|
|
|
/* End symbol. */
|
|
syms[1].the_bfd = abfd;
|
|
syms[1].name = mangle_name (abfd, "end");
|
|
syms[1].value = sec->size;
|
|
syms[1].flags = BSF_GLOBAL;
|
|
syms[1].section = sec;
|
|
syms[1].udata.p = NULL;
|
|
|
|
/* Size symbol. */
|
|
syms[2].the_bfd = abfd;
|
|
syms[2].name = mangle_name (abfd, "size");
|
|
syms[2].value = sec->size;
|
|
syms[2].flags = BSF_GLOBAL;
|
|
syms[2].section = bfd_abs_section_ptr;
|
|
syms[2].udata.p = NULL;
|
|
|
|
for (i = 0; i < BIN_SYMS; i++)
|
|
*alocation++ = syms++;
|
|
*alocation = NULL;
|
|
|
|
return BIN_SYMS;
|
|
}
|
|
|
|
#define binary_make_empty_symbol _bfd_generic_make_empty_symbol
|
|
#define binary_print_symbol _bfd_nosymbols_print_symbol
|
|
#define binary_get_symbol_version_string \
|
|
_bfd_nosymbols_get_symbol_version_string
|
|
|
|
/* Get information about a symbol. */
|
|
|
|
static void
|
|
binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
|
|
asymbol *symbol,
|
|
symbol_info *ret)
|
|
{
|
|
bfd_symbol_info (symbol, ret);
|
|
}
|
|
|
|
#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name
|
|
#define binary_get_lineno _bfd_nosymbols_get_lineno
|
|
#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line
|
|
#define binary_find_line _bfd_nosymbols_find_line
|
|
#define binary_find_inliner_info _bfd_nosymbols_find_inliner_info
|
|
#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
|
#define binary_read_minisymbols _bfd_generic_read_minisymbols
|
|
#define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
|
#define binary_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
|
|
|
|
/* Set the architecture of a binary file. */
|
|
#define binary_set_arch_mach _bfd_generic_set_arch_mach
|
|
|
|
/* Write section contents of a binary file. */
|
|
|
|
static bfd_boolean
|
|
binary_set_section_contents (bfd *abfd,
|
|
asection *sec,
|
|
const void * data,
|
|
file_ptr offset,
|
|
bfd_size_type size)
|
|
{
|
|
if (size == 0)
|
|
return TRUE;
|
|
|
|
if (! abfd->output_has_begun)
|
|
{
|
|
bfd_boolean found_low;
|
|
bfd_vma low;
|
|
asection *s;
|
|
|
|
/* The lowest section LMA sets the virtual address of the start
|
|
of the file. We use this to set the file position of all the
|
|
sections. */
|
|
found_low = FALSE;
|
|
low = 0;
|
|
for (s = abfd->sections; s != NULL; s = s->next)
|
|
if (((s->flags
|
|
& (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD))
|
|
== (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC))
|
|
&& (s->size > 0)
|
|
&& (! found_low || s->lma < low))
|
|
{
|
|
low = s->lma;
|
|
found_low = TRUE;
|
|
}
|
|
|
|
for (s = abfd->sections; s != NULL; s = s->next)
|
|
{
|
|
unsigned int opb = bfd_octets_per_byte (abfd, s);
|
|
|
|
s->filepos = (s->lma - low) * opb;
|
|
|
|
/* Skip following warning check for sections that will not
|
|
occupy file space. */
|
|
if ((s->flags
|
|
& (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD))
|
|
!= (SEC_HAS_CONTENTS | SEC_ALLOC)
|
|
|| (s->size == 0))
|
|
continue;
|
|
|
|
/* If attempting to generate a binary file from a bfd with
|
|
LMA's all over the place, huge (sparse?) binary files may
|
|
result. This condition attempts to detect this situation
|
|
and print a warning. Better heuristics would be nice to
|
|
have. */
|
|
|
|
if (s->filepos < 0)
|
|
_bfd_error_handler
|
|
/* xgettext:c-format */
|
|
(_("warning: writing section `%pA' at huge (ie negative) "
|
|
"file offset"),
|
|
s);
|
|
}
|
|
|
|
abfd->output_has_begun = TRUE;
|
|
}
|
|
|
|
/* We don't want to output anything for a section that is neither
|
|
loaded nor allocated. The contents of such a section are not
|
|
meaningful in the binary format. */
|
|
if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
|
|
return TRUE;
|
|
if ((sec->flags & SEC_NEVER_LOAD) != 0)
|
|
return TRUE;
|
|
|
|
return _bfd_generic_set_section_contents (abfd, sec, data, offset, size);
|
|
}
|
|
|
|
/* No space is required for header information. */
|
|
|
|
static int
|
|
binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
|
|
struct bfd_link_info *info ATTRIBUTE_UNUSED)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
#define binary_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
|
|
#define binary_bfd_relax_section bfd_generic_relax_section
|
|
#define binary_bfd_gc_sections bfd_generic_gc_sections
|
|
#define binary_bfd_lookup_section_flags bfd_generic_lookup_section_flags
|
|
#define binary_bfd_merge_sections bfd_generic_merge_sections
|
|
#define binary_bfd_is_group_section bfd_generic_is_group_section
|
|
#define binary_bfd_group_name bfd_generic_group_name
|
|
#define binary_bfd_discard_group bfd_generic_discard_group
|
|
#define binary_section_already_linked _bfd_generic_section_already_linked
|
|
#define binary_bfd_define_common_symbol bfd_generic_define_common_symbol
|
|
#define binary_bfd_link_hide_symbol _bfd_generic_link_hide_symbol
|
|
#define binary_bfd_define_start_stop bfd_generic_define_start_stop
|
|
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
|
#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
|
|
#define binary_bfd_copy_link_hash_symbol_type _bfd_generic_copy_link_hash_symbol_type
|
|
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
|
#define binary_bfd_final_link _bfd_generic_final_link
|
|
#define binary_bfd_link_split_section _bfd_generic_link_split_section
|
|
#define binary_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
|
#define binary_bfd_link_check_relocs _bfd_generic_link_check_relocs
|
|
|
|
const bfd_target binary_vec =
|
|
{
|
|
"binary", /* name */
|
|
bfd_target_unknown_flavour, /* flavour */
|
|
BFD_ENDIAN_UNKNOWN, /* byteorder */
|
|
BFD_ENDIAN_UNKNOWN, /* header_byteorder */
|
|
EXEC_P, /* object_flags */
|
|
(SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA
|
|
| SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */
|
|
0, /* symbol_leading_char */
|
|
' ', /* ar_pad_char */
|
|
16, /* ar_max_namelen */
|
|
255, /* match priority. */
|
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
|
{ /* bfd_check_format */
|
|
_bfd_dummy_target,
|
|
binary_object_p,
|
|
_bfd_dummy_target,
|
|
_bfd_dummy_target,
|
|
},
|
|
{ /* bfd_set_format */
|
|
_bfd_bool_bfd_false_error,
|
|
binary_mkobject,
|
|
_bfd_bool_bfd_false_error,
|
|
_bfd_bool_bfd_false_error,
|
|
},
|
|
{ /* bfd_write_contents */
|
|
_bfd_bool_bfd_false_error,
|
|
_bfd_bool_bfd_true,
|
|
_bfd_bool_bfd_false_error,
|
|
_bfd_bool_bfd_false_error,
|
|
},
|
|
|
|
BFD_JUMP_TABLE_GENERIC (binary),
|
|
BFD_JUMP_TABLE_COPY (_bfd_generic),
|
|
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
|
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
|
|
BFD_JUMP_TABLE_SYMBOLS (binary),
|
|
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
|
BFD_JUMP_TABLE_WRITE (binary),
|
|
BFD_JUMP_TABLE_LINK (binary),
|
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
};
|