mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-04-12 14:33:06 +08:00
Convert to ISO C90 formatting
This commit is contained in:
parent
514d955ded
commit
116c20d240
@ -1,3 +1,40 @@
|
||||
2005-04-11 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* aout-target.h: Convert to ISO C.
|
||||
* aoutf1.h: Convert to ISO C.
|
||||
* aoutx.h: Convert to ISO C.
|
||||
* bout.c: Convert to ISO C.
|
||||
* dwarf1.c: Convert to ISO C.
|
||||
* ecoffswap.h: Convert to ISO C.
|
||||
* freebsd.h: Convert to ISO C.
|
||||
* genlink.h: Convert to ISO C.
|
||||
* ieee.c: Convert to ISO C.
|
||||
* ihex.c: Convert to ISO C.
|
||||
* libcoff-in.h: Convert to ISO C.
|
||||
* mach-o.c: Convert to ISO C.
|
||||
* mach-o.h: Convert to ISO C.
|
||||
* netbsd.h: Convert to ISO C.
|
||||
* ns32k.h: Convert to ISO C.
|
||||
* ns32knetbsd.c: Convert to ISO C.
|
||||
* oasys.c: Convert to ISO C.
|
||||
* pdp11.c: Convert to ISO C.
|
||||
* pef-traceback.h: Convert to ISO C.
|
||||
* pef.c: Convert to ISO C.
|
||||
* pef.h: Convert to ISO C.
|
||||
* riscix.c: Convert to ISO C.
|
||||
* som.c: Convert to ISO C.
|
||||
* som.h: Convert to ISO C.
|
||||
* srec.c: Convert to ISO C.
|
||||
* stabs.c: Convert to ISO C.
|
||||
* sunos.c: Convert to ISO C.
|
||||
* tekhex.c: Convert to ISO C.
|
||||
* versados.c: Convert to ISO C.
|
||||
* version.h: Convert to ISO C.
|
||||
* xcoff-target.h: Convert to ISO C.
|
||||
* xcofflink.c: Convert to ISO C.
|
||||
* xsym.c: Convert to ISO C.
|
||||
* xsym.h: Convert to ISO C.
|
||||
|
||||
2005-04-08 Paul Brook <paul@codesourcery.com>
|
||||
|
||||
* elf32-arm.c (ARM2THUMB_GLUE_SIZE): Rename...
|
||||
|
@ -3,21 +3,21 @@
|
||||
2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
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 2 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.
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "aout/aout64.h"
|
||||
#include "aout/stab_gnu.h"
|
||||
@ -28,30 +28,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
#endif
|
||||
|
||||
extern reloc_howto_type * NAME(aout,reloc_type_lookup)
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
|
||||
|
||||
/* Set parameters about this a.out file that are machine-dependent.
|
||||
This routine is called from some_aout_object_p just before it returns. */
|
||||
#ifndef MY_callback
|
||||
|
||||
static const bfd_target *MY(callback) PARAMS ((bfd *));
|
||||
|
||||
static const bfd_target *
|
||||
MY(callback) (abfd)
|
||||
bfd *abfd;
|
||||
MY (callback) (bfd *abfd)
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
unsigned int arch_align_power;
|
||||
unsigned long arch_align;
|
||||
|
||||
/* Calculate the file positions of the parts of a newly read aout header */
|
||||
obj_textsec (abfd)->size = N_TXTSIZE(*execp);
|
||||
/* Calculate the file positions of the parts of a newly read aout header. */
|
||||
obj_textsec (abfd)->size = N_TXTSIZE (*execp);
|
||||
|
||||
/* The virtual memory addresses of the sections */
|
||||
obj_textsec (abfd)->vma = N_TXTADDR(*execp);
|
||||
obj_datasec (abfd)->vma = N_DATADDR(*execp);
|
||||
obj_bsssec (abfd)->vma = N_BSSADDR(*execp);
|
||||
/* The virtual memory addresses of the sections. */
|
||||
obj_textsec (abfd)->vma = N_TXTADDR (*execp);
|
||||
obj_datasec (abfd)->vma = N_DATADDR (*execp);
|
||||
obj_bsssec (abfd)->vma = N_BSSADDR (*execp);
|
||||
|
||||
/* For some targets, if the entry point is not in the same page
|
||||
as the start of the text, then adjust the VMA so that it is.
|
||||
@ -74,13 +70,13 @@ MY(callback) (abfd)
|
||||
obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
|
||||
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
|
||||
|
||||
/* The file offsets of the sections */
|
||||
/* The file offsets of the sections. */
|
||||
obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
|
||||
obj_datasec (abfd)->filepos = N_DATOFF (*execp);
|
||||
|
||||
/* The file offsets of the relocation info */
|
||||
obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp);
|
||||
obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp);
|
||||
/* The file offsets of the relocation info. */
|
||||
obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp);
|
||||
obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp);
|
||||
|
||||
/* The file offsets of the string table and symbol table. */
|
||||
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
|
||||
@ -103,7 +99,7 @@ MY(callback) (abfd)
|
||||
execp->a_drsize / obj_reloc_entry_size (abfd);
|
||||
|
||||
/* Now that we know the architecture, set the alignments of the
|
||||
sections. This is normally done by NAME(aout,new_section_hook),
|
||||
sections. This is normally done by NAME (aout,new_section_hook),
|
||||
but when the initial sections were created the architecture had
|
||||
not yet been set. However, for backward compatibility, we don't
|
||||
set the alignment power any higher than as required by the size
|
||||
@ -130,20 +126,17 @@ MY(callback) (abfd)
|
||||
#endif
|
||||
|
||||
#ifndef MY_object_p
|
||||
/* Finish up the reading of an a.out file header */
|
||||
|
||||
static const bfd_target *MY(object_p) PARAMS ((bfd *));
|
||||
/* Finish up the reading of an a.out file header. */
|
||||
|
||||
static const bfd_target *
|
||||
MY(object_p) (abfd)
|
||||
bfd *abfd;
|
||||
MY (object_p) (bfd *abfd)
|
||||
{
|
||||
struct external_exec exec_bytes; /* Raw exec header from file */
|
||||
struct internal_exec exec; /* Cleaned-up exec header */
|
||||
struct external_exec exec_bytes; /* Raw exec header from file. */
|
||||
struct internal_exec exec; /* Cleaned-up exec header. */
|
||||
const bfd_target *target;
|
||||
bfd_size_type amt = EXEC_BYTES_SIZE;
|
||||
|
||||
if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
|
||||
if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
@ -154,28 +147,31 @@ MY(object_p) (abfd)
|
||||
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
|
||||
#else
|
||||
exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
|
||||
#endif /* SWAP_MAGIC */
|
||||
|
||||
if (N_BADMAG (exec)) return 0;
|
||||
#ifdef MACHTYPE_OK
|
||||
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
|
||||
#endif
|
||||
|
||||
NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
|
||||
if (N_BADMAG (exec))
|
||||
return 0;
|
||||
|
||||
#ifdef MACHTYPE_OK
|
||||
if (!(MACHTYPE_OK (N_MACHTYPE (exec))))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec);
|
||||
|
||||
#ifdef SWAP_MAGIC
|
||||
/* swap_exec_header_in read in a_info with the wrong byte order */
|
||||
/* Swap_exec_header_in read in a_info with the wrong byte order. */
|
||||
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
|
||||
#endif /* SWAP_MAGIC */
|
||||
#endif
|
||||
|
||||
target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback));
|
||||
target = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback));
|
||||
|
||||
#ifdef ENTRY_CAN_BE_ZERO
|
||||
/* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
|
||||
* means that it isn't obvious if EXEC_P should be set.
|
||||
* All of the following must be true for an executable:
|
||||
* There must be no relocations, the bfd can be neither an
|
||||
* archive nor an archive element, and the file must be executable. */
|
||||
means that it isn't obvious if EXEC_P should be set.
|
||||
All of the following must be true for an executable:
|
||||
There must be no relocations, the bfd can be neither an
|
||||
archive nor an archive element, and the file must be executable. */
|
||||
|
||||
if (exec.a_trsize + exec.a_drsize == 0
|
||||
&& bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
|
||||
@ -191,21 +187,18 @@ MY(object_p) (abfd)
|
||||
|
||||
return target;
|
||||
}
|
||||
#define MY_object_p MY(object_p)
|
||||
#define MY_object_p MY (object_p)
|
||||
#endif
|
||||
|
||||
#ifndef MY_mkobject
|
||||
|
||||
static bfd_boolean MY(mkobject) PARAMS ((bfd *));
|
||||
|
||||
static bfd_boolean
|
||||
MY(mkobject) (abfd)
|
||||
bfd *abfd;
|
||||
MY (mkobject) (bfd *abfd)
|
||||
{
|
||||
return NAME (aout, mkobject (abfd));
|
||||
}
|
||||
|
||||
#define MY_mkobject MY(mkobject)
|
||||
#define MY_mkobject MY (mkobject)
|
||||
#endif
|
||||
|
||||
#ifndef MY_bfd_copy_private_section_data
|
||||
@ -216,15 +209,11 @@ MY(mkobject) (abfd)
|
||||
section contents, and copy_private_bfd_data is not called until
|
||||
after the section contents have been set. */
|
||||
|
||||
static bfd_boolean MY_bfd_copy_private_section_data
|
||||
PARAMS ((bfd *, asection *, bfd *, asection *));
|
||||
|
||||
static bfd_boolean
|
||||
MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
|
||||
bfd *ibfd;
|
||||
asection *isec ATTRIBUTE_UNUSED;
|
||||
bfd *obfd;
|
||||
asection *osec ATTRIBUTE_UNUSED;
|
||||
MY_bfd_copy_private_section_data (bfd *ibfd,
|
||||
asection *isec ATTRIBUTE_UNUSED,
|
||||
bfd *obfd,
|
||||
asection *osec ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
|
||||
&& bfd_get_flavour (obfd) == bfd_target_aout_flavour)
|
||||
@ -239,31 +228,26 @@ MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
|
||||
file header, symbols, and relocation. */
|
||||
|
||||
#ifndef MY_write_object_contents
|
||||
static bfd_boolean MY(write_object_contents) PARAMS ((bfd *));
|
||||
|
||||
static bfd_boolean
|
||||
MY(write_object_contents) (abfd)
|
||||
bfd *abfd;
|
||||
MY (write_object_contents) (bfd *abfd)
|
||||
{
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
|
||||
WRITE_HEADERS(abfd, execp);
|
||||
WRITE_HEADERS (abfd, execp);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#define MY_write_object_contents MY(write_object_contents)
|
||||
#define MY_write_object_contents MY (write_object_contents)
|
||||
#endif
|
||||
|
||||
#ifndef MY_set_sizes
|
||||
|
||||
static bfd_boolean MY(set_sizes) PARAMS ((bfd *));
|
||||
|
||||
static bfd_boolean
|
||||
MY(set_sizes) (abfd)
|
||||
bfd *abfd;
|
||||
MY (set_sizes) (bfd *abfd)
|
||||
{
|
||||
adata(abfd).page_size = TARGET_PAGE_SIZE;
|
||||
adata(abfd).segment_size = SEGMENT_SIZE;
|
||||
@ -277,7 +261,7 @@ MY(set_sizes) (abfd)
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
return TRUE;
|
||||
}
|
||||
#define MY_set_sizes MY(set_sizes)
|
||||
#define MY_set_sizes MY (set_sizes)
|
||||
#endif
|
||||
|
||||
#ifndef MY_exec_hdr_flags
|
||||
@ -317,12 +301,13 @@ MY(set_sizes) (abfd)
|
||||
#define MY_finish_dynamic_link 0
|
||||
#endif
|
||||
|
||||
static const struct aout_backend_data MY(backend_data) = {
|
||||
static const struct aout_backend_data MY (backend_data) =
|
||||
{
|
||||
MY_zmagic_contiguous,
|
||||
MY_text_includes_header,
|
||||
MY_entry_is_text_address,
|
||||
MY_exec_hdr_flags,
|
||||
0, /* text vma? */
|
||||
0, /* Text vma? */
|
||||
MY_set_sizes,
|
||||
MY_exec_header_not_counted,
|
||||
MY_add_dynamic_symbols,
|
||||
@ -332,22 +317,18 @@ static const struct aout_backend_data MY(backend_data) = {
|
||||
MY_check_dynamic_reloc,
|
||||
MY_finish_dynamic_link
|
||||
};
|
||||
#define MY_backend_data &MY(backend_data)
|
||||
#define MY_backend_data &MY (backend_data)
|
||||
#endif
|
||||
|
||||
#ifndef MY_final_link_callback
|
||||
|
||||
/* Callback for the final_link routine to set the section offsets. */
|
||||
|
||||
static void MY_final_link_callback
|
||||
PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
|
||||
|
||||
static void
|
||||
MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff)
|
||||
bfd *abfd;
|
||||
file_ptr *ptreloff;
|
||||
file_ptr *pdreloff;
|
||||
file_ptr *psymoff;
|
||||
MY_final_link_callback (bfd *abfd,
|
||||
file_ptr *ptreloff,
|
||||
file_ptr *pdreloff,
|
||||
file_ptr *psymoff)
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
@ -363,14 +344,10 @@ MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff)
|
||||
/* Final link routine. We need to use a call back to get the correct
|
||||
offsets in the output file. */
|
||||
|
||||
static bfd_boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
static bfd_boolean
|
||||
MY_bfd_final_link (abfd, info)
|
||||
bfd *abfd;
|
||||
struct bfd_link_info *info;
|
||||
MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
{
|
||||
return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
|
||||
return NAME (aout, final_link) (abfd, info, MY_final_link_callback);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -431,62 +408,62 @@ MY_bfd_final_link (abfd, info)
|
||||
#endif
|
||||
#ifndef MY_bfd_debug_info_accumulate
|
||||
#define MY_bfd_debug_info_accumulate \
|
||||
(void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void
|
||||
(void (*) (bfd *, struct bfd_section *)) bfd_void
|
||||
#endif
|
||||
|
||||
#ifndef MY_core_file_failing_command
|
||||
#define MY_core_file_failing_command NAME(aout,core_file_failing_command)
|
||||
#define MY_core_file_failing_command NAME (aout, core_file_failing_command)
|
||||
#endif
|
||||
#ifndef MY_core_file_failing_signal
|
||||
#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal)
|
||||
#define MY_core_file_failing_signal NAME (aout, core_file_failing_signal)
|
||||
#endif
|
||||
#ifndef MY_core_file_matches_executable_p
|
||||
#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p)
|
||||
#define MY_core_file_matches_executable_p NAME (aout, core_file_matches_executable_p)
|
||||
#endif
|
||||
#ifndef MY_set_section_contents
|
||||
#define MY_set_section_contents NAME(aout,set_section_contents)
|
||||
#define MY_set_section_contents NAME (aout, set_section_contents)
|
||||
#endif
|
||||
#ifndef MY_get_section_contents
|
||||
#define MY_get_section_contents NAME(aout,get_section_contents)
|
||||
#define MY_get_section_contents NAME (aout, get_section_contents)
|
||||
#endif
|
||||
#ifndef MY_get_section_contents_in_window
|
||||
#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
||||
#endif
|
||||
#ifndef MY_new_section_hook
|
||||
#define MY_new_section_hook NAME(aout,new_section_hook)
|
||||
#define MY_new_section_hook NAME (aout, new_section_hook)
|
||||
#endif
|
||||
#ifndef MY_get_symtab_upper_bound
|
||||
#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound)
|
||||
#define MY_get_symtab_upper_bound NAME (aout, get_symtab_upper_bound)
|
||||
#endif
|
||||
#ifndef MY_canonicalize_symtab
|
||||
#define MY_canonicalize_symtab NAME(aout,canonicalize_symtab)
|
||||
#define MY_canonicalize_symtab NAME (aout, canonicalize_symtab)
|
||||
#endif
|
||||
#ifndef MY_get_reloc_upper_bound
|
||||
#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound)
|
||||
#define MY_get_reloc_upper_bound NAME (aout,get_reloc_upper_bound)
|
||||
#endif
|
||||
#ifndef MY_canonicalize_reloc
|
||||
#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc)
|
||||
#define MY_canonicalize_reloc NAME (aout, canonicalize_reloc)
|
||||
#endif
|
||||
#ifndef MY_make_empty_symbol
|
||||
#define MY_make_empty_symbol NAME(aout,make_empty_symbol)
|
||||
#define MY_make_empty_symbol NAME (aout, make_empty_symbol)
|
||||
#endif
|
||||
#ifndef MY_print_symbol
|
||||
#define MY_print_symbol NAME(aout,print_symbol)
|
||||
#define MY_print_symbol NAME (aout, print_symbol)
|
||||
#endif
|
||||
#ifndef MY_get_symbol_info
|
||||
#define MY_get_symbol_info NAME(aout,get_symbol_info)
|
||||
#define MY_get_symbol_info NAME (aout, get_symbol_info)
|
||||
#endif
|
||||
#ifndef MY_get_lineno
|
||||
#define MY_get_lineno NAME(aout,get_lineno)
|
||||
#define MY_get_lineno NAME (aout, get_lineno)
|
||||
#endif
|
||||
#ifndef MY_set_arch_mach
|
||||
#define MY_set_arch_mach NAME(aout,set_arch_mach)
|
||||
#define MY_set_arch_mach NAME (aout, set_arch_mach)
|
||||
#endif
|
||||
#ifndef MY_find_nearest_line
|
||||
#define MY_find_nearest_line NAME(aout,find_nearest_line)
|
||||
#define MY_find_nearest_line NAME (aout, find_nearest_line)
|
||||
#endif
|
||||
#ifndef MY_sizeof_headers
|
||||
#define MY_sizeof_headers NAME(aout,sizeof_headers)
|
||||
#define MY_sizeof_headers NAME (aout, sizeof_headers)
|
||||
#endif
|
||||
#ifndef MY_bfd_get_relocated_section_contents
|
||||
#define MY_bfd_get_relocated_section_contents \
|
||||
@ -512,25 +489,25 @@ MY_bfd_final_link (abfd, info)
|
||||
_bfd_generic_section_already_linked
|
||||
#endif
|
||||
#ifndef MY_bfd_reloc_type_lookup
|
||||
#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup)
|
||||
#define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup)
|
||||
#endif
|
||||
#ifndef MY_bfd_make_debug_symbol
|
||||
#define MY_bfd_make_debug_symbol 0
|
||||
#endif
|
||||
#ifndef MY_read_minisymbols
|
||||
#define MY_read_minisymbols NAME(aout,read_minisymbols)
|
||||
#define MY_read_minisymbols NAME (aout, read_minisymbols)
|
||||
#endif
|
||||
#ifndef MY_minisymbol_to_symbol
|
||||
#define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol)
|
||||
#define MY_minisymbol_to_symbol NAME (aout, minisymbol_to_symbol)
|
||||
#endif
|
||||
#ifndef MY_bfd_link_hash_table_create
|
||||
#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create)
|
||||
#define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create)
|
||||
#endif
|
||||
#ifndef MY_bfd_link_hash_table_free
|
||||
#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
||||
#endif
|
||||
#ifndef MY_bfd_link_add_symbols
|
||||
#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
|
||||
#define MY_bfd_link_add_symbols NAME (aout, link_add_symbols)
|
||||
#endif
|
||||
#ifndef MY_bfd_link_just_syms
|
||||
#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
|
||||
@ -572,7 +549,7 @@ MY_bfd_final_link (abfd, info)
|
||||
#endif
|
||||
|
||||
#ifndef MY_bfd_free_cached_info
|
||||
#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
|
||||
#define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info)
|
||||
#endif
|
||||
|
||||
#ifndef MY_close_and_cleanup
|
||||
@ -600,55 +577,55 @@ MY_bfd_final_link (abfd, info)
|
||||
_bfd_nodynamic_canonicalize_dynamic_reloc
|
||||
#endif
|
||||
|
||||
/* Aout symbols normally have leading underscores */
|
||||
/* Aout symbols normally have leading underscores. */
|
||||
#ifndef MY_symbol_leading_char
|
||||
#define MY_symbol_leading_char '_'
|
||||
#endif
|
||||
|
||||
/* Aout archives normally use spaces for padding */
|
||||
/* Aout archives normally use spaces for padding. */
|
||||
#ifndef AR_PAD_CHAR
|
||||
#define AR_PAD_CHAR ' '
|
||||
#endif
|
||||
|
||||
#ifndef MY_BFD_TARGET
|
||||
const bfd_target MY(vec) =
|
||||
const bfd_target MY (vec) =
|
||||
{
|
||||
TARGETNAME, /* name */
|
||||
TARGETNAME, /* Name. */
|
||||
bfd_target_aout_flavour,
|
||||
#ifdef TARGET_IS_BIG_ENDIAN_P
|
||||
BFD_ENDIAN_BIG, /* target byte order (big) */
|
||||
BFD_ENDIAN_BIG, /* target headers byte order (big) */
|
||||
BFD_ENDIAN_BIG, /* Target byte order (big). */
|
||||
BFD_ENDIAN_BIG, /* Target headers byte order (big). */
|
||||
#else
|
||||
BFD_ENDIAN_LITTLE, /* target byte order (little) */
|
||||
BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
|
||||
BFD_ENDIAN_LITTLE, /* Target byte order (little). */
|
||||
BFD_ENDIAN_LITTLE, /* Target headers byte order (little). */
|
||||
#endif
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
(HAS_RELOC | EXEC_P | /* Object flags. */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
|
||||
MY_symbol_leading_char,
|
||||
AR_PAD_CHAR, /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
AR_PAD_CHAR, /* AR_pad_char. */
|
||||
15, /* AR_max_namelen. */
|
||||
#ifdef TARGET_IS_BIG_ENDIAN_P
|
||||
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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
|
||||
#else
|
||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
|
||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
|
||||
#endif
|
||||
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
|
||||
{_bfd_dummy_target, MY_object_p, /* bfd_check_format. */
|
||||
bfd_generic_archive_p, MY_core_file_p},
|
||||
{bfd_false, MY_mkobject, /* bfd_set_format */
|
||||
{bfd_false, MY_mkobject, /* bfd_set_format. */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
|
||||
{bfd_false, MY_write_object_contents, /* bfd_write_contents. */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (MY),
|
||||
@ -661,9 +638,9 @@ const bfd_target MY(vec) =
|
||||
BFD_JUMP_TABLE_LINK (MY),
|
||||
BFD_JUMP_TABLE_DYNAMIC (MY),
|
||||
|
||||
/* Alternative_target */
|
||||
/* Alternative_target. */
|
||||
NULL,
|
||||
|
||||
(PTR) MY_backend_data
|
||||
MY_backend_data
|
||||
};
|
||||
#endif /* MY_BFD_TARGET */
|
||||
|
400
bfd/aoutf1.h
400
bfd/aoutf1.h
@ -1,31 +1,31 @@
|
||||
/* A.out "format 1" file handling code for BFD.
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
|
||||
2001, 2002, 2003, 2004
|
||||
2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
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 2 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.
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
#include "aout/sun4.h"
|
||||
#include "libaout.h" /* BFD a.out internal data structures */
|
||||
#include "libaout.h" /* BFD a.out internal data structures. */
|
||||
|
||||
#include "aout/aout64.h"
|
||||
#include "aout/stab_gnu.h"
|
||||
@ -42,30 +42,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
&& bfd_lookup_arch (bfd_arch_m68k, 0) != NULL))
|
||||
#endif
|
||||
|
||||
/*
|
||||
The file @code{aoutf1.h} contains the code for BFD's
|
||||
a.out back end. Control over the generated back end is given by these
|
||||
two preprocessor names:
|
||||
@table @code
|
||||
@item ARCH_SIZE
|
||||
This value should be either 32 or 64, depending upon the size of an
|
||||
int in the target format. It changes the sizes of the structs which
|
||||
perform the memory/disk mapping of structures.
|
||||
/* The file @code{aoutf1.h} contains the code for BFD's
|
||||
a.out back end. Control over the generated back end is given by these
|
||||
two preprocessor names:
|
||||
@table @code
|
||||
@item ARCH_SIZE
|
||||
This value should be either 32 or 64, depending upon the size of an
|
||||
int in the target format. It changes the sizes of the structs which
|
||||
perform the memory/disk mapping of structures.
|
||||
|
||||
The 64 bit backend may only be used if the host compiler supports 64
|
||||
ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}.
|
||||
With this name defined, @emph{all} bfd operations are performed with 64bit
|
||||
arithmetic, not just those to a 64bit target.
|
||||
The 64 bit backend may only be used if the host compiler supports 64
|
||||
ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}.
|
||||
With this name defined, @emph{all} bfd operations are performed with 64bit
|
||||
arithmetic, not just those to a 64bit target.
|
||||
|
||||
@item TARGETNAME
|
||||
The name put into the target vector.
|
||||
@item
|
||||
@end table
|
||||
|
||||
*/
|
||||
|
||||
/*SUPPRESS558*/
|
||||
/*SUPPRESS529*/
|
||||
@item TARGETNAME
|
||||
The name put into the target vector.
|
||||
@item
|
||||
@end table. */
|
||||
|
||||
#if ARCH_SIZE == 64
|
||||
#define sunos_set_arch_mach sunos_64_set_arch_mach
|
||||
@ -75,25 +69,6 @@ The name put into the target vector.
|
||||
#define sunos_write_object_contents aout_32_sunos4_write_object_contents
|
||||
#endif
|
||||
|
||||
static bfd_boolean sunos_merge_private_bfd_data
|
||||
PARAMS ((bfd *, bfd *));
|
||||
static void sunos_set_arch_mach
|
||||
PARAMS ((bfd *, enum machine_type));
|
||||
static void choose_reloc_size
|
||||
PARAMS ((bfd *));
|
||||
static bfd_boolean sunos_write_object_contents
|
||||
PARAMS ((bfd *));
|
||||
static const bfd_target *sunos4_core_file_p
|
||||
PARAMS ((bfd *));
|
||||
static char *sunos4_core_file_failing_command
|
||||
PARAMS ((bfd *));
|
||||
static int sunos4_core_file_failing_signal
|
||||
PARAMS ((bfd *));
|
||||
static bfd_boolean sunos4_core_file_matches_executable_p
|
||||
PARAMS ((bfd *, bfd *));
|
||||
static bfd_boolean sunos4_set_sizes
|
||||
PARAMS ((bfd *));
|
||||
|
||||
/* Merge backend data into the output file.
|
||||
This is necessary on sparclet-aout where we want the resultant machine
|
||||
number to be M_SPARCLET if any input file is M_SPARCLET. */
|
||||
@ -101,8 +76,7 @@ static bfd_boolean sunos4_set_sizes
|
||||
#define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data
|
||||
|
||||
static bfd_boolean
|
||||
sunos_merge_private_bfd_data (ibfd, obfd)
|
||||
bfd *ibfd, *obfd;
|
||||
sunos_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
|
||||
{
|
||||
if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour
|
||||
|| bfd_get_flavour (obfd) != bfd_target_aout_flavour)
|
||||
@ -121,16 +95,14 @@ sunos_merge_private_bfd_data (ibfd, obfd)
|
||||
depending upon ARCH_SIZE. */
|
||||
|
||||
static void
|
||||
sunos_set_arch_mach (abfd, machtype)
|
||||
bfd *abfd;
|
||||
enum machine_type machtype;
|
||||
sunos_set_arch_mach (bfd *abfd, enum machine_type machtype)
|
||||
{
|
||||
/* Determine the architecture and machine type of the object file. */
|
||||
enum bfd_architecture arch;
|
||||
unsigned long machine;
|
||||
|
||||
switch (machtype)
|
||||
{
|
||||
|
||||
case M_UNKNOWN:
|
||||
/* Some Sun3s make magic numbers without cpu types in them, so
|
||||
we'll default to the 68000. */
|
||||
@ -193,10 +165,10 @@ sunos_set_arch_mach (abfd, machtype)
|
||||
NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
|
||||
choose_reloc_size(ABFD);
|
||||
|
||||
/* Determine the size of a relocation entry, based on the architecture */
|
||||
/* Determine the size of a relocation entry, based on the architecture. */
|
||||
|
||||
static void
|
||||
choose_reloc_size (abfd)
|
||||
bfd *abfd;
|
||||
choose_reloc_size (bfd *abfd)
|
||||
{
|
||||
switch (bfd_get_arch (abfd))
|
||||
{
|
||||
@ -217,8 +189,7 @@ choose_reloc_size (abfd)
|
||||
aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */
|
||||
|
||||
static bfd_boolean
|
||||
sunos_write_object_contents (abfd)
|
||||
bfd *abfd;
|
||||
sunos_write_object_contents (bfd *abfd)
|
||||
{
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
@ -276,9 +247,9 @@ sunos_write_object_contents (abfd)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* core files */
|
||||
/* Core files. */
|
||||
|
||||
#define CORE_MAGIC 0x080456
|
||||
#define CORE_MAGIC 0x080456
|
||||
#define CORE_NAMELEN 16
|
||||
|
||||
/* The core structure is taken from the Sun documentation.
|
||||
@ -320,115 +291,106 @@ struct regs
|
||||
even portably access the stuff in between! */
|
||||
|
||||
struct external_sparc_core
|
||||
{
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
{
|
||||
int c_magic; /* Corefile magic number. */
|
||||
int c_len; /* Sizeof (struct core). */
|
||||
#define SPARC_CORE_LEN 432
|
||||
int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */
|
||||
struct external_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
double fp_stuff[1]; /* external FPU state (size unknown by us) */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
SunOS declares a struct here, but the struct's alignment
|
||||
is double since it contains doubles. */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
/* (this member is not accessible by name since we don't
|
||||
portably know the size of fp_stuff.) */
|
||||
};
|
||||
int c_regs[19]; /* General purpose registers -- MACHDEP SIZE. */
|
||||
struct external_exec c_aouthdr; /* A.out header. */
|
||||
int c_signo; /* Killing signal, if any. */
|
||||
int c_tsize; /* Text size (bytes). */
|
||||
int c_dsize; /* Data size (bytes). */
|
||||
int c_ssize; /* Stack size (bytes). */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
|
||||
double fp_stuff[1]; /* External FPU state (size unknown by us). */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
SunOS declares a struct here, but the struct's
|
||||
alignment is double since it contains doubles. */
|
||||
int c_ucode; /* Exception no. from u_code. */
|
||||
/* This member is not accessible by name since
|
||||
we don't portably know the size of fp_stuff. */
|
||||
};
|
||||
|
||||
/* Core files generated by the BCP (the part of Solaris which allows
|
||||
it to run SunOS4 a.out files). */
|
||||
struct external_solaris_bcp_core
|
||||
{
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
{
|
||||
int c_magic; /* Corefile magic number. */
|
||||
int c_len; /* Sizeof (struct core). */
|
||||
#define SOLARIS_BCP_CORE_LEN 456
|
||||
int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */
|
||||
int c_exdata_vp; /* exdata structure */
|
||||
int c_exdata_tsize;
|
||||
int c_exdata_dsize;
|
||||
int c_exdata_bsize;
|
||||
int c_exdata_lsize;
|
||||
int c_exdata_nshlibs;
|
||||
short c_exdata_mach;
|
||||
short c_exdata_mag;
|
||||
int c_exdata_toffset;
|
||||
int c_exdata_doffset;
|
||||
int c_exdata_loffset;
|
||||
int c_exdata_txtorg;
|
||||
int c_exdata_datorg;
|
||||
int c_exdata_entloc;
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
double fp_stuff[1]; /* external FPU state (size unknown by us) */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
SunOS declares a struct here, but the struct's alignment
|
||||
is double since it contains doubles. */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
/* (this member is not accessible by name since we don't
|
||||
portably know the size of fp_stuff.) */
|
||||
};
|
||||
int c_regs[19]; /* General purpose registers -- MACHDEP SIZE. */
|
||||
int c_exdata_vp; /* Exdata structure. */
|
||||
int c_exdata_tsize;
|
||||
int c_exdata_dsize;
|
||||
int c_exdata_bsize;
|
||||
int c_exdata_lsize;
|
||||
int c_exdata_nshlibs;
|
||||
short c_exdata_mach;
|
||||
short c_exdata_mag;
|
||||
int c_exdata_toffset;
|
||||
int c_exdata_doffset;
|
||||
int c_exdata_loffset;
|
||||
int c_exdata_txtorg;
|
||||
int c_exdata_datorg;
|
||||
int c_exdata_entloc;
|
||||
int c_signo; /* Killing signal, if any. */
|
||||
int c_tsize; /* Text size (bytes). */
|
||||
int c_dsize; /* Data size (bytes). */
|
||||
int c_ssize; /* Stack size (bytes). */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
|
||||
double fp_stuff[1]; /* External FPU state (size unknown by us). */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
SunOS declares a struct here, but the struct's
|
||||
alignment is double since it contains doubles. */
|
||||
int c_ucode; /* Exception no. from u_code. */
|
||||
/* This member is not accessible by name since
|
||||
we don't portably know the size of fp_stuff. */
|
||||
};
|
||||
|
||||
struct external_sun3_core
|
||||
{
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
#define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1 */
|
||||
int c_regs[18]; /* General purpose registers -- MACHDEP SIZE */
|
||||
struct external_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
double fp_stuff[1]; /* external FPU state (size unknown by us) */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
SunOS declares a struct here, but the struct's alignment
|
||||
is double since it contains doubles. */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
/* (this member is not accessible by name since we don't
|
||||
portably know the size of fp_stuff.) */
|
||||
};
|
||||
{
|
||||
int c_magic; /* Corefile magic number. */
|
||||
int c_len; /* Sizeof (struct core). */
|
||||
#define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1. */
|
||||
int c_regs[18]; /* General purpose registers -- MACHDEP SIZE. */
|
||||
struct external_exec c_aouthdr; /* A.out header. */
|
||||
int c_signo; /* Killing signal, if any. */
|
||||
int c_tsize; /* Text size (bytes). */
|
||||
int c_dsize; /* Data size (bytes). */
|
||||
int c_ssize; /* Stack size (bytes). */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
|
||||
double fp_stuff[1]; /* External FPU state (size unknown by us). */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
SunOS declares a struct here, but the struct's
|
||||
alignment is double since it contains doubles. */
|
||||
int c_ucode; /* Exception no. from u_code. */
|
||||
/* This member is not accessible by name since
|
||||
we don't portably know the size of fp_stuff. */
|
||||
};
|
||||
|
||||
struct internal_sunos_core
|
||||
{
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
long c_regs_pos; /* file offset of General purpose registers */
|
||||
int c_regs_size; /* size of General purpose registers */
|
||||
struct internal_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
bfd_vma c_data_addr; /* Data start (address) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
bfd_vma c_stacktop; /* Stack top (address) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
long fp_stuff_pos; /* file offset of external FPU state (regs) */
|
||||
int fp_stuff_size; /* Size of it */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
};
|
||||
{
|
||||
int c_magic; /* Corefile magic number. */
|
||||
int c_len; /* Sizeof (struct core). */
|
||||
long c_regs_pos; /* File offset of General purpose registers. */
|
||||
int c_regs_size; /* Size of General purpose registers. */
|
||||
struct internal_exec c_aouthdr; /* A.out header. */
|
||||
int c_signo; /* Killing signal, if any. */
|
||||
int c_tsize; /* Text size (bytes). */
|
||||
int c_dsize; /* Data size (bytes). */
|
||||
bfd_vma c_data_addr; /* Data start (address). */
|
||||
int c_ssize; /* Stack size (bytes). */
|
||||
bfd_vma c_stacktop; /* Stack top (address). */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
|
||||
long fp_stuff_pos; /* File offset of external FPU state (regs). */
|
||||
int fp_stuff_size; /* Size of it. */
|
||||
int c_ucode; /* Exception no. from u_code. */
|
||||
};
|
||||
|
||||
static void swapcore_sun3
|
||||
PARAMS ((bfd *, char *, struct internal_sunos_core *));
|
||||
static void swapcore_sparc
|
||||
PARAMS ((bfd *, char *, struct internal_sunos_core *));
|
||||
static void swapcore_solaris_bcp
|
||||
PARAMS ((bfd *, char *, struct internal_sunos_core *));
|
||||
/* Byte-swap in the Sun-3 core structure. */
|
||||
|
||||
/* byte-swap in the Sun-3 core structure */
|
||||
static void
|
||||
swapcore_sun3 (abfd, ext, intcore)
|
||||
bfd *abfd;
|
||||
char *ext;
|
||||
struct internal_sunos_core *intcore;
|
||||
swapcore_sun3 (bfd *abfd, char *ext, struct internal_sunos_core *intcore)
|
||||
{
|
||||
struct external_sun3_core *extcore = (struct external_sun3_core *) ext;
|
||||
|
||||
@ -452,20 +414,18 @@ swapcore_sun3 (abfd, ext, intcore)
|
||||
/* FP stuff takes up whole rest of struct, except c_ucode. */
|
||||
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
|
||||
(file_ptr) (((struct external_sun3_core *) 0)->fp_stuff);
|
||||
/* Ucode is the last thing in the struct -- just before the end */
|
||||
/* Ucode is the last thing in the struct -- just before the end. */
|
||||
intcore->c_ucode = H_GET_32 (abfd,
|
||||
(intcore->c_len
|
||||
- sizeof (extcore->c_ucode)
|
||||
+ (unsigned char *) extcore));
|
||||
intcore->c_stacktop = 0x0E000000; /* By experimentation */
|
||||
intcore->c_stacktop = 0x0E000000; /* By experimentation. */
|
||||
}
|
||||
|
||||
/* byte-swap in the Sparc core structure */
|
||||
/* Byte-swap in the Sparc core structure. */
|
||||
|
||||
static void
|
||||
swapcore_sparc (abfd, ext, intcore)
|
||||
bfd *abfd;
|
||||
char *ext;
|
||||
struct internal_sunos_core *intcore;
|
||||
swapcore_sparc (bfd *abfd, char *ext, struct internal_sunos_core *intcore)
|
||||
{
|
||||
struct external_sparc_core *extcore = (struct external_sparc_core *) ext;
|
||||
|
||||
@ -489,7 +449,7 @@ swapcore_sparc (abfd, ext, intcore)
|
||||
/* FP stuff takes up whole rest of struct, except c_ucode. */
|
||||
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
|
||||
(file_ptr) (((struct external_sparc_core *) 0)->fp_stuff);
|
||||
/* Ucode is the last thing in the struct -- just before the end */
|
||||
/* Ucode is the last thing in the struct -- just before the end. */
|
||||
intcore->c_ucode = H_GET_32 (abfd,
|
||||
(intcore->c_len
|
||||
- sizeof (extcore->c_ucode)
|
||||
@ -519,12 +479,10 @@ swapcore_sparc (abfd, ext, intcore)
|
||||
}
|
||||
}
|
||||
|
||||
/* byte-swap in the Solaris BCP core structure */
|
||||
/* Byte-swap in the Solaris BCP core structure. */
|
||||
|
||||
static void
|
||||
swapcore_solaris_bcp (abfd, ext, intcore)
|
||||
bfd *abfd;
|
||||
char *ext;
|
||||
struct internal_sunos_core *intcore;
|
||||
swapcore_solaris_bcp (bfd *abfd, char *ext, struct internal_sunos_core *intcore)
|
||||
{
|
||||
struct external_solaris_bcp_core *extcore =
|
||||
(struct external_solaris_bcp_core *) ext;
|
||||
@ -544,7 +502,7 @@ swapcore_solaris_bcp (abfd, ext, intcore)
|
||||
are buggy. The exdata structure is not properly filled in, and
|
||||
the data section is written from address zero instead of the data
|
||||
start address. */
|
||||
memset ((PTR) &intcore->c_aouthdr, 0, sizeof (struct internal_exec));
|
||||
memset ((void *) &intcore->c_aouthdr, 0, sizeof (struct internal_exec));
|
||||
intcore->c_data_addr = H_GET_32 (abfd, &extcore->c_exdata_datorg);
|
||||
intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
|
||||
intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
|
||||
@ -586,17 +544,17 @@ swapcore_solaris_bcp (abfd, ext, intcore)
|
||||
}
|
||||
}
|
||||
|
||||
/* need this cast because ptr is really void * */
|
||||
#define core_hdr(bfd) ((bfd)->tdata.sun_core_data)
|
||||
#define core_datasec(bfd) (core_hdr(bfd)->data_section)
|
||||
#define core_stacksec(bfd) (core_hdr(bfd)->stack_section)
|
||||
#define core_regsec(bfd) (core_hdr(bfd)->reg_section)
|
||||
#define core_reg2sec(bfd) (core_hdr(bfd)->reg2_section)
|
||||
/* Need this cast because ptr is really void *. */
|
||||
#define core_hdr(bfd) ((bfd)->tdata.sun_core_data)
|
||||
#define core_datasec(bfd) (core_hdr (bfd)->data_section)
|
||||
#define core_stacksec(bfd) (core_hdr (bfd)->stack_section)
|
||||
#define core_regsec(bfd) (core_hdr (bfd)->reg_section)
|
||||
#define core_reg2sec(bfd) (core_hdr (bfd)->reg2_section)
|
||||
|
||||
/* These are stored in the bfd's tdata */
|
||||
/* These are stored in the bfd's tdata. */
|
||||
struct sun_core_struct
|
||||
{
|
||||
struct internal_sunos_core *hdr; /* core file header */
|
||||
struct internal_sunos_core *hdr; /* Core file header. */
|
||||
asection *data_section;
|
||||
asection *stack_section;
|
||||
asection *reg_section;
|
||||
@ -604,10 +562,9 @@ struct sun_core_struct
|
||||
};
|
||||
|
||||
static const bfd_target *
|
||||
sunos4_core_file_p (abfd)
|
||||
bfd *abfd;
|
||||
sunos4_core_file_p (bfd *abfd)
|
||||
{
|
||||
unsigned char longbuf[4]; /* Raw bytes of various header fields */
|
||||
unsigned char longbuf[4]; /* Raw bytes of various header fields. */
|
||||
bfd_size_type core_size, amt;
|
||||
unsigned long core_mag;
|
||||
struct internal_sunos_core *core;
|
||||
@ -619,40 +576,40 @@ sunos4_core_file_p (abfd)
|
||||
char external_core[1];
|
||||
} *mergem;
|
||||
|
||||
if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
|
||||
if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
|
||||
!= sizeof (longbuf))
|
||||
return 0;
|
||||
return NULL;
|
||||
core_mag = H_GET_32 (abfd, longbuf);
|
||||
|
||||
if (core_mag != CORE_MAGIC)
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
/* SunOS core headers can vary in length; second word is size; */
|
||||
if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
|
||||
if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
|
||||
!= sizeof (longbuf))
|
||||
return 0;
|
||||
return NULL;
|
||||
core_size = H_GET_32 (abfd, longbuf);
|
||||
/* Sanity check */
|
||||
/* Sanity check. */
|
||||
if (core_size > 20000)
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
amt = core_size + sizeof (struct mergem);
|
||||
mergem = (struct mergem *) bfd_zalloc (abfd, amt);
|
||||
mergem = bfd_zalloc (abfd, amt);
|
||||
if (mergem == NULL)
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
extcore = mergem->external_core;
|
||||
|
||||
if ((bfd_bread ((PTR) extcore, core_size, abfd)) != core_size)
|
||||
if ((bfd_bread ((void *) extcore, core_size, abfd)) != core_size)
|
||||
{
|
||||
loser:
|
||||
bfd_release (abfd, (char *) mergem);
|
||||
abfd->tdata.any = NULL;
|
||||
bfd_section_list_clear (abfd);
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Validate that it's a core file we know how to handle, due to sun
|
||||
@ -671,7 +628,7 @@ sunos4_core_file_p (abfd)
|
||||
swapcore_solaris_bcp (abfd, extcore, core);
|
||||
break;
|
||||
default:
|
||||
bfd_set_error (bfd_error_system_call); /* FIXME */
|
||||
bfd_set_error (bfd_error_system_call); /* FIXME. */
|
||||
goto loser;
|
||||
}
|
||||
|
||||
@ -713,11 +670,11 @@ sunos4_core_file_p (abfd)
|
||||
|
||||
core_stacksec (abfd)->filepos = core->c_len + core->c_dsize;
|
||||
core_datasec (abfd)->filepos = core->c_len;
|
||||
/* We'll access the regs afresh in the core file, like any section: */
|
||||
/* We'll access the regs afresh in the core file, like any section: */
|
||||
core_regsec (abfd)->filepos = (file_ptr) core->c_regs_pos;
|
||||
core_reg2sec (abfd)->filepos = (file_ptr) core->fp_stuff_pos;
|
||||
|
||||
/* Align to word at least */
|
||||
/* Align to word at least. */
|
||||
core_stacksec (abfd)->alignment_power = 2;
|
||||
core_datasec (abfd)->alignment_power = 2;
|
||||
core_regsec (abfd)->alignment_power = 2;
|
||||
@ -727,23 +684,19 @@ sunos4_core_file_p (abfd)
|
||||
}
|
||||
|
||||
static char *
|
||||
sunos4_core_file_failing_command (abfd)
|
||||
bfd *abfd;
|
||||
sunos4_core_file_failing_command (bfd *abfd)
|
||||
{
|
||||
return core_hdr (abfd)->hdr->c_cmdname;
|
||||
}
|
||||
|
||||
static int
|
||||
sunos4_core_file_failing_signal (abfd)
|
||||
bfd *abfd;
|
||||
sunos4_core_file_failing_signal (bfd *abfd)
|
||||
{
|
||||
return core_hdr (abfd)->hdr->c_signo;
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
bfd *core_bfd;
|
||||
bfd *exec_bfd;
|
||||
sunos4_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
|
||||
{
|
||||
if (core_bfd->xvec != exec_bfd->xvec)
|
||||
{
|
||||
@ -755,15 +708,15 @@ sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN)
|
||||
return TRUE;
|
||||
|
||||
return (memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr),
|
||||
(char *) exec_hdr (exec_bfd),
|
||||
sizeof (struct internal_exec)) == 0);
|
||||
return memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr),
|
||||
(char *) exec_hdr (exec_bfd),
|
||||
sizeof (struct internal_exec)) == 0;
|
||||
}
|
||||
|
||||
#define MY_set_sizes sunos4_set_sizes
|
||||
|
||||
static bfd_boolean
|
||||
sunos4_set_sizes (abfd)
|
||||
bfd *abfd;
|
||||
sunos4_set_sizes (bfd *abfd)
|
||||
{
|
||||
switch (bfd_get_arch (abfd))
|
||||
{
|
||||
@ -812,13 +765,13 @@ sunos4_set_sizes (abfd)
|
||||
|
||||
static const struct aout_backend_data sunos4_aout_backend =
|
||||
{
|
||||
0, /* zmagic files are not contiguous */
|
||||
1, /* text includes header */
|
||||
0, /* Zmagic files are not contiguous. */
|
||||
1, /* Text includes header. */
|
||||
MY_entry_is_text_address,
|
||||
MY_exec_hdr_flags,
|
||||
0, /* default text vma */
|
||||
0, /* Default text vma. */
|
||||
sunos4_set_sizes,
|
||||
0, /* header is counted in zmagic text */
|
||||
0, /* Header is counted in zmagic text. */
|
||||
MY_add_dynamic_symbols,
|
||||
MY_add_one_symbol,
|
||||
MY_link_dynamic_object,
|
||||
@ -833,11 +786,10 @@ static const struct aout_backend_data sunos4_aout_backend =
|
||||
|
||||
#define MY_bfd_debug_info_start bfd_void
|
||||
#define MY_bfd_debug_info_end bfd_void
|
||||
#define MY_bfd_debug_info_accumulate \
|
||||
(void (*) PARAMS ((bfd *, struct bfd_section *))) bfd_void
|
||||
#define MY_bfd_debug_info_accumulate (void (*) (bfd *, struct bfd_section *)) bfd_void
|
||||
#define MY_core_file_p sunos4_core_file_p
|
||||
#define MY_write_object_contents NAME(aout,sunos4_write_object_contents)
|
||||
#define MY_backend_data &sunos4_aout_backend
|
||||
#define MY_write_object_contents NAME(aout, sunos4_write_object_contents)
|
||||
#define MY_backend_data & sunos4_aout_backend
|
||||
|
||||
#ifndef TARGET_IS_LITTLE_ENDIAN_P
|
||||
#define TARGET_IS_BIG_ENDIAN_P
|
||||
|
4264
bfd/aoutx.h
4264
bfd/aoutx.h
File diff suppressed because it is too large
Load Diff
1001
bfd/bout.c
1001
bfd/bout.c
File diff suppressed because it is too large
Load Diff
166
bfd/dwarf1.c
166
bfd/dwarf1.c
@ -1,23 +1,24 @@
|
||||
/* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
|
||||
Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
|
||||
Copyright 1998, 1999, 2000, 2001, 2002, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
|
||||
Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
|
||||
|
||||
This file is part of BFD.
|
||||
This file is part of BFD.
|
||||
|
||||
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 2 of the License, or (at
|
||||
your option) any later version.
|
||||
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 2 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.
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
@ -28,8 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* dwarf1_debug is the starting point for all dwarf1 info. */
|
||||
|
||||
struct dwarf1_debug {
|
||||
|
||||
struct dwarf1_debug
|
||||
{
|
||||
/* The bfd we are working with. */
|
||||
bfd* abfd;
|
||||
|
||||
@ -55,7 +56,8 @@ struct dwarf1_debug {
|
||||
|
||||
/* One dwarf1_unit for each parsed compilation unit die. */
|
||||
|
||||
struct dwarf1_unit {
|
||||
struct dwarf1_unit
|
||||
{
|
||||
/* Linked starting from stash->lastUnit. */
|
||||
struct dwarf1_unit* prev;
|
||||
|
||||
@ -66,7 +68,7 @@ struct dwarf1_unit {
|
||||
unsigned long low_pc;
|
||||
unsigned long high_pc;
|
||||
|
||||
/* Does this unit have a statement list? */
|
||||
/* Does this unit have a statement list? */
|
||||
int has_stmt_list;
|
||||
|
||||
/* If any, the offset of the line number table in the .line section. */
|
||||
@ -75,7 +77,7 @@ struct dwarf1_unit {
|
||||
/* If non-zero, a pointer to the first child of this unit. */
|
||||
char* first_child;
|
||||
|
||||
/* How many line entries? */
|
||||
/* How many line entries? */
|
||||
unsigned long line_count;
|
||||
|
||||
/* The decoded line number table (line_count entries). */
|
||||
@ -87,7 +89,8 @@ struct dwarf1_unit {
|
||||
|
||||
/* One dwarf1_func for each parsed function die. */
|
||||
|
||||
struct dwarf1_func {
|
||||
struct dwarf1_func
|
||||
{
|
||||
/* Linked starting from aUnit->func_list. */
|
||||
struct dwarf1_func* prev;
|
||||
|
||||
@ -100,7 +103,8 @@ struct dwarf1_func {
|
||||
};
|
||||
|
||||
/* Used to return info about a parsed die. */
|
||||
struct die_info {
|
||||
struct die_info
|
||||
{
|
||||
unsigned long length;
|
||||
unsigned long sibling;
|
||||
unsigned long low_pc;
|
||||
@ -115,7 +119,8 @@ struct die_info {
|
||||
};
|
||||
|
||||
/* Parsed line number information. */
|
||||
struct linenumber {
|
||||
struct linenumber
|
||||
{
|
||||
/* First address in the line. */
|
||||
unsigned long addr;
|
||||
|
||||
@ -124,32 +129,17 @@ struct linenumber {
|
||||
};
|
||||
|
||||
/* Find the form of an attr, from the attr field. */
|
||||
#define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified */
|
||||
|
||||
static struct dwarf1_unit *alloc_dwarf1_unit
|
||||
PARAMS ((struct dwarf1_debug *));
|
||||
static struct dwarf1_func *alloc_dwarf1_func
|
||||
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
|
||||
static bfd_boolean parse_die
|
||||
PARAMS ((bfd *, struct die_info *, char *, char *));
|
||||
static bfd_boolean parse_line_table
|
||||
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
|
||||
static bfd_boolean parse_functions_in_unit
|
||||
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
|
||||
static bfd_boolean dwarf1_unit_find_nearest_line
|
||||
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *, unsigned long,
|
||||
const char **, const char **, unsigned int *));
|
||||
#define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified. */
|
||||
|
||||
/* Return a newly allocated dwarf1_unit. It should be cleared and
|
||||
then attached into the 'stash' at 'stash->lastUnit'. */
|
||||
|
||||
static struct dwarf1_unit*
|
||||
alloc_dwarf1_unit (stash)
|
||||
struct dwarf1_debug* stash;
|
||||
alloc_dwarf1_unit (struct dwarf1_debug* stash)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct dwarf1_unit);
|
||||
|
||||
struct dwarf1_unit* x = (struct dwarf1_unit*) bfd_zalloc (stash->abfd, amt);
|
||||
struct dwarf1_unit* x = bfd_zalloc (stash->abfd, amt);
|
||||
x->prev = stash->lastUnit;
|
||||
stash->lastUnit = x;
|
||||
|
||||
@ -159,14 +149,12 @@ alloc_dwarf1_unit (stash)
|
||||
/* Return a newly allocated dwarf1_func. It must be cleared and
|
||||
attached into 'aUnit' at 'aUnit->func_list'. */
|
||||
|
||||
static struct dwarf1_func*
|
||||
alloc_dwarf1_func (stash, aUnit)
|
||||
struct dwarf1_debug* stash;
|
||||
struct dwarf1_unit* aUnit;
|
||||
static struct dwarf1_func *
|
||||
alloc_dwarf1_func (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct dwarf1_func);
|
||||
|
||||
struct dwarf1_func* x = (struct dwarf1_func*) bfd_zalloc (stash->abfd, amt);
|
||||
struct dwarf1_func* x = bfd_zalloc (stash->abfd, amt);
|
||||
x->prev = aUnit->func_list;
|
||||
aUnit->func_list = x;
|
||||
|
||||
@ -181,16 +169,15 @@ alloc_dwarf1_func (stash, aUnit)
|
||||
Return FALSE if the die is invalidly formatted; TRUE otherwise. */
|
||||
|
||||
static bfd_boolean
|
||||
parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
|
||||
bfd* abfd;
|
||||
struct die_info* aDieInfo;
|
||||
char* aDiePtr;
|
||||
char* aDiePtrEnd;
|
||||
parse_die (bfd * abfd,
|
||||
struct die_info * aDieInfo,
|
||||
char * aDiePtr,
|
||||
char * aDiePtrEnd)
|
||||
{
|
||||
char* this_die = aDiePtr;
|
||||
char* xptr = this_die;
|
||||
|
||||
memset (aDieInfo,0,sizeof (*aDieInfo));
|
||||
memset (aDieInfo, 0, sizeof (* aDieInfo));
|
||||
|
||||
/* First comes the length. */
|
||||
aDieInfo->length = bfd_get_32 (abfd, (bfd_byte *) xptr);
|
||||
@ -217,7 +204,6 @@ parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
|
||||
/* Parse the attribute based on its form. This section
|
||||
must handle all dwarf1 forms, but need only handle the
|
||||
actual attributes that we care about. */
|
||||
|
||||
attr = bfd_get_16 (abfd, (bfd_byte *) xptr);
|
||||
xptr += 2;
|
||||
|
||||
@ -269,9 +255,7 @@ parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
|
||||
occurs; TRUE otherwise. */
|
||||
|
||||
static bfd_boolean
|
||||
parse_line_table (stash, aUnit)
|
||||
struct dwarf1_debug* stash;
|
||||
struct dwarf1_unit* aUnit;
|
||||
parse_line_table (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit)
|
||||
{
|
||||
char* xptr;
|
||||
|
||||
@ -286,7 +270,7 @@ parse_line_table (stash, aUnit)
|
||||
return FALSE;
|
||||
|
||||
size = msec->rawsize ? msec->rawsize : msec->size;
|
||||
stash->line_section = (char *) bfd_alloc (stash->abfd, size);
|
||||
stash->line_section = bfd_alloc (stash->abfd, size);
|
||||
|
||||
if (! stash->line_section)
|
||||
return FALSE;
|
||||
@ -318,13 +302,12 @@ parse_line_table (stash, aUnit)
|
||||
xptr += 4;
|
||||
|
||||
/* How many line entrys?
|
||||
10 = 4 (line number) + 2 (pos in line) + 4 (address in line) */
|
||||
10 = 4 (line number) + 2 (pos in line) + 4 (address in line). */
|
||||
aUnit->line_count = (tblend - xptr) / 10;
|
||||
|
||||
/* Allocate an array for the entries. */
|
||||
amt = sizeof (struct linenumber) * aUnit->line_count;
|
||||
aUnit->linenumber_table = ((struct linenumber *)
|
||||
bfd_alloc (stash->abfd, amt));
|
||||
aUnit->linenumber_table = bfd_alloc (stash->abfd, amt);
|
||||
|
||||
for (eachLine = 0; eachLine < aUnit->line_count; eachLine++)
|
||||
{
|
||||
@ -352,15 +335,13 @@ parse_line_table (stash, aUnit)
|
||||
Return FALSE if error; TRUE otherwise. */
|
||||
|
||||
static bfd_boolean
|
||||
parse_functions_in_unit (stash, aUnit)
|
||||
struct dwarf1_debug* stash;
|
||||
struct dwarf1_unit* aUnit;
|
||||
parse_functions_in_unit (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit)
|
||||
{
|
||||
char* eachDie;
|
||||
|
||||
if (aUnit->first_child)
|
||||
for (eachDie = aUnit->first_child;
|
||||
eachDie < stash->debug_section_end;
|
||||
eachDie < stash->debug_section_end;
|
||||
)
|
||||
{
|
||||
struct die_info eachDieInfo;
|
||||
@ -395,15 +376,12 @@ parse_functions_in_unit (stash, aUnit)
|
||||
Return whether we found the line (or a function) without error. */
|
||||
|
||||
static bfd_boolean
|
||||
dwarf1_unit_find_nearest_line (stash, aUnit, addr,
|
||||
filename_ptr, functionname_ptr,
|
||||
linenumber_ptr)
|
||||
struct dwarf1_debug* stash;
|
||||
struct dwarf1_unit* aUnit;
|
||||
unsigned long addr;
|
||||
const char **filename_ptr;
|
||||
const char **functionname_ptr;
|
||||
unsigned int *linenumber_ptr;
|
||||
dwarf1_unit_find_nearest_line (struct dwarf1_debug* stash,
|
||||
struct dwarf1_unit* aUnit,
|
||||
unsigned long addr,
|
||||
const char **filename_ptr,
|
||||
const char **functionname_ptr,
|
||||
unsigned int *linenumber_ptr)
|
||||
{
|
||||
int line_p = FALSE;
|
||||
int func_p = FALSE;
|
||||
@ -461,15 +439,13 @@ dwarf1_unit_find_nearest_line (stash, aUnit, addr,
|
||||
Return TRUE if the line is found without error. */
|
||||
|
||||
bfd_boolean
|
||||
_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
|
||||
filename_ptr, functionname_ptr, linenumber_ptr)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
asymbol **symbols ATTRIBUTE_UNUSED;
|
||||
bfd_vma offset;
|
||||
const char **filename_ptr;
|
||||
const char **functionname_ptr;
|
||||
unsigned int *linenumber_ptr;
|
||||
_bfd_dwarf1_find_nearest_line (bfd *abfd,
|
||||
asection *section,
|
||||
asymbol **symbols ATTRIBUTE_UNUSED,
|
||||
bfd_vma offset,
|
||||
const char **filename_ptr,
|
||||
const char **functionname_ptr,
|
||||
unsigned int *linenumber_ptr)
|
||||
{
|
||||
struct dwarf1_debug *stash = elf_tdata (abfd)->dwarf1_find_line_info;
|
||||
|
||||
@ -488,22 +464,20 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
|
||||
bfd_size_type size = sizeof (struct dwarf1_debug);
|
||||
|
||||
stash = elf_tdata (abfd)->dwarf1_find_line_info
|
||||
= (struct dwarf1_debug *) bfd_zalloc (abfd, size);
|
||||
= bfd_zalloc (abfd, size);
|
||||
|
||||
if (! stash)
|
||||
return FALSE;
|
||||
|
||||
msec = bfd_get_section_by_name (abfd, ".debug");
|
||||
if (! msec)
|
||||
{
|
||||
/* No dwarf1 info. Note that at this point the stash
|
||||
has been allocated, but contains zeros, this lets
|
||||
future calls to this function fail quicker. */
|
||||
return FALSE;
|
||||
}
|
||||
/* No dwarf1 info. Note that at this point the stash
|
||||
has been allocated, but contains zeros, this lets
|
||||
future calls to this function fail quicker. */
|
||||
return FALSE;
|
||||
|
||||
size = msec->rawsize ? msec->rawsize : msec->size;
|
||||
stash->debug_section = (char *) bfd_alloc (abfd, size);
|
||||
stash->debug_section = bfd_alloc (abfd, size);
|
||||
|
||||
if (! stash->debug_section)
|
||||
return FALSE;
|
||||
@ -529,13 +503,11 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
|
||||
/* Look at the previously parsed units to see if any contain
|
||||
the addr. */
|
||||
for (eachUnit = stash->lastUnit; eachUnit; eachUnit = eachUnit->prev)
|
||||
{
|
||||
if (eachUnit->low_pc <= addr && addr < eachUnit->high_pc)
|
||||
return dwarf1_unit_find_nearest_line (stash, eachUnit, addr,
|
||||
filename_ptr,
|
||||
functionname_ptr,
|
||||
linenumber_ptr);
|
||||
}
|
||||
if (eachUnit->low_pc <= addr && addr < eachUnit->high_pc)
|
||||
return dwarf1_unit_find_nearest_line (stash, eachUnit, addr,
|
||||
filename_ptr,
|
||||
functionname_ptr,
|
||||
linenumber_ptr);
|
||||
|
||||
while (stash->currentDie < stash->debug_section_end)
|
||||
{
|
||||
@ -582,5 +554,3 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
154
bfd/ecoffswap.h
154
bfd/ecoffswap.h
@ -1,5 +1,5 @@
|
||||
/* Generic ECOFF swapping routines, for BFD.
|
||||
Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2004
|
||||
Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
@ -65,40 +65,37 @@
|
||||
for all ECOFF targets, so they are defined in ecofflink.c. */
|
||||
|
||||
extern void _bfd_ecoff_swap_tir_in
|
||||
PARAMS ((int, const struct tir_ext *, TIR *));
|
||||
(int, const struct tir_ext *, TIR *);
|
||||
extern void _bfd_ecoff_swap_tir_out
|
||||
PARAMS ((int, const TIR *, struct tir_ext *));
|
||||
(int, const TIR *, struct tir_ext *);
|
||||
extern void _bfd_ecoff_swap_rndx_in
|
||||
PARAMS ((int, const struct rndx_ext *, RNDXR *));
|
||||
(int, const struct rndx_ext *, RNDXR *);
|
||||
extern void _bfd_ecoff_swap_rndx_out
|
||||
PARAMS ((int, const RNDXR *, struct rndx_ext *));
|
||||
(int, const RNDXR *, struct rndx_ext *);
|
||||
|
||||
/* Prototypes for functions defined in this file. */
|
||||
|
||||
static void ecoff_swap_hdr_in PARAMS ((bfd *, PTR, HDRR *));
|
||||
static void ecoff_swap_hdr_out PARAMS ((bfd *, const HDRR *, PTR));
|
||||
static void ecoff_swap_fdr_in PARAMS ((bfd *, PTR, FDR *));
|
||||
static void ecoff_swap_fdr_out PARAMS ((bfd *, const FDR *, PTR));
|
||||
static void ecoff_swap_pdr_in PARAMS ((bfd *, PTR, PDR *));
|
||||
static void ecoff_swap_pdr_out PARAMS ((bfd *, const PDR *, PTR));
|
||||
static void ecoff_swap_sym_in PARAMS ((bfd *, PTR, SYMR *));
|
||||
static void ecoff_swap_sym_out PARAMS ((bfd *, const SYMR *, PTR));
|
||||
static void ecoff_swap_ext_in PARAMS ((bfd *, PTR, EXTR *));
|
||||
static void ecoff_swap_ext_out PARAMS ((bfd *, const EXTR *, PTR));
|
||||
static void ecoff_swap_rfd_in PARAMS ((bfd *, PTR, RFDT *));
|
||||
static void ecoff_swap_rfd_out PARAMS ((bfd *, const RFDT *, PTR));
|
||||
static void ecoff_swap_opt_in PARAMS ((bfd *, PTR, OPTR *));
|
||||
static void ecoff_swap_opt_out PARAMS ((bfd *, const OPTR *, PTR));
|
||||
static void ecoff_swap_dnr_in PARAMS ((bfd *, PTR, DNR *));
|
||||
static void ecoff_swap_dnr_out PARAMS ((bfd *, const DNR *, PTR));
|
||||
static void ecoff_swap_hdr_in (bfd *, void *, HDRR *);
|
||||
static void ecoff_swap_hdr_out (bfd *, const HDRR *, void *);
|
||||
static void ecoff_swap_fdr_in (bfd *, void *, FDR *);
|
||||
static void ecoff_swap_fdr_out (bfd *, const FDR *, void *);
|
||||
static void ecoff_swap_pdr_in (bfd *, void *, PDR *);
|
||||
static void ecoff_swap_pdr_out (bfd *, const PDR *, void *);
|
||||
static void ecoff_swap_sym_in (bfd *, void *, SYMR *);
|
||||
static void ecoff_swap_sym_out (bfd *, const SYMR *, void *);
|
||||
static void ecoff_swap_ext_in (bfd *, void *, EXTR *);
|
||||
static void ecoff_swap_ext_out (bfd *, const EXTR *, void *);
|
||||
static void ecoff_swap_rfd_in (bfd *, void *, RFDT *);
|
||||
static void ecoff_swap_rfd_out (bfd *, const RFDT *, void *);
|
||||
static void ecoff_swap_opt_in (bfd *, void *, OPTR *);
|
||||
static void ecoff_swap_opt_out (bfd *, const OPTR *, void *);
|
||||
static void ecoff_swap_dnr_in (bfd *, void *, DNR *);
|
||||
static void ecoff_swap_dnr_out (bfd *, const DNR *, void *);
|
||||
|
||||
/* Swap in the symbolic header. */
|
||||
|
||||
static void
|
||||
ecoff_swap_hdr_in (abfd, ext_copy, intern)
|
||||
bfd *abfd;
|
||||
PTR ext_copy;
|
||||
HDRR *intern;
|
||||
ecoff_swap_hdr_in (bfd *abfd, void * ext_copy, HDRR *intern)
|
||||
{
|
||||
struct hdr_ext ext[1];
|
||||
|
||||
@ -131,7 +128,7 @@ ecoff_swap_hdr_in (abfd, ext_copy, intern)
|
||||
intern->cbExtOffset = ECOFF_GET_OFF (abfd, ext->h_cbExtOffset);
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -139,10 +136,7 @@ ecoff_swap_hdr_in (abfd, ext_copy, intern)
|
||||
/* Swap out the symbolic header. */
|
||||
|
||||
static void
|
||||
ecoff_swap_hdr_out (abfd, intern_copy, ext_ptr)
|
||||
bfd *abfd;
|
||||
const HDRR *intern_copy;
|
||||
PTR ext_ptr;
|
||||
ecoff_swap_hdr_out (bfd *abfd, const HDRR *intern_copy, void * ext_ptr)
|
||||
{
|
||||
struct hdr_ext *ext = (struct hdr_ext *) ext_ptr;
|
||||
HDRR intern[1];
|
||||
@ -184,10 +178,7 @@ ecoff_swap_hdr_out (abfd, intern_copy, ext_ptr)
|
||||
/* Swap in the file descriptor record. */
|
||||
|
||||
static void
|
||||
ecoff_swap_fdr_in (abfd, ext_copy, intern)
|
||||
bfd *abfd;
|
||||
PTR ext_copy;
|
||||
FDR *intern;
|
||||
ecoff_swap_fdr_in (bfd *abfd, void * ext_copy, FDR *intern)
|
||||
{
|
||||
struct fdr_ext ext[1];
|
||||
|
||||
@ -247,7 +238,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
|
||||
intern->cbLine = ECOFF_GET_OFF (abfd, ext->f_cbLine);
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -255,10 +246,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
|
||||
/* Swap out the file descriptor record. */
|
||||
|
||||
static void
|
||||
ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
|
||||
bfd *abfd;
|
||||
const FDR *intern_copy;
|
||||
PTR ext_ptr;
|
||||
ecoff_swap_fdr_out (bfd *abfd, const FDR *intern_copy, void * ext_ptr)
|
||||
{
|
||||
struct fdr_ext *ext = (struct fdr_ext *) ext_ptr;
|
||||
FDR intern[1];
|
||||
@ -319,7 +307,7 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
|
||||
ECOFF_PUT_OFF (abfd, intern->cbLine, ext->f_cbLine);
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -327,16 +315,13 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
|
||||
/* Swap in the procedure descriptor record. */
|
||||
|
||||
static void
|
||||
ecoff_swap_pdr_in (abfd, ext_copy, intern)
|
||||
bfd *abfd;
|
||||
PTR ext_copy;
|
||||
PDR *intern;
|
||||
ecoff_swap_pdr_in (bfd *abfd, void * ext_copy, PDR *intern)
|
||||
{
|
||||
struct pdr_ext ext[1];
|
||||
|
||||
*ext = *(struct pdr_ext *) ext_copy;
|
||||
|
||||
memset ((PTR) intern, 0, sizeof (*intern));
|
||||
memset ((void *) intern, 0, sizeof (*intern));
|
||||
|
||||
intern->adr = ECOFF_GET_OFF (abfd, ext->p_adr);
|
||||
intern->isym = H_GET_32 (abfd, ext->p_isym);
|
||||
@ -384,7 +369,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
|
||||
#endif
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -392,10 +377,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
|
||||
/* Swap out the procedure descriptor record. */
|
||||
|
||||
static void
|
||||
ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
|
||||
bfd *abfd;
|
||||
const PDR *intern_copy;
|
||||
PTR ext_ptr;
|
||||
ecoff_swap_pdr_out (bfd *abfd, const PDR *intern_copy, void * ext_ptr)
|
||||
{
|
||||
struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
|
||||
PDR intern[1];
|
||||
@ -447,7 +429,7 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
|
||||
#endif
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -455,10 +437,7 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
|
||||
/* Swap in a symbol record. */
|
||||
|
||||
static void
|
||||
ecoff_swap_sym_in (abfd, ext_copy, intern)
|
||||
bfd *abfd;
|
||||
PTR ext_copy;
|
||||
SYMR *intern;
|
||||
ecoff_swap_sym_in (bfd *abfd, void * ext_copy, SYMR *intern)
|
||||
{
|
||||
struct sym_ext ext[1];
|
||||
|
||||
@ -504,7 +483,7 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -512,10 +491,7 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
|
||||
/* Swap out a symbol record. */
|
||||
|
||||
static void
|
||||
ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
|
||||
bfd *abfd;
|
||||
const SYMR *intern_copy;
|
||||
PTR ext_ptr;
|
||||
ecoff_swap_sym_out (bfd *abfd, const SYMR *intern_copy, void * ext_ptr)
|
||||
{
|
||||
struct sym_ext *ext = (struct sym_ext *) ext_ptr;
|
||||
SYMR intern[1];
|
||||
@ -557,7 +533,7 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -565,10 +541,7 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
|
||||
/* Swap in an external symbol record. */
|
||||
|
||||
static void
|
||||
ecoff_swap_ext_in (abfd, ext_copy, intern)
|
||||
bfd *abfd;
|
||||
PTR ext_copy;
|
||||
EXTR *intern;
|
||||
ecoff_swap_ext_in (bfd *abfd, void * ext_copy, EXTR *intern)
|
||||
{
|
||||
struct ext_ext ext[1];
|
||||
|
||||
@ -599,7 +572,7 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
|
||||
ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym);
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -607,10 +580,7 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
|
||||
/* Swap out an external symbol record. */
|
||||
|
||||
static void
|
||||
ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
|
||||
bfd *abfd;
|
||||
const EXTR *intern_copy;
|
||||
PTR ext_ptr;
|
||||
ecoff_swap_ext_out (bfd *abfd, const EXTR *intern_copy, void * ext_ptr)
|
||||
{
|
||||
struct ext_ext *ext = (struct ext_ext *) ext_ptr;
|
||||
EXTR intern[1];
|
||||
@ -652,7 +622,7 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
|
||||
ecoff_swap_sym_out (abfd, &intern->asym, &ext->es_asym);
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -660,17 +630,14 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
|
||||
/* Swap in a relative file descriptor. */
|
||||
|
||||
static void
|
||||
ecoff_swap_rfd_in (abfd, ext_ptr, intern)
|
||||
bfd *abfd;
|
||||
PTR ext_ptr;
|
||||
RFDT *intern;
|
||||
ecoff_swap_rfd_in (bfd *abfd, void * ext_ptr, RFDT *intern)
|
||||
{
|
||||
struct rfd_ext *ext = (struct rfd_ext *) ext_ptr;
|
||||
|
||||
*intern = H_GET_32 (abfd, ext->rfd);
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -678,17 +645,14 @@ ecoff_swap_rfd_in (abfd, ext_ptr, intern)
|
||||
/* Swap out a relative file descriptor. */
|
||||
|
||||
static void
|
||||
ecoff_swap_rfd_out (abfd, intern, ext_ptr)
|
||||
bfd *abfd;
|
||||
const RFDT *intern;
|
||||
PTR ext_ptr;
|
||||
ecoff_swap_rfd_out (bfd *abfd, const RFDT *intern, void * ext_ptr)
|
||||
{
|
||||
struct rfd_ext *ext = (struct rfd_ext *) ext_ptr;
|
||||
|
||||
H_PUT_32 (abfd, *intern, ext->rfd);
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -696,10 +660,7 @@ ecoff_swap_rfd_out (abfd, intern, ext_ptr)
|
||||
/* Swap in an optimization symbol. */
|
||||
|
||||
static void
|
||||
ecoff_swap_opt_in (abfd, ext_copy, intern)
|
||||
bfd *abfd;
|
||||
PTR ext_copy;
|
||||
OPTR *intern;
|
||||
ecoff_swap_opt_in (bfd *abfd, void * ext_copy, OPTR * intern)
|
||||
{
|
||||
struct opt_ext ext[1];
|
||||
|
||||
@ -729,7 +690,7 @@ ecoff_swap_opt_in (abfd, ext_copy, intern)
|
||||
intern->offset = H_GET_32 (abfd, ext->o_offset);
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -737,10 +698,7 @@ ecoff_swap_opt_in (abfd, ext_copy, intern)
|
||||
/* Swap out an optimization symbol. */
|
||||
|
||||
static void
|
||||
ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
|
||||
bfd *abfd;
|
||||
const OPTR *intern_copy;
|
||||
PTR ext_ptr;
|
||||
ecoff_swap_opt_out (bfd *abfd, const OPTR *intern_copy, void * ext_ptr)
|
||||
{
|
||||
struct opt_ext *ext = (struct opt_ext *) ext_ptr;
|
||||
OPTR intern[1];
|
||||
@ -769,7 +727,7 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
|
||||
H_PUT_32 (abfd, intern->value, ext->o_offset);
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -777,10 +735,7 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
|
||||
/* Swap in a dense number. */
|
||||
|
||||
static void
|
||||
ecoff_swap_dnr_in (abfd, ext_copy, intern)
|
||||
bfd *abfd;
|
||||
PTR ext_copy;
|
||||
DNR *intern;
|
||||
ecoff_swap_dnr_in (bfd *abfd, void * ext_copy, DNR *intern)
|
||||
{
|
||||
struct dnr_ext ext[1];
|
||||
|
||||
@ -790,7 +745,7 @@ ecoff_swap_dnr_in (abfd, ext_copy, intern)
|
||||
intern->index = H_GET_32 (abfd, ext->d_index);
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
@ -798,10 +753,7 @@ ecoff_swap_dnr_in (abfd, ext_copy, intern)
|
||||
/* Swap out a dense number. */
|
||||
|
||||
static void
|
||||
ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr)
|
||||
bfd *abfd;
|
||||
const DNR *intern_copy;
|
||||
PTR ext_ptr;
|
||||
ecoff_swap_dnr_out (bfd *abfd, const DNR *intern_copy, void * ext_ptr)
|
||||
{
|
||||
struct dnr_ext *ext = (struct dnr_ext *) ext_ptr;
|
||||
DNR intern[1];
|
||||
@ -813,7 +765,7 @@ ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr)
|
||||
H_PUT_32 (abfd, intern->index, ext->d_index);
|
||||
|
||||
#ifdef TEST
|
||||
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
|
||||
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
|
@ -1,23 +1,23 @@
|
||||
/* BFD back-end definitions used by all FreeBSD targets.
|
||||
Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002
|
||||
Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
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 2 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.
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* FreeBSD ZMAGIC files never have the header in the text. */
|
||||
#define N_HEADER_IN_TEXT(x) 0
|
||||
@ -46,7 +46,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
| (((flags) & 0x3f) << 26))
|
||||
#define N_SET_MACHTYPE(exec, machtype) \
|
||||
((exec).a_info = \
|
||||
((exec).a_info & 0xfb00ffff) | ((((int)(machtype))&0x3ff) << 16))
|
||||
((exec).a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16))
|
||||
#define N_SET_FLAGS(exec, flags) \
|
||||
((exec).a_info = \
|
||||
((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26))
|
||||
@ -60,8 +60,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
format. I think. */
|
||||
#define SWAP_MAGIC(ext) bfd_getl32 (ext)
|
||||
|
||||
#define MY_write_object_contents MY(write_object_contents)
|
||||
static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
|
||||
#define MY_write_object_contents MY (write_object_contents)
|
||||
static bfd_boolean MY (write_object_contents) (bfd *);
|
||||
|
||||
#include "aout-target.h"
|
||||
|
||||
@ -70,8 +70,7 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
|
||||
file header, symbols, and relocation. */
|
||||
|
||||
static bfd_boolean
|
||||
MY(write_object_contents) (abfd)
|
||||
bfd *abfd;
|
||||
MY (write_object_contents) (bfd *abfd)
|
||||
{
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
@ -79,26 +78,27 @@ MY(write_object_contents) (abfd)
|
||||
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
|
||||
/* Magic number, maestro, please! */
|
||||
switch (bfd_get_arch(abfd)) {
|
||||
case bfd_arch_m68k:
|
||||
if (strcmp (abfd->xvec->name, "a.out-m68k4k-netbsd") == 0)
|
||||
N_SET_MACHTYPE(*execp, M_68K4K_NETBSD);
|
||||
else
|
||||
N_SET_MACHTYPE(*execp, M_68K_NETBSD);
|
||||
break;
|
||||
case bfd_arch_sparc:
|
||||
N_SET_MACHTYPE(*execp, M_SPARC_NETBSD);
|
||||
break;
|
||||
case bfd_arch_i386:
|
||||
N_SET_MACHTYPE(*execp, M_386_NETBSD);
|
||||
break;
|
||||
case bfd_arch_ns32k:
|
||||
N_SET_MACHTYPE(*execp, M_532_NETBSD);
|
||||
break;
|
||||
default:
|
||||
N_SET_MACHTYPE(*execp, M_UNKNOWN);
|
||||
break;
|
||||
}
|
||||
switch (bfd_get_arch(abfd))
|
||||
{
|
||||
case bfd_arch_m68k:
|
||||
if (strcmp (abfd->xvec->name, "a.out-m68k4k-netbsd") == 0)
|
||||
N_SET_MACHTYPE (*execp, M_68K4K_NETBSD);
|
||||
else
|
||||
N_SET_MACHTYPE (*execp, M_68K_NETBSD);
|
||||
break;
|
||||
case bfd_arch_sparc:
|
||||
N_SET_MACHTYPE (*execp, M_SPARC_NETBSD);
|
||||
break;
|
||||
case bfd_arch_i386:
|
||||
N_SET_MACHTYPE (*execp, M_386_NETBSD);
|
||||
break;
|
||||
case bfd_arch_ns32k:
|
||||
N_SET_MACHTYPE (*execp, M_532_NETBSD);
|
||||
break;
|
||||
default:
|
||||
N_SET_MACHTYPE (*execp, M_UNKNOWN);
|
||||
break;
|
||||
}
|
||||
|
||||
WRITE_HEADERS(abfd, execp);
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
/* genlink.h -- interface to the BFD generic linker
|
||||
Copyright 1993, 1994, 1996, 2002 Free Software Foundation, Inc.
|
||||
Copyright 1993, 1994, 1996, 2002, 2005 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
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 2 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.
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef GENLINK_H
|
||||
#define GENLINK_H
|
||||
@ -65,7 +65,7 @@ struct generic_link_hash_table
|
||||
#define _bfd_generic_link_hash_traverse(table, func, info) \
|
||||
(bfd_link_hash_traverse \
|
||||
(&(table)->root, \
|
||||
(bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
||||
(bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
|
||||
(info)))
|
||||
|
||||
/* Get the generic link hash table from the info structure. This is
|
||||
@ -77,14 +77,13 @@ struct generic_link_hash_table
|
||||
/* The generic linker reads in the asymbol structures for an input BFD
|
||||
and keeps them in the outsymbol and symcount fields. */
|
||||
|
||||
#define _bfd_generic_link_get_symbols(abfd) ((abfd)->outsymbols)
|
||||
#define _bfd_generic_link_get_symbols(abfd) ((abfd)->outsymbols)
|
||||
#define _bfd_generic_link_get_symcount(abfd) ((abfd)->symcount)
|
||||
|
||||
/* Add the symbols of input_bfd to the symbols being built for
|
||||
output_bfd. */
|
||||
extern bfd_boolean _bfd_generic_link_output_symbols
|
||||
PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *,
|
||||
size_t *psymalloc));
|
||||
(bfd *, bfd *, struct bfd_link_info *, size_t *);
|
||||
|
||||
/* This structure is used to pass information to
|
||||
_bfd_generic_link_write_global_symbol, which may be called via
|
||||
@ -101,11 +100,10 @@ struct generic_write_global_symbol_info
|
||||
via _bfd_generic_link_hash_traverse. The second argument must
|
||||
actually be a struct generic_write_global_symbol_info *. */
|
||||
extern bfd_boolean _bfd_generic_link_write_global_symbol
|
||||
PARAMS ((struct generic_link_hash_entry *, PTR));
|
||||
(struct generic_link_hash_entry *, void *);
|
||||
|
||||
/* Generic link hash table entry creation routine. */
|
||||
struct bfd_hash_entry *_bfd_generic_link_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
|
||||
const char *));
|
||||
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
|
||||
|
||||
#endif
|
||||
|
31
bfd/ieee.c
31
bfd/ieee.c
@ -1490,9 +1490,8 @@ do_one (ieee_data_type *ieee,
|
||||
bfd_boolean pcrel = FALSE;
|
||||
asection *section;
|
||||
ieee_reloc_type *r;
|
||||
bfd_size_type amt = sizeof (ieee_reloc_type);
|
||||
|
||||
r = bfd_alloc (ieee->h.abfd, amt);
|
||||
r = bfd_alloc (ieee->h.abfd, sizeof (* r));
|
||||
if (!r)
|
||||
return FALSE;
|
||||
|
||||
@ -3709,12 +3708,12 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
#define ieee_slurp_extended_name_table bfd_true
|
||||
#define ieee_construct_extended_name_table \
|
||||
((bfd_boolean (*) \
|
||||
PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
|
||||
(bfd *, char **, bfd_size_type *, const char **)) \
|
||||
bfd_true)
|
||||
#define ieee_truncate_arname bfd_dont_truncate_arname
|
||||
#define ieee_write_armap \
|
||||
((bfd_boolean (*) \
|
||||
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
|
||||
(bfd *, unsigned int, struct orl *, unsigned int, int)) \
|
||||
bfd_true)
|
||||
#define ieee_read_ar_hdr bfd_nullvoidptr
|
||||
#define ieee_update_armap_timestamp bfd_true
|
||||
@ -3752,27 +3751,27 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
|
||||
const bfd_target ieee_vec =
|
||||
{
|
||||
"ieee", /* name */
|
||||
"ieee", /* Name. */
|
||||
bfd_target_ieee_flavour,
|
||||
BFD_ENDIAN_UNKNOWN, /* target byte order */
|
||||
BFD_ENDIAN_UNKNOWN, /* target headers byte order */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
BFD_ENDIAN_UNKNOWN, /* Target byte order. */
|
||||
BFD_ENDIAN_UNKNOWN, /* Target headers byte order. */
|
||||
(HAS_RELOC | EXEC_P | /* Object flags. */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
||||
(SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
|
||||
| SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* leading underscore */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
| SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
|
||||
'_', /* Leading underscore. */
|
||||
' ', /* AR_pad_char. */
|
||||
16, /* AR_max_namelen. */
|
||||
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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
|
||||
|
||||
{_bfd_dummy_target,
|
||||
ieee_object_p, /* bfd_check_format */
|
||||
ieee_object_p, /* bfd_check_format. */
|
||||
ieee_archive_p,
|
||||
_bfd_dummy_target,
|
||||
},
|
||||
@ -3829,5 +3828,5 @@ const bfd_target ieee_vec =
|
||||
|
||||
NULL,
|
||||
|
||||
(void *) 0
|
||||
NULL
|
||||
};
|
||||
|
224
bfd/ihex.c
224
bfd/ihex.c
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for Intel Hex objects.
|
||||
Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
||||
Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>.
|
||||
|
||||
@ -116,8 +116,7 @@ The MRI compiler uses this, which is a repeat of type 5:
|
||||
10..13 Upper 16 bits of start address
|
||||
14..17 Lower 16 bits of start address
|
||||
18..19 Checksum in hex notation
|
||||
20..21 Carriage return, line feed
|
||||
*/
|
||||
20..21 Carriage return, line feed. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
@ -125,33 +124,6 @@ The MRI compiler uses this, which is a repeat of type 5:
|
||||
#include "libiberty.h"
|
||||
#include "safe-ctype.h"
|
||||
|
||||
static void ihex_init
|
||||
PARAMS ((void));
|
||||
static bfd_boolean ihex_mkobject
|
||||
PARAMS ((bfd *));
|
||||
static INLINE int ihex_get_byte
|
||||
PARAMS ((bfd *, bfd_boolean *));
|
||||
static void ihex_bad_byte
|
||||
PARAMS ((bfd *, unsigned int, int, bfd_boolean));
|
||||
static bfd_boolean ihex_scan
|
||||
PARAMS ((bfd *));
|
||||
static const bfd_target *ihex_object_p
|
||||
PARAMS ((bfd *));
|
||||
static bfd_boolean ihex_read_section
|
||||
PARAMS ((bfd *, asection *, bfd_byte *));
|
||||
static bfd_boolean ihex_get_section_contents
|
||||
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
|
||||
static bfd_boolean ihex_set_section_contents
|
||||
PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
|
||||
static bfd_boolean ihex_write_record
|
||||
PARAMS ((bfd *, size_t, unsigned int, unsigned int, bfd_byte *));
|
||||
static bfd_boolean ihex_write_object_contents
|
||||
PARAMS ((bfd *));
|
||||
static bfd_boolean ihex_set_arch_mach
|
||||
PARAMS ((bfd *, enum bfd_architecture, unsigned long));
|
||||
static int ihex_sizeof_headers
|
||||
PARAMS ((bfd *, bfd_boolean));
|
||||
|
||||
/* The number of bytes we put on one line during output. */
|
||||
|
||||
#define CHUNK 16
|
||||
@ -185,7 +157,7 @@ struct ihex_data_struct
|
||||
/* Initialize by filling in the hex conversion array. */
|
||||
|
||||
static void
|
||||
ihex_init ()
|
||||
ihex_init (void)
|
||||
{
|
||||
static bfd_boolean inited;
|
||||
|
||||
@ -199,13 +171,11 @@ ihex_init ()
|
||||
/* Create an ihex object. */
|
||||
|
||||
static bfd_boolean
|
||||
ihex_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
ihex_mkobject (bfd *abfd)
|
||||
{
|
||||
struct ihex_data_struct *tdata;
|
||||
bfd_size_type amt = sizeof (struct ihex_data_struct);
|
||||
|
||||
tdata = (struct ihex_data_struct *) bfd_alloc (abfd, amt);
|
||||
tdata = bfd_alloc (abfd, sizeof (* tdata));
|
||||
if (tdata == NULL)
|
||||
return FALSE;
|
||||
|
||||
@ -219,9 +189,7 @@ ihex_mkobject (abfd)
|
||||
Return EOF on error or end of file. */
|
||||
|
||||
static INLINE int
|
||||
ihex_get_byte (abfd, errorptr)
|
||||
bfd *abfd;
|
||||
bfd_boolean *errorptr;
|
||||
ihex_get_byte (bfd *abfd, bfd_boolean *errorptr)
|
||||
{
|
||||
bfd_byte c;
|
||||
|
||||
@ -238,11 +206,7 @@ ihex_get_byte (abfd, errorptr)
|
||||
/* Report a problem in an Intel Hex file. */
|
||||
|
||||
static void
|
||||
ihex_bad_byte (abfd, lineno, c, error)
|
||||
bfd *abfd;
|
||||
unsigned int lineno;
|
||||
int c;
|
||||
bfd_boolean error;
|
||||
ihex_bad_byte (bfd *abfd, unsigned int lineno, int c, bfd_boolean error)
|
||||
{
|
||||
if (c == EOF)
|
||||
{
|
||||
@ -271,8 +235,7 @@ ihex_bad_byte (abfd, lineno, c, error)
|
||||
section for each contiguous set of bytes. */
|
||||
|
||||
static bfd_boolean
|
||||
ihex_scan (abfd)
|
||||
bfd *abfd;
|
||||
ihex_scan (bfd *abfd)
|
||||
{
|
||||
bfd_vma segbase;
|
||||
bfd_vma extbase;
|
||||
@ -344,7 +307,7 @@ ihex_scan (abfd)
|
||||
chars = len * 2 + 2;
|
||||
if (chars >= bufsize)
|
||||
{
|
||||
buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) chars);
|
||||
buf = bfd_realloc (buf, (bfd_size_type) chars);
|
||||
if (buf == NULL)
|
||||
goto error_return;
|
||||
bufsize = chars;
|
||||
@ -395,7 +358,7 @@ ihex_scan (abfd)
|
||||
|
||||
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
|
||||
amt = strlen (secbuf) + 1;
|
||||
secname = (char *) bfd_alloc (abfd, amt);
|
||||
secname = bfd_alloc (abfd, amt);
|
||||
if (secname == NULL)
|
||||
goto error_return;
|
||||
strcpy (secname, secbuf);
|
||||
@ -516,10 +479,9 @@ ihex_scan (abfd)
|
||||
/* Try to recognize an Intel Hex file. */
|
||||
|
||||
static const bfd_target *
|
||||
ihex_object_p (abfd)
|
||||
bfd *abfd;
|
||||
ihex_object_p (bfd *abfd)
|
||||
{
|
||||
PTR tdata_save;
|
||||
void * tdata_save;
|
||||
bfd_byte b[9];
|
||||
unsigned int i;
|
||||
unsigned int type;
|
||||
@ -573,10 +535,7 @@ ihex_object_p (abfd)
|
||||
/* Read the contents of a section in an Intel Hex file. */
|
||||
|
||||
static bfd_boolean
|
||||
ihex_read_section (abfd, section, contents)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
bfd_byte *contents;
|
||||
ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents)
|
||||
{
|
||||
int c;
|
||||
bfd_byte *p;
|
||||
@ -623,7 +582,7 @@ ihex_read_section (abfd, section, contents)
|
||||
|
||||
if (len * 2 > bufsize)
|
||||
{
|
||||
buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) len * 2);
|
||||
buf = bfd_realloc (buf, (bfd_size_type) len * 2);
|
||||
if (buf == NULL)
|
||||
goto error_return;
|
||||
bufsize = len * 2;
|
||||
@ -669,12 +628,11 @@ ihex_read_section (abfd, section, contents)
|
||||
/* Get the contents of a section in an Intel Hex file. */
|
||||
|
||||
static bfd_boolean
|
||||
ihex_get_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
ihex_get_section_contents (bfd *abfd,
|
||||
asection *section,
|
||||
void * location,
|
||||
file_ptr offset,
|
||||
bfd_size_type count)
|
||||
{
|
||||
if (section->used_by_bfd == NULL)
|
||||
{
|
||||
@ -694,29 +652,26 @@ ihex_get_section_contents (abfd, section, location, offset, count)
|
||||
/* Set the contents of a section in an Intel Hex file. */
|
||||
|
||||
static bfd_boolean
|
||||
ihex_set_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
const PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
ihex_set_section_contents (bfd *abfd,
|
||||
asection *section,
|
||||
const void * location,
|
||||
file_ptr offset,
|
||||
bfd_size_type count)
|
||||
{
|
||||
struct ihex_data_list *n;
|
||||
bfd_byte *data;
|
||||
struct ihex_data_struct *tdata;
|
||||
bfd_size_type amt;
|
||||
|
||||
if (count == 0
|
||||
|| (section->flags & SEC_ALLOC) == 0
|
||||
|| (section->flags & SEC_LOAD) == 0)
|
||||
return TRUE;
|
||||
|
||||
amt = sizeof (struct ihex_data_list);
|
||||
n = (struct ihex_data_list *) bfd_alloc (abfd, amt);
|
||||
n = bfd_alloc (abfd, sizeof (* n));
|
||||
if (n == NULL)
|
||||
return FALSE;
|
||||
|
||||
data = (bfd_byte *) bfd_alloc (abfd, count);
|
||||
data = bfd_alloc (abfd, count);
|
||||
if (data == NULL)
|
||||
return FALSE;
|
||||
memcpy (data, location, (size_t) count);
|
||||
@ -737,7 +692,7 @@ ihex_set_section_contents (abfd, section, location, offset, count)
|
||||
}
|
||||
else
|
||||
{
|
||||
register struct ihex_data_list **pp;
|
||||
struct ihex_data_list **pp;
|
||||
|
||||
for (pp = &tdata->head;
|
||||
*pp != NULL && (*pp)->where < n->where;
|
||||
@ -755,12 +710,11 @@ ihex_set_section_contents (abfd, section, location, offset, count)
|
||||
/* Write a record out to an Intel Hex file. */
|
||||
|
||||
static bfd_boolean
|
||||
ihex_write_record (abfd, count, addr, type, data)
|
||||
bfd *abfd;
|
||||
size_t count;
|
||||
unsigned int addr;
|
||||
unsigned int type;
|
||||
bfd_byte *data;
|
||||
ihex_write_record (bfd *abfd,
|
||||
size_t count,
|
||||
unsigned int addr,
|
||||
unsigned int type,
|
||||
bfd_byte *data)
|
||||
{
|
||||
static const char digs[] = "0123456789ABCDEF";
|
||||
char buf[9 + CHUNK * 2 + 4];
|
||||
@ -800,8 +754,7 @@ ihex_write_record (abfd, count, addr, type, data)
|
||||
/* Write out an Intel Hex file. */
|
||||
|
||||
static bfd_boolean
|
||||
ihex_write_object_contents (abfd)
|
||||
bfd *abfd;
|
||||
ihex_write_object_contents (bfd *abfd)
|
||||
{
|
||||
bfd_vma segbase;
|
||||
bfd_vma extbase;
|
||||
@ -818,6 +771,7 @@ ihex_write_object_contents (abfd)
|
||||
where = l->where;
|
||||
p = l->data;
|
||||
count = l->size;
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
size_t now;
|
||||
@ -931,10 +885,9 @@ ihex_write_object_contents (abfd)
|
||||
irrelevant, so we ignore errors about unknown architectures. */
|
||||
|
||||
static bfd_boolean
|
||||
ihex_set_arch_mach (abfd, arch, mach)
|
||||
bfd *abfd;
|
||||
enum bfd_architecture arch;
|
||||
unsigned long mach;
|
||||
ihex_set_arch_mach (bfd *abfd,
|
||||
enum bfd_architecture arch,
|
||||
unsigned long mach)
|
||||
{
|
||||
if (! bfd_default_set_arch_mach (abfd, arch, mach))
|
||||
{
|
||||
@ -947,80 +900,69 @@ ihex_set_arch_mach (abfd, arch, mach)
|
||||
/* Get the size of the headers, for the linker. */
|
||||
|
||||
static int
|
||||
ihex_sizeof_headers (abfd, exec)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_boolean exec ATTRIBUTE_UNUSED;
|
||||
ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Some random definitions for the target vector. */
|
||||
|
||||
#define ihex_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||
#define ihex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
||||
#define ihex_new_section_hook _bfd_generic_new_section_hook
|
||||
#define ihex_get_section_contents_in_window \
|
||||
_bfd_generic_get_section_contents_in_window
|
||||
|
||||
#define ihex_get_symtab_upper_bound bfd_0l
|
||||
#define ihex_canonicalize_symtab \
|
||||
((long (*) PARAMS ((bfd *, asymbol **))) bfd_0l)
|
||||
#define ihex_make_empty_symbol _bfd_generic_make_empty_symbol
|
||||
#define ihex_print_symbol _bfd_nosymbols_print_symbol
|
||||
#define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info
|
||||
#define ihex_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
||||
#define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
|
||||
#define ihex_get_lineno _bfd_nosymbols_get_lineno
|
||||
#define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line
|
||||
#define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||
#define ihex_read_minisymbols _bfd_nosymbols_read_minisymbols
|
||||
#define ihex_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol
|
||||
|
||||
#define ihex_get_reloc_upper_bound \
|
||||
((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
|
||||
#define ihex_canonicalize_reloc \
|
||||
((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
|
||||
#define ihex_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
||||
|
||||
#define ihex_bfd_get_relocated_section_contents \
|
||||
bfd_generic_get_relocated_section_contents
|
||||
#define ihex_bfd_relax_section bfd_generic_relax_section
|
||||
#define ihex_bfd_gc_sections bfd_generic_gc_sections
|
||||
#define ihex_bfd_merge_sections bfd_generic_merge_sections
|
||||
#define ihex_bfd_is_group_section bfd_generic_is_group_section
|
||||
#define ihex_bfd_discard_group bfd_generic_discard_group
|
||||
#define ihex_section_already_linked \
|
||||
_bfd_generic_section_already_linked
|
||||
#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
||||
#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define ihex_bfd_link_just_syms _bfd_generic_link_just_syms
|
||||
#define ihex_bfd_final_link _bfd_generic_final_link
|
||||
#define ihex_bfd_link_split_section _bfd_generic_link_split_section
|
||||
#define ihex_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||
#define ihex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
||||
#define ihex_new_section_hook _bfd_generic_new_section_hook
|
||||
#define ihex_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
||||
#define ihex_get_symtab_upper_bound bfd_0l
|
||||
#define ihex_canonicalize_symtab ((long (*) (bfd *, asymbol **)) bfd_0l)
|
||||
#define ihex_make_empty_symbol _bfd_generic_make_empty_symbol
|
||||
#define ihex_print_symbol _bfd_nosymbols_print_symbol
|
||||
#define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info
|
||||
#define ihex_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
||||
#define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
|
||||
#define ihex_get_lineno _bfd_nosymbols_get_lineno
|
||||
#define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line
|
||||
#define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||
#define ihex_read_minisymbols _bfd_nosymbols_read_minisymbols
|
||||
#define ihex_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol
|
||||
#define ihex_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l)
|
||||
#define ihex_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l)
|
||||
#define ihex_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
||||
#define ihex_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
|
||||
#define ihex_bfd_relax_section bfd_generic_relax_section
|
||||
#define ihex_bfd_gc_sections bfd_generic_gc_sections
|
||||
#define ihex_bfd_merge_sections bfd_generic_merge_sections
|
||||
#define ihex_bfd_is_group_section bfd_generic_is_group_section
|
||||
#define ihex_bfd_discard_group bfd_generic_discard_group
|
||||
#define ihex_section_already_linked _bfd_generic_section_already_linked
|
||||
#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
||||
#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define ihex_bfd_link_just_syms _bfd_generic_link_just_syms
|
||||
#define ihex_bfd_final_link _bfd_generic_final_link
|
||||
#define ihex_bfd_link_split_section _bfd_generic_link_split_section
|
||||
|
||||
/* The Intel Hex target vector. */
|
||||
|
||||
const bfd_target ihex_vec =
|
||||
{
|
||||
"ihex", /* name */
|
||||
"ihex", /* Name. */
|
||||
bfd_target_ihex_flavour,
|
||||
BFD_ENDIAN_UNKNOWN, /* target byte order */
|
||||
BFD_ENDIAN_UNKNOWN, /* target headers byte order */
|
||||
0, /* object flags */
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD), /* section flags */
|
||||
0, /* leading underscore */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
BFD_ENDIAN_UNKNOWN, /* Target byte order. */
|
||||
BFD_ENDIAN_UNKNOWN, /* Target headers byte order. */
|
||||
0, /* Object flags. */
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD), /* Section flags. */
|
||||
0, /* Leading underscore. */
|
||||
' ', /* AR_pad_char. */
|
||||
16, /* AR_max_namelen. */
|
||||
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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
|
||||
|
||||
{
|
||||
_bfd_dummy_target,
|
||||
ihex_object_p, /* bfd_check_format */
|
||||
ihex_object_p, /* bfd_check_format. */
|
||||
_bfd_dummy_target,
|
||||
_bfd_dummy_target,
|
||||
},
|
||||
@ -1030,7 +972,7 @@ const bfd_target ihex_vec =
|
||||
_bfd_generic_mkarchive,
|
||||
bfd_false,
|
||||
},
|
||||
{ /* bfd_write_contents */
|
||||
{ /* bfd_write_contents. */
|
||||
bfd_false,
|
||||
ihex_write_object_contents,
|
||||
_bfd_write_archive_contents,
|
||||
@ -1049,5 +991,5 @@ const bfd_target ihex_vec =
|
||||
|
||||
NULL,
|
||||
|
||||
(PTR) 0
|
||||
NULL
|
||||
};
|
||||
|
@ -362,7 +362,7 @@ extern void bfd_perform_slip
|
||||
|
||||
/* Functions and types in cofflink.c. */
|
||||
|
||||
#define STRING_SIZE_SIZE (4)
|
||||
#define STRING_SIZE_SIZE 4
|
||||
|
||||
/* We use a hash table to merge identical enum, struct, and union
|
||||
definitions in the linker. */
|
||||
|
849
bfd/mach-o.c
849
bfd/mach-o.c
File diff suppressed because it is too large
Load Diff
271
bfd/mach-o.h
271
bfd/mach-o.h
@ -1,5 +1,5 @@
|
||||
/* Mach-O support for BFD.
|
||||
Copyright 1999, 2000, 2001, 2002, 2003
|
||||
Copyright 1999, 2000, 2001, 2002, 2003, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -34,141 +34,141 @@
|
||||
#define BFD_MACH_O_N_INDR 0x0a /* Indirect. */
|
||||
|
||||
typedef enum bfd_mach_o_ppc_thread_flavour
|
||||
{
|
||||
BFD_MACH_O_PPC_THREAD_STATE = 1,
|
||||
BFD_MACH_O_PPC_FLOAT_STATE = 2,
|
||||
BFD_MACH_O_PPC_EXCEPTION_STATE = 3,
|
||||
BFD_MACH_O_PPC_VECTOR_STATE = 4
|
||||
}
|
||||
{
|
||||
BFD_MACH_O_PPC_THREAD_STATE = 1,
|
||||
BFD_MACH_O_PPC_FLOAT_STATE = 2,
|
||||
BFD_MACH_O_PPC_EXCEPTION_STATE = 3,
|
||||
BFD_MACH_O_PPC_VECTOR_STATE = 4
|
||||
}
|
||||
bfd_mach_o_ppc_thread_flavour;
|
||||
|
||||
typedef enum bfd_mach_o_i386_thread_flavour
|
||||
{
|
||||
BFD_MACH_O_i386_NEW_THREAD_STATE = 1,
|
||||
BFD_MACH_O_i386_FLOAT_STATE = 2,
|
||||
BFD_MACH_O_i386_ISA_PORT_MAP_STATE = 3,
|
||||
BFD_MACH_O_i386_V86_ASSIST_STATE = 4,
|
||||
BFD_MACH_O_i386_REGS_SEGS_STATE = 5,
|
||||
BFD_MACH_O_i386_THREAD_SYSCALL_STATE = 6,
|
||||
BFD_MACH_O_i386_THREAD_STATE_NONE = 7,
|
||||
BFD_MACH_O_i386_SAVED_STATE = 8,
|
||||
BFD_MACH_O_i386_THREAD_STATE = -1,
|
||||
BFD_MACH_O_i386_THREAD_FPSTATE = -2,
|
||||
BFD_MACH_O_i386_THREAD_EXCEPTSTATE = -3,
|
||||
BFD_MACH_O_i386_THREAD_CTHREADSTATE = -4,
|
||||
}
|
||||
{
|
||||
BFD_MACH_O_i386_NEW_THREAD_STATE = 1,
|
||||
BFD_MACH_O_i386_FLOAT_STATE = 2,
|
||||
BFD_MACH_O_i386_ISA_PORT_MAP_STATE = 3,
|
||||
BFD_MACH_O_i386_V86_ASSIST_STATE = 4,
|
||||
BFD_MACH_O_i386_REGS_SEGS_STATE = 5,
|
||||
BFD_MACH_O_i386_THREAD_SYSCALL_STATE = 6,
|
||||
BFD_MACH_O_i386_THREAD_STATE_NONE = 7,
|
||||
BFD_MACH_O_i386_SAVED_STATE = 8,
|
||||
BFD_MACH_O_i386_THREAD_STATE = -1,
|
||||
BFD_MACH_O_i386_THREAD_FPSTATE = -2,
|
||||
BFD_MACH_O_i386_THREAD_EXCEPTSTATE = -3,
|
||||
BFD_MACH_O_i386_THREAD_CTHREADSTATE = -4,
|
||||
}
|
||||
bfd_mach_o_i386_thread_flavour;
|
||||
|
||||
#define BFD_MACH_O_LC_REQ_DYLD 0x80000000
|
||||
|
||||
typedef enum bfd_mach_o_load_command_type
|
||||
{
|
||||
BFD_MACH_O_LC_SEGMENT = 0x1, /* File segment to be mapped. */
|
||||
BFD_MACH_O_LC_SYMTAB = 0x2, /* Link-edit stab symbol table info (obsolete). */
|
||||
BFD_MACH_O_LC_SYMSEG = 0x3, /* Link-edit gdb symbol table info. */
|
||||
BFD_MACH_O_LC_THREAD = 0x4, /* Thread. */
|
||||
BFD_MACH_O_LC_UNIXTHREAD = 0x5, /* UNIX thread (includes a stack). */
|
||||
BFD_MACH_O_LC_LOADFVMLIB = 0x6, /* Load a fixed VM shared library. */
|
||||
BFD_MACH_O_LC_IDFVMLIB = 0x7, /* Fixed VM shared library id. */
|
||||
BFD_MACH_O_LC_IDENT = 0x8, /* Object identification information (obsolete). */
|
||||
BFD_MACH_O_LC_FVMFILE = 0x9, /* Fixed VM file inclusion. */
|
||||
BFD_MACH_O_LC_PREPAGE = 0xa, /* Prepage command (internal use). */
|
||||
BFD_MACH_O_LC_DYSYMTAB = 0xb, /* Dynamic link-edit symbol table info. */
|
||||
BFD_MACH_O_LC_LOAD_DYLIB = 0xc, /* Load a dynamically linked shared library. */
|
||||
BFD_MACH_O_LC_ID_DYLIB = 0xd, /* Dynamically linked shared lib identification. */
|
||||
BFD_MACH_O_LC_LOAD_DYLINKER = 0xe, /* Load a dynamic linker. */
|
||||
BFD_MACH_O_LC_ID_DYLINKER = 0xf, /* Dynamic linker identification. */
|
||||
BFD_MACH_O_LC_PREBOUND_DYLIB = 0x10,/* Modules prebound for a dynamically. */
|
||||
BFD_MACH_O_LC_ROUTINES = 0x11, /* Image routines. */
|
||||
BFD_MACH_O_LC_SUB_FRAMEWORK = 0x12, /* Sub framework. */
|
||||
BFD_MACH_O_LC_SUB_UMBRELLA = 0x13, /* Sub umbrella. */
|
||||
BFD_MACH_O_LC_SUB_CLIENT = 0x14, /* Sub client. */
|
||||
BFD_MACH_O_LC_SUB_LIBRARY = 0x15, /* Sub library. */
|
||||
BFD_MACH_O_LC_TWOLEVEL_HINTS = 0x16,/* Two-level namespace lookup hints. */
|
||||
BFD_MACH_O_LC_PREBIND_CKSUM = 0x17, /* Prebind checksum. */
|
||||
/* Load a dynamically linked shared library that is allowed to be
|
||||
{
|
||||
BFD_MACH_O_LC_SEGMENT = 0x1, /* File segment to be mapped. */
|
||||
BFD_MACH_O_LC_SYMTAB = 0x2, /* Link-edit stab symbol table info (obsolete). */
|
||||
BFD_MACH_O_LC_SYMSEG = 0x3, /* Link-edit gdb symbol table info. */
|
||||
BFD_MACH_O_LC_THREAD = 0x4, /* Thread. */
|
||||
BFD_MACH_O_LC_UNIXTHREAD = 0x5, /* UNIX thread (includes a stack). */
|
||||
BFD_MACH_O_LC_LOADFVMLIB = 0x6, /* Load a fixed VM shared library. */
|
||||
BFD_MACH_O_LC_IDFVMLIB = 0x7, /* Fixed VM shared library id. */
|
||||
BFD_MACH_O_LC_IDENT = 0x8, /* Object identification information (obsolete). */
|
||||
BFD_MACH_O_LC_FVMFILE = 0x9, /* Fixed VM file inclusion. */
|
||||
BFD_MACH_O_LC_PREPAGE = 0xa, /* Prepage command (internal use). */
|
||||
BFD_MACH_O_LC_DYSYMTAB = 0xb, /* Dynamic link-edit symbol table info. */
|
||||
BFD_MACH_O_LC_LOAD_DYLIB = 0xc, /* Load a dynamically linked shared library. */
|
||||
BFD_MACH_O_LC_ID_DYLIB = 0xd, /* Dynamically linked shared lib identification. */
|
||||
BFD_MACH_O_LC_LOAD_DYLINKER = 0xe, /* Load a dynamic linker. */
|
||||
BFD_MACH_O_LC_ID_DYLINKER = 0xf, /* Dynamic linker identification. */
|
||||
BFD_MACH_O_LC_PREBOUND_DYLIB = 0x10, /* Modules prebound for a dynamically. */
|
||||
BFD_MACH_O_LC_ROUTINES = 0x11, /* Image routines. */
|
||||
BFD_MACH_O_LC_SUB_FRAMEWORK = 0x12, /* Sub framework. */
|
||||
BFD_MACH_O_LC_SUB_UMBRELLA = 0x13, /* Sub umbrella. */
|
||||
BFD_MACH_O_LC_SUB_CLIENT = 0x14, /* Sub client. */
|
||||
BFD_MACH_O_LC_SUB_LIBRARY = 0x15, /* Sub library. */
|
||||
BFD_MACH_O_LC_TWOLEVEL_HINTS = 0x16, /* Two-level namespace lookup hints. */
|
||||
BFD_MACH_O_LC_PREBIND_CKSUM = 0x17, /* Prebind checksum. */
|
||||
/* Load a dynamically linked shared library that is allowed to be
|
||||
missing (weak). */
|
||||
BFD_MACH_O_LC_LOAD_WEAK_DYLIB = 0x18
|
||||
}
|
||||
BFD_MACH_O_LC_LOAD_WEAK_DYLIB = 0x18
|
||||
}
|
||||
bfd_mach_o_load_command_type;
|
||||
|
||||
typedef enum bfd_mach_o_cpu_type
|
||||
{
|
||||
BFD_MACH_O_CPU_TYPE_VAX = 1,
|
||||
BFD_MACH_O_CPU_TYPE_MC680x0 = 6,
|
||||
BFD_MACH_O_CPU_TYPE_I386 = 7,
|
||||
BFD_MACH_O_CPU_TYPE_MIPS = 8,
|
||||
BFD_MACH_O_CPU_TYPE_MC98000 = 10,
|
||||
BFD_MACH_O_CPU_TYPE_HPPA = 11,
|
||||
BFD_MACH_O_CPU_TYPE_ARM = 12,
|
||||
BFD_MACH_O_CPU_TYPE_MC88000 = 13,
|
||||
BFD_MACH_O_CPU_TYPE_SPARC = 14,
|
||||
BFD_MACH_O_CPU_TYPE_I860 = 15,
|
||||
BFD_MACH_O_CPU_TYPE_ALPHA = 16,
|
||||
BFD_MACH_O_CPU_TYPE_POWERPC = 18
|
||||
}
|
||||
{
|
||||
BFD_MACH_O_CPU_TYPE_VAX = 1,
|
||||
BFD_MACH_O_CPU_TYPE_MC680x0 = 6,
|
||||
BFD_MACH_O_CPU_TYPE_I386 = 7,
|
||||
BFD_MACH_O_CPU_TYPE_MIPS = 8,
|
||||
BFD_MACH_O_CPU_TYPE_MC98000 = 10,
|
||||
BFD_MACH_O_CPU_TYPE_HPPA = 11,
|
||||
BFD_MACH_O_CPU_TYPE_ARM = 12,
|
||||
BFD_MACH_O_CPU_TYPE_MC88000 = 13,
|
||||
BFD_MACH_O_CPU_TYPE_SPARC = 14,
|
||||
BFD_MACH_O_CPU_TYPE_I860 = 15,
|
||||
BFD_MACH_O_CPU_TYPE_ALPHA = 16,
|
||||
BFD_MACH_O_CPU_TYPE_POWERPC = 18
|
||||
}
|
||||
bfd_mach_o_cpu_type;
|
||||
|
||||
typedef enum bfd_mach_o_filetype
|
||||
{
|
||||
BFD_MACH_O_MH_OBJECT = 1,
|
||||
BFD_MACH_O_MH_EXECUTE = 2,
|
||||
BFD_MACH_O_MH_FVMLIB = 3,
|
||||
BFD_MACH_O_MH_CORE = 4,
|
||||
BFD_MACH_O_MH_PRELOAD = 5,
|
||||
BFD_MACH_O_MH_DYLIB = 6,
|
||||
BFD_MACH_O_MH_DYLINKER = 7,
|
||||
BFD_MACH_O_MH_BUNDLE = 8
|
||||
}
|
||||
{
|
||||
BFD_MACH_O_MH_OBJECT = 1,
|
||||
BFD_MACH_O_MH_EXECUTE = 2,
|
||||
BFD_MACH_O_MH_FVMLIB = 3,
|
||||
BFD_MACH_O_MH_CORE = 4,
|
||||
BFD_MACH_O_MH_PRELOAD = 5,
|
||||
BFD_MACH_O_MH_DYLIB = 6,
|
||||
BFD_MACH_O_MH_DYLINKER = 7,
|
||||
BFD_MACH_O_MH_BUNDLE = 8
|
||||
}
|
||||
bfd_mach_o_filetype;
|
||||
|
||||
/* Constants for the type of a section. */
|
||||
|
||||
typedef enum bfd_mach_o_section_type
|
||||
{
|
||||
/* Regular section. */
|
||||
BFD_MACH_O_S_REGULAR = 0x0,
|
||||
{
|
||||
/* Regular section. */
|
||||
BFD_MACH_O_S_REGULAR = 0x0,
|
||||
|
||||
/* Zero fill on demand section. */
|
||||
BFD_MACH_O_S_ZEROFILL = 0x1,
|
||||
/* Zero fill on demand section. */
|
||||
BFD_MACH_O_S_ZEROFILL = 0x1,
|
||||
|
||||
/* Section with only literal C strings. */
|
||||
BFD_MACH_O_S_CSTRING_LITERALS = 0x2,
|
||||
/* Section with only literal C strings. */
|
||||
BFD_MACH_O_S_CSTRING_LITERALS = 0x2,
|
||||
|
||||
/* Section with only 4 byte literals. */
|
||||
BFD_MACH_O_S_4BYTE_LITERALS = 0x3,
|
||||
/* Section with only 4 byte literals. */
|
||||
BFD_MACH_O_S_4BYTE_LITERALS = 0x3,
|
||||
|
||||
/* Section with only 8 byte literals. */
|
||||
BFD_MACH_O_S_8BYTE_LITERALS = 0x4,
|
||||
/* Section with only 8 byte literals. */
|
||||
BFD_MACH_O_S_8BYTE_LITERALS = 0x4,
|
||||
|
||||
/* Section with only pointers to literals. */
|
||||
BFD_MACH_O_S_LITERAL_POINTERS = 0x5,
|
||||
/* Section with only pointers to literals. */
|
||||
BFD_MACH_O_S_LITERAL_POINTERS = 0x5,
|
||||
|
||||
/* For the two types of symbol pointers sections and the symbol stubs
|
||||
section they have indirect symbol table entries. For each of the
|
||||
entries in the section the indirect symbol table entries, in
|
||||
corresponding order in the indirect symbol table, start at the index
|
||||
stored in the reserved1 field of the section structure. Since the
|
||||
indirect symbol table entries correspond to the entries in the
|
||||
section the number of indirect symbol table entries is inferred from
|
||||
the size of the section divided by the size of the entries in the
|
||||
section. For symbol pointers sections the size of the entries in
|
||||
the section is 4 bytes and for symbol stubs sections the byte size
|
||||
of the stubs is stored in the reserved2 field of the section
|
||||
structure. */
|
||||
/* For the two types of symbol pointers sections and the symbol stubs
|
||||
section they have indirect symbol table entries. For each of the
|
||||
entries in the section the indirect symbol table entries, in
|
||||
corresponding order in the indirect symbol table, start at the index
|
||||
stored in the reserved1 field of the section structure. Since the
|
||||
indirect symbol table entries correspond to the entries in the
|
||||
section the number of indirect symbol table entries is inferred from
|
||||
the size of the section divided by the size of the entries in the
|
||||
section. For symbol pointers sections the size of the entries in
|
||||
the section is 4 bytes and for symbol stubs sections the byte size
|
||||
of the stubs is stored in the reserved2 field of the section
|
||||
structure. */
|
||||
|
||||
/* Section with only non-lazy symbol pointers. */
|
||||
BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS = 0x6,
|
||||
/* Section with only non-lazy symbol pointers. */
|
||||
BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS = 0x6,
|
||||
|
||||
/* Section with only lazy symbol pointers. */
|
||||
BFD_MACH_O_S_LAZY_SYMBOL_POINTERS = 0x7,
|
||||
/* Section with only lazy symbol pointers. */
|
||||
BFD_MACH_O_S_LAZY_SYMBOL_POINTERS = 0x7,
|
||||
|
||||
/* Section with only symbol stubs, byte size of stub in the reserved2 field. */
|
||||
BFD_MACH_O_S_SYMBOL_STUBS = 0x8,
|
||||
/* Section with only symbol stubs, byte size of stub in the reserved2 field. */
|
||||
BFD_MACH_O_S_SYMBOL_STUBS = 0x8,
|
||||
|
||||
/* Section with only function pointers for initialization. */
|
||||
BFD_MACH_O_S_MOD_INIT_FUNC_POINTERS = 0x9
|
||||
}
|
||||
/* Section with only function pointers for initialization. */
|
||||
BFD_MACH_O_S_MOD_INIT_FUNC_POINTERS = 0x9
|
||||
}
|
||||
bfd_mach_o_section_type;
|
||||
|
||||
typedef unsigned long bfd_mach_o_cpu_subtype;
|
||||
@ -463,46 +463,25 @@ mach_o_data_struct;
|
||||
|
||||
typedef struct mach_o_data_struct bfd_mach_o_data_struct;
|
||||
|
||||
bfd_boolean bfd_mach_o_valid
|
||||
PARAMS ((bfd *));
|
||||
int bfd_mach_o_scan_read_symtab_symbol
|
||||
PARAMS ((bfd *, bfd_mach_o_symtab_command *, asymbol *, unsigned long));
|
||||
int bfd_mach_o_scan_read_symtab_strtab
|
||||
PARAMS ((bfd *, bfd_mach_o_symtab_command *));
|
||||
int bfd_mach_o_scan_read_symtab_symbols
|
||||
PARAMS ((bfd *, bfd_mach_o_symtab_command *));
|
||||
int bfd_mach_o_scan_read_dysymtab_symbol
|
||||
PARAMS ((bfd *, bfd_mach_o_dysymtab_command *, bfd_mach_o_symtab_command *,
|
||||
asymbol *, unsigned long));
|
||||
int bfd_mach_o_scan_start_address
|
||||
PARAMS ((bfd *));
|
||||
int bfd_mach_o_scan
|
||||
PARAMS ((bfd *, bfd_mach_o_header *, bfd_mach_o_data_struct *));
|
||||
bfd_boolean bfd_mach_o_mkobject
|
||||
PARAMS ((bfd *));
|
||||
const bfd_target * bfd_mach_o_object_p
|
||||
PARAMS ((bfd *));
|
||||
const bfd_target * bfd_mach_o_core_p
|
||||
PARAMS ((bfd *));
|
||||
const bfd_target * bfd_mach_o_archive_p
|
||||
PARAMS ((bfd *));
|
||||
bfd * bfd_mach_o_openr_next_archived_file
|
||||
PARAMS ((bfd *, bfd *));
|
||||
int bfd_mach_o_lookup_section
|
||||
PARAMS ((bfd *, asection *, bfd_mach_o_load_command **,
|
||||
bfd_mach_o_section **));
|
||||
int bfd_mach_o_lookup_command
|
||||
PARAMS ((bfd *, bfd_mach_o_load_command_type, bfd_mach_o_load_command **));
|
||||
unsigned long bfd_mach_o_stack_addr
|
||||
PARAMS ((enum bfd_mach_o_cpu_type));
|
||||
int bfd_mach_o_core_fetch_environment
|
||||
PARAMS ((bfd *, unsigned char **, unsigned int *));
|
||||
char * bfd_mach_o_core_file_failing_command
|
||||
PARAMS ((bfd *));
|
||||
int bfd_mach_o_core_file_failing_signal
|
||||
PARAMS ((bfd *));
|
||||
bfd_boolean bfd_mach_o_core_file_matches_executable_p
|
||||
PARAMS ((bfd *, bfd *));
|
||||
bfd_boolean bfd_mach_o_valid (bfd *);
|
||||
int bfd_mach_o_scan_read_symtab_symbol (bfd *, bfd_mach_o_symtab_command *, asymbol *, unsigned long);
|
||||
int bfd_mach_o_scan_read_symtab_strtab (bfd *, bfd_mach_o_symtab_command *);
|
||||
int bfd_mach_o_scan_read_symtab_symbols (bfd *, bfd_mach_o_symtab_command *);
|
||||
int bfd_mach_o_scan_read_dysymtab_symbol (bfd *, bfd_mach_o_dysymtab_command *, bfd_mach_o_symtab_command *, asymbol *, unsigned long);
|
||||
int bfd_mach_o_scan_start_address (bfd *);
|
||||
int bfd_mach_o_scan (bfd *, bfd_mach_o_header *, bfd_mach_o_data_struct *);
|
||||
bfd_boolean bfd_mach_o_mkobject (bfd *);
|
||||
const bfd_target * bfd_mach_o_object_p (bfd *);
|
||||
const bfd_target * bfd_mach_o_core_p (bfd *);
|
||||
const bfd_target * bfd_mach_o_archive_p (bfd *);
|
||||
bfd * bfd_mach_o_openr_next_archived_file (bfd *, bfd *);
|
||||
int bfd_mach_o_lookup_section (bfd *, asection *, bfd_mach_o_load_command **, bfd_mach_o_section **);
|
||||
int bfd_mach_o_lookup_command (bfd *, bfd_mach_o_load_command_type, bfd_mach_o_load_command **);
|
||||
unsigned long bfd_mach_o_stack_addr (enum bfd_mach_o_cpu_type);
|
||||
int bfd_mach_o_core_fetch_environment (bfd *, unsigned char **, unsigned int *);
|
||||
char * bfd_mach_o_core_file_failing_command (bfd *);
|
||||
int bfd_mach_o_core_file_failing_signal (bfd *);
|
||||
bfd_boolean bfd_mach_o_core_file_matches_executable_p (bfd *, bfd *);
|
||||
|
||||
extern const bfd_target mach_o_be_vec;
|
||||
extern const bfd_target mach_o_le_vec;
|
||||
|
61
bfd/netbsd.h
61
bfd/netbsd.h
@ -1,23 +1,23 @@
|
||||
/* BFD back-end definitions used by all NetBSD targets.
|
||||
Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002
|
||||
Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
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 2 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.
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* Check for our machine type (part of magic number). */
|
||||
#ifndef MACHTYPE_OK
|
||||
@ -31,7 +31,7 @@ USA. */
|
||||
#define N_HEADER_IN_TEXT(x) 1
|
||||
|
||||
/* Determine if this is a shared library using the flags. */
|
||||
#define N_SHARED_LIB(x) (N_DYNAMIC(x))
|
||||
#define N_SHARED_LIB(x) (N_DYNAMIC (x))
|
||||
|
||||
/* We have 6 bits of flags and 10 bits of machine ID. */
|
||||
#define N_MACHTYPE(exec) \
|
||||
@ -45,7 +45,7 @@ USA. */
|
||||
| (((flags) & 0x3f) << 24))
|
||||
#define N_SET_MACHTYPE(exec, machtype) \
|
||||
((exec).a_info = \
|
||||
((exec).a_info & 0xfb00ffff) | ((((int) (machtype))&0x3ff) << 16))
|
||||
((exec).a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16))
|
||||
#define N_SET_FLAGS(exec, flags) \
|
||||
((exec).a_info = \
|
||||
((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26))
|
||||
@ -63,8 +63,9 @@ USA. */
|
||||
section. */
|
||||
#define MY_entry_is_text_address 1
|
||||
|
||||
#define MY_write_object_contents MY(write_object_contents)
|
||||
static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
|
||||
#define MY_write_object_contents MY (write_object_contents)
|
||||
static bfd_boolean MY (write_object_contents) (bfd *);
|
||||
|
||||
#define MY_text_includes_header 1
|
||||
|
||||
#include "aout-target.h"
|
||||
@ -74,8 +75,7 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
|
||||
file header, symbols, and relocation. */
|
||||
|
||||
static bfd_boolean
|
||||
MY(write_object_contents) (abfd)
|
||||
bfd *abfd;
|
||||
MY (write_object_contents) (bfd *abfd)
|
||||
{
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
@ -88,20 +88,21 @@ MY(write_object_contents) (abfd)
|
||||
bfd_size_type text_size;
|
||||
file_ptr text_end;
|
||||
|
||||
NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end);
|
||||
NAME (aout, adjust_sizes_and_vmas) (abfd, & text_size, & text_end);
|
||||
}
|
||||
|
||||
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
|
||||
/* Magic number, maestro, please! */
|
||||
switch (bfd_get_arch(abfd)) {
|
||||
case DEFAULT_ARCH:
|
||||
N_SET_MACHTYPE(*execp, DEFAULT_MID);
|
||||
break;
|
||||
default:
|
||||
N_SET_MACHTYPE(*execp, M_UNKNOWN);
|
||||
break;
|
||||
}
|
||||
switch (bfd_get_arch(abfd))
|
||||
{
|
||||
case DEFAULT_ARCH:
|
||||
N_SET_MACHTYPE(*execp, DEFAULT_MID);
|
||||
break;
|
||||
default:
|
||||
N_SET_MACHTYPE(*execp, M_UNKNOWN);
|
||||
break;
|
||||
}
|
||||
|
||||
/* The NetBSD magic number is always big-endian */
|
||||
#ifndef TARGET_IS_BIG_ENDIAN_P
|
||||
@ -112,7 +113,7 @@ MY(write_object_contents) (abfd)
|
||||
| (execp->a_info & 0xff0000) >> 8 | (execp->a_info & 0xff000000) >> 24;
|
||||
#endif
|
||||
|
||||
WRITE_HEADERS(abfd, execp);
|
||||
WRITE_HEADERS (abfd, execp);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
32
bfd/ns32k.h
32
bfd/ns32k.h
@ -1,5 +1,5 @@
|
||||
/* Header file for ns32k routines.
|
||||
Copyright 1996, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright 1996, 2001, 2002, 2005 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -18,24 +18,12 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
extern bfd_reloc_status_type _bfd_ns32k_relocate_contents
|
||||
PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *));
|
||||
|
||||
extern bfd_reloc_status_type _bfd_do_ns32k_reloc_contents
|
||||
PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *,
|
||||
bfd_vma (*) (bfd_byte *, int),
|
||||
void (*) (bfd_vma, bfd_byte *, int)));
|
||||
|
||||
extern bfd_reloc_status_type _bfd_ns32k_final_link_relocate
|
||||
PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma,
|
||||
bfd_vma, bfd_vma));
|
||||
|
||||
extern bfd_vma _bfd_ns32k_get_displacement PARAMS ((bfd_byte *, int));
|
||||
extern bfd_vma _bfd_ns32k_get_immediate PARAMS ((bfd_byte *, int));
|
||||
extern void _bfd_ns32k_put_displacement PARAMS ((bfd_vma, bfd_byte *, int));
|
||||
extern void _bfd_ns32k_put_immediate PARAMS ((bfd_vma, bfd_byte *, int));
|
||||
|
||||
extern bfd_reloc_status_type _bfd_ns32k_reloc_disp
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
extern bfd_reloc_status_type _bfd_ns32k_reloc_imm
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
extern bfd_reloc_status_type _bfd_ns32k_relocate_contents (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
|
||||
extern bfd_reloc_status_type _bfd_do_ns32k_reloc_contents (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *, bfd_vma (*) (bfd_byte *, int), void (*) (bfd_vma, bfd_byte *, int));
|
||||
extern bfd_reloc_status_type _bfd_ns32k_final_link_relocate (reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma, bfd_vma, bfd_vma);
|
||||
extern bfd_vma _bfd_ns32k_get_displacement (bfd_byte *, int);
|
||||
extern bfd_vma _bfd_ns32k_get_immediate (bfd_byte *, int);
|
||||
extern void _bfd_ns32k_put_displacement (bfd_vma, bfd_byte *, int);
|
||||
extern void _bfd_ns32k_put_immediate (bfd_vma, bfd_byte *, int);
|
||||
extern bfd_reloc_status_type _bfd_ns32k_reloc_disp (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
|
||||
extern bfd_reloc_status_type _bfd_ns32k_reloc_imm (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
|
||||
|
@ -1,31 +1,31 @@
|
||||
/* BFD back-end for NetBSD/ns32k a.out-ish binaries.
|
||||
Copyright 1990, 1991, 1992, 1994, 1995, 1998, 2000, 2001, 2002
|
||||
Copyright 1990, 1991, 1992, 1994, 1995, 1998, 2000, 2001, 2002, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
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 2 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.
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define BYTES_IN_WORD 4
|
||||
#define BYTES_IN_WORD 4
|
||||
#undef TARGET_IS_BIG_ENDIAN_P
|
||||
|
||||
#define TARGET_PAGE_SIZE 4096
|
||||
#define SEGMENT_SIZE 4096
|
||||
#define SEGMENT_SIZE 4096
|
||||
|
||||
#define DEFAULT_ARCH bfd_arch_ns32k
|
||||
#define DEFAULT_MID M_532_NETBSD
|
||||
#define DEFAULT_ARCH bfd_arch_ns32k
|
||||
#define DEFAULT_MID M_532_NETBSD
|
||||
|
||||
/* Do not "beautify" the CONCAT* macro args. Traditional C will not
|
||||
remove whitespace added here, and thus will fail to concatenate
|
||||
@ -42,15 +42,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define MY_text_includes_header 1
|
||||
|
||||
/* We can`t use the MYNS macro here for cpp reasons too subtle
|
||||
* for me -- IWD
|
||||
*/
|
||||
for me -- IWD. */
|
||||
#define MY_bfd_reloc_type_lookup ns32kaout_bfd_reloc_type_lookup
|
||||
|
||||
#include "bfd.h" /* To ensure following declaration is OK */
|
||||
#include "bfd.h" /* To ensure following declaration is OK. */
|
||||
|
||||
const struct reloc_howto_struct *
|
||||
MY_bfd_reloc_type_lookup
|
||||
PARAMS((bfd *abfd AND
|
||||
bfd_reloc_code_real_type code));
|
||||
const struct reloc_howto_struct * MY_bfd_reloc_type_lookup (bfd *, bfd_reloc_code_real_type);
|
||||
|
||||
#include "netbsd.h"
|
||||
|
1256
bfd/oasys.c
1256
bfd/oasys.c
File diff suppressed because it is too large
Load Diff
3015
bfd/pdp11.c
3015
bfd/pdp11.c
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/* PowerPC traceback table support for BFD.
|
||||
Copyright 1993, 1998, 1999, 2000, 2001, 2002
|
||||
Copyright 1993, 1998, 1999, 2000, 2001, 2002, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -49,7 +49,7 @@
|
||||
#define TB_PL8 11U /* PL8 */
|
||||
#define TB_ASM 12U /* Asm */
|
||||
|
||||
/* flags 1 */
|
||||
/* Flags 1. */
|
||||
|
||||
#define TB_GLOBALLINK 0x80U /* Routine is Global Linkage. */
|
||||
#define TB_is_eprol 0x40U /* Out-of-line prolog or epilog routine. */
|
||||
@ -60,7 +60,7 @@
|
||||
#define TB_FP_PRESENT 0x02U /* Routine has floating point ops. */
|
||||
#define TB_LOG_ABORT 0x01U /* fp_present && log/abort compiler opt. */
|
||||
|
||||
/* flags 2 */
|
||||
/* Flags 2. */
|
||||
|
||||
#define TB_INT_HNDL 0x80U /* Routine is an interrupt handler. */
|
||||
#define TB_NAME_PRESENT 0x40U /* Name_len/name set (extension field). */
|
||||
@ -69,7 +69,7 @@
|
||||
#define TB_SAVES_CR 0x02U /* Routine saves the CR. */
|
||||
#define TB_SAVES_LR 0x01U /* Routine saves the LR. */
|
||||
|
||||
/* cl_dis_inv "on condition" settings: */
|
||||
/* cl_dis_inv "on condition" settings: */
|
||||
|
||||
#define TB_CL_DIS_INV(x) (((x) & cl_dis_inv) >> 2U)
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
#define TB_DISCARD_ONCOND 1U /* Walk stack and discard. */
|
||||
#define TB_INVOKE_ONCOND 2U /* Invoke a specific system routine. */
|
||||
|
||||
/* flags 3 */
|
||||
/* Flags 3. */
|
||||
|
||||
#define TB_STORES_BC 0x80U /* Routine saves frame ptr of caller. */
|
||||
#define TB_SPARE2 0X40U /* Spare bit. */
|
||||
@ -86,7 +86,7 @@
|
||||
|
||||
#define TB_NUM_FPR_SAVED(x) ((x) & fpr_saved)
|
||||
|
||||
/* flags 4 */
|
||||
/* Flags 4. */
|
||||
|
||||
#define TB_HAS_VEC_INFO 0x80U /* Routine uses vectors. */
|
||||
#define TB_SPARE3 0X40U /* Spare bit. */
|
||||
@ -95,14 +95,14 @@
|
||||
|
||||
#define TB_NUM_GPR_SAVED(x) ((x) & gpr_saved)
|
||||
|
||||
/* flags 5 */
|
||||
/* Flags 5. */
|
||||
|
||||
#define TB_FLOATPARAMS 0xfeU /* Number of floating point parameters. */
|
||||
#define TB_PARAMSONSTK 0X01U /* All parameters are on the stack. */
|
||||
|
||||
#define TB_NUM_FLOATPARAMS(X) (((x) & floatparams) >> 1U)
|
||||
|
||||
/* traceback_table (fixed portion). */
|
||||
/* Traceback_table (fixed portion). */
|
||||
|
||||
struct traceback_table
|
||||
{
|
||||
|
445
bfd/pef.c
445
bfd/pef.c
@ -19,14 +19,11 @@
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "safe-ctype.h"
|
||||
|
||||
#include "pef.h"
|
||||
#include "pef-traceback.h"
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
#include "libiberty.h"
|
||||
|
||||
#ifndef BFD_IO_FUNCS
|
||||
@ -55,7 +52,7 @@
|
||||
#define bfd_pef_bfd_merge_sections bfd_generic_merge_sections
|
||||
#define bfd_pef_bfd_is_group_section bfd_generic_is_group_section
|
||||
#define bfd_pef_bfd_discard_group bfd_generic_discard_group
|
||||
#define bfd_pef_section_already_linked _bfd_generic_section_already_linked
|
||||
#define bfd_pef_section_already_linked _bfd_generic_section_already_linked
|
||||
#define bfd_pef_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define bfd_pef_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
||||
#define bfd_pef_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
@ -64,96 +61,14 @@
|
||||
#define bfd_pef_bfd_link_split_section _bfd_generic_link_split_section
|
||||
#define bfd_pef_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
||||
|
||||
static void bfd_pef_print_symbol PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
|
||||
static void bfd_pef_convert_architecture PARAMS ((unsigned long, enum bfd_architecture *, unsigned long *));
|
||||
static bfd_boolean bfd_pef_mkobject PARAMS ((bfd *));
|
||||
static int bfd_pef_parse_traceback_table PARAMS ((bfd *, asection *, unsigned char *, size_t, size_t, asymbol *, FILE *));
|
||||
static const char *bfd_pef_section_name PARAMS ((bfd_pef_section *));
|
||||
static unsigned long bfd_pef_section_flags PARAMS ((bfd_pef_section *));
|
||||
static asection *bfd_pef_make_bfd_section PARAMS ((bfd *, bfd_pef_section *));
|
||||
static int bfd_pef_read_header PARAMS ((bfd *, bfd_pef_header *));
|
||||
static const bfd_target *bfd_pef_object_p PARAMS ((bfd *));
|
||||
static int bfd_pef_parse_traceback_tables PARAMS ((bfd *, asection *, unsigned char *, size_t, long *, asymbol **));
|
||||
static int bfd_pef_parse_function_stub PARAMS ((bfd *, unsigned char *, size_t, unsigned long *));
|
||||
static int bfd_pef_parse_function_stubs PARAMS ((bfd *, asection *, unsigned char *, size_t, unsigned char *, size_t, unsigned long *, asymbol **));
|
||||
static long bfd_pef_parse_symbols PARAMS ((bfd *, asymbol **));
|
||||
static long bfd_pef_count_symbols PARAMS ((bfd *));
|
||||
static long bfd_pef_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
static long bfd_pef_canonicalize_symtab PARAMS ((bfd *, asymbol **));
|
||||
static asymbol *bfd_pef_make_empty_symbol PARAMS ((bfd *));
|
||||
static void bfd_pef_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
|
||||
static int bfd_pef_sizeof_headers PARAMS ((bfd *, bfd_boolean));
|
||||
static int bfd_pef_xlib_read_header PARAMS ((bfd *, bfd_pef_xlib_header *));
|
||||
static int bfd_pef_xlib_scan PARAMS ((bfd *, bfd_pef_xlib_header *));
|
||||
static const bfd_target *bfd_pef_xlib_object_p PARAMS ((bfd *));
|
||||
|
||||
static void
|
||||
bfd_pef_print_symbol (abfd, afile, symbol, how)
|
||||
bfd *abfd;
|
||||
PTR afile;
|
||||
asymbol *symbol;
|
||||
bfd_print_symbol_type how;
|
||||
{
|
||||
FILE *file = (FILE *) afile;
|
||||
|
||||
switch (how)
|
||||
{
|
||||
case bfd_print_symbol_name:
|
||||
fprintf (file, "%s", symbol->name);
|
||||
break;
|
||||
default:
|
||||
bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
|
||||
fprintf (file, " %-5s %s", symbol->section->name, symbol->name);
|
||||
if (strncmp (symbol->name, "__traceback_", strlen ("__traceback_")) == 0)
|
||||
{
|
||||
unsigned char *buf = alloca (symbol->udata.i);
|
||||
size_t offset = symbol->value + 4;
|
||||
size_t len = symbol->udata.i;
|
||||
int ret;
|
||||
|
||||
bfd_get_section_contents (abfd, symbol->section, buf, offset, len);
|
||||
ret = bfd_pef_parse_traceback_table (abfd, symbol->section, buf,
|
||||
len, 0, NULL, file);
|
||||
if (ret < 0)
|
||||
fprintf (file, " [ERROR]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bfd_pef_convert_architecture (architecture, type, subtype)
|
||||
unsigned long architecture;
|
||||
enum bfd_architecture *type;
|
||||
unsigned long *subtype;
|
||||
{
|
||||
const unsigned long ARCH_POWERPC = 0x70777063; /* 'pwpc' */
|
||||
const unsigned long ARCH_M68K = 0x6d36386b; /* 'm68k' */
|
||||
|
||||
*subtype = bfd_arch_unknown;
|
||||
*type = bfd_arch_unknown;
|
||||
|
||||
if (architecture == ARCH_POWERPC)
|
||||
*type = bfd_arch_powerpc;
|
||||
else if (architecture == ARCH_M68K)
|
||||
*type = bfd_arch_m68k;
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
bfd_pef_mkobject (abfd)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
bfd_pef_parse_traceback_table (abfd, section, buf, len, pos, sym, file)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
unsigned char *buf;
|
||||
size_t len;
|
||||
size_t pos;
|
||||
asymbol *sym;
|
||||
FILE *file;
|
||||
bfd_pef_parse_traceback_table (bfd *abfd,
|
||||
asection *section,
|
||||
unsigned char *buf,
|
||||
size_t len,
|
||||
size_t pos,
|
||||
asymbol *sym,
|
||||
FILE *file)
|
||||
{
|
||||
struct traceback_table table;
|
||||
size_t offset;
|
||||
@ -161,7 +76,7 @@ bfd_pef_parse_traceback_table (abfd, section, buf, len, pos, sym, file)
|
||||
asymbol tmpsymbol;
|
||||
|
||||
if (sym == NULL)
|
||||
sym = &tmpsymbol;
|
||||
sym = & tmpsymbol;
|
||||
|
||||
sym->name = NULL;
|
||||
sym->value = 0;
|
||||
@ -171,14 +86,12 @@ bfd_pef_parse_traceback_table (abfd, section, buf, len, pos, sym, file)
|
||||
sym->udata.i = 0;
|
||||
|
||||
/* memcpy is fine since all fields are unsigned char. */
|
||||
|
||||
if ((pos + 8) > len)
|
||||
return -1;
|
||||
memcpy (&table, buf + pos, 8);
|
||||
|
||||
/* Calling code relies on returned symbols having a name and
|
||||
correct offset. */
|
||||
|
||||
if ((table.lang != TB_C) && (table.lang != TB_CPLUSPLUS))
|
||||
return -1;
|
||||
|
||||
@ -204,7 +117,6 @@ bfd_pef_parse_traceback_table (abfd, section, buf, len, pos, sym, file)
|
||||
|
||||
/* Need to subtract 4 because the offset includes the 0x0L
|
||||
preceding the table. */
|
||||
|
||||
if (file != NULL)
|
||||
fprintf (file, " [offset = 0x%lx]", off.tb_offset);
|
||||
|
||||
@ -248,7 +160,7 @@ bfd_pef_parse_traceback_table (abfd, section, buf, len, pos, sym, file)
|
||||
if ((pos + offset + name.name_len) > len)
|
||||
return -1;
|
||||
|
||||
namebuf = (char *) bfd_alloc (abfd, name.name_len + 1);
|
||||
namebuf = bfd_alloc (abfd, name.name_len + 1);
|
||||
if (namebuf == NULL)
|
||||
return -1;
|
||||
|
||||
@ -280,8 +192,62 @@ bfd_pef_parse_traceback_table (abfd, section, buf, len, pos, sym, file)
|
||||
return offset;
|
||||
}
|
||||
|
||||
static const char *bfd_pef_section_name (section)
|
||||
bfd_pef_section *section;
|
||||
static void
|
||||
bfd_pef_print_symbol (bfd *abfd,
|
||||
void * afile,
|
||||
asymbol *symbol,
|
||||
bfd_print_symbol_type how)
|
||||
{
|
||||
FILE *file = (FILE *) afile;
|
||||
|
||||
switch (how)
|
||||
{
|
||||
case bfd_print_symbol_name:
|
||||
fprintf (file, "%s", symbol->name);
|
||||
break;
|
||||
default:
|
||||
bfd_print_symbol_vandf (abfd, (void *) file, symbol);
|
||||
fprintf (file, " %-5s %s", symbol->section->name, symbol->name);
|
||||
if (strncmp (symbol->name, "__traceback_", strlen ("__traceback_")) == 0)
|
||||
{
|
||||
unsigned char *buf = alloca (symbol->udata.i);
|
||||
size_t offset = symbol->value + 4;
|
||||
size_t len = symbol->udata.i;
|
||||
int ret;
|
||||
|
||||
bfd_get_section_contents (abfd, symbol->section, buf, offset, len);
|
||||
ret = bfd_pef_parse_traceback_table (abfd, symbol->section, buf,
|
||||
len, 0, NULL, file);
|
||||
if (ret < 0)
|
||||
fprintf (file, " [ERROR]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bfd_pef_convert_architecture (unsigned long architecture,
|
||||
enum bfd_architecture *type,
|
||||
unsigned long *subtype)
|
||||
{
|
||||
const unsigned long ARCH_POWERPC = 0x70777063; /* 'pwpc'. */
|
||||
const unsigned long ARCH_M68K = 0x6d36386b; /* 'm68k'. */
|
||||
|
||||
*subtype = bfd_arch_unknown;
|
||||
*type = bfd_arch_unknown;
|
||||
|
||||
if (architecture == ARCH_POWERPC)
|
||||
*type = bfd_arch_powerpc;
|
||||
else if (architecture == ARCH_M68K)
|
||||
*type = bfd_arch_m68k;
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
bfd_pef_mkobject (bfd *abfd ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const char *bfd_pef_section_name (bfd_pef_section *section)
|
||||
{
|
||||
switch (section->section_kind)
|
||||
{
|
||||
@ -298,8 +264,7 @@ static const char *bfd_pef_section_name (section)
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned long bfd_pef_section_flags (section)
|
||||
bfd_pef_section *section;
|
||||
static unsigned long bfd_pef_section_flags (bfd_pef_section *section)
|
||||
{
|
||||
switch (section->section_kind)
|
||||
{
|
||||
@ -319,9 +284,7 @@ static unsigned long bfd_pef_section_flags (section)
|
||||
}
|
||||
|
||||
static asection *
|
||||
bfd_pef_make_bfd_section (abfd, section)
|
||||
bfd *abfd;
|
||||
bfd_pef_section *section;
|
||||
bfd_pef_make_bfd_section (bfd *abfd, bfd_pef_section *section)
|
||||
{
|
||||
asection *bfdsec;
|
||||
const char *name = bfd_pef_section_name (section);
|
||||
@ -341,11 +304,11 @@ bfd_pef_make_bfd_section (abfd, section)
|
||||
return bfdsec;
|
||||
}
|
||||
|
||||
int bfd_pef_parse_loader_header (abfd, buf, len, header)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
unsigned char *buf;
|
||||
size_t len;
|
||||
bfd_pef_loader_header *header;
|
||||
int
|
||||
bfd_pef_parse_loader_header (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
unsigned char *buf,
|
||||
size_t len,
|
||||
bfd_pef_loader_header *header)
|
||||
{
|
||||
BFD_ASSERT (len == 56);
|
||||
|
||||
@ -367,11 +330,11 @@ int bfd_pef_parse_loader_header (abfd, buf, len, header)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bfd_pef_parse_imported_library (abfd, buf, len, header)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
unsigned char *buf;
|
||||
size_t len;
|
||||
bfd_pef_imported_library *header;
|
||||
int
|
||||
bfd_pef_parse_imported_library (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
unsigned char *buf,
|
||||
size_t len,
|
||||
bfd_pef_imported_library *header)
|
||||
{
|
||||
BFD_ASSERT (len == 24);
|
||||
|
||||
@ -387,11 +350,11 @@ int bfd_pef_parse_imported_library (abfd, buf, len, header)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bfd_pef_parse_imported_symbol (abfd, buf, len, symbol)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
unsigned char *buf;
|
||||
size_t len;
|
||||
bfd_pef_imported_symbol *symbol;
|
||||
int
|
||||
bfd_pef_parse_imported_symbol (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
unsigned char *buf,
|
||||
size_t len,
|
||||
bfd_pef_imported_symbol *symbol)
|
||||
{
|
||||
unsigned long value;
|
||||
|
||||
@ -404,14 +367,13 @@ int bfd_pef_parse_imported_symbol (abfd, buf, len, symbol)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bfd_pef_scan_section (abfd, section)
|
||||
bfd *abfd;
|
||||
bfd_pef_section *section;
|
||||
int
|
||||
bfd_pef_scan_section (bfd *abfd, bfd_pef_section *section)
|
||||
{
|
||||
unsigned char buf[28];
|
||||
|
||||
bfd_seek (abfd, section->header_offset, SEEK_SET);
|
||||
if (bfd_bread ((PTR) buf, 28, abfd) != 28)
|
||||
if (bfd_bread ((void *) buf, 28, abfd) != 28)
|
||||
return -1;
|
||||
|
||||
section->name_offset = bfd_h_get_32 (abfd, buf);
|
||||
@ -433,10 +395,9 @@ int bfd_pef_scan_section (abfd, section)
|
||||
}
|
||||
|
||||
void
|
||||
bfd_pef_print_loader_header (abfd, header, file)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_pef_loader_header *header;
|
||||
FILE *file;
|
||||
bfd_pef_print_loader_header (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
bfd_pef_loader_header *header,
|
||||
FILE *file)
|
||||
{
|
||||
fprintf (file, "main_section: %ld\n", header->main_section);
|
||||
fprintf (file, "main_offset: %lu\n", header->main_offset);
|
||||
@ -460,40 +421,24 @@ bfd_pef_print_loader_header (abfd, header, file)
|
||||
}
|
||||
|
||||
int
|
||||
bfd_pef_print_loader_section (abfd, file)
|
||||
bfd *abfd;
|
||||
FILE *file;
|
||||
bfd_pef_print_loader_section (bfd *abfd, FILE *file)
|
||||
{
|
||||
bfd_pef_loader_header header;
|
||||
asection *loadersec = NULL;
|
||||
unsigned char *loaderbuf = NULL;
|
||||
size_t loaderlen = 0;
|
||||
int ret;
|
||||
|
||||
loadersec = bfd_get_section_by_name (abfd, "loader");
|
||||
if (loadersec == NULL)
|
||||
return -1;
|
||||
|
||||
loaderlen = loadersec->size;
|
||||
loaderbuf = (unsigned char *) bfd_malloc (loaderlen);
|
||||
if (bfd_seek (abfd, loadersec->filepos, SEEK_SET) < 0)
|
||||
{
|
||||
free (loaderbuf);
|
||||
return -1;
|
||||
}
|
||||
if (bfd_bread ((PTR) loaderbuf, loaderlen, abfd) != loaderlen)
|
||||
{
|
||||
free (loaderbuf);
|
||||
return -1;
|
||||
}
|
||||
loaderbuf = bfd_malloc (loaderlen);
|
||||
|
||||
if (loaderlen < 56)
|
||||
{
|
||||
free (loaderbuf);
|
||||
return -1;
|
||||
}
|
||||
ret = bfd_pef_parse_loader_header (abfd, loaderbuf, 56, &header);
|
||||
if (ret < 0)
|
||||
if (bfd_seek (abfd, loadersec->filepos, SEEK_SET) < 0
|
||||
|| bfd_bread ((void *) loaderbuf, loaderlen, abfd) != loaderlen
|
||||
|| loaderlen < 56
|
||||
|| bfd_pef_parse_loader_header (abfd, loaderbuf, 56, &header) < 0)
|
||||
{
|
||||
free (loaderbuf);
|
||||
return -1;
|
||||
@ -504,8 +449,7 @@ bfd_pef_print_loader_section (abfd, file)
|
||||
}
|
||||
|
||||
int
|
||||
bfd_pef_scan_start_address (abfd)
|
||||
bfd *abfd;
|
||||
bfd_pef_scan_start_address (bfd *abfd)
|
||||
{
|
||||
bfd_pef_loader_header header;
|
||||
asection *section;
|
||||
@ -520,10 +464,10 @@ bfd_pef_scan_start_address (abfd)
|
||||
goto end;
|
||||
|
||||
loaderlen = loadersec->size;
|
||||
loaderbuf = (unsigned char *) bfd_malloc (loaderlen);
|
||||
loaderbuf = bfd_malloc (loaderlen);
|
||||
if (bfd_seek (abfd, loadersec->filepos, SEEK_SET) < 0)
|
||||
goto error;
|
||||
if (bfd_bread ((PTR) loaderbuf, loaderlen, abfd) != loaderlen)
|
||||
if (bfd_bread ((void *) loaderbuf, loaderlen, abfd) != loaderlen)
|
||||
goto error;
|
||||
|
||||
if (loaderlen < 56)
|
||||
@ -583,9 +527,7 @@ bfd_pef_scan (abfd, header, mdata)
|
||||
|
||||
if (header->section_count != 0)
|
||||
{
|
||||
mdata->sections =
|
||||
((bfd_pef_section *)
|
||||
bfd_alloc (abfd, header->section_count * sizeof (bfd_pef_section)));
|
||||
mdata->sections = bfd_alloc (abfd, header->section_count * sizeof (bfd_pef_section));
|
||||
|
||||
if (mdata->sections == NULL)
|
||||
return -1;
|
||||
@ -608,15 +550,13 @@ bfd_pef_scan (abfd, header, mdata)
|
||||
}
|
||||
|
||||
static int
|
||||
bfd_pef_read_header (abfd, header)
|
||||
bfd *abfd;
|
||||
bfd_pef_header *header;
|
||||
bfd_pef_read_header (bfd *abfd, bfd_pef_header *header)
|
||||
{
|
||||
unsigned char buf[40];
|
||||
|
||||
bfd_seek (abfd, 0, SEEK_SET);
|
||||
|
||||
if (bfd_bread ((PTR) buf, 40, abfd) != 40)
|
||||
if (bfd_bread ((void *) buf, 40, abfd) != 40)
|
||||
return -1;
|
||||
|
||||
header->tag1 = bfd_getb32 (buf);
|
||||
@ -635,8 +575,7 @@ bfd_pef_read_header (abfd, header)
|
||||
}
|
||||
|
||||
static const bfd_target *
|
||||
bfd_pef_object_p (abfd)
|
||||
bfd *abfd;
|
||||
bfd_pef_object_p (bfd *abfd)
|
||||
{
|
||||
struct bfd_preserve preserve;
|
||||
bfd_pef_header header;
|
||||
@ -669,13 +608,13 @@ bfd_pef_object_p (abfd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int bfd_pef_parse_traceback_tables (abfd, sec, buf, len, nsym, csym)
|
||||
bfd *abfd;
|
||||
asection *sec;
|
||||
unsigned char *buf;
|
||||
size_t len;
|
||||
long *nsym;
|
||||
asymbol **csym;
|
||||
static int
|
||||
bfd_pef_parse_traceback_tables (bfd *abfd,
|
||||
asection *sec,
|
||||
unsigned char *buf,
|
||||
size_t len,
|
||||
long *nsym,
|
||||
asymbol **csym)
|
||||
{
|
||||
char *name;
|
||||
|
||||
@ -721,14 +660,13 @@ static int bfd_pef_parse_traceback_tables (abfd, sec, buf, len, nsym, csym)
|
||||
|
||||
/* Don't bother to compute the name if we are just
|
||||
counting symbols. */
|
||||
|
||||
if (csym)
|
||||
{
|
||||
tbnamelen = strlen (tbprefix) + strlen (function.name);
|
||||
name = bfd_alloc (abfd, tbnamelen + 1);
|
||||
if (name == NULL)
|
||||
{
|
||||
bfd_release (abfd, (PTR) function.name);
|
||||
bfd_release (abfd, (void *) function.name);
|
||||
function.name = NULL;
|
||||
break;
|
||||
}
|
||||
@ -752,11 +690,11 @@ static int bfd_pef_parse_traceback_tables (abfd, sec, buf, len, nsym, csym)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bfd_pef_parse_function_stub (abfd, buf, len, offset)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
unsigned char *buf;
|
||||
size_t len;
|
||||
unsigned long *offset;
|
||||
static int
|
||||
bfd_pef_parse_function_stub (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
unsigned char *buf,
|
||||
size_t len,
|
||||
unsigned long *offset)
|
||||
{
|
||||
BFD_ASSERT (len == 24);
|
||||
|
||||
@ -779,16 +717,15 @@ static int bfd_pef_parse_function_stub (abfd, buf, len, offset)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bfd_pef_parse_function_stubs (abfd, codesec, codebuf, codelen,
|
||||
loaderbuf, loaderlen, nsym, csym)
|
||||
bfd *abfd;
|
||||
asection *codesec;
|
||||
unsigned char *codebuf;
|
||||
size_t codelen;
|
||||
unsigned char *loaderbuf;
|
||||
size_t loaderlen;
|
||||
unsigned long *nsym;
|
||||
asymbol **csym;
|
||||
static int
|
||||
bfd_pef_parse_function_stubs (bfd *abfd,
|
||||
asection *codesec,
|
||||
unsigned char *codebuf,
|
||||
size_t codelen,
|
||||
unsigned char *loaderbuf,
|
||||
size_t loaderlen,
|
||||
unsigned long *nsym,
|
||||
asymbol **csym)
|
||||
{
|
||||
const char *const sprefix = "__stub_";
|
||||
|
||||
@ -809,9 +746,9 @@ static int bfd_pef_parse_function_stubs (abfd, codesec, codebuf, codelen,
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
libraries = (bfd_pef_imported_library *) bfd_malloc
|
||||
libraries = bfd_malloc
|
||||
(header.imported_library_count * sizeof (bfd_pef_imported_library));
|
||||
imports = (bfd_pef_imported_symbol *) bfd_malloc
|
||||
imports = bfd_malloc
|
||||
(header.total_imported_symbol_count * sizeof (bfd_pef_imported_symbol));
|
||||
|
||||
if (loaderlen < (56 + (header.imported_library_count * 24)))
|
||||
@ -940,9 +877,8 @@ static int bfd_pef_parse_function_stubs (abfd, codesec, codebuf, codelen,
|
||||
return -1;
|
||||
}
|
||||
|
||||
static long bfd_pef_parse_symbols (abfd, csym)
|
||||
bfd *abfd;
|
||||
asymbol **csym;
|
||||
static long
|
||||
bfd_pef_parse_symbols (bfd *abfd, asymbol **csym)
|
||||
{
|
||||
unsigned long count = 0;
|
||||
|
||||
@ -958,10 +894,10 @@ static long bfd_pef_parse_symbols (abfd, csym)
|
||||
if (codesec != NULL)
|
||||
{
|
||||
codelen = codesec->size;
|
||||
codebuf = (unsigned char *) bfd_malloc (codelen);
|
||||
codebuf = bfd_malloc (codelen);
|
||||
if (bfd_seek (abfd, codesec->filepos, SEEK_SET) < 0)
|
||||
goto end;
|
||||
if (bfd_bread ((PTR) codebuf, codelen, abfd) != codelen)
|
||||
if (bfd_bread ((void *) codebuf, codelen, abfd) != codelen)
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -969,10 +905,10 @@ static long bfd_pef_parse_symbols (abfd, csym)
|
||||
if (loadersec != NULL)
|
||||
{
|
||||
loaderlen = loadersec->size;
|
||||
loaderbuf = (unsigned char *) bfd_malloc (loaderlen);
|
||||
loaderbuf = bfd_malloc (loaderlen);
|
||||
if (bfd_seek (abfd, loadersec->filepos, SEEK_SET) < 0)
|
||||
goto end;
|
||||
if (bfd_bread ((PTR) loaderbuf, loaderlen, abfd) != loaderlen)
|
||||
if (bfd_bread ((void *) loaderbuf, loaderlen, abfd) != loaderlen)
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -1008,32 +944,29 @@ static long bfd_pef_parse_symbols (abfd, csym)
|
||||
}
|
||||
|
||||
static long
|
||||
bfd_pef_count_symbols (abfd)
|
||||
bfd *abfd;
|
||||
bfd_pef_count_symbols (bfd *abfd)
|
||||
{
|
||||
return bfd_pef_parse_symbols (abfd, NULL);
|
||||
}
|
||||
|
||||
static long
|
||||
bfd_pef_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
bfd_pef_get_symtab_upper_bound (bfd *abfd)
|
||||
{
|
||||
long nsyms = bfd_pef_count_symbols (abfd);
|
||||
|
||||
if (nsyms < 0)
|
||||
return nsyms;
|
||||
return ((nsyms + 1) * sizeof (asymbol *));
|
||||
}
|
||||
|
||||
static long
|
||||
bfd_pef_canonicalize_symtab (abfd, alocation)
|
||||
bfd *abfd;
|
||||
asymbol **alocation;
|
||||
bfd_pef_canonicalize_symtab (bfd *abfd, asymbol **alocation)
|
||||
{
|
||||
long i;
|
||||
asymbol *syms;
|
||||
long ret;
|
||||
|
||||
long nsyms = bfd_pef_count_symbols (abfd);
|
||||
|
||||
if (nsyms < 0)
|
||||
return nsyms;
|
||||
|
||||
@ -1054,62 +987,58 @@ bfd_pef_canonicalize_symtab (abfd, alocation)
|
||||
}
|
||||
|
||||
static asymbol *
|
||||
bfd_pef_make_empty_symbol (abfd)
|
||||
bfd *abfd;
|
||||
bfd_pef_make_empty_symbol (bfd *abfd)
|
||||
{
|
||||
return (asymbol *) bfd_alloc (abfd, sizeof (asymbol));
|
||||
return bfd_alloc (abfd, sizeof (asymbol));
|
||||
}
|
||||
|
||||
static void
|
||||
bfd_pef_get_symbol_info (abfd, symbol, ret)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol;
|
||||
symbol_info *ret;
|
||||
bfd_pef_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
asymbol *symbol,
|
||||
symbol_info *ret)
|
||||
{
|
||||
bfd_symbol_info (symbol, ret);
|
||||
}
|
||||
|
||||
static int
|
||||
bfd_pef_sizeof_headers (abfd, exec)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_boolean exec ATTRIBUTE_UNUSED;
|
||||
bfd_pef_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const bfd_target pef_vec =
|
||||
{
|
||||
"pef", /* name */
|
||||
bfd_target_pef_flavour, /* flavour */
|
||||
BFD_ENDIAN_BIG, /* byteorder */
|
||||
BFD_ENDIAN_BIG, /* header_byteorder */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
"pef", /* Name. */
|
||||
bfd_target_pef_flavour, /* Flavour. */
|
||||
BFD_ENDIAN_BIG, /* Byteorder. */
|
||||
BFD_ENDIAN_BIG, /* Header_byteorder. */
|
||||
(HAS_RELOC | EXEC_P | /* Object flags. */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
(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 */
|
||||
| SEC_ROM | SEC_HAS_CONTENTS), /* Section_flags. */
|
||||
0, /* Symbol_leading_char. */
|
||||
' ', /* AR_pad_char. */
|
||||
16, /* AR_max_namelen. */
|
||||
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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
|
||||
{ /* bfd_check_format. */
|
||||
_bfd_dummy_target,
|
||||
bfd_pef_object_p, /* bfd_check_format */
|
||||
bfd_pef_object_p, /* bfd_check_format. */
|
||||
_bfd_dummy_target,
|
||||
_bfd_dummy_target,
|
||||
},
|
||||
{ /* bfd_set_format */
|
||||
{ /* bfd_set_format. */
|
||||
bfd_false,
|
||||
bfd_pef_mkobject,
|
||||
bfd_false,
|
||||
bfd_false,
|
||||
},
|
||||
{ /* bfd_write_contents */
|
||||
{ /* bfd_write_contents. */
|
||||
bfd_false,
|
||||
bfd_true,
|
||||
bfd_false,
|
||||
@ -1131,24 +1060,22 @@ const bfd_target pef_vec =
|
||||
NULL
|
||||
};
|
||||
|
||||
#define bfd_pef_xlib_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||
#define bfd_pef_xlib_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
||||
#define bfd_pef_xlib_new_section_hook _bfd_generic_new_section_hook
|
||||
#define bfd_pef_xlib_get_section_contents _bfd_generic_get_section_contents
|
||||
#define bfd_pef_xlib_set_section_contents _bfd_generic_set_section_contents
|
||||
#define bfd_pef_xlib_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||
#define bfd_pef_xlib_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
||||
#define bfd_pef_xlib_new_section_hook _bfd_generic_new_section_hook
|
||||
#define bfd_pef_xlib_get_section_contents _bfd_generic_get_section_contents
|
||||
#define bfd_pef_xlib_set_section_contents _bfd_generic_set_section_contents
|
||||
#define bfd_pef_xlib_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
||||
#define bfd_pef_xlib_set_section_contents_in_window _bfd_generic_set_section_contents_in_window
|
||||
|
||||
static int
|
||||
bfd_pef_xlib_read_header (abfd, header)
|
||||
bfd *abfd;
|
||||
bfd_pef_xlib_header *header;
|
||||
bfd_pef_xlib_read_header (bfd *abfd, bfd_pef_xlib_header *header)
|
||||
{
|
||||
unsigned char buf[76];
|
||||
|
||||
bfd_seek (abfd, 0, SEEK_SET);
|
||||
|
||||
if (bfd_bread ((PTR) buf, 76, abfd) != 76)
|
||||
if (bfd_bread ((void *) buf, 76, abfd) != 76)
|
||||
return -1;
|
||||
|
||||
header->tag1 = bfd_getb32 (buf);
|
||||
@ -1175,15 +1102,12 @@ bfd_pef_xlib_read_header (abfd, header)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bfd_pef_xlib_scan (abfd, header)
|
||||
bfd *abfd;
|
||||
bfd_pef_xlib_header *header;
|
||||
static int
|
||||
bfd_pef_xlib_scan (bfd *abfd, bfd_pef_xlib_header *header)
|
||||
{
|
||||
bfd_pef_xlib_data_struct *mdata = NULL;
|
||||
|
||||
mdata = ((bfd_pef_xlib_data_struct *)
|
||||
bfd_alloc (abfd, sizeof (bfd_pef_xlib_data_struct)));
|
||||
mdata = bfd_alloc (abfd, sizeof (* mdata));
|
||||
if (mdata == NULL)
|
||||
return -1;
|
||||
|
||||
@ -1198,8 +1122,7 @@ bfd_pef_xlib_scan (abfd, header)
|
||||
}
|
||||
|
||||
static const bfd_target *
|
||||
bfd_pef_xlib_object_p (abfd)
|
||||
bfd *abfd;
|
||||
bfd_pef_xlib_object_p (bfd *abfd)
|
||||
{
|
||||
struct bfd_preserve preserve;
|
||||
bfd_pef_xlib_header header;
|
||||
@ -1237,37 +1160,37 @@ bfd_pef_xlib_object_p (abfd)
|
||||
|
||||
const bfd_target pef_xlib_vec =
|
||||
{
|
||||
"pef-xlib", /* name */
|
||||
bfd_target_pef_xlib_flavour, /* flavour */
|
||||
BFD_ENDIAN_BIG, /* byteorder */
|
||||
BFD_ENDIAN_BIG, /* header_byteorder */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
"pef-xlib", /* Name. */
|
||||
bfd_target_pef_xlib_flavour, /* Flavour. */
|
||||
BFD_ENDIAN_BIG, /* Byteorder */
|
||||
BFD_ENDIAN_BIG, /* Header_byteorder. */
|
||||
(HAS_RELOC | EXEC_P | /* Object flags. */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
(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 */
|
||||
| SEC_ROM | SEC_HAS_CONTENTS),/* Section_flags. */
|
||||
0, /* Symbol_leading_char. */
|
||||
' ', /* AR_pad_char. */
|
||||
16, /* AR_max_namelen. */
|
||||
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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
|
||||
{ /* bfd_check_format. */
|
||||
_bfd_dummy_target,
|
||||
bfd_pef_xlib_object_p, /* bfd_check_format */
|
||||
bfd_pef_xlib_object_p, /* bfd_check_format. */
|
||||
_bfd_dummy_target,
|
||||
_bfd_dummy_target,
|
||||
},
|
||||
{ /* bfd_set_format */
|
||||
{ /* bfd_set_format. */
|
||||
bfd_false,
|
||||
bfd_pef_mkobject,
|
||||
bfd_false,
|
||||
bfd_false,
|
||||
},
|
||||
{ /* bfd_write_contents */
|
||||
{ /* bfd_write_contents. */
|
||||
bfd_false,
|
||||
bfd_true,
|
||||
bfd_false,
|
||||
|
16
bfd/pef.h
16
bfd/pef.h
@ -176,11 +176,11 @@ struct bfd_pef_xlib_data_struct
|
||||
};
|
||||
typedef struct bfd_pef_xlib_data_struct bfd_pef_xlib_data_struct;
|
||||
|
||||
int bfd_pef_parse_loader_header PARAMS ((bfd *, unsigned char *, size_t, bfd_pef_loader_header *));
|
||||
int bfd_pef_print_loader_section PARAMS ((bfd *, FILE *));
|
||||
void bfd_pef_print_loader_header PARAMS ((bfd *, bfd_pef_loader_header *, FILE *));
|
||||
int bfd_pef_parse_imported_library PARAMS ((bfd *, unsigned char *, size_t, bfd_pef_imported_library *));
|
||||
int bfd_pef_parse_imported_symbol PARAMS ((bfd *, unsigned char *, size_t, bfd_pef_imported_symbol *));
|
||||
int bfd_pef_scan_section PARAMS ((bfd *, bfd_pef_section *));
|
||||
int bfd_pef_scan_start_address PARAMS ((bfd *));
|
||||
int bfd_pef_scan PARAMS ((bfd *, bfd_pef_header *, bfd_pef_data_struct *));
|
||||
int bfd_pef_parse_loader_header (bfd *, unsigned char *, size_t, bfd_pef_loader_header *);
|
||||
int bfd_pef_print_loader_section (bfd *, FILE *);
|
||||
void bfd_pef_print_loader_header (bfd *, bfd_pef_loader_header *, FILE *);
|
||||
int bfd_pef_parse_imported_library (bfd *, unsigned char *, size_t, bfd_pef_imported_library *);
|
||||
int bfd_pef_parse_imported_symbol (bfd *, unsigned char *, size_t, bfd_pef_imported_symbol *);
|
||||
int bfd_pef_scan_section (bfd *, bfd_pef_section *);
|
||||
int bfd_pef_scan_start_address (bfd *);
|
||||
int bfd_pef_scan (bfd *, bfd_pef_header *, bfd_pef_data_struct *);
|
||||
|
412
bfd/riscix.c
412
bfd/riscix.c
@ -3,21 +3,21 @@
|
||||
2005 Free Software Foundation, Inc.
|
||||
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
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 2 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.
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* RISC iX overloads the MAGIC field to indicate more than just the usual
|
||||
[ZNO]MAGIC values. Also included are squeezing information and
|
||||
@ -32,29 +32,39 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define MF_IS_SL 04000
|
||||
|
||||
/* Common combinations. */
|
||||
#define IMAGIC (MF_IMPURE|ZMAGIC) /* Demand load (impure text) */
|
||||
#define SPOMAGIC (MF_USES_SL|OMAGIC) /* OMAGIC with large header */
|
||||
/* -- may contain a ref to a */
|
||||
/* shared lib required by the */
|
||||
/* object. */
|
||||
#define SLOMAGIC (MF_IS_SL|OMAGIC) /* A reference to a shared library */
|
||||
/* The text portion of the object */
|
||||
/* contains "overflow text" from */
|
||||
/* the shared library to be linked */
|
||||
/* in with an object */
|
||||
#define QMAGIC (MF_SQUEEZED|ZMAGIC) /* Sqeezed demand paged. */
|
||||
/* NOTE: This interpretation of */
|
||||
/* QMAGIC seems to be at variance */
|
||||
/* With that used on other */
|
||||
/* architectures. */
|
||||
#define SPZMAGIC (MF_USES_SL|ZMAGIC) /* program which uses sl */
|
||||
#define SPQMAGIC (MF_USES_SL|QMAGIC) /* sqeezed ditto */
|
||||
#define SLZMAGIC (MF_IS_SL|ZMAGIC) /* shared lib part of prog */
|
||||
#define SLPZMAGIC (MF_USES_SL|SLZMAGIC) /* sl which uses another */
|
||||
|
||||
/* Demand load (impure text). */
|
||||
#define IMAGIC (MF_IMPURE | ZMAGIC)
|
||||
|
||||
/* OMAGIC with large header.
|
||||
May contain a ref to a shared lib required by the object. */
|
||||
#define SPOMAGIC (MF_USES_SL | OMAGIC)
|
||||
|
||||
/* A reference to a shared library.
|
||||
The text portion of the object contains "overflow text" from
|
||||
the shared library to be linked in with an object. */
|
||||
#define SLOMAGIC (MF_IS_SL | OMAGIC)
|
||||
|
||||
/* Sqeezed demand paged.
|
||||
NOTE: This interpretation of QMAGIC seems to be at variance
|
||||
with that used on other architectures. */
|
||||
#define QMAGIC (MF_SQUEEZED | ZMAGIC)
|
||||
|
||||
/* Program which uses sl. */
|
||||
#define SPZMAGIC (MF_USES_SL | ZMAGIC)
|
||||
|
||||
/* Sqeezed ditto. */
|
||||
#define SPQMAGIC (MF_USES_SL | QMAGIC)
|
||||
|
||||
/* Shared lib part of prog. */
|
||||
#define SLZMAGIC (MF_IS_SL | ZMAGIC)
|
||||
|
||||
/* Sl which uses another. */
|
||||
#define SLPZMAGIC (MF_USES_SL | SLZMAGIC)
|
||||
|
||||
#define N_SHARED_LIB(x) ((x).a_info & MF_USES_SL)
|
||||
|
||||
/* Only a pure OMAGIC file has the minimal header */
|
||||
/* Only a pure OMAGIC file has the minimal header. */
|
||||
#define N_TXTOFF(x) \
|
||||
((x).a_info == OMAGIC \
|
||||
? 32 \
|
||||
@ -78,19 +88,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define N_STROFF(x) (N_SYMOFF (x) + (x).a_syms)
|
||||
|
||||
#define TEXT_START_ADDR 32768
|
||||
#define TARGET_PAGE_SIZE 32768
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
#define DEFAULT_ARCH bfd_arch_arm
|
||||
#define TEXT_START_ADDR 32768
|
||||
#define TARGET_PAGE_SIZE 32768
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
#define DEFAULT_ARCH bfd_arch_arm
|
||||
|
||||
/* Do not "beautify" the CONCAT* macro args. Traditional C will not
|
||||
remove whitespace added here, and thus will fail to concatenate
|
||||
the tokens. */
|
||||
#define MY(OP) CONCAT2 (riscix_,OP)
|
||||
#define TARGETNAME "a.out-riscix"
|
||||
#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \
|
||||
(((x).a_info & ~006000) != OMAGIC) && \
|
||||
((x).a_info != NMAGIC))
|
||||
#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) \
|
||||
&& (((x).a_info & ~006000) != OMAGIC) \
|
||||
&& ((x).a_info != NMAGIC))
|
||||
#define N_MAGIC(x) ((x).a_info & ~07200)
|
||||
|
||||
#include "bfd.h"
|
||||
@ -99,10 +109,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define WRITE_HEADERS(abfd, execp) \
|
||||
{ \
|
||||
bfd_size_type text_size; /* dummy vars */ \
|
||||
bfd_size_type text_size; /* Dummy vars. */ \
|
||||
file_ptr text_end; \
|
||||
if (adata(abfd).magic == undecided_magic) \
|
||||
NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \
|
||||
\
|
||||
if (adata (abfd).magic == undecided_magic) \
|
||||
NAME (aout, adjust_sizes_and_vmas) (abfd, & text_size, & text_end); \
|
||||
\
|
||||
execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
|
||||
execp->a_entry = bfd_get_start_address (abfd); \
|
||||
@ -111,31 +122,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
obj_reloc_entry_size (abfd)); \
|
||||
execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
|
||||
obj_reloc_entry_size (abfd)); \
|
||||
NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
|
||||
NAME (aout, swap_exec_header_out) (abfd, execp, & exec_bytes); \
|
||||
\
|
||||
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \
|
||||
|| bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
|
||||
|| bfd_bwrite ((void *) & exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
|
||||
abfd) != EXEC_BYTES_SIZE) \
|
||||
return FALSE; \
|
||||
/* Now write out reloc info, followed by syms and strings */ \
|
||||
/* Now write out reloc info, followed by syms and strings. */ \
|
||||
\
|
||||
if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
|
||||
if (bfd_get_outsymbols (abfd) != NULL \
|
||||
&& bfd_get_symcount (abfd) != 0) \
|
||||
{ \
|
||||
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0) \
|
||||
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (* execp)), SEEK_SET) != 0)\
|
||||
return FALSE; \
|
||||
\
|
||||
if (! NAME(aout,write_syms) (abfd)) return FALSE; \
|
||||
if (! NAME (aout, write_syms) (abfd)) \
|
||||
return FALSE; \
|
||||
\
|
||||
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \
|
||||
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (* execp)), SEEK_SET) != 0)\
|
||||
return FALSE; \
|
||||
\
|
||||
if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd))) \
|
||||
return FALSE; \
|
||||
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \
|
||||
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (* execp)), SEEK_SET) != 0)\
|
||||
return FALSE; \
|
||||
\
|
||||
if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \
|
||||
if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \
|
||||
return FALSE; \
|
||||
} \
|
||||
}
|
||||
@ -144,81 +156,55 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "aout/aout64.h"
|
||||
|
||||
static bfd_reloc_status_type
|
||||
riscix_fix_pcrel_26_done PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
riscix_fix_pcrel_26_done (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
arelent *reloc_entry ATTRIBUTE_UNUSED,
|
||||
asymbol *symbol ATTRIBUTE_UNUSED,
|
||||
void * data ATTRIBUTE_UNUSED,
|
||||
asection *input_section ATTRIBUTE_UNUSED,
|
||||
bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
char **error_message ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* This is dead simple at present. */
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
static bfd_reloc_status_type
|
||||
riscix_fix_pcrel_26 PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
static const bfd_target *
|
||||
MY (object_p) PARAMS ((bfd *));
|
||||
static bfd_reloc_status_type riscix_fix_pcrel_26 (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
|
||||
static const bfd_target *riscix_callback (bfd *);
|
||||
|
||||
reloc_howto_type *
|
||||
riscix_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
|
||||
void
|
||||
riscix_swap_std_reloc_out PARAMS ((bfd *, arelent *, struct reloc_std_external *));
|
||||
|
||||
bfd_boolean
|
||||
riscix_squirt_out_relocs PARAMS ((bfd *, asection *));
|
||||
|
||||
long
|
||||
MY (canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
|
||||
|
||||
const bfd_target *
|
||||
riscix_some_aout_object_p PARAMS ((bfd *, struct internal_exec *, const bfd_target *(*) (bfd *)));
|
||||
|
||||
|
||||
static reloc_howto_type riscix_std_reloc_howto[] = {
|
||||
/* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */
|
||||
HOWTO( 0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", TRUE, 0x000000ff,0x000000ff, FALSE),
|
||||
static reloc_howto_type riscix_std_reloc_howto[] =
|
||||
{
|
||||
/* Type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */
|
||||
HOWTO( 0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", TRUE, 0x000000ff,0x000000ff, FALSE),
|
||||
HOWTO( 1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
|
||||
HOWTO( 2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"32", TRUE, 0xffffffff,0xffffffff, FALSE),
|
||||
HOWTO( 3, 2, 3, 26, TRUE, 0, complain_overflow_signed, riscix_fix_pcrel_26 , "ARM26", TRUE, 0x00ffffff,0x00ffffff, FALSE),
|
||||
HOWTO( 3, 2, 3, 26, TRUE, 0, complain_overflow_signed, riscix_fix_pcrel_26 , "ARM26", TRUE, 0x00ffffff,0x00ffffff, FALSE),
|
||||
HOWTO( 4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0,"DISP8", TRUE, 0x000000ff,0x000000ff, TRUE),
|
||||
HOWTO( 5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0,"DISP16", TRUE, 0x0000ffff,0x0000ffff, TRUE),
|
||||
HOWTO( 6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0,"DISP32", TRUE, 0xffffffff,0xffffffff, TRUE),
|
||||
HOWTO( 7, 2, 3, 26, FALSE, 0, complain_overflow_signed, riscix_fix_pcrel_26_done, "ARM26D",TRUE,0x00ffffff,0x00ffffff, FALSE),
|
||||
EMPTY_HOWTO (-1),
|
||||
HOWTO( 9, 0, -1, 16, FALSE, 0, complain_overflow_bitfield,0,"NEG16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
|
||||
HOWTO( 10, 0, -2, 32, FALSE, 0, complain_overflow_bitfield,0,"NEG32", TRUE, 0xffffffff,0xffffffff, FALSE)
|
||||
HOWTO( 9, 0, -1, 16, FALSE, 0, complain_overflow_bitfield,0,"NEG16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
|
||||
HOWTO( 10, 0, -2, 32, FALSE, 0, complain_overflow_bitfield,0,"NEG32", TRUE, 0xffffffff,0xffffffff, FALSE)
|
||||
};
|
||||
|
||||
#define RISCIX_TABLE_SIZE \
|
||||
(sizeof (riscix_std_reloc_howto) / sizeof (reloc_howto_type))
|
||||
|
||||
static bfd_reloc_status_type
|
||||
riscix_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section,
|
||||
output_bfd, error_message)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *reloc_entry ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol ATTRIBUTE_UNUSED;
|
||||
PTR data ATTRIBUTE_UNUSED;
|
||||
asection *input_section ATTRIBUTE_UNUSED;
|
||||
bfd *output_bfd ATTRIBUTE_UNUSED;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
/* This is dead simple at present. */
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
static bfd_reloc_status_type
|
||||
riscix_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
|
||||
output_bfd, error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
riscix_fix_pcrel_26 (bfd *abfd,
|
||||
arelent *reloc_entry,
|
||||
asymbol *symbol,
|
||||
void * data,
|
||||
asection *input_section,
|
||||
bfd *output_bfd,
|
||||
char **error_message ATTRIBUTE_UNUSED)
|
||||
{
|
||||
bfd_vma relocation;
|
||||
bfd_size_type addr = reloc_entry->address;
|
||||
long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
|
||||
bfd_reloc_status_type flag = bfd_reloc_ok;
|
||||
|
||||
/* If this is an undefined symbol, return error */
|
||||
/* If this is an undefined symbol, return error. */
|
||||
if (symbol->section == &bfd_und_section
|
||||
&& (symbol->flags & BSF_WEAK) == 0)
|
||||
return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined;
|
||||
@ -226,11 +212,11 @@ riscix_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
|
||||
/* If the sections are different, and we are doing a partial relocation,
|
||||
just ignore it for now. */
|
||||
if (symbol->section->name != input_section->name
|
||||
&& output_bfd != (bfd *)NULL)
|
||||
&& output_bfd != NULL)
|
||||
return bfd_reloc_continue;
|
||||
|
||||
relocation = (target & 0x00ffffff) << 2;
|
||||
relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend */
|
||||
relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend. */
|
||||
relocation += symbol->value;
|
||||
relocation += symbol->section->output_section->vma;
|
||||
relocation += symbol->section->output_offset;
|
||||
@ -241,7 +227,7 @@ riscix_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
|
||||
if (relocation & 3)
|
||||
return bfd_reloc_overflow;
|
||||
|
||||
/* Check for overflow */
|
||||
/* Check for overflow. */
|
||||
if (relocation & 0x02000000)
|
||||
{
|
||||
if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff)
|
||||
@ -261,10 +247,8 @@ riscix_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
|
||||
return flag;
|
||||
}
|
||||
|
||||
reloc_howto_type *
|
||||
riscix_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
static reloc_howto_type *
|
||||
riscix_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
|
||||
{
|
||||
#define ASTD(i,j) case i: return &riscix_std_reloc_howto[j]
|
||||
if (code == BFD_RELOC_CTOR)
|
||||
@ -273,7 +257,8 @@ riscix_reloc_type_lookup (abfd, code)
|
||||
case 32:
|
||||
code = BFD_RELOC_32;
|
||||
break;
|
||||
default: return (reloc_howto_type *) NULL;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (code)
|
||||
@ -284,26 +269,24 @@ riscix_reloc_type_lookup (abfd, code)
|
||||
ASTD (BFD_RELOC_8_PCREL, 4);
|
||||
ASTD (BFD_RELOC_16_PCREL, 5);
|
||||
ASTD (BFD_RELOC_32_PCREL, 6);
|
||||
default: return (reloc_howto_type *) NULL;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define MY_final_link_callback should_not_be_used
|
||||
#define MY_bfd_final_link _bfd_generic_final_link
|
||||
#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define MY_final_link_callback should_not_be_used
|
||||
#define MY_bfd_final_link _bfd_generic_final_link
|
||||
|
||||
#define MY_bfd_reloc_type_lookup riscix_reloc_type_lookup
|
||||
#define MY_canonicalize_reloc riscix_canonicalize_reloc
|
||||
#define MY_object_p riscix_object_p
|
||||
#define MY_bfd_reloc_type_lookup riscix_reloc_type_lookup
|
||||
#define MY_canonicalize_reloc riscix_canonicalize_reloc
|
||||
#define MY_object_p riscix_object_p
|
||||
|
||||
static const bfd_target *riscix_callback PARAMS ((bfd *));
|
||||
|
||||
void
|
||||
riscix_swap_std_reloc_out (abfd, g, natptr)
|
||||
bfd *abfd;
|
||||
arelent *g;
|
||||
struct reloc_std_external *natptr;
|
||||
static void
|
||||
riscix_swap_std_reloc_out (bfd *abfd,
|
||||
arelent *g,
|
||||
struct reloc_std_external *natptr)
|
||||
{
|
||||
int r_index;
|
||||
asymbol *sym = *(g->sym_ptr_ptr);
|
||||
@ -315,58 +298,55 @@ riscix_swap_std_reloc_out (abfd, g, natptr)
|
||||
|
||||
PUT_WORD(abfd, g->address, natptr->r_address);
|
||||
|
||||
r_length = g->howto->size ; /* Size as a power of two */
|
||||
r_length = g->howto->size ; /* Size as a power of two. */
|
||||
if (r_length < 0)
|
||||
{
|
||||
r_length = -r_length;
|
||||
r_neg = 1;
|
||||
}
|
||||
|
||||
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
|
||||
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
|
||||
|
||||
/* For RISC iX, in pc-relative relocs the r_pcrel bit means that the
|
||||
relocation has been done already (Only for the 26-bit one I think)???!!!
|
||||
*/
|
||||
|
||||
relocation has been done already (Only for the 26-bit one I think)? */
|
||||
if (r_length == 3)
|
||||
r_pcrel = r_pcrel ? 0 : 1;
|
||||
|
||||
/* name was clobbered by aout_write_syms to be symbol index */
|
||||
/* Name was clobbered by aout_write_syms to be symbol index. */
|
||||
|
||||
/* If this relocation is relative to a symbol then set the
|
||||
r_index to the symbols index, and the r_extern bit.
|
||||
|
||||
Absolute symbols can come in in two ways, either as an offset
|
||||
from the abs section, or as a symbol which has an abs value.
|
||||
check for that here
|
||||
*/
|
||||
check for that here. */
|
||||
|
||||
if (bfd_is_com_section (output_section)
|
||||
|| output_section == &bfd_abs_section
|
||||
|| output_section == &bfd_und_section)
|
||||
|| output_section == & bfd_abs_section
|
||||
|| output_section == & bfd_und_section)
|
||||
{
|
||||
if (bfd_abs_section.symbol == sym)
|
||||
{
|
||||
/* Whoops, looked like an abs symbol, but is really an offset
|
||||
from the abs section */
|
||||
from the abs section. */
|
||||
r_index = 0;
|
||||
r_extern = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fill in symbol */
|
||||
/* Fill in symbol. */
|
||||
r_extern = 1;
|
||||
r_index = (*g->sym_ptr_ptr)->udata.i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Just an ordinary section */
|
||||
/* Just an ordinary section. */
|
||||
r_extern = 0;
|
||||
r_index = output_section->target_index;
|
||||
}
|
||||
|
||||
/* now the fun stuff */
|
||||
/* Now the fun stuff. */
|
||||
if (bfd_header_big_endian (abfd))
|
||||
{
|
||||
natptr->r_index[0] = r_index >> 16;
|
||||
@ -391,15 +371,12 @@ riscix_swap_std_reloc_out (abfd, g, natptr)
|
||||
}
|
||||
}
|
||||
|
||||
bfd_boolean
|
||||
riscix_squirt_out_relocs (abfd, section)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
static bfd_boolean
|
||||
riscix_squirt_out_relocs (bfd *abfd, asection *section)
|
||||
{
|
||||
arelent **generic;
|
||||
unsigned char *native, *natptr;
|
||||
size_t each_size;
|
||||
|
||||
unsigned int count = section->reloc_count;
|
||||
bfd_size_type natsize;
|
||||
|
||||
@ -409,7 +386,7 @@ riscix_squirt_out_relocs (abfd, section)
|
||||
each_size = obj_reloc_entry_size (abfd);
|
||||
natsize = each_size;
|
||||
natsize *= count;
|
||||
native = (unsigned char *) bfd_zalloc (abfd, natsize);
|
||||
native = bfd_zalloc (abfd, natsize);
|
||||
if (!native)
|
||||
return FALSE;
|
||||
|
||||
@ -421,7 +398,7 @@ riscix_squirt_out_relocs (abfd, section)
|
||||
riscix_swap_std_reloc_out (abfd, *generic,
|
||||
(struct reloc_std_external *) natptr);
|
||||
|
||||
if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
|
||||
if (bfd_bwrite ((void *) native, natsize, abfd) != natsize)
|
||||
{
|
||||
bfd_release (abfd, native);
|
||||
return FALSE;
|
||||
@ -431,44 +408,46 @@ riscix_squirt_out_relocs (abfd, section)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is just like the standard aoutx.h version but we need to do our
|
||||
* own mapping of external reloc type values to howto entries.
|
||||
*/
|
||||
long
|
||||
MY(canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
arelent **relptr;
|
||||
asymbol **symbols;
|
||||
/* This is just like the standard aoutx.h version but we need to do our
|
||||
own mapping of external reloc type values to howto entries. */
|
||||
|
||||
static long
|
||||
MY (canonicalize_reloc) (bfd *abfd,
|
||||
sec_ptr section,
|
||||
arelent **relptr,
|
||||
asymbol **symbols)
|
||||
{
|
||||
arelent *tblptr = section->relocation;
|
||||
unsigned int count, c;
|
||||
extern reloc_howto_type NAME(aout,std_howto_table)[];
|
||||
extern reloc_howto_type NAME (aout, std_howto_table)[];
|
||||
|
||||
/* If we have already read in the relocation table, return the values. */
|
||||
if (section->flags & SEC_CONSTRUCTOR) {
|
||||
arelent_chain *chain = section->constructor_chain;
|
||||
if (section->flags & SEC_CONSTRUCTOR)
|
||||
{
|
||||
arelent_chain *chain = section->constructor_chain;
|
||||
|
||||
for (count = 0; count < section->reloc_count; count++) {
|
||||
*relptr++ = &chain->relent;
|
||||
chain = chain->next;
|
||||
for (count = 0; count < section->reloc_count; count++)
|
||||
{
|
||||
*relptr++ = &chain->relent;
|
||||
chain = chain->next;
|
||||
}
|
||||
*relptr = 0;
|
||||
return section->reloc_count;
|
||||
}
|
||||
*relptr = 0;
|
||||
return section->reloc_count;
|
||||
}
|
||||
if (tblptr && section->reloc_count) {
|
||||
for (count = 0; count++ < section->reloc_count;)
|
||||
*relptr++ = tblptr++;
|
||||
*relptr = 0;
|
||||
return section->reloc_count;
|
||||
}
|
||||
|
||||
if (!NAME(aout,slurp_reloc_table) (abfd, section, symbols))
|
||||
if (tblptr && section->reloc_count)
|
||||
{
|
||||
for (count = 0; count++ < section->reloc_count;)
|
||||
*relptr++ = tblptr++;
|
||||
*relptr = 0;
|
||||
return section->reloc_count;
|
||||
}
|
||||
|
||||
if (!NAME (aout, slurp_reloc_table) (abfd, section, symbols))
|
||||
return -1;
|
||||
tblptr = section->relocation;
|
||||
|
||||
/* fix up howto entries */
|
||||
/* Fix up howto entries. */
|
||||
for (count = 0; count++ < section->reloc_count;)
|
||||
{
|
||||
c = tblptr->howto - NAME(aout,std_howto_table);
|
||||
@ -484,20 +463,19 @@ MY(canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
/* This is the same as NAME(aout,some_aout_object_p), but has different
|
||||
expansions of the macro definitions. */
|
||||
|
||||
const bfd_target *
|
||||
riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
|
||||
bfd *abfd;
|
||||
struct internal_exec *execp;
|
||||
const bfd_target *(*callback_to_real_object_p) PARAMS ((bfd *));
|
||||
static const bfd_target *
|
||||
riscix_some_aout_object_p (bfd *abfd,
|
||||
struct internal_exec *execp,
|
||||
const bfd_target *(*callback_to_real_object_p) (bfd *))
|
||||
{
|
||||
struct aout_data_struct *rawptr, *oldrawptr;
|
||||
const bfd_target *result;
|
||||
bfd_size_type amt = sizeof (struct aout_data_struct);
|
||||
|
||||
rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
|
||||
rawptr = bfd_zalloc (abfd, amt);
|
||||
|
||||
if (rawptr == NULL)
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
oldrawptr = abfd->tdata.aout_data;
|
||||
abfd->tdata.aout_data = rawptr;
|
||||
@ -510,28 +488,29 @@ riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
|
||||
*abfd->tdata.aout_data = *oldrawptr;
|
||||
|
||||
abfd->tdata.aout_data->a.hdr = &rawptr->e;
|
||||
*(abfd->tdata.aout_data->a.hdr) = *execp; /* Copy in the internal_exec
|
||||
struct */
|
||||
/* Copy in the internal_exec struct. */
|
||||
*(abfd->tdata.aout_data->a.hdr) = *execp;
|
||||
execp = abfd->tdata.aout_data->a.hdr;
|
||||
|
||||
/* Set the file flags */
|
||||
/* Set the file flags. */
|
||||
abfd->flags = BFD_NO_FLAGS;
|
||||
if (execp->a_drsize || execp->a_trsize)
|
||||
abfd->flags |= HAS_RELOC;
|
||||
/* Setting of EXEC_P has been deferred to the bottom of this function */
|
||||
/* Setting of EXEC_P has been deferred to the bottom of this function. */
|
||||
if (execp->a_syms)
|
||||
abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
|
||||
if (N_DYNAMIC(*execp))
|
||||
abfd->flags |= DYNAMIC;
|
||||
|
||||
if ((execp->a_info & MF_SQUEEZED) != 0) /* Squeezed files aren't supported
|
||||
(yet)! */
|
||||
/* Squeezed files aren't supported (yet)! */
|
||||
if ((execp->a_info & MF_SQUEEZED) != 0)
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
else if ((execp->a_info & MF_IS_SL) != 0) /* Nor are shared libraries */
|
||||
else if ((execp->a_info & MF_IS_SL) != 0)
|
||||
{
|
||||
/* Nor are shared libraries. */
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
@ -548,15 +527,13 @@ riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
|
||||
else if (N_MAGIC (*execp) == OMAGIC)
|
||||
adata (abfd).magic = o_magic;
|
||||
else
|
||||
{
|
||||
/* Should have been checked with N_BADMAG before this routine
|
||||
was called. */
|
||||
abort ();
|
||||
}
|
||||
/* Should have been checked with N_BADMAG before this routine
|
||||
was called. */
|
||||
abort ();
|
||||
|
||||
bfd_get_start_address (abfd) = execp->a_entry;
|
||||
|
||||
obj_aout_symbols (abfd) = (aout_symbol_type *)NULL;
|
||||
obj_aout_symbols (abfd) = NULL;
|
||||
bfd_get_symcount (abfd) = execp->a_syms / sizeof (struct external_nlist);
|
||||
|
||||
/* The default relocation entry size is that of traditional V7 Unix. */
|
||||
@ -569,7 +546,7 @@ riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
|
||||
obj_aout_external_strings (abfd) = NULL;
|
||||
obj_aout_sym_hashes (abfd) = NULL;
|
||||
|
||||
if (! NAME(aout,make_sections) (abfd))
|
||||
if (! NAME (aout, make_sections) (abfd))
|
||||
return NULL;
|
||||
|
||||
obj_datasec (abfd)->size = execp->a_data;
|
||||
@ -589,15 +566,15 @@ riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
|
||||
|
||||
#if defined(MACH) || defined(STAT_FOR_EXEC)
|
||||
/* The original heuristic doesn't work in some important cases. The
|
||||
* a.out file has no information about the text start address. For
|
||||
* files (like kernels) linked to non-standard addresses (ld -Ttext
|
||||
* nnn) the entry point may not be between the default text start
|
||||
* (obj_textsec(abfd)->vma) and (obj_textsec(abfd)->vma) + text size
|
||||
* This is not just a mach issue. Many kernels are loaded at non
|
||||
* standard addresses.
|
||||
*/
|
||||
a.out file has no information about the text start address. For
|
||||
files (like kernels) linked to non-standard addresses (ld -Ttext
|
||||
nnn) the entry point may not be between the default text start
|
||||
(obj_textsec(abfd)->vma) and (obj_textsec(abfd)->vma) + text size
|
||||
This is not just a mach issue. Many kernels are loaded at non
|
||||
standard addresses. */
|
||||
{
|
||||
struct stat stat_buf;
|
||||
|
||||
if (abfd->iostream != NULL
|
||||
&& (abfd->flags & BFD_IN_MEMORY) == 0
|
||||
&& (fstat(fileno((FILE *) (abfd->iostream)), &stat_buf) == 0)
|
||||
@ -617,10 +594,7 @@ riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
|
||||
(execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->size))
|
||||
abfd->flags |= EXEC_P;
|
||||
#endif /* MACH */
|
||||
if (result)
|
||||
{
|
||||
}
|
||||
else
|
||||
if (result == NULL)
|
||||
{
|
||||
free (rawptr);
|
||||
abfd->tdata.aout_data = oldrawptr;
|
||||
@ -629,31 +603,33 @@ riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
|
||||
}
|
||||
|
||||
static const bfd_target *
|
||||
MY(object_p) (abfd)
|
||||
bfd *abfd;
|
||||
MY (object_p) (bfd *abfd)
|
||||
{
|
||||
struct external_exec exec_bytes; /* Raw exec header from file */
|
||||
struct internal_exec exec; /* Cleaned-up exec header */
|
||||
struct external_exec exec_bytes; /* Raw exec header from file. */
|
||||
struct internal_exec exec; /* Cleaned-up exec header. */
|
||||
const bfd_target *target;
|
||||
|
||||
if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd)
|
||||
if (bfd_bread ((void *) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd)
|
||||
!= EXEC_BYTES_SIZE)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
exec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
|
||||
|
||||
if (N_BADMAG (exec)) return 0;
|
||||
if (N_BADMAG (exec))
|
||||
return NULL;
|
||||
|
||||
#ifdef MACHTYPE_OK
|
||||
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
|
||||
if (!(MACHTYPE_OK (N_MACHTYPE (exec))))
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
|
||||
NAME (aout, swap_exec_header_in) (abfd, & exec_bytes, & exec);
|
||||
|
||||
target = riscix_some_aout_object_p (abfd, &exec, MY(callback));
|
||||
target = riscix_some_aout_object_p (abfd, & exec, MY (callback));
|
||||
|
||||
return target;
|
||||
}
|
||||
|
302
bfd/som.h
302
bfd/som.h
@ -1,6 +1,6 @@
|
||||
/* HP PA-RISC SOM object file format: definitions internal to BFD.
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
|
||||
2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
Contributed by the Center for Software Science at the
|
||||
University of Utah (pa-gdb-bugs@cs.utah.edu).
|
||||
@ -53,154 +53,154 @@
|
||||
#define AUX_HDR_SIZE sizeof (struct som_exec_auxhdr)
|
||||
|
||||
typedef struct som_symbol
|
||||
{
|
||||
asymbol symbol;
|
||||
unsigned int som_type;
|
||||
|
||||
/* Structured like the ELF tc_data union. Allows more code sharing
|
||||
in GAS this way. */
|
||||
union
|
||||
{
|
||||
asymbol symbol;
|
||||
unsigned int som_type;
|
||||
|
||||
/* Structured like the ELF tc_data union. Allows more code sharing
|
||||
in GAS this way. */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned int hppa_arg_reloc;
|
||||
unsigned int hppa_priv_level;
|
||||
} ap;
|
||||
PTR any;
|
||||
}
|
||||
tc_data;
|
||||
|
||||
/* Index of this symbol in the symbol table. Only used when
|
||||
building relocation streams for incomplete objects. */
|
||||
int index;
|
||||
|
||||
/* How many times this symbol is used in a relocation. By sorting
|
||||
the symbols from most used to least used we can significantly
|
||||
reduce the size of the relocation stream for incomplete objects. */
|
||||
int reloc_count;
|
||||
|
||||
/* During object file writing, the offset of the name of this symbol
|
||||
in the SOM string table. */
|
||||
int stringtab_offset;
|
||||
struct
|
||||
{
|
||||
unsigned int hppa_arg_reloc;
|
||||
unsigned int hppa_priv_level;
|
||||
} ap;
|
||||
PTR any;
|
||||
}
|
||||
tc_data;
|
||||
|
||||
/* Index of this symbol in the symbol table. Only used when
|
||||
building relocation streams for incomplete objects. */
|
||||
int index;
|
||||
|
||||
/* How many times this symbol is used in a relocation. By sorting
|
||||
the symbols from most used to least used we can significantly
|
||||
reduce the size of the relocation stream for incomplete objects. */
|
||||
int reloc_count;
|
||||
|
||||
/* During object file writing, the offset of the name of this symbol
|
||||
in the SOM string table. */
|
||||
int stringtab_offset;
|
||||
}
|
||||
som_symbol_type;
|
||||
|
||||
/* A structure containing all the magic information stored in a BFD's
|
||||
private data which needs to be copied during an objcopy/strip run. */
|
||||
struct som_exec_data
|
||||
{
|
||||
/* Sort-of a magic number. BSD uses it to distinguish between
|
||||
native executables and hpux executables. */
|
||||
short system_id;
|
||||
{
|
||||
/* Sort-of a magic number. BSD uses it to distinguish between
|
||||
native executables and hpux executables. */
|
||||
short system_id;
|
||||
|
||||
/* Magic exec flags. These control things like whether or not
|
||||
null pointer dereferencing is allowed and the like. */
|
||||
long exec_flags;
|
||||
/* Magic exec flags. These control things like whether or not
|
||||
null pointer dereferencing is allowed and the like. */
|
||||
long exec_flags;
|
||||
|
||||
/* We must preserve the version identifier too. Some versions
|
||||
of the HP linker do not grok NEW_VERSION_ID for reasons unknown. */
|
||||
unsigned int version_id;
|
||||
/* We must preserve the version identifier too. Some versions
|
||||
of the HP linker do not grok NEW_VERSION_ID for reasons unknown. */
|
||||
unsigned int version_id;
|
||||
|
||||
/* Add more stuff here as needed. Good examples of information
|
||||
we might want to pass would be presumed_dp, entry_* and maybe
|
||||
others from the file header. */
|
||||
};
|
||||
/* Add more stuff here as needed. Good examples of information
|
||||
we might want to pass would be presumed_dp, entry_* and maybe
|
||||
others from the file header. */
|
||||
};
|
||||
|
||||
struct somdata
|
||||
{
|
||||
/* All the magic information about an executable which lives
|
||||
in the private BFD structure and needs to be copied from
|
||||
the input bfd to the output bfd during an objcopy/strip. */
|
||||
struct som_exec_data *exec_data;
|
||||
{
|
||||
/* All the magic information about an executable which lives
|
||||
in the private BFD structure and needs to be copied from
|
||||
the input bfd to the output bfd during an objcopy/strip. */
|
||||
struct som_exec_data *exec_data;
|
||||
|
||||
/* These three fields are only used when writing files and are
|
||||
generated from scratch. They need not be copied for objcopy
|
||||
or strip to work. */
|
||||
struct header *file_hdr;
|
||||
struct copyright_aux_hdr *copyright_aux_hdr;
|
||||
struct user_string_aux_hdr *version_aux_hdr;
|
||||
struct som_exec_auxhdr *exec_hdr;
|
||||
COMPUNIT *comp_unit;
|
||||
/* These three fields are only used when writing files and are
|
||||
generated from scratch. They need not be copied for objcopy
|
||||
or strip to work. */
|
||||
struct header *file_hdr;
|
||||
struct copyright_aux_hdr *copyright_aux_hdr;
|
||||
struct user_string_aux_hdr *version_aux_hdr;
|
||||
struct som_exec_auxhdr *exec_hdr;
|
||||
COMPUNIT *comp_unit;
|
||||
|
||||
/* Pointers to a saved copy of the symbol and string tables. These
|
||||
need not be copied for objcopy or strip to work. */
|
||||
som_symbol_type *symtab;
|
||||
char *stringtab;
|
||||
asymbol **sorted_syms;
|
||||
/* Pointers to a saved copy of the symbol and string tables. These
|
||||
need not be copied for objcopy or strip to work. */
|
||||
som_symbol_type *symtab;
|
||||
char *stringtab;
|
||||
asymbol **sorted_syms;
|
||||
|
||||
/* We remember these offsets so that after check_file_format, we have
|
||||
no dependencies on the particular format of the exec_hdr.
|
||||
These offsets need not be copied for objcopy or strip to work. */
|
||||
/* We remember these offsets so that after check_file_format, we have
|
||||
no dependencies on the particular format of the exec_hdr.
|
||||
These offsets need not be copied for objcopy or strip to work. */
|
||||
|
||||
file_ptr sym_filepos;
|
||||
file_ptr str_filepos;
|
||||
file_ptr reloc_filepos;
|
||||
unsigned stringtab_size;
|
||||
};
|
||||
file_ptr sym_filepos;
|
||||
file_ptr str_filepos;
|
||||
file_ptr reloc_filepos;
|
||||
unsigned stringtab_size;
|
||||
};
|
||||
|
||||
struct som_data_struct
|
||||
{
|
||||
struct somdata a;
|
||||
};
|
||||
{
|
||||
struct somdata a;
|
||||
};
|
||||
|
||||
struct som_subspace_dictionary_record
|
||||
{
|
||||
int space_index;
|
||||
unsigned int access_control_bits : 7;
|
||||
unsigned int memory_resident : 1;
|
||||
unsigned int dup_common : 1;
|
||||
unsigned int is_common : 1;
|
||||
unsigned int is_loadable : 1;
|
||||
unsigned int quadrant : 2;
|
||||
unsigned int initially_frozen : 1;
|
||||
unsigned int is_first : 1;
|
||||
unsigned int code_only : 1;
|
||||
unsigned int sort_key : 8;
|
||||
unsigned int replicate_init : 1;
|
||||
unsigned int continuation : 1;
|
||||
unsigned int is_tspecific : 1;
|
||||
unsigned int is_comdat : 1;
|
||||
unsigned int reserved : 4;
|
||||
int file_loc_init_value;
|
||||
unsigned int initialization_length;
|
||||
unsigned int subspace_start;
|
||||
unsigned int subspace_length;
|
||||
unsigned int reserved2 : 5;
|
||||
unsigned int alignment :27;
|
||||
union name_pt name;
|
||||
int fixup_request_index;
|
||||
unsigned int fixup_request_quantity;
|
||||
};
|
||||
{
|
||||
int space_index;
|
||||
unsigned int access_control_bits : 7;
|
||||
unsigned int memory_resident : 1;
|
||||
unsigned int dup_common : 1;
|
||||
unsigned int is_common : 1;
|
||||
unsigned int is_loadable : 1;
|
||||
unsigned int quadrant : 2;
|
||||
unsigned int initially_frozen : 1;
|
||||
unsigned int is_first : 1;
|
||||
unsigned int code_only : 1;
|
||||
unsigned int sort_key : 8;
|
||||
unsigned int replicate_init : 1;
|
||||
unsigned int continuation : 1;
|
||||
unsigned int is_tspecific : 1;
|
||||
unsigned int is_comdat : 1;
|
||||
unsigned int reserved : 4;
|
||||
int file_loc_init_value;
|
||||
unsigned int initialization_length;
|
||||
unsigned int subspace_start;
|
||||
unsigned int subspace_length;
|
||||
unsigned int reserved2 : 5;
|
||||
unsigned int alignment :27;
|
||||
union name_pt name;
|
||||
int fixup_request_index;
|
||||
unsigned int fixup_request_quantity;
|
||||
};
|
||||
|
||||
/* Substructure of som_section_data_struct used to hold information
|
||||
which can't be represented by the generic BFD section structure,
|
||||
but which must be copied during objcopy or strip. */
|
||||
struct som_copyable_section_data_struct
|
||||
{
|
||||
/* Various fields in space and subspace headers that we need
|
||||
to pass around. */
|
||||
unsigned int sort_key : 8;
|
||||
unsigned int access_control_bits : 7;
|
||||
unsigned int is_defined : 1;
|
||||
unsigned int is_private : 1;
|
||||
unsigned int quadrant : 2;
|
||||
unsigned int is_comdat : 1;
|
||||
unsigned int is_common : 1;
|
||||
unsigned int dup_common : 1;
|
||||
{
|
||||
/* Various fields in space and subspace headers that we need
|
||||
to pass around. */
|
||||
unsigned int sort_key : 8;
|
||||
unsigned int access_control_bits : 7;
|
||||
unsigned int is_defined : 1;
|
||||
unsigned int is_private : 1;
|
||||
unsigned int quadrant : 2;
|
||||
unsigned int is_comdat : 1;
|
||||
unsigned int is_common : 1;
|
||||
unsigned int dup_common : 1;
|
||||
|
||||
/* For subspaces, this points to the section which represents the
|
||||
space in which the subspace is contained. For spaces it points
|
||||
back to the section for this space. */
|
||||
asection *container;
|
||||
/* For subspaces, this points to the section which represents the
|
||||
space in which the subspace is contained. For spaces it points
|
||||
back to the section for this space. */
|
||||
asection *container;
|
||||
|
||||
/* The user-specified space number. It is wrong to use this as
|
||||
an index since duplicates and holes are allowed. */
|
||||
int space_number;
|
||||
/* The user-specified space number. It is wrong to use this as
|
||||
an index since duplicates and holes are allowed. */
|
||||
int space_number;
|
||||
|
||||
/* Add more stuff here as needed. Good examples of information
|
||||
we might want to pass would be initialization pointers,
|
||||
and the many subspace flags we do not represent yet. */
|
||||
};
|
||||
/* Add more stuff here as needed. Good examples of information
|
||||
we might want to pass would be initialization pointers,
|
||||
and the many subspace flags we do not represent yet. */
|
||||
};
|
||||
|
||||
/* Used to keep extra SOM specific information for a given section.
|
||||
|
||||
@ -211,30 +211,29 @@ struct som_copyable_section_data_struct
|
||||
reloc_stream is the actual stream of relocation entries. */
|
||||
|
||||
struct som_section_data_struct
|
||||
{
|
||||
struct som_copyable_section_data_struct *copy_data;
|
||||
unsigned int reloc_size;
|
||||
char *reloc_stream;
|
||||
struct space_dictionary_record *space_dict;
|
||||
struct som_subspace_dictionary_record *subspace_dict;
|
||||
};
|
||||
{
|
||||
struct som_copyable_section_data_struct *copy_data;
|
||||
unsigned int reloc_size;
|
||||
char *reloc_stream;
|
||||
struct space_dictionary_record *space_dict;
|
||||
struct som_subspace_dictionary_record *subspace_dict;
|
||||
};
|
||||
|
||||
#define somdata(bfd) ((bfd)->tdata.som_data->a)
|
||||
#define obj_som_exec_data(bfd) (somdata(bfd).exec_data)
|
||||
#define obj_som_file_hdr(bfd) (somdata(bfd).file_hdr)
|
||||
#define obj_som_exec_hdr(bfd) (somdata(bfd).exec_hdr)
|
||||
#define obj_som_copyright_hdr(bfd) (somdata(bfd).copyright_aux_hdr)
|
||||
#define obj_som_version_hdr(bfd) (somdata(bfd).version_aux_hdr)
|
||||
#define obj_som_compilation_unit(bfd) (somdata(bfd).comp_unit)
|
||||
#define obj_som_symtab(bfd) (somdata(bfd).symtab)
|
||||
#define obj_som_stringtab(bfd) (somdata(bfd).stringtab)
|
||||
#define obj_som_sym_filepos(bfd) (somdata(bfd).sym_filepos)
|
||||
#define obj_som_str_filepos(bfd) (somdata(bfd).str_filepos)
|
||||
#define obj_som_stringtab_size(bfd) (somdata(bfd).stringtab_size)
|
||||
#define obj_som_reloc_filepos(bfd) (somdata(bfd).reloc_filepos)
|
||||
#define obj_som_sorted_syms(bfd) (somdata(bfd).sorted_syms)
|
||||
#define som_section_data(sec) \
|
||||
((struct som_section_data_struct *)sec->used_by_bfd)
|
||||
#define obj_som_exec_data(bfd) (somdata (bfd).exec_data)
|
||||
#define obj_som_file_hdr(bfd) (somdata (bfd).file_hdr)
|
||||
#define obj_som_exec_hdr(bfd) (somdata (bfd).exec_hdr)
|
||||
#define obj_som_copyright_hdr(bfd) (somdata (bfd).copyright_aux_hdr)
|
||||
#define obj_som_version_hdr(bfd) (somdata (bfd).version_aux_hdr)
|
||||
#define obj_som_compilation_unit(bfd) (somdata (bfd).comp_unit)
|
||||
#define obj_som_symtab(bfd) (somdata (bfd).symtab)
|
||||
#define obj_som_stringtab(bfd) (somdata (bfd).stringtab)
|
||||
#define obj_som_sym_filepos(bfd) (somdata (bfd).sym_filepos)
|
||||
#define obj_som_str_filepos(bfd) (somdata (bfd).str_filepos)
|
||||
#define obj_som_stringtab_size(bfd) (somdata (bfd).stringtab_size)
|
||||
#define obj_som_reloc_filepos(bfd) (somdata (bfd).reloc_filepos)
|
||||
#define obj_som_sorted_syms(bfd) (somdata (bfd).sorted_syms)
|
||||
#define som_section_data(sec) ((struct som_section_data_struct *) sec->used_by_bfd)
|
||||
#define som_symbol_data(symbol) ((som_symbol_type *) symbol)
|
||||
|
||||
/* Defines groups of basic relocations. FIXME: These should
|
||||
@ -260,16 +259,11 @@ struct som_section_data_struct
|
||||
#define R_HPPA_END_TRY R_END_TRY
|
||||
|
||||
/* Exported functions, mostly for use by GAS. */
|
||||
bfd_boolean bfd_som_set_section_attributes
|
||||
PARAMS ((asection *, int, int, unsigned int, int));
|
||||
bfd_boolean bfd_som_set_subsection_attributes
|
||||
PARAMS ((asection *, asection *, int, unsigned int, int, int, int, int));
|
||||
void bfd_som_set_symbol_type PARAMS ((asymbol *, unsigned int));
|
||||
bfd_boolean bfd_som_attach_aux_hdr PARAMS ((bfd *, int, char *));
|
||||
int ** hppa_som_gen_reloc_type
|
||||
PARAMS ((bfd *, int, int, enum hppa_reloc_field_selector_type_alt,
|
||||
int, asymbol *));
|
||||
bfd_boolean bfd_som_attach_compilation_unit
|
||||
PARAMS ((bfd *, const char *, const char *, const char *, const char *));
|
||||
bfd_boolean bfd_som_set_section_attributes (asection *, int, int, unsigned int, int);
|
||||
bfd_boolean bfd_som_set_subsection_attributes (asection *, asection *, int, unsigned int, int, int, int, int);
|
||||
void bfd_som_set_symbol_type (asymbol *, unsigned int);
|
||||
bfd_boolean bfd_som_attach_aux_hdr (bfd *, int, char *);
|
||||
int ** hppa_som_gen_reloc_type (bfd *, int, int, enum hppa_reloc_field_selector_type_alt, int, asymbol *);
|
||||
bfd_boolean bfd_som_attach_compilation_unit (bfd *, const char *, const char *, const char *, const char *);
|
||||
|
||||
#endif /* _SOM_H */
|
||||
|
413
bfd/srec.c
413
bfd/srec.c
@ -4,27 +4,26 @@
|
||||
Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
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 2 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.
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
SUBSECTION
|
||||
/* SUBSECTION
|
||||
S-Record handling
|
||||
|
||||
DESCRIPTION
|
||||
DESCRIPTION
|
||||
|
||||
Ordinary S-Records cannot hold anything but addresses and
|
||||
data, so that's all that we implement.
|
||||
@ -44,10 +43,10 @@ DESCRIPTION
|
||||
|
||||
An s record looks like:
|
||||
|
||||
EXAMPLE
|
||||
EXAMPLE
|
||||
S<type><length><address><data><checksum>
|
||||
|
||||
DESCRIPTION
|
||||
DESCRIPTION
|
||||
Where
|
||||
o length
|
||||
is the number of bytes following upto the checksum. Note that
|
||||
@ -72,10 +71,10 @@ DESCRIPTION
|
||||
is the sum of all the raw byte data in the record, from the length
|
||||
upwards, modulo 256 and subtracted from 255.
|
||||
|
||||
SUBSECTION
|
||||
SUBSECTION
|
||||
Symbol S-Record handling
|
||||
|
||||
DESCRIPTION
|
||||
DESCRIPTION
|
||||
Some ICE equipment understands an addition to the standard
|
||||
S-Record format; symbols and their addresses can be sent
|
||||
before the data.
|
||||
@ -87,7 +86,7 @@ DESCRIPTION
|
||||
|
||||
so a short symbol table could look like:
|
||||
|
||||
EXAMPLE
|
||||
EXAMPLE
|
||||
$$ flash.x
|
||||
$$ flash.c
|
||||
_port6 $0
|
||||
@ -98,11 +97,9 @@ EXAMPLE
|
||||
_end $8036
|
||||
$$
|
||||
|
||||
DESCRIPTION
|
||||
DESCRIPTION
|
||||
We allow symbols to be anywhere in the data stream - the module names
|
||||
are always ignored.
|
||||
|
||||
*/
|
||||
are always ignored. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
@ -110,61 +107,18 @@ DESCRIPTION
|
||||
#include "libiberty.h"
|
||||
#include "safe-ctype.h"
|
||||
|
||||
static void srec_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
|
||||
static void srec_print_symbol
|
||||
PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
|
||||
static void srec_init PARAMS ((void));
|
||||
static bfd_boolean srec_mkobject PARAMS ((bfd *));
|
||||
static int srec_get_byte PARAMS ((bfd *, bfd_boolean *));
|
||||
static void srec_bad_byte PARAMS ((bfd *, unsigned int, int, bfd_boolean));
|
||||
static bfd_boolean srec_scan PARAMS ((bfd *));
|
||||
static const bfd_target *srec_object_p PARAMS ((bfd *));
|
||||
static const bfd_target *symbolsrec_object_p PARAMS ((bfd *));
|
||||
static bfd_boolean srec_read_section PARAMS ((bfd *, asection *, bfd_byte *));
|
||||
|
||||
static bfd_boolean srec_write_record
|
||||
PARAMS ((bfd *, unsigned int, bfd_vma, const bfd_byte *, const bfd_byte *));
|
||||
static bfd_boolean srec_write_header PARAMS ((bfd *));
|
||||
static bfd_boolean srec_write_symbols PARAMS ((bfd *));
|
||||
static bfd_boolean srec_new_symbol PARAMS ((bfd *, const char *, bfd_vma));
|
||||
static bfd_boolean srec_get_section_contents
|
||||
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
|
||||
static bfd_boolean srec_set_arch_mach
|
||||
PARAMS ((bfd *, enum bfd_architecture, unsigned long));
|
||||
static bfd_boolean srec_set_section_contents
|
||||
PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type));
|
||||
static bfd_boolean internal_srec_write_object_contents PARAMS ((bfd *, int));
|
||||
static bfd_boolean srec_write_object_contents PARAMS ((bfd *));
|
||||
static bfd_boolean symbolsrec_write_object_contents PARAMS ((bfd *));
|
||||
static int srec_sizeof_headers PARAMS ((bfd *, bfd_boolean));
|
||||
static long srec_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
static long srec_canonicalize_symtab PARAMS ((bfd *, asymbol **));
|
||||
|
||||
/* Macros for converting between hex and binary. */
|
||||
|
||||
static const char digs[] = "0123456789ABCDEF";
|
||||
|
||||
#define NIBBLE(x) hex_value(x)
|
||||
#define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1]))
|
||||
#define NIBBLE(x) hex_value(x)
|
||||
#define HEX(buffer) ((NIBBLE ((buffer)[0])<<4) + NIBBLE ((buffer)[1]))
|
||||
#define TOHEX(d, x, ch) \
|
||||
d[1] = digs[(x) & 0xf]; \
|
||||
d[0] = digs[((x)>>4)&0xf]; \
|
||||
ch += ((x) & 0xff);
|
||||
#define ISHEX(x) hex_p(x)
|
||||
|
||||
/* Initialize by filling in the hex conversion array. */
|
||||
|
||||
static void
|
||||
srec_init ()
|
||||
{
|
||||
static bfd_boolean inited = FALSE;
|
||||
|
||||
if (! inited)
|
||||
{
|
||||
inited = TRUE;
|
||||
hex_init ();
|
||||
}
|
||||
}
|
||||
#define ISHEX(x) hex_p(x)
|
||||
|
||||
/* The maximum number of address+data+crc bytes on a line is FF. */
|
||||
#define MAXCHUNK 0xff
|
||||
@ -219,24 +173,30 @@ typedef struct srec_data_struct
|
||||
}
|
||||
tdata_type;
|
||||
|
||||
static bfd_boolean srec_write_section
|
||||
PARAMS ((bfd *, tdata_type *, srec_data_list_type *));
|
||||
static bfd_boolean srec_write_terminator
|
||||
PARAMS ((bfd *, tdata_type *));
|
||||
/* Initialize by filling in the hex conversion array. */
|
||||
|
||||
static void
|
||||
srec_init (void)
|
||||
{
|
||||
static bfd_boolean inited = FALSE;
|
||||
|
||||
if (! inited)
|
||||
{
|
||||
inited = TRUE;
|
||||
hex_init ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up the S-record tdata information. */
|
||||
|
||||
static bfd_boolean
|
||||
srec_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
srec_mkobject (bfd *abfd)
|
||||
{
|
||||
bfd_size_type amt;
|
||||
tdata_type *tdata;
|
||||
|
||||
srec_init ();
|
||||
|
||||
amt = sizeof (tdata_type);
|
||||
tdata = (tdata_type *) bfd_alloc (abfd, amt);
|
||||
tdata = bfd_alloc (abfd, sizeof (tdata_type));
|
||||
if (tdata == NULL)
|
||||
return FALSE;
|
||||
|
||||
@ -255,9 +215,7 @@ srec_mkobject (abfd)
|
||||
occurred. Return EOF on error or end of file. */
|
||||
|
||||
static int
|
||||
srec_get_byte (abfd, errorptr)
|
||||
bfd *abfd;
|
||||
bfd_boolean *errorptr;
|
||||
srec_get_byte (bfd *abfd, bfd_boolean *errorptr)
|
||||
{
|
||||
bfd_byte c;
|
||||
|
||||
@ -276,11 +234,10 @@ srec_get_byte (abfd, errorptr)
|
||||
error messages. */
|
||||
|
||||
static void
|
||||
srec_bad_byte (abfd, lineno, c, error)
|
||||
bfd *abfd;
|
||||
unsigned int lineno;
|
||||
int c;
|
||||
bfd_boolean error;
|
||||
srec_bad_byte (bfd *abfd,
|
||||
unsigned int lineno,
|
||||
int c,
|
||||
bfd_boolean error)
|
||||
{
|
||||
if (c == EOF)
|
||||
{
|
||||
@ -308,15 +265,11 @@ srec_bad_byte (abfd, lineno, c, error)
|
||||
/* Add a new symbol found in an S-record file. */
|
||||
|
||||
static bfd_boolean
|
||||
srec_new_symbol (abfd, name, val)
|
||||
bfd *abfd;
|
||||
const char *name;
|
||||
bfd_vma val;
|
||||
srec_new_symbol (bfd *abfd, const char *name, bfd_vma val)
|
||||
{
|
||||
struct srec_symbol *n;
|
||||
bfd_size_type amt = sizeof (struct srec_symbol);
|
||||
|
||||
n = (struct srec_symbol *) bfd_alloc (abfd, amt);
|
||||
n = bfd_alloc (abfd, sizeof (* n));
|
||||
if (n == NULL)
|
||||
return FALSE;
|
||||
|
||||
@ -339,8 +292,7 @@ srec_new_symbol (abfd, name, val)
|
||||
section for each contiguous set of bytes. */
|
||||
|
||||
static bfd_boolean
|
||||
srec_scan (abfd)
|
||||
bfd *abfd;
|
||||
srec_scan (bfd *abfd)
|
||||
{
|
||||
int c;
|
||||
unsigned int lineno = 1;
|
||||
@ -385,7 +337,6 @@ srec_scan (abfd)
|
||||
}
|
||||
|
||||
++lineno;
|
||||
|
||||
break;
|
||||
|
||||
case ' ':
|
||||
@ -410,7 +361,7 @@ srec_scan (abfd)
|
||||
}
|
||||
|
||||
alc = 10;
|
||||
symbuf = (char *) bfd_malloc (alc + 1);
|
||||
symbuf = bfd_malloc (alc + 1);
|
||||
if (symbuf == NULL)
|
||||
goto error_return;
|
||||
|
||||
@ -425,7 +376,7 @@ srec_scan (abfd)
|
||||
char *n;
|
||||
|
||||
alc *= 2;
|
||||
n = (char *) bfd_realloc (symbuf, alc + 1);
|
||||
n = bfd_realloc (symbuf, alc + 1);
|
||||
if (n == NULL)
|
||||
goto error_return;
|
||||
p = n + (p - symbuf);
|
||||
@ -523,7 +474,7 @@ srec_scan (abfd)
|
||||
{
|
||||
if (buf != NULL)
|
||||
free (buf);
|
||||
buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
|
||||
buf = bfd_malloc ((bfd_size_type) bytes * 2);
|
||||
if (buf == NULL)
|
||||
goto error_return;
|
||||
bufsize = bytes * 2;
|
||||
@ -578,7 +529,7 @@ srec_scan (abfd)
|
||||
|
||||
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
|
||||
amt = strlen (secbuf) + 1;
|
||||
secname = (char *) bfd_alloc (abfd, amt);
|
||||
secname = bfd_alloc (abfd, amt);
|
||||
strcpy (secname, secbuf);
|
||||
sec = bfd_make_section (abfd, secname);
|
||||
if (sec == NULL)
|
||||
@ -589,7 +540,6 @@ srec_scan (abfd)
|
||||
sec->size = bytes;
|
||||
sec->filepos = pos;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case '7':
|
||||
@ -638,10 +588,9 @@ srec_scan (abfd)
|
||||
/* Check whether an existing file is an S-record file. */
|
||||
|
||||
static const bfd_target *
|
||||
srec_object_p (abfd)
|
||||
bfd *abfd;
|
||||
srec_object_p (bfd *abfd)
|
||||
{
|
||||
PTR tdata_save;
|
||||
void * tdata_save;
|
||||
bfd_byte b[4];
|
||||
|
||||
srec_init ();
|
||||
@ -674,10 +623,9 @@ srec_object_p (abfd)
|
||||
/* Check whether an existing file is an S-record file with symbols. */
|
||||
|
||||
static const bfd_target *
|
||||
symbolsrec_object_p (abfd)
|
||||
bfd *abfd;
|
||||
symbolsrec_object_p (bfd *abfd)
|
||||
{
|
||||
PTR tdata_save;
|
||||
void * tdata_save;
|
||||
char b[2];
|
||||
|
||||
srec_init ();
|
||||
@ -710,10 +658,7 @@ symbolsrec_object_p (abfd)
|
||||
/* Read in the contents of a section in an S-record file. */
|
||||
|
||||
static bfd_boolean
|
||||
srec_read_section (abfd, section, contents)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
bfd_byte *contents;
|
||||
srec_read_section (bfd *abfd, asection *section, bfd_byte *contents)
|
||||
{
|
||||
int c;
|
||||
bfd_size_type sofar = 0;
|
||||
@ -749,7 +694,7 @@ srec_read_section (abfd, section, contents)
|
||||
{
|
||||
if (buf != NULL)
|
||||
free (buf);
|
||||
buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
|
||||
buf = bfd_malloc ((bfd_size_type) bytes * 2);
|
||||
if (buf == NULL)
|
||||
goto error_return;
|
||||
bufsize = bytes * 2;
|
||||
@ -827,12 +772,11 @@ srec_read_section (abfd, section, contents)
|
||||
/* Get the contents of a section in an S-record file. */
|
||||
|
||||
static bfd_boolean
|
||||
srec_get_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
srec_get_section_contents (bfd *abfd,
|
||||
asection *section,
|
||||
void * location,
|
||||
file_ptr offset,
|
||||
bfd_size_type count)
|
||||
{
|
||||
if (section->used_by_bfd == NULL)
|
||||
{
|
||||
@ -853,34 +797,28 @@ srec_get_section_contents (abfd, section, location, offset, count)
|
||||
/* Set the architecture. We accept an unknown architecture here. */
|
||||
|
||||
static bfd_boolean
|
||||
srec_set_arch_mach (abfd, arch, mach)
|
||||
bfd *abfd;
|
||||
enum bfd_architecture arch;
|
||||
unsigned long mach;
|
||||
srec_set_arch_mach (bfd *abfd, enum bfd_architecture arch, unsigned long mach)
|
||||
{
|
||||
if (arch == bfd_arch_unknown)
|
||||
{
|
||||
abfd->arch_info = &bfd_default_arch_struct;
|
||||
return TRUE;
|
||||
}
|
||||
return bfd_default_set_arch_mach (abfd, arch, mach);
|
||||
if (arch != bfd_arch_unknown)
|
||||
return bfd_default_set_arch_mach (abfd, arch, mach);
|
||||
|
||||
abfd->arch_info = & bfd_default_arch_struct;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* We have to save up all the Srecords for a splurge before output. */
|
||||
|
||||
static bfd_boolean
|
||||
srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
const PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type bytes_to_do;
|
||||
srec_set_section_contents (bfd *abfd,
|
||||
sec_ptr section,
|
||||
const void * location,
|
||||
file_ptr offset,
|
||||
bfd_size_type bytes_to_do)
|
||||
{
|
||||
tdata_type *tdata = abfd->tdata.srec_data;
|
||||
register srec_data_list_type *entry;
|
||||
srec_data_list_type *entry;
|
||||
|
||||
entry = ((srec_data_list_type *)
|
||||
bfd_alloc (abfd, (bfd_size_type) sizeof (srec_data_list_type)));
|
||||
entry = bfd_alloc (abfd, sizeof (* entry));
|
||||
if (entry == NULL)
|
||||
return FALSE;
|
||||
|
||||
@ -890,10 +828,10 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
|
||||
{
|
||||
bfd_byte *data;
|
||||
|
||||
data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
|
||||
data = bfd_alloc (abfd, bytes_to_do);
|
||||
if (data == NULL)
|
||||
return FALSE;
|
||||
memcpy ((PTR) data, location, (size_t) bytes_to_do);
|
||||
memcpy ((void *) data, location, (size_t) bytes_to_do);
|
||||
|
||||
/* Ff S3Forced is TRUE then always select S3 records,
|
||||
regardless of the siez of the addresses. */
|
||||
@ -922,7 +860,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
|
||||
}
|
||||
else
|
||||
{
|
||||
register srec_data_list_type **look;
|
||||
srec_data_list_type **look;
|
||||
|
||||
for (look = &tdata->head;
|
||||
*look != NULL && (*look)->where < entry->where;
|
||||
@ -942,12 +880,11 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
|
||||
here. */
|
||||
|
||||
static bfd_boolean
|
||||
srec_write_record (abfd, type, address, data, end)
|
||||
bfd *abfd;
|
||||
unsigned int type;
|
||||
bfd_vma address;
|
||||
const bfd_byte *data;
|
||||
const bfd_byte *end;
|
||||
srec_write_record (bfd *abfd,
|
||||
unsigned int type,
|
||||
bfd_vma address,
|
||||
const bfd_byte *data,
|
||||
const bfd_byte *end)
|
||||
{
|
||||
char buffer[2 * MAXCHUNK + 6];
|
||||
unsigned int check_sum = 0;
|
||||
@ -998,14 +935,12 @@ srec_write_record (abfd, type, address, data, end)
|
||||
*dst++ = '\r';
|
||||
*dst++ = '\n';
|
||||
wrlen = dst - buffer;
|
||||
if (bfd_bwrite ((PTR) buffer, wrlen, abfd) != wrlen)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
|
||||
return bfd_bwrite ((void *) buffer, wrlen, abfd) == wrlen;
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
srec_write_header (abfd)
|
||||
bfd *abfd;
|
||||
srec_write_header (bfd *abfd)
|
||||
{
|
||||
unsigned int len = strlen (abfd->filename);
|
||||
|
||||
@ -1019,10 +954,9 @@ srec_write_header (abfd)
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
srec_write_section (abfd, tdata, list)
|
||||
bfd *abfd;
|
||||
tdata_type *tdata;
|
||||
srec_data_list_type *list;
|
||||
srec_write_section (bfd *abfd,
|
||||
tdata_type *tdata,
|
||||
srec_data_list_type *list)
|
||||
{
|
||||
unsigned int octets_written = 0;
|
||||
bfd_byte *location = list->data;
|
||||
@ -1063,17 +997,14 @@ srec_write_section (abfd, tdata, list)
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
srec_write_terminator (abfd, tdata)
|
||||
bfd *abfd;
|
||||
tdata_type *tdata;
|
||||
srec_write_terminator (bfd *abfd, tdata_type *tdata)
|
||||
{
|
||||
return srec_write_record (abfd, 10 - tdata->type,
|
||||
abfd->start_address, NULL, NULL);
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
srec_write_symbols (abfd)
|
||||
bfd *abfd;
|
||||
srec_write_symbols (bfd *abfd)
|
||||
{
|
||||
/* Dump out the symbols of a bfd. */
|
||||
int i;
|
||||
@ -1083,6 +1014,7 @@ srec_write_symbols (abfd)
|
||||
{
|
||||
bfd_size_type len;
|
||||
asymbol **table = bfd_get_outsymbols (abfd);
|
||||
|
||||
len = strlen (abfd->filename);
|
||||
if (bfd_bwrite ("$$ ", (bfd_size_type) 3, abfd) != 3
|
||||
|| bfd_bwrite (abfd->filename, len, abfd) != len
|
||||
@ -1127,9 +1059,7 @@ srec_write_symbols (abfd)
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
internal_srec_write_object_contents (abfd, symbols)
|
||||
bfd *abfd;
|
||||
int symbols;
|
||||
internal_srec_write_object_contents (bfd *abfd, int symbols)
|
||||
{
|
||||
tdata_type *tdata = abfd->tdata.srec_data;
|
||||
srec_data_list_type *list;
|
||||
@ -1156,23 +1086,20 @@ internal_srec_write_object_contents (abfd, symbols)
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
srec_write_object_contents (abfd)
|
||||
bfd *abfd;
|
||||
srec_write_object_contents (bfd *abfd)
|
||||
{
|
||||
return internal_srec_write_object_contents (abfd, 0);
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
symbolsrec_write_object_contents (abfd)
|
||||
bfd *abfd;
|
||||
symbolsrec_write_object_contents (bfd *abfd)
|
||||
{
|
||||
return internal_srec_write_object_contents (abfd, 1);
|
||||
}
|
||||
|
||||
static int
|
||||
srec_sizeof_headers (abfd, exec)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_boolean exec ATTRIBUTE_UNUSED;
|
||||
srec_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
bfd_boolean exec ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -1180,8 +1107,7 @@ srec_sizeof_headers (abfd, exec)
|
||||
/* Return the amount of memory needed to read the symbol table. */
|
||||
|
||||
static long
|
||||
srec_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
srec_get_symtab_upper_bound (bfd *abfd)
|
||||
{
|
||||
return (bfd_get_symcount (abfd) + 1) * sizeof (asymbol *);
|
||||
}
|
||||
@ -1189,9 +1115,7 @@ srec_get_symtab_upper_bound (abfd)
|
||||
/* Return the symbol table. */
|
||||
|
||||
static long
|
||||
srec_canonicalize_symtab (abfd, alocation)
|
||||
bfd *abfd;
|
||||
asymbol **alocation;
|
||||
srec_canonicalize_symtab (bfd *abfd, asymbol **alocation)
|
||||
{
|
||||
bfd_size_type symcount = bfd_get_symcount (abfd);
|
||||
asymbol *csymbols;
|
||||
@ -1203,7 +1127,7 @@ srec_canonicalize_symtab (abfd, alocation)
|
||||
asymbol *c;
|
||||
struct srec_symbol *s;
|
||||
|
||||
csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
|
||||
csymbols = bfd_alloc (abfd, symcount * sizeof (asymbol));
|
||||
if (csymbols == NULL && symcount != 0)
|
||||
return 0;
|
||||
abfd->tdata.srec_data->csymbols = csymbols;
|
||||
@ -1229,98 +1153,87 @@ srec_canonicalize_symtab (abfd, alocation)
|
||||
}
|
||||
|
||||
static void
|
||||
srec_get_symbol_info (ignore_abfd, symbol, ret)
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol;
|
||||
symbol_info *ret;
|
||||
srec_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
|
||||
asymbol *symbol,
|
||||
symbol_info *ret)
|
||||
{
|
||||
bfd_symbol_info (symbol, ret);
|
||||
}
|
||||
|
||||
static void
|
||||
srec_print_symbol (abfd, afile, symbol, how)
|
||||
bfd *abfd;
|
||||
PTR afile;
|
||||
asymbol *symbol;
|
||||
bfd_print_symbol_type how;
|
||||
srec_print_symbol (bfd *abfd,
|
||||
void * afile,
|
||||
asymbol *symbol,
|
||||
bfd_print_symbol_type how)
|
||||
{
|
||||
FILE *file = (FILE *) afile;
|
||||
|
||||
switch (how)
|
||||
{
|
||||
case bfd_print_symbol_name:
|
||||
fprintf (file, "%s", symbol->name);
|
||||
break;
|
||||
default:
|
||||
bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
|
||||
bfd_print_symbol_vandf (abfd, (void *) file, symbol);
|
||||
fprintf (file, " %-5s %s",
|
||||
symbol->section->name,
|
||||
symbol->name);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#define srec_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||
#define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
||||
#define srec_new_section_hook _bfd_generic_new_section_hook
|
||||
|
||||
#define srec_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
||||
#define srec_bfd_is_local_label_name bfd_generic_is_local_label_name
|
||||
#define srec_get_lineno _bfd_nosymbols_get_lineno
|
||||
#define srec_find_nearest_line _bfd_nosymbols_find_nearest_line
|
||||
#define srec_make_empty_symbol _bfd_generic_make_empty_symbol
|
||||
#define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||
#define srec_read_minisymbols _bfd_generic_read_minisymbols
|
||||
#define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
||||
|
||||
#define srec_get_reloc_upper_bound \
|
||||
((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
|
||||
#define srec_canonicalize_reloc \
|
||||
((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
|
||||
#define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
||||
|
||||
#define srec_get_section_contents_in_window \
|
||||
_bfd_generic_get_section_contents_in_window
|
||||
|
||||
#define srec_bfd_get_relocated_section_contents \
|
||||
bfd_generic_get_relocated_section_contents
|
||||
#define srec_bfd_relax_section bfd_generic_relax_section
|
||||
#define srec_bfd_gc_sections bfd_generic_gc_sections
|
||||
#define srec_bfd_merge_sections bfd_generic_merge_sections
|
||||
#define srec_bfd_is_group_section bfd_generic_is_group_section
|
||||
#define srec_bfd_discard_group bfd_generic_discard_group
|
||||
#define srec_section_already_linked \
|
||||
_bfd_generic_section_already_linked
|
||||
#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
||||
#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define srec_bfd_link_just_syms _bfd_generic_link_just_syms
|
||||
#define srec_bfd_final_link _bfd_generic_final_link
|
||||
#define srec_bfd_link_split_section _bfd_generic_link_split_section
|
||||
#define srec_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||
#define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
||||
#define srec_new_section_hook _bfd_generic_new_section_hook
|
||||
#define srec_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
||||
#define srec_bfd_is_local_label_name bfd_generic_is_local_label_name
|
||||
#define srec_get_lineno _bfd_nosymbols_get_lineno
|
||||
#define srec_find_nearest_line _bfd_nosymbols_find_nearest_line
|
||||
#define srec_make_empty_symbol _bfd_generic_make_empty_symbol
|
||||
#define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||
#define srec_read_minisymbols _bfd_generic_read_minisymbols
|
||||
#define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
||||
#define srec_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l)
|
||||
#define srec_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l)
|
||||
#define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
||||
#define srec_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
||||
#define srec_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
|
||||
#define srec_bfd_relax_section bfd_generic_relax_section
|
||||
#define srec_bfd_gc_sections bfd_generic_gc_sections
|
||||
#define srec_bfd_merge_sections bfd_generic_merge_sections
|
||||
#define srec_bfd_is_group_section bfd_generic_is_group_section
|
||||
#define srec_bfd_discard_group bfd_generic_discard_group
|
||||
#define srec_section_already_linked _bfd_generic_section_already_linked
|
||||
#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
||||
#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define srec_bfd_link_just_syms _bfd_generic_link_just_syms
|
||||
#define srec_bfd_final_link _bfd_generic_final_link
|
||||
#define srec_bfd_link_split_section _bfd_generic_link_split_section
|
||||
|
||||
const bfd_target srec_vec =
|
||||
{
|
||||
"srec", /* name */
|
||||
"srec", /* Name. */
|
||||
bfd_target_srec_flavour,
|
||||
BFD_ENDIAN_UNKNOWN, /* target byte order */
|
||||
BFD_ENDIAN_UNKNOWN, /* target headers byte order */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
BFD_ENDIAN_UNKNOWN, /* Target byte order. */
|
||||
BFD_ENDIAN_UNKNOWN, /* Target headers byte order. */
|
||||
(HAS_RELOC | EXEC_P | /* Object flags. */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
||||
(SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
|
||||
| SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
| SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
|
||||
0, /* Leading underscore. */
|
||||
' ', /* AR_pad_char. */
|
||||
16, /* AR_max_namelen. */
|
||||
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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Hdrs. */
|
||||
|
||||
{
|
||||
_bfd_dummy_target,
|
||||
srec_object_p, /* bfd_check_format */
|
||||
srec_object_p, /* bfd_check_format. */
|
||||
_bfd_dummy_target,
|
||||
_bfd_dummy_target,
|
||||
},
|
||||
@ -1330,7 +1243,7 @@ const bfd_target srec_vec =
|
||||
_bfd_generic_mkarchive,
|
||||
bfd_false,
|
||||
},
|
||||
{ /* bfd_write_contents */
|
||||
{ /* bfd_write_contents. */
|
||||
bfd_false,
|
||||
srec_write_object_contents,
|
||||
_bfd_write_archive_contents,
|
||||
@ -1349,33 +1262,33 @@ const bfd_target srec_vec =
|
||||
|
||||
NULL,
|
||||
|
||||
(PTR) 0
|
||||
NULL
|
||||
};
|
||||
|
||||
const bfd_target symbolsrec_vec =
|
||||
{
|
||||
"symbolsrec", /* name */
|
||||
"symbolsrec", /* Name. */
|
||||
bfd_target_srec_flavour,
|
||||
BFD_ENDIAN_UNKNOWN, /* target byte order */
|
||||
BFD_ENDIAN_UNKNOWN, /* target headers byte order */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
BFD_ENDIAN_UNKNOWN, /* Target byte order. */
|
||||
BFD_ENDIAN_UNKNOWN, /* Target headers byte order. */
|
||||
(HAS_RELOC | EXEC_P | /* Object flags. */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
||||
(SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
|
||||
| SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
| SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
|
||||
0, /* Leading underscore. */
|
||||
' ', /* AR_pad_char. */
|
||||
16, /* AR_max_namelen. */
|
||||
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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
|
||||
|
||||
{
|
||||
_bfd_dummy_target,
|
||||
symbolsrec_object_p, /* bfd_check_format */
|
||||
symbolsrec_object_p, /* bfd_check_format. */
|
||||
_bfd_dummy_target,
|
||||
_bfd_dummy_target,
|
||||
},
|
||||
@ -1385,7 +1298,7 @@ const bfd_target symbolsrec_vec =
|
||||
_bfd_generic_mkarchive,
|
||||
bfd_false,
|
||||
},
|
||||
{ /* bfd_write_contents */
|
||||
{ /* bfd_write_contents. */
|
||||
bfd_false,
|
||||
symbolsrec_write_object_contents,
|
||||
_bfd_write_archive_contents,
|
||||
@ -1404,5 +1317,5 @@ const bfd_target symbolsrec_vec =
|
||||
|
||||
NULL,
|
||||
|
||||
(PTR) 0
|
||||
NULL
|
||||
};
|
||||
|
171
bfd/stabs.c
171
bfd/stabs.c
@ -1,5 +1,5 @@
|
||||
/* Stabs in sections linking support.
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Cygnus Support.
|
||||
|
||||
@ -41,12 +41,12 @@
|
||||
the string table for this unit, and the desc field is the number of
|
||||
stabs symbols for this unit. */
|
||||
|
||||
#define STRDXOFF (0)
|
||||
#define TYPEOFF (4)
|
||||
#define OTHEROFF (5)
|
||||
#define DESCOFF (6)
|
||||
#define VALOFF (8)
|
||||
#define STABSIZE (12)
|
||||
#define STRDXOFF 0
|
||||
#define TYPEOFF 4
|
||||
#define OTHEROFF 5
|
||||
#define DESCOFF 6
|
||||
#define VALOFF 8
|
||||
#define STABSIZE 12
|
||||
|
||||
/* A linked list of totals that we have found for a particular header
|
||||
file. A total is a unique identifier for a particular BINCL...EINCL
|
||||
@ -111,37 +111,31 @@ struct stab_section_info
|
||||
bfd_size_type stridxs[1];
|
||||
};
|
||||
|
||||
static struct bfd_hash_entry *stab_link_includes_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
|
||||
/* The function to create a new entry in the header file hash table. */
|
||||
|
||||
static struct bfd_hash_entry *
|
||||
stab_link_includes_newfunc (entry, table, string)
|
||||
struct bfd_hash_entry *entry;
|
||||
struct bfd_hash_table *table;
|
||||
const char *string;
|
||||
stab_link_includes_newfunc (struct bfd_hash_entry *entry,
|
||||
struct bfd_hash_table *table,
|
||||
const char *string)
|
||||
{
|
||||
struct stab_link_includes_entry *ret =
|
||||
(struct stab_link_includes_entry *) entry;
|
||||
|
||||
/* Allocate the structure if it has not already been allocated by a
|
||||
subclass. */
|
||||
if (ret == (struct stab_link_includes_entry *) NULL)
|
||||
ret = ((struct stab_link_includes_entry *)
|
||||
bfd_hash_allocate (table,
|
||||
sizeof (struct stab_link_includes_entry)));
|
||||
if (ret == (struct stab_link_includes_entry *) NULL)
|
||||
return (struct bfd_hash_entry *) ret;
|
||||
if (ret == NULL)
|
||||
ret = bfd_hash_allocate (table,
|
||||
sizeof (struct stab_link_includes_entry));
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Call the allocation method of the superclass. */
|
||||
ret = ((struct stab_link_includes_entry *)
|
||||
bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
|
||||
if (ret)
|
||||
{
|
||||
/* Set local fields. */
|
||||
ret->totals = NULL;
|
||||
}
|
||||
/* Set local fields. */
|
||||
ret->totals = NULL;
|
||||
|
||||
return (struct bfd_hash_entry *) ret;
|
||||
}
|
||||
@ -150,13 +144,12 @@ stab_link_includes_newfunc (entry, table, string)
|
||||
pass of the linker. */
|
||||
|
||||
bfd_boolean
|
||||
_bfd_link_section_stabs (abfd, sinfo, stabsec, stabstrsec, psecinfo, pstring_offset)
|
||||
bfd *abfd;
|
||||
struct stab_info *sinfo;
|
||||
asection *stabsec;
|
||||
asection *stabstrsec;
|
||||
PTR *psecinfo;
|
||||
bfd_size_type *pstring_offset;
|
||||
_bfd_link_section_stabs (bfd *abfd,
|
||||
struct stab_info *sinfo,
|
||||
asection *stabsec,
|
||||
asection *stabstrsec,
|
||||
void * *psecinfo,
|
||||
bfd_size_type *pstring_offset)
|
||||
{
|
||||
bfd_boolean first;
|
||||
bfd_size_type count, amt;
|
||||
@ -169,34 +162,26 @@ _bfd_link_section_stabs (abfd, sinfo, stabsec, stabstrsec, psecinfo, pstring_off
|
||||
|
||||
if (stabsec->size == 0
|
||||
|| stabstrsec->size == 0)
|
||||
{
|
||||
/* This file does not contain stabs debugging information. */
|
||||
return TRUE;
|
||||
}
|
||||
/* This file does not contain stabs debugging information. */
|
||||
return TRUE;
|
||||
|
||||
if (stabsec->size % STABSIZE != 0)
|
||||
{
|
||||
/* Something is wrong with the format of these stab symbols.
|
||||
Don't try to optimize them. */
|
||||
return TRUE;
|
||||
}
|
||||
/* Something is wrong with the format of these stab symbols.
|
||||
Don't try to optimize them. */
|
||||
return TRUE;
|
||||
|
||||
if ((stabstrsec->flags & SEC_RELOC) != 0)
|
||||
{
|
||||
/* We shouldn't see relocations in the strings, and we aren't
|
||||
prepared to handle them. */
|
||||
return TRUE;
|
||||
}
|
||||
/* We shouldn't see relocations in the strings, and we aren't
|
||||
prepared to handle them. */
|
||||
return TRUE;
|
||||
|
||||
if ((stabsec->output_section != NULL
|
||||
&& bfd_is_abs_section (stabsec->output_section))
|
||||
|| (stabstrsec->output_section != NULL
|
||||
&& bfd_is_abs_section (stabstrsec->output_section)))
|
||||
{
|
||||
/* At least one of the sections is being discarded from the
|
||||
link, so we should just ignore them. */
|
||||
return TRUE;
|
||||
}
|
||||
/* At least one of the sections is being discarded from the
|
||||
link, so we should just ignore them. */
|
||||
return TRUE;
|
||||
|
||||
first = FALSE;
|
||||
|
||||
@ -222,7 +207,6 @@ _bfd_link_section_stabs (abfd, sinfo, stabsec, stabstrsec, psecinfo, pstring_off
|
||||
|
||||
/* Initialize the information we are going to store for this .stab
|
||||
section. */
|
||||
|
||||
count = stabsec->size / STABSIZE;
|
||||
|
||||
amt = sizeof (struct stab_section_info);
|
||||
@ -238,14 +222,12 @@ _bfd_link_section_stabs (abfd, sinfo, stabsec, stabstrsec, psecinfo, pstring_off
|
||||
memset (secinfo->stridxs, 0, (size_t) count * sizeof (bfd_size_type));
|
||||
|
||||
/* Read the stabs information from abfd. */
|
||||
|
||||
if (!bfd_malloc_and_get_section (abfd, stabsec, &stabbuf)
|
||||
|| !bfd_malloc_and_get_section (abfd, stabstrsec, &stabstrbuf))
|
||||
goto error_return;
|
||||
|
||||
/* Look through the stabs symbols, work out the new string indices,
|
||||
and identify N_BINCL symbols which can be eliminated. */
|
||||
|
||||
stroff = 0;
|
||||
/* The stabs sections can be split when
|
||||
-split-by-reloc/-split-by-file is used. We must keep track of
|
||||
@ -264,10 +246,8 @@ _bfd_link_section_stabs (abfd, sinfo, stabsec, stabstrsec, psecinfo, pstring_off
|
||||
const char *string;
|
||||
|
||||
if (*pstridx != 0)
|
||||
{
|
||||
/* This symbol has already been handled by an N_BINCL pass. */
|
||||
continue;
|
||||
}
|
||||
/* This symbol has already been handled by an N_BINCL pass. */
|
||||
continue;
|
||||
|
||||
type = sym[TYPEOFF];
|
||||
|
||||
@ -392,7 +372,7 @@ _bfd_link_section_stabs (abfd, sinfo, stabsec, stabstrsec, psecinfo, pstring_off
|
||||
/* Record this symbol, so that we can set the value
|
||||
correctly. */
|
||||
amt = sizeof *ne;
|
||||
ne = (struct stab_excl_list *) bfd_alloc (abfd, amt);
|
||||
ne = bfd_alloc (abfd, amt);
|
||||
if (ne == NULL)
|
||||
goto error_return;
|
||||
ne->offset = sym - stabbuf;
|
||||
@ -405,8 +385,7 @@ _bfd_link_section_stabs (abfd, sinfo, stabsec, stabstrsec, psecinfo, pstring_off
|
||||
{
|
||||
/* This is the first time we have seen this header file
|
||||
with this set of stabs strings. */
|
||||
t = ((struct stab_link_includes_totals *)
|
||||
bfd_hash_allocate (&sinfo->includes, sizeof *t));
|
||||
t = bfd_hash_allocate (&sinfo->includes, sizeof *t);
|
||||
if (t == NULL)
|
||||
goto error_return;
|
||||
t->sum_chars = sum_chars;
|
||||
@ -489,7 +468,7 @@ _bfd_link_section_stabs (abfd, sinfo, stabsec, stabstrsec, psecinfo, pstring_off
|
||||
bfd_size_type *pskips;
|
||||
|
||||
amt = count * sizeof (bfd_size_type);
|
||||
secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
|
||||
secinfo->cumulative_skips = bfd_alloc (abfd, amt);
|
||||
if (secinfo->cumulative_skips == NULL)
|
||||
goto error_return;
|
||||
|
||||
@ -524,13 +503,11 @@ _bfd_link_section_stabs (abfd, sinfo, stabsec, stabstrsec, psecinfo, pstring_off
|
||||
*/
|
||||
|
||||
bfd_boolean
|
||||
_bfd_discard_section_stabs (abfd, stabsec, psecinfo,
|
||||
reloc_symbol_deleted_p, cookie)
|
||||
bfd *abfd;
|
||||
asection *stabsec;
|
||||
PTR psecinfo;
|
||||
bfd_boolean (*reloc_symbol_deleted_p) PARAMS ((bfd_vma, PTR));
|
||||
PTR cookie;
|
||||
_bfd_discard_section_stabs (bfd *abfd,
|
||||
asection *stabsec,
|
||||
void * psecinfo,
|
||||
bfd_boolean (*reloc_symbol_deleted_p) (bfd_vma, void *),
|
||||
void * cookie)
|
||||
{
|
||||
bfd_size_type count, amt;
|
||||
struct stab_section_info *secinfo;
|
||||
@ -541,25 +518,19 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
|
||||
int deleting;
|
||||
|
||||
if (stabsec->size == 0)
|
||||
{
|
||||
/* This file does not contain stabs debugging information. */
|
||||
return FALSE;
|
||||
}
|
||||
/* This file does not contain stabs debugging information. */
|
||||
return FALSE;
|
||||
|
||||
if (stabsec->size % STABSIZE != 0)
|
||||
{
|
||||
/* Something is wrong with the format of these stab symbols.
|
||||
Don't try to optimize them. */
|
||||
return FALSE;
|
||||
}
|
||||
/* Something is wrong with the format of these stab symbols.
|
||||
Don't try to optimize them. */
|
||||
return FALSE;
|
||||
|
||||
if ((stabsec->output_section != NULL
|
||||
&& bfd_is_abs_section (stabsec->output_section)))
|
||||
{
|
||||
/* At least one of the sections is being discarded from the
|
||||
link, so we should just ignore them. */
|
||||
return FALSE;
|
||||
}
|
||||
/* At least one of the sections is being discarded from the
|
||||
link, so we should just ignore them. */
|
||||
return FALSE;
|
||||
|
||||
/* We should have initialized our data in _bfd_link_stab_sections.
|
||||
If there was some bizarre error reading the string sections, though,
|
||||
@ -571,13 +542,11 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
|
||||
secinfo = (struct stab_section_info *) psecinfo;
|
||||
|
||||
/* Read the stabs information from abfd. */
|
||||
|
||||
if (!bfd_malloc_and_get_section (abfd, stabsec, &stabbuf))
|
||||
goto error_return;
|
||||
|
||||
/* Look through the stabs symbols and discard any information for
|
||||
discarded functions. */
|
||||
|
||||
skip = 0;
|
||||
deleting = -1;
|
||||
|
||||
@ -589,10 +558,8 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
|
||||
int type;
|
||||
|
||||
if (*pstridx == (bfd_size_type) -1)
|
||||
{
|
||||
/* This stab was deleted in a previous pass. */
|
||||
continue;
|
||||
}
|
||||
/* This stab was deleted in a previous pass. */
|
||||
continue;
|
||||
|
||||
type = sym[TYPEOFF];
|
||||
|
||||
@ -654,7 +621,7 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
|
||||
if (secinfo->cumulative_skips == NULL)
|
||||
{
|
||||
amt = count * sizeof (bfd_size_type);
|
||||
secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
|
||||
secinfo->cumulative_skips = bfd_alloc (abfd, amt);
|
||||
if (secinfo->cumulative_skips == NULL)
|
||||
goto error_return;
|
||||
}
|
||||
@ -685,12 +652,11 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
|
||||
contents. */
|
||||
|
||||
bfd_boolean
|
||||
_bfd_write_section_stabs (output_bfd, sinfo, stabsec, psecinfo, contents)
|
||||
bfd *output_bfd;
|
||||
struct stab_info *sinfo;
|
||||
asection *stabsec;
|
||||
PTR *psecinfo;
|
||||
bfd_byte *contents;
|
||||
_bfd_write_section_stabs (bfd *output_bfd,
|
||||
struct stab_info *sinfo,
|
||||
asection *stabsec,
|
||||
void * *psecinfo,
|
||||
bfd_byte *contents)
|
||||
{
|
||||
struct stab_section_info *secinfo;
|
||||
struct stab_excl_list *e;
|
||||
@ -757,15 +723,11 @@ _bfd_write_section_stabs (output_bfd, sinfo, stabsec, psecinfo, contents)
|
||||
/* Write out the .stabstr section. */
|
||||
|
||||
bfd_boolean
|
||||
_bfd_write_stab_strings (output_bfd, sinfo)
|
||||
bfd *output_bfd;
|
||||
struct stab_info *sinfo;
|
||||
_bfd_write_stab_strings (bfd *output_bfd, struct stab_info *sinfo)
|
||||
{
|
||||
if (bfd_is_abs_section (sinfo->stabstr->output_section))
|
||||
{
|
||||
/* The section was discarded from the link. */
|
||||
return TRUE;
|
||||
}
|
||||
/* The section was discarded from the link. */
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT ((sinfo->stabstr->output_offset
|
||||
+ _bfd_stringtab_size (sinfo->strings))
|
||||
@ -792,10 +754,9 @@ _bfd_write_stab_strings (output_bfd, sinfo)
|
||||
or -1 if the address refers to a stab which has been removed. */
|
||||
|
||||
bfd_vma
|
||||
_bfd_stab_section_offset (stabsec, psecinfo, offset)
|
||||
asection *stabsec;
|
||||
PTR psecinfo;
|
||||
bfd_vma offset;
|
||||
_bfd_stab_section_offset (asection *stabsec,
|
||||
void * psecinfo,
|
||||
bfd_vma offset)
|
||||
{
|
||||
struct stab_section_info *secinfo;
|
||||
|
||||
|
984
bfd/sunos.c
984
bfd/sunos.c
File diff suppressed because it is too large
Load Diff
693
bfd/tekhex.c
693
bfd/tekhex.c
File diff suppressed because it is too large
Load Diff
477
bfd/versados.c
477
bfd/versados.c
@ -35,79 +35,53 @@
|
||||
o Identification Record
|
||||
o External Symbol Definition Record
|
||||
o Object Text Record
|
||||
o End Record
|
||||
|
||||
*/
|
||||
o End Record. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "libiberty.h"
|
||||
|
||||
static bfd_boolean versados_mkobject PARAMS ((bfd *));
|
||||
static bfd_boolean versados_scan PARAMS ((bfd *));
|
||||
static const bfd_target *versados_object_p PARAMS ((bfd *));
|
||||
static asymbol *versados_new_symbol
|
||||
PARAMS ((bfd *, int, const char *, bfd_vma, asection *));
|
||||
static char *new_symbol_string PARAMS ((bfd *, const char *));
|
||||
static const bfd_target *versados_object_p PARAMS ((bfd *));
|
||||
static bfd_boolean versados_pass_2 PARAMS ((bfd *));
|
||||
static bfd_boolean versados_get_section_contents
|
||||
PARAMS ((bfd *, asection *, void *, file_ptr, bfd_size_type));
|
||||
static bfd_boolean versados_set_section_contents
|
||||
PARAMS ((bfd *, sec_ptr, const void *, file_ptr, bfd_size_type));
|
||||
static int versados_sizeof_headers PARAMS ((bfd *, bfd_boolean));
|
||||
static long int versados_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
static long int versados_canonicalize_symtab PARAMS ((bfd *, asymbol **));
|
||||
static void versados_get_symbol_info
|
||||
PARAMS ((bfd *, asymbol *, symbol_info *));
|
||||
static void versados_print_symbol
|
||||
PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
|
||||
static long versados_get_reloc_upper_bound
|
||||
PARAMS ((bfd *, sec_ptr));
|
||||
static long versados_canonicalize_reloc
|
||||
PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
|
||||
|
||||
#define VHEADER '1'
|
||||
#define VESTDEF '2'
|
||||
#define VOTR '3'
|
||||
#define VEND '4'
|
||||
|
||||
#define ES_BASE 17 /* first symbol has esdid 17 */
|
||||
#define ES_BASE 17 /* First symbol has esdid 17. */
|
||||
|
||||
/* Per file target dependent information */
|
||||
/* Per file target dependent information. */
|
||||
|
||||
/* one for each section */
|
||||
/* One for each section. */
|
||||
struct esdid
|
||||
{
|
||||
asection *section; /* ptr to bfd version */
|
||||
unsigned char *contents; /* used to build image */
|
||||
int pc;
|
||||
int relocs; /* reloc count, valid end of pass 1 */
|
||||
int donerel; /* have relocs been translated */
|
||||
};
|
||||
{
|
||||
asection *section; /* Ptr to bfd version. */
|
||||
unsigned char *contents; /* Used to build image. */
|
||||
int pc;
|
||||
int relocs; /* Reloc count, valid end of pass 1. */
|
||||
int donerel; /* Have relocs been translated. */
|
||||
};
|
||||
|
||||
typedef struct versados_data_struct
|
||||
{
|
||||
int es_done; /* count of symbol index, starts at ES_BASE */
|
||||
asymbol *symbols; /* pointer to local symbols */
|
||||
char *strings; /* strings of all the above */
|
||||
int stringlen; /* len of string table (valid end of pass1) */
|
||||
int nsecsyms; /* number of sections */
|
||||
{
|
||||
int es_done; /* Count of symbol index, starts at ES_BASE. */
|
||||
asymbol *symbols; /* Pointer to local symbols. */
|
||||
char *strings; /* Strings of all the above. */
|
||||
int stringlen; /* Len of string table (valid end of pass1). */
|
||||
int nsecsyms; /* Number of sections. */
|
||||
|
||||
int ndefs; /* number of exported symbols (they dont get esdids) */
|
||||
int nrefs; /* number of imported symbols (valid end of pass1) */
|
||||
int ndefs; /* Number of exported symbols (they dont get esdids). */
|
||||
int nrefs; /* Number of imported symbols (valid end of pass1). */
|
||||
|
||||
int ref_idx; /* current processed value of the above */
|
||||
int def_idx;
|
||||
int ref_idx; /* Current processed value of the above. */
|
||||
int def_idx;
|
||||
|
||||
int pass_2_done;
|
||||
int pass_2_done;
|
||||
|
||||
struct esdid e[16]; /* per section info */
|
||||
int alert; /* to see if we're trampling */
|
||||
asymbol *rest[256 - 16]; /* per symbol info */
|
||||
|
||||
}
|
||||
struct esdid e[16]; /* Per section info. */
|
||||
int alert; /* To see if we're trampling. */
|
||||
asymbol *rest[256 - 16]; /* Per symbol info. */
|
||||
}
|
||||
tdata_type;
|
||||
|
||||
#define VDATA(abfd) (abfd->tdata.versados_data)
|
||||
@ -115,72 +89,67 @@ tdata_type;
|
||||
#define RDATA(abfd, n) (abfd->tdata.versados_data->rest[n])
|
||||
|
||||
struct ext_otr
|
||||
{
|
||||
unsigned char size;
|
||||
char type;
|
||||
unsigned char map[4];
|
||||
unsigned char esdid;
|
||||
unsigned char data[200];
|
||||
};
|
||||
{
|
||||
unsigned char size;
|
||||
char type;
|
||||
unsigned char map[4];
|
||||
unsigned char esdid;
|
||||
unsigned char data[200];
|
||||
};
|
||||
|
||||
struct ext_vheader
|
||||
{
|
||||
unsigned char size;
|
||||
char type; /* record type */
|
||||
char name[10]; /* module name */
|
||||
char rev; /* module rev number */
|
||||
char lang;
|
||||
char vol[4];
|
||||
char user[2];
|
||||
char cat[8];
|
||||
char fname[8];
|
||||
char ext[2];
|
||||
char time[3];
|
||||
char date[3];
|
||||
char rest[211];
|
||||
};
|
||||
{
|
||||
unsigned char size;
|
||||
char type; /* Record type. */
|
||||
char name[10]; /* Module name. */
|
||||
char rev; /* Module rev number. */
|
||||
char lang;
|
||||
char vol[4];
|
||||
char user[2];
|
||||
char cat[8];
|
||||
char fname[8];
|
||||
char ext[2];
|
||||
char time[3];
|
||||
char date[3];
|
||||
char rest[211];
|
||||
};
|
||||
|
||||
struct ext_esd
|
||||
{
|
||||
unsigned char size;
|
||||
char type;
|
||||
unsigned char esd_entries[1];
|
||||
};
|
||||
#define ESD_ABS 0
|
||||
#define ESD_COMMON 1
|
||||
#define ESD_STD_REL_SEC 2
|
||||
#define ESD_SHRT_REL_SEC 3
|
||||
#define ESD_XDEF_IN_SEC 4
|
||||
#define ESD_XREF_SYM 7
|
||||
#define ESD_XREF_SEC 6
|
||||
#define ESD_XDEF_IN_ABS 5
|
||||
union ext_any
|
||||
{
|
||||
unsigned char size;
|
||||
struct ext_vheader header;
|
||||
struct ext_esd esd;
|
||||
struct ext_otr otr;
|
||||
};
|
||||
{
|
||||
unsigned char size;
|
||||
char type;
|
||||
unsigned char esd_entries[1];
|
||||
};
|
||||
|
||||
static int get_record PARAMS ((bfd *, union ext_any *));
|
||||
static int get_4 PARAMS ((unsigned char **));
|
||||
static void get_10 PARAMS ((unsigned char **, char *));
|
||||
static void process_esd PARAMS ((bfd *, struct ext_esd *, int));
|
||||
static int get_offset PARAMS ((int, unsigned char *));
|
||||
static void process_otr PARAMS ((bfd *, struct ext_otr *, int));
|
||||
#define ESD_ABS 0
|
||||
#define ESD_COMMON 1
|
||||
#define ESD_STD_REL_SEC 2
|
||||
#define ESD_SHRT_REL_SEC 3
|
||||
#define ESD_XDEF_IN_SEC 4
|
||||
#define ESD_XDEF_IN_ABS 5
|
||||
#define ESD_XREF_SEC 6
|
||||
#define ESD_XREF_SYM 7
|
||||
|
||||
union ext_any
|
||||
{
|
||||
unsigned char size;
|
||||
struct ext_vheader header;
|
||||
struct ext_esd esd;
|
||||
struct ext_otr otr;
|
||||
};
|
||||
|
||||
/* Initialize by filling in the hex conversion array. */
|
||||
|
||||
/* Set up the tdata information. */
|
||||
|
||||
static bfd_boolean
|
||||
versados_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
versados_mkobject (bfd *abfd)
|
||||
{
|
||||
if (abfd->tdata.versados_data == NULL)
|
||||
{
|
||||
bfd_size_type amt = sizeof (tdata_type);
|
||||
tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, amt);
|
||||
tdata_type *tdata = bfd_alloc (abfd, amt);
|
||||
|
||||
if (tdata == NULL)
|
||||
return FALSE;
|
||||
abfd->tdata.versados_data = tdata;
|
||||
@ -197,12 +166,11 @@ versados_mkobject (abfd)
|
||||
error messages. */
|
||||
|
||||
static asymbol *
|
||||
versados_new_symbol (abfd, snum, name, val, sec)
|
||||
bfd *abfd;
|
||||
int snum;
|
||||
const char *name;
|
||||
bfd_vma val;
|
||||
asection *sec;
|
||||
versados_new_symbol (bfd *abfd,
|
||||
int snum,
|
||||
const char *name,
|
||||
bfd_vma val,
|
||||
asection *sec)
|
||||
{
|
||||
asymbol *n = VDATA (abfd)->symbols + snum;
|
||||
n->name = name;
|
||||
@ -214,9 +182,7 @@ versados_new_symbol (abfd, snum, name, val, sec)
|
||||
}
|
||||
|
||||
static int
|
||||
get_record (abfd, ptr)
|
||||
bfd *abfd;
|
||||
union ext_any *ptr;
|
||||
get_record (bfd *abfd, union ext_any *ptr)
|
||||
{
|
||||
if (bfd_bread (&ptr->size, (bfd_size_type) 1, abfd) != 1
|
||||
|| (bfd_bread ((char *) ptr + 1, (bfd_size_type) ptr->size, abfd)
|
||||
@ -226,24 +192,22 @@ get_record (abfd, ptr)
|
||||
}
|
||||
|
||||
static int
|
||||
get_4 (pp)
|
||||
unsigned char **pp;
|
||||
get_4 (unsigned char **pp)
|
||||
{
|
||||
unsigned char *p = *pp;
|
||||
|
||||
*pp += 4;
|
||||
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0);
|
||||
}
|
||||
|
||||
static void
|
||||
get_10 (pp, name)
|
||||
unsigned char **pp;
|
||||
char *name;
|
||||
get_10 (unsigned char **pp, char *name)
|
||||
{
|
||||
char *p = (char *) *pp;
|
||||
int len = 10;
|
||||
|
||||
*pp += len;
|
||||
while (*p != ' '
|
||||
&& len)
|
||||
while (*p != ' ' && len)
|
||||
{
|
||||
*name++ = *p++;
|
||||
len--;
|
||||
@ -252,23 +216,19 @@ get_10 (pp, name)
|
||||
}
|
||||
|
||||
static char *
|
||||
new_symbol_string (abfd, name)
|
||||
bfd *abfd;
|
||||
const char *name;
|
||||
new_symbol_string (bfd *abfd, const char *name)
|
||||
{
|
||||
char *n = VDATA (abfd)->strings;
|
||||
|
||||
strcpy (VDATA (abfd)->strings, name);
|
||||
VDATA (abfd)->strings += strlen (VDATA (abfd)->strings) + 1;
|
||||
return n;
|
||||
}
|
||||
|
||||
static void
|
||||
process_esd (abfd, esd, pass)
|
||||
bfd *abfd;
|
||||
struct ext_esd *esd;
|
||||
int pass;
|
||||
process_esd (bfd *abfd, struct ext_esd *esd, int pass)
|
||||
{
|
||||
/* Read through the ext def for the est entries */
|
||||
/* Read through the ext def for the est entries. */
|
||||
int togo = esd->size - 2;
|
||||
bfd_vma size;
|
||||
bfd_vma start;
|
||||
@ -276,17 +236,19 @@ process_esd (abfd, esd, pass)
|
||||
char name[11];
|
||||
unsigned char *ptr = esd->esd_entries;
|
||||
unsigned char *end = ptr + togo;
|
||||
|
||||
while (ptr < end)
|
||||
{
|
||||
int scn = *ptr & 0xf;
|
||||
int typ = (*ptr >> 4) & 0xf;
|
||||
|
||||
/* Declare this section */
|
||||
/* Declare this section. */
|
||||
sprintf (name, "%d", scn);
|
||||
sec = bfd_make_section_old_way (abfd, strdup (name));
|
||||
sec->target_index = scn;
|
||||
EDATA (abfd, scn).section = sec;
|
||||
ptr++;
|
||||
|
||||
switch (typ)
|
||||
{
|
||||
default:
|
||||
@ -297,14 +259,13 @@ process_esd (abfd, esd, pass)
|
||||
int snum = VDATA (abfd)->ref_idx++;
|
||||
get_10 (&ptr, name);
|
||||
if (pass == 1)
|
||||
{
|
||||
VDATA (abfd)->stringlen += strlen (name) + 1;
|
||||
}
|
||||
VDATA (abfd)->stringlen += strlen (name) + 1;
|
||||
else
|
||||
{
|
||||
int esidx;
|
||||
asymbol *s;
|
||||
char *n = new_symbol_string (abfd, name);
|
||||
|
||||
s = versados_new_symbol (abfd, snum, n, (bfd_vma) 0,
|
||||
bfd_und_section_ptr);
|
||||
esidx = VDATA (abfd)->es_done++;
|
||||
@ -319,10 +280,8 @@ process_esd (abfd, esd, pass)
|
||||
break;
|
||||
case ESD_STD_REL_SEC:
|
||||
case ESD_SHRT_REL_SEC:
|
||||
{
|
||||
sec->size = get_4 (&ptr);
|
||||
sec->flags |= SEC_ALLOC;
|
||||
}
|
||||
sec->size = get_4 (&ptr);
|
||||
sec->flags |= SEC_ALLOC;
|
||||
break;
|
||||
case ESD_XDEF_IN_ABS:
|
||||
sec = (asection *) & bfd_abs_section;
|
||||
@ -330,17 +289,17 @@ process_esd (abfd, esd, pass)
|
||||
{
|
||||
int snum = VDATA (abfd)->def_idx++;
|
||||
bfd_vma val;
|
||||
|
||||
get_10 (&ptr, name);
|
||||
val = get_4 (&ptr);
|
||||
if (pass == 1)
|
||||
{
|
||||
/* Just remember the symbol */
|
||||
VDATA (abfd)->stringlen += strlen (name) + 1;
|
||||
}
|
||||
/* Just remember the symbol. */
|
||||
VDATA (abfd)->stringlen += strlen (name) + 1;
|
||||
else
|
||||
{
|
||||
asymbol *s;
|
||||
char *n = new_symbol_string (abfd, name);
|
||||
|
||||
s = versados_new_symbol (abfd, snum + VDATA (abfd)->nrefs, n,
|
||||
val, sec);
|
||||
s->flags |= BSF_GLOBAL;
|
||||
@ -351,8 +310,8 @@ process_esd (abfd, esd, pass)
|
||||
}
|
||||
}
|
||||
|
||||
#define R_RELWORD 1
|
||||
#define R_RELLONG 2
|
||||
#define R_RELWORD 1
|
||||
#define R_RELLONG 2
|
||||
#define R_RELWORD_NEG 3
|
||||
#define R_RELLONG_NEG 4
|
||||
|
||||
@ -374,14 +333,14 @@ reloc_howto_type versados_howto_table[] =
|
||||
};
|
||||
|
||||
static int
|
||||
get_offset (len, ptr)
|
||||
int len;
|
||||
unsigned char *ptr;
|
||||
get_offset (int len, unsigned char *ptr)
|
||||
{
|
||||
int val = 0;
|
||||
|
||||
if (len)
|
||||
{
|
||||
int i;
|
||||
|
||||
val = *ptr++;
|
||||
if (val & 0x80)
|
||||
val |= ~0xff;
|
||||
@ -393,10 +352,7 @@ get_offset (len, ptr)
|
||||
}
|
||||
|
||||
static void
|
||||
process_otr (abfd, otr, pass)
|
||||
bfd *abfd;
|
||||
struct ext_otr *otr;
|
||||
int pass;
|
||||
process_otr (bfd *abfd, struct ext_otr *otr, int pass)
|
||||
{
|
||||
unsigned long shift;
|
||||
unsigned char *srcp = otr->data;
|
||||
@ -423,13 +379,14 @@ process_otr (abfd, otr, pass)
|
||||
|
||||
if (esdids == 0)
|
||||
{
|
||||
/* A zero esdid means the new pc is the offset given */
|
||||
/* A zero esdid means the new pc is the offset given. */
|
||||
dst_idx += get_offset (offsetlen, srcp);
|
||||
srcp += offsetlen;
|
||||
}
|
||||
else
|
||||
{
|
||||
int val = get_offset (offsetlen, srcp + esdids);
|
||||
|
||||
if (pass == 1)
|
||||
need_contents = 1;
|
||||
else
|
||||
@ -446,10 +403,11 @@ process_otr (abfd, otr, pass)
|
||||
if (esdid)
|
||||
{
|
||||
int rn = EDATA (abfd, otr->esdid - 1).relocs++;
|
||||
|
||||
if (pass == 1)
|
||||
{
|
||||
/* this is the first pass over the data,
|
||||
just remember that we need a reloc */
|
||||
/* This is the first pass over the data,
|
||||
just remember that we need a reloc. */
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -473,7 +431,7 @@ process_otr (abfd, otr, pass)
|
||||
if (dst_idx < esdid->section->size)
|
||||
if (pass == 2)
|
||||
{
|
||||
/* absolute code, comes in 16 bit lumps */
|
||||
/* Absolute code, comes in 16 bit lumps. */
|
||||
contents[dst_idx] = srcp[0];
|
||||
contents[dst_idx + 1] = srcp[1];
|
||||
}
|
||||
@ -486,13 +444,12 @@ process_otr (abfd, otr, pass)
|
||||
if (!contents && need_contents)
|
||||
{
|
||||
bfd_size_type size = esdid->section->size;
|
||||
esdid->contents = (unsigned char *) bfd_alloc (abfd, size);
|
||||
esdid->contents = bfd_alloc (abfd, size);
|
||||
}
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
versados_scan (abfd)
|
||||
bfd *abfd;
|
||||
versados_scan (bfd *abfd)
|
||||
{
|
||||
int loop = 1;
|
||||
int i;
|
||||
@ -510,6 +467,7 @@ versados_scan (abfd)
|
||||
while (loop)
|
||||
{
|
||||
union ext_any any;
|
||||
|
||||
if (!get_record (abfd, &any))
|
||||
return TRUE;
|
||||
switch (any.header.type)
|
||||
@ -528,8 +486,7 @@ versados_scan (abfd)
|
||||
}
|
||||
}
|
||||
|
||||
/* Now allocate space for the relocs and sections */
|
||||
|
||||
/* Now allocate space for the relocs and sections. */
|
||||
VDATA (abfd)->nrefs = VDATA (abfd)->ref_idx;
|
||||
VDATA (abfd)->ndefs = VDATA (abfd)->def_idx;
|
||||
VDATA (abfd)->ref_idx = 0;
|
||||
@ -540,10 +497,11 @@ versados_scan (abfd)
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
struct esdid *esdid = &EDATA (abfd, i);
|
||||
|
||||
if (esdid->section)
|
||||
{
|
||||
amt = (bfd_size_type) esdid->relocs * sizeof (arelent);
|
||||
esdid->section->relocation = (arelent *) bfd_alloc (abfd, amt);
|
||||
esdid->section->relocation = bfd_alloc (abfd, amt);
|
||||
|
||||
esdid->pc = 0;
|
||||
|
||||
@ -556,7 +514,7 @@ versados_scan (abfd)
|
||||
|
||||
esdid->relocs = 0;
|
||||
|
||||
/* Add an entry into the symbol table for it */
|
||||
/* Add an entry into the symbol table for it. */
|
||||
nsecs++;
|
||||
VDATA (abfd)->stringlen += strlen (esdid->section->name) + 1;
|
||||
}
|
||||
@ -566,7 +524,7 @@ versados_scan (abfd)
|
||||
|
||||
amt = abfd->symcount;
|
||||
amt *= sizeof (asymbol);
|
||||
VDATA (abfd)->symbols = (asymbol *) bfd_alloc (abfd, amt);
|
||||
VDATA (abfd)->symbols = bfd_alloc (abfd, amt);
|
||||
|
||||
amt = VDATA (abfd)->stringlen;
|
||||
VDATA (abfd)->strings = bfd_alloc (abfd, amt);
|
||||
@ -576,12 +534,12 @@ versados_scan (abfd)
|
||||
return FALSE;
|
||||
|
||||
/* Actually fill in the section symbols,
|
||||
we stick them at the end of the table */
|
||||
|
||||
we stick them at the end of the table. */
|
||||
for (j = VDATA (abfd)->nrefs + VDATA (abfd)->ndefs, i = 0; i < 16; i++)
|
||||
{
|
||||
struct esdid *esdid = &EDATA (abfd, i);
|
||||
asection *sec = esdid->section;
|
||||
|
||||
if (sec)
|
||||
{
|
||||
asymbol *s = VDATA (abfd)->symbols + j;
|
||||
@ -593,11 +551,12 @@ versados_scan (abfd)
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
if (abfd->symcount)
|
||||
abfd->flags |= HAS_SYMS;
|
||||
|
||||
/* Set this to nsecs - since we've already planted the section
|
||||
symbols */
|
||||
symbols. */
|
||||
VDATA (abfd)->nsecsyms = nsecs;
|
||||
|
||||
VDATA (abfd)->ref_idx = 0;
|
||||
@ -608,8 +567,7 @@ versados_scan (abfd)
|
||||
/* Check whether an existing file is a versados file. */
|
||||
|
||||
static const bfd_target *
|
||||
versados_object_p (abfd)
|
||||
bfd *abfd;
|
||||
versados_object_p (bfd *abfd)
|
||||
{
|
||||
struct ext_vheader ext;
|
||||
unsigned char len;
|
||||
@ -643,7 +601,6 @@ versados_object_p (abfd)
|
||||
}
|
||||
|
||||
/* OK, looks like a record, build the tdata and read in. */
|
||||
|
||||
tdata_save = abfd->tdata.versados_data;
|
||||
if (!versados_mkobject (abfd) || !versados_scan (abfd))
|
||||
{
|
||||
@ -655,8 +612,7 @@ versados_object_p (abfd)
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
versados_pass_2 (abfd)
|
||||
bfd *abfd;
|
||||
versados_pass_2 (bfd *abfd)
|
||||
{
|
||||
union ext_any any;
|
||||
|
||||
@ -668,8 +624,7 @@ versados_pass_2 (abfd)
|
||||
|
||||
VDATA (abfd)->es_done = ES_BASE;
|
||||
|
||||
/* read records till we get to where we want to be */
|
||||
|
||||
/* Read records till we get to where we want to be. */
|
||||
while (1)
|
||||
{
|
||||
get_record (abfd, &any);
|
||||
@ -689,12 +644,11 @@ versados_pass_2 (abfd)
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
versados_get_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
versados_get_section_contents (bfd *abfd,
|
||||
asection *section,
|
||||
void * location,
|
||||
file_ptr offset,
|
||||
bfd_size_type count)
|
||||
{
|
||||
if (!versados_pass_2 (abfd))
|
||||
return FALSE;
|
||||
@ -710,20 +664,18 @@ versados_get_section_contents (abfd, section, location, offset, count)
|
||||
_bfd_generic_get_section_contents_in_window
|
||||
|
||||
static bfd_boolean
|
||||
versados_set_section_contents (abfd, section, location, offset, bytes_to_do)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
sec_ptr section ATTRIBUTE_UNUSED;
|
||||
const PTR location ATTRIBUTE_UNUSED;
|
||||
file_ptr offset ATTRIBUTE_UNUSED;
|
||||
bfd_size_type bytes_to_do ATTRIBUTE_UNUSED;
|
||||
versados_set_section_contents (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
sec_ptr section ATTRIBUTE_UNUSED,
|
||||
const void * location ATTRIBUTE_UNUSED,
|
||||
file_ptr offset ATTRIBUTE_UNUSED,
|
||||
bfd_size_type bytes_to_do ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
versados_sizeof_headers (abfd, exec)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_boolean exec ATTRIBUTE_UNUSED;
|
||||
versados_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
bfd_boolean exec ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -731,8 +683,7 @@ versados_sizeof_headers (abfd, exec)
|
||||
/* Return the amount of memory needed to read the symbol table. */
|
||||
|
||||
static long
|
||||
versados_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
versados_get_symtab_upper_bound (bfd *abfd)
|
||||
{
|
||||
return (bfd_get_symcount (abfd) + 1) * sizeof (asymbol *);
|
||||
}
|
||||
@ -740,9 +691,7 @@ versados_get_symtab_upper_bound (abfd)
|
||||
/* Return the symbol table. */
|
||||
|
||||
static long
|
||||
versados_canonicalize_symtab (abfd, alocation)
|
||||
bfd *abfd;
|
||||
asymbol **alocation;
|
||||
versados_canonicalize_symtab (bfd *abfd, asymbol **alocation)
|
||||
{
|
||||
unsigned int symcount = bfd_get_symcount (abfd);
|
||||
unsigned int i;
|
||||
@ -753,9 +702,7 @@ versados_canonicalize_symtab (abfd, alocation)
|
||||
for (i = 0, s = VDATA (abfd)->symbols;
|
||||
i < symcount;
|
||||
s++, i++)
|
||||
{
|
||||
*alocation++ = s;
|
||||
}
|
||||
*alocation++ = s;
|
||||
|
||||
*alocation = NULL;
|
||||
|
||||
@ -763,50 +710,46 @@ versados_canonicalize_symtab (abfd, alocation)
|
||||
}
|
||||
|
||||
static void
|
||||
versados_get_symbol_info (ignore_abfd, symbol, ret)
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol;
|
||||
symbol_info *ret;
|
||||
versados_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
asymbol *symbol,
|
||||
symbol_info *ret)
|
||||
{
|
||||
bfd_symbol_info (symbol, ret);
|
||||
}
|
||||
|
||||
static void
|
||||
versados_print_symbol (abfd, afile, symbol, how)
|
||||
bfd *abfd;
|
||||
PTR afile;
|
||||
asymbol *symbol;
|
||||
bfd_print_symbol_type how;
|
||||
versados_print_symbol (bfd *abfd,
|
||||
void * afile,
|
||||
asymbol *symbol,
|
||||
bfd_print_symbol_type how)
|
||||
{
|
||||
FILE *file = (FILE *) afile;
|
||||
|
||||
switch (how)
|
||||
{
|
||||
case bfd_print_symbol_name:
|
||||
fprintf (file, "%s", symbol->name);
|
||||
break;
|
||||
default:
|
||||
bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
|
||||
bfd_print_symbol_vandf (abfd, (void *) file, symbol);
|
||||
fprintf (file, " %-5s %s",
|
||||
symbol->section->name,
|
||||
symbol->name);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static long
|
||||
versados_get_reloc_upper_bound (abfd, asect)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
sec_ptr asect;
|
||||
versados_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
sec_ptr asect)
|
||||
{
|
||||
return (asect->reloc_count + 1) * sizeof (arelent *);
|
||||
}
|
||||
|
||||
static long
|
||||
versados_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
arelent **relptr;
|
||||
asymbol **symbols;
|
||||
versados_canonicalize_reloc (bfd *abfd,
|
||||
sec_ptr section,
|
||||
arelent **relptr,
|
||||
asymbol **symbols)
|
||||
{
|
||||
unsigned int count;
|
||||
arelent *src;
|
||||
@ -816,99 +759,83 @@ versados_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
if (!EDATA (abfd, section->target_index).donerel)
|
||||
{
|
||||
EDATA (abfd, section->target_index).donerel = 1;
|
||||
/* translate from indexes to symptr ptrs */
|
||||
/* Translate from indexes to symptr ptrs. */
|
||||
for (count = 0; count < section->reloc_count; count++)
|
||||
{
|
||||
int esdid = (int) (size_t) src[count].sym_ptr_ptr;
|
||||
|
||||
if (esdid == 0)
|
||||
src[count].sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
|
||||
else if (esdid < ES_BASE)
|
||||
{
|
||||
src[count].sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
|
||||
}
|
||||
else if (esdid < ES_BASE) /* Section relative thing */
|
||||
{
|
||||
/* Section relative thing. */
|
||||
struct esdid *e = &EDATA (abfd, esdid - 1);
|
||||
if (!section)
|
||||
{
|
||||
/** relocation relative to section which was
|
||||
never declared ! */
|
||||
}
|
||||
|
||||
src[count].sym_ptr_ptr = e->section->symbol_ptr_ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
src[count].sym_ptr_ptr = symbols + esdid - ES_BASE;
|
||||
}
|
||||
|
||||
src[count].sym_ptr_ptr = symbols + esdid - ES_BASE;
|
||||
}
|
||||
}
|
||||
|
||||
for (count = 0; count < section->reloc_count; count++)
|
||||
{
|
||||
*relptr++ = src++;
|
||||
}
|
||||
*relptr++ = src++;
|
||||
|
||||
*relptr = 0;
|
||||
return section->reloc_count;
|
||||
}
|
||||
|
||||
#define versados_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||
#define versados_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
||||
#define versados_new_section_hook _bfd_generic_new_section_hook
|
||||
|
||||
#define versados_bfd_is_target_special_symbol \
|
||||
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
||||
#define versados_bfd_is_local_label_name bfd_generic_is_local_label_name
|
||||
#define versados_get_lineno _bfd_nosymbols_get_lineno
|
||||
#define versados_find_nearest_line _bfd_nosymbols_find_nearest_line
|
||||
#define versados_make_empty_symbol _bfd_generic_make_empty_symbol
|
||||
#define versados_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||
#define versados_read_minisymbols _bfd_generic_read_minisymbols
|
||||
#define versados_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
||||
|
||||
#define versados_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
||||
|
||||
#define versados_set_arch_mach bfd_default_set_arch_mach
|
||||
|
||||
#define versados_bfd_get_relocated_section_contents \
|
||||
bfd_generic_get_relocated_section_contents
|
||||
#define versados_bfd_relax_section bfd_generic_relax_section
|
||||
#define versados_bfd_gc_sections bfd_generic_gc_sections
|
||||
#define versados_bfd_merge_sections bfd_generic_merge_sections
|
||||
#define versados_bfd_is_group_section bfd_generic_is_group_section
|
||||
#define versados_bfd_discard_group bfd_generic_discard_group
|
||||
#define versados_section_already_linked \
|
||||
_bfd_generic_section_already_linked
|
||||
#define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define versados_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
||||
#define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define versados_bfd_link_just_syms _bfd_generic_link_just_syms
|
||||
#define versados_bfd_final_link _bfd_generic_final_link
|
||||
#define versados_bfd_link_split_section _bfd_generic_link_split_section
|
||||
#define versados_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||
#define versados_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
||||
#define versados_new_section_hook _bfd_generic_new_section_hook
|
||||
#define versados_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
||||
#define versados_bfd_is_local_label_name bfd_generic_is_local_label_name
|
||||
#define versados_get_lineno _bfd_nosymbols_get_lineno
|
||||
#define versados_find_nearest_line _bfd_nosymbols_find_nearest_line
|
||||
#define versados_make_empty_symbol _bfd_generic_make_empty_symbol
|
||||
#define versados_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||
#define versados_read_minisymbols _bfd_generic_read_minisymbols
|
||||
#define versados_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
||||
#define versados_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
||||
#define versados_set_arch_mach bfd_default_set_arch_mach
|
||||
#define versados_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
|
||||
#define versados_bfd_relax_section bfd_generic_relax_section
|
||||
#define versados_bfd_gc_sections bfd_generic_gc_sections
|
||||
#define versados_bfd_merge_sections bfd_generic_merge_sections
|
||||
#define versados_bfd_is_group_section bfd_generic_is_group_section
|
||||
#define versados_bfd_discard_group bfd_generic_discard_group
|
||||
#define versados_section_already_linked _bfd_generic_section_already_linked
|
||||
#define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define versados_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
||||
#define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define versados_bfd_link_just_syms _bfd_generic_link_just_syms
|
||||
#define versados_bfd_final_link _bfd_generic_final_link
|
||||
#define versados_bfd_link_split_section _bfd_generic_link_split_section
|
||||
|
||||
const bfd_target versados_vec =
|
||||
{
|
||||
"versados", /* name */
|
||||
"versados", /* Name. */
|
||||
bfd_target_versados_flavour,
|
||||
BFD_ENDIAN_BIG, /* target byte order */
|
||||
BFD_ENDIAN_BIG, /* target headers byte order */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
BFD_ENDIAN_BIG, /* Target byte order. */
|
||||
BFD_ENDIAN_BIG, /* Target headers byte order. */
|
||||
(HAS_RELOC | EXEC_P | /* Object flags. */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
||||
(SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
|
||||
| SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
| SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
|
||||
0, /* Leading underscore. */
|
||||
' ', /* AR_pad_char. */
|
||||
16, /* AR_max_namelen. */
|
||||
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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
|
||||
|
||||
{
|
||||
_bfd_dummy_target,
|
||||
versados_object_p, /* bfd_check_format */
|
||||
versados_object_p, /* bfd_check_format. */
|
||||
_bfd_dummy_target,
|
||||
_bfd_dummy_target,
|
||||
},
|
||||
@ -918,7 +845,7 @@ const bfd_target versados_vec =
|
||||
_bfd_generic_mkarchive,
|
||||
bfd_false,
|
||||
},
|
||||
{ /* bfd_write_contents */
|
||||
{ /* bfd_write_contents. */
|
||||
bfd_false,
|
||||
bfd_false,
|
||||
_bfd_write_archive_contents,
|
||||
@ -937,5 +864,5 @@ const bfd_target versados_vec =
|
||||
|
||||
NULL,
|
||||
|
||||
(PTR) 0
|
||||
NULL
|
||||
};
|
||||
|
@ -1,23 +1,23 @@
|
||||
/* Common definitions for backends based on IBM RS/6000 "XCOFF64" files.
|
||||
Copyright 2000, 2001, 2002, 2004
|
||||
Copyright 2000, 2001, 2002, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
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 2 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.
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Internalcoff.h and coffcode.h modify themselves based on this flag. */
|
||||
#define RS6000COFF_C 1
|
||||
@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
| (howto->bitsize - 1)); \
|
||||
}
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 3
|
||||
|
||||
#define COFF_LONG_FILENAMES
|
||||
|
||||
@ -40,77 +40,71 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst)
|
||||
|
||||
#define coff_mkobject _bfd_xcoff_mkobject
|
||||
#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
|
||||
#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
|
||||
#define coff_mkobject _bfd_xcoff_mkobject
|
||||
#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
|
||||
#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
|
||||
#define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
||||
#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
|
||||
#define coff_relocate_section _bfd_ppc_xcoff_relocate_section
|
||||
#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
|
||||
#define coff_relocate_section _bfd_ppc_xcoff_relocate_section
|
||||
#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command
|
||||
#define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal
|
||||
#define coff_core_file_matches_executable_p _bfd_nocore_core_file_matches_executable_p
|
||||
#define _bfd_xcoff_bfd_get_relocated_section_contents coff_bfd_get_relocated_section_contents
|
||||
#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
|
||||
#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
|
||||
#define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections
|
||||
#define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group
|
||||
#define _bfd_xcoff_section_already_linked _bfd_generic_section_already_linked
|
||||
#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section
|
||||
|
||||
#define CORE_FILE_P _bfd_dummy_target
|
||||
|
||||
#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command
|
||||
#define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal
|
||||
#define coff_core_file_matches_executable_p \
|
||||
_bfd_nocore_core_file_matches_executable_p
|
||||
|
||||
#ifdef AIX_CORE
|
||||
#undef CORE_FILE_P
|
||||
|
||||
#undef CORE_FILE_P
|
||||
#define CORE_FILE_P rs6000coff_core_p
|
||||
extern const bfd_target * rs6000coff_core_p ();
|
||||
extern bfd_boolean rs6000coff_core_file_matches_executable_p ();
|
||||
extern const bfd_target * rs6000coff_core_p (void);
|
||||
extern bfd_boolean rs6000coff_core_file_matches_executable_p (void);
|
||||
|
||||
#undef coff_core_file_matches_executable_p
|
||||
#define coff_core_file_matches_executable_p \
|
||||
rs6000coff_core_file_matches_executable_p
|
||||
|
||||
extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd));
|
||||
#undef coff_core_file_failing_command
|
||||
extern char *rs6000coff_core_file_failing_command (bfd *);
|
||||
#undef coff_core_file_failing_command
|
||||
#define coff_core_file_failing_command rs6000coff_core_file_failing_command
|
||||
|
||||
extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||
#undef coff_core_file_failing_signal
|
||||
extern int rs6000coff_core_file_failing_signal (bfd *);
|
||||
#undef coff_core_file_failing_signal
|
||||
#define coff_core_file_failing_signal rs6000coff_core_file_failing_signal
|
||||
#endif /* AIX_CORE */
|
||||
|
||||
#ifdef LYNX_CORE
|
||||
|
||||
#undef CORE_FILE_P
|
||||
#undef CORE_FILE_P
|
||||
#define CORE_FILE_P lynx_core_file_p
|
||||
extern const bfd_target *lynx_core_file_p PARAMS ((bfd *abfd));
|
||||
extern const bfd_target *lynx_core_file_p (bfd *);
|
||||
|
||||
extern bfd_boolean lynx_core_file_matches_executable_p
|
||||
PARAMS ((bfd *core_bfd, bfd *exec_bfd));
|
||||
extern bfd_boolean lynx_core_file_matches_executable_p (bfd *, bfd *);
|
||||
#undef coff_core_file_matches_executable_p
|
||||
#define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p
|
||||
|
||||
extern char *lynx_core_file_failing_command PARAMS ((bfd *abfd));
|
||||
#undef coff_core_file_failing_command
|
||||
extern char *lynx_core_file_failing_command (bfd *);
|
||||
#undef coff_core_file_failing_command
|
||||
#define coff_core_file_failing_command lynx_core_file_failing_command
|
||||
|
||||
extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||
#undef coff_core_file_failing_signal
|
||||
extern int lynx_core_file_failing_signal (bfd *);
|
||||
#undef coff_core_file_failing_signal
|
||||
#define coff_core_file_failing_signal lynx_core_file_failing_signal
|
||||
|
||||
#endif /* LYNX_CORE */
|
||||
|
||||
#define _bfd_xcoff_bfd_get_relocated_section_contents \
|
||||
coff_bfd_get_relocated_section_contents
|
||||
#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
|
||||
#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
|
||||
#define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections
|
||||
#define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group
|
||||
#define _bfd_xcoff_section_already_linked \
|
||||
_bfd_generic_section_already_linked
|
||||
#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section
|
||||
|
||||
/* XCOFF archives do not have anything which corresponds to an
|
||||
extended name table. */
|
||||
|
||||
#define _bfd_xcoff_slurp_extended_name_table bfd_false
|
||||
#define _bfd_xcoff_construct_extended_name_table \
|
||||
((bfd_boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
|
||||
bfd_false)
|
||||
((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false)
|
||||
#define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname
|
||||
|
||||
/* We can use the standard get_elt_at_index routine. */
|
||||
@ -121,31 +115,28 @@ extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||
|
||||
#define _bfd_xcoff_update_armap_timestamp bfd_true
|
||||
|
||||
extern bfd_boolean _bfd_xcoff_mkobject PARAMS ((bfd *));
|
||||
extern bfd_boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
|
||||
extern bfd_boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *));
|
||||
extern void _bfd_xcoff_rtype2howto
|
||||
PARAMS ((arelent *, struct internal_reloc *));
|
||||
extern reloc_howto_type *_bfd_xcoff_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
extern bfd_boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *));
|
||||
extern const bfd_target *_bfd_xcoff_archive_p PARAMS ((bfd *));
|
||||
extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *));
|
||||
extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *));
|
||||
extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
|
||||
extern bfd_boolean _bfd_xcoff_write_armap
|
||||
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
|
||||
extern bfd_boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *));
|
||||
extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, bfd_boolean));
|
||||
extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
|
||||
extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
|
||||
extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
|
||||
extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
|
||||
extern bfd_boolean _bfd_xcoff_mkobject (bfd *);
|
||||
extern bfd_boolean _bfd_xcoff_copy_private_bfd_data (bfd *, bfd *);
|
||||
extern bfd_boolean _bfd_xcoff_is_local_label_name (bfd *, const char *);
|
||||
extern void _bfd_xcoff_rtype2howto (arelent *, struct internal_reloc *);
|
||||
extern bfd_boolean _bfd_xcoff_slurp_armap (bfd *);
|
||||
extern void * _bfd_xcoff_read_ar_hdr (bfd *);
|
||||
extern bfd * _bfd_xcoff_openr_next_archived_file (bfd *, bfd *);
|
||||
extern int _bfd_xcoff_generic_stat_arch_elt (bfd *, struct stat *);
|
||||
extern bfd_boolean _bfd_xcoff_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int);
|
||||
extern bfd_boolean _bfd_xcoff_write_archive_contents (bfd *);
|
||||
extern int _bfd_xcoff_sizeof_headers (bfd *, bfd_boolean);
|
||||
extern void _bfd_xcoff_swap_sym_in (bfd *, void *, void *);
|
||||
extern unsigned int _bfd_xcoff_swap_sym_out (bfd *, void *, void *);
|
||||
extern void _bfd_xcoff_swap_aux_in (bfd *, void *, int, int, int, int, void *);
|
||||
extern unsigned int _bfd_xcoff_swap_aux_out (bfd *, void *, int, int, int, int, void *);
|
||||
extern reloc_howto_type * _bfd_xcoff_reloc_type_lookup (bfd *, bfd_reloc_code_real_type);
|
||||
extern const bfd_target * _bfd_xcoff_archive_p (bfd *);
|
||||
|
||||
#ifndef coff_SWAP_sym_in
|
||||
#define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in
|
||||
#define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in
|
||||
#define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out
|
||||
#define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in
|
||||
#define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in
|
||||
#define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out
|
||||
#endif
|
||||
|
||||
@ -157,30 +148,30 @@ const bfd_target TARGET_SYM =
|
||||
{
|
||||
TARGET_NAME,
|
||||
bfd_target_xcoff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
BFD_ENDIAN_BIG, /* Data byte order is big. */
|
||||
BFD_ENDIAN_BIG, /* Header byte order is big. */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
(HAS_RELOC | EXEC_P | /* Object flags. */
|
||||
HAS_LINENO | HAS_DEBUG | DYNAMIC |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading char */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen??? FIXMEmgo */
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
|
||||
0, /* Leading char. */
|
||||
'/', /* AR_pad_char. */
|
||||
15, /* AR_max_namelen??? FIXME. */
|
||||
|
||||
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_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_getb16, bfd_getb_signed_16, bfd_putb16,/* Headers. */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format. */
|
||||
_bfd_xcoff_archive_p, CORE_FILE_P},
|
||||
{bfd_false, coff_mkobject, /* bfd_set_format */
|
||||
{bfd_false, coff_mkobject, /* bfd_set_format. */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents. */
|
||||
_bfd_xcoff_write_archive_contents, bfd_false},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (coff),
|
||||
|
5478
bfd/xcofflink.c
5478
bfd/xcofflink.c
File diff suppressed because it is too large
Load Diff
583
bfd/xsym.c
583
bfd/xsym.c
File diff suppressed because it is too large
Load Diff
154
bfd/xsym.h
154
bfd/xsym.h
@ -1,5 +1,5 @@
|
||||
/* xSYM symbol-file support for BFD.
|
||||
Copyright 1999, 2000, 2001, 2002, 2003
|
||||
Copyright 1999, 2000, 2001, 2002, 2003, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -546,156 +546,156 @@ struct bfd_sym_data_struct
|
||||
typedef struct bfd_sym_data_struct bfd_sym_data_struct;
|
||||
|
||||
extern bfd_boolean bfd_sym_mkobject
|
||||
PARAMS ((bfd *));
|
||||
(bfd *);
|
||||
extern void bfd_sym_print_symbol
|
||||
PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
|
||||
(bfd *, PTR, asymbol *, bfd_print_symbol_type);
|
||||
extern bfd_boolean bfd_sym_valid
|
||||
PARAMS ((bfd *));
|
||||
(bfd *);
|
||||
extern unsigned char * bfd_sym_read_name_table
|
||||
PARAMS ((bfd *, bfd_sym_header_block *));
|
||||
(bfd *, bfd_sym_header_block *);
|
||||
extern void bfd_sym_parse_file_reference_v32
|
||||
PARAMS ((unsigned char *, size_t, bfd_sym_file_reference *));
|
||||
(unsigned char *, size_t, bfd_sym_file_reference *);
|
||||
extern void bfd_sym_parse_disk_table_v32
|
||||
PARAMS ((unsigned char *, size_t, bfd_sym_table_info *));
|
||||
(unsigned char *, size_t, bfd_sym_table_info *);
|
||||
extern void bfd_sym_parse_header_v32
|
||||
PARAMS ((unsigned char *, size_t, bfd_sym_header_block *));
|
||||
(unsigned char *, size_t, bfd_sym_header_block *);
|
||||
extern int bfd_sym_read_header_v32
|
||||
PARAMS ((bfd *, bfd_sym_header_block *));
|
||||
(bfd *, bfd_sym_header_block *);
|
||||
extern int bfd_sym_read_header_v34
|
||||
PARAMS ((bfd *, bfd_sym_header_block *));
|
||||
(bfd *, bfd_sym_header_block *);
|
||||
extern int bfd_sym_read_header
|
||||
PARAMS ((bfd *, bfd_sym_header_block *, bfd_sym_version));
|
||||
(bfd *, bfd_sym_header_block *, bfd_sym_version);
|
||||
extern int bfd_sym_read_version
|
||||
PARAMS ((bfd *, bfd_sym_version *));
|
||||
(bfd *, bfd_sym_version *);
|
||||
extern void bfd_sym_display_table_summary
|
||||
PARAMS ((FILE *, bfd_sym_table_info *, const char *));
|
||||
(FILE *, bfd_sym_table_info *, const char *);
|
||||
extern void bfd_sym_display_header
|
||||
PARAMS ((FILE *, bfd_sym_header_block *));
|
||||
(FILE *, bfd_sym_header_block *);
|
||||
extern void bfd_sym_parse_resources_table_entry_v32
|
||||
PARAMS ((unsigned char *, size_t, bfd_sym_resources_table_entry *));
|
||||
(unsigned char *, size_t, bfd_sym_resources_table_entry *);
|
||||
extern void bfd_sym_parse_modules_table_entry_v33
|
||||
PARAMS ((unsigned char *, size_t, bfd_sym_modules_table_entry *));
|
||||
(unsigned char *, size_t, bfd_sym_modules_table_entry *);
|
||||
extern void bfd_sym_parse_file_references_table_entry_v32
|
||||
PARAMS ((unsigned char *, size_t, bfd_sym_file_references_table_entry *));
|
||||
(unsigned char *, size_t, bfd_sym_file_references_table_entry *);
|
||||
extern void bfd_sym_parse_contained_modules_table_entry_v32
|
||||
PARAMS ((unsigned char *, size_t, bfd_sym_contained_modules_table_entry *));
|
||||
(unsigned char *, size_t, bfd_sym_contained_modules_table_entry *);
|
||||
extern void bfd_sym_parse_contained_variables_table_entry_v32
|
||||
PARAMS ((unsigned char *, size_t, bfd_sym_contained_variables_table_entry *));
|
||||
(unsigned char *, size_t, bfd_sym_contained_variables_table_entry *);
|
||||
extern void bfd_sym_parse_contained_statements_table_entry_v32
|
||||
PARAMS ((unsigned char *, size_t, bfd_sym_contained_statements_table_entry *));
|
||||
(unsigned char *, size_t, bfd_sym_contained_statements_table_entry *);
|
||||
extern void bfd_sym_parse_contained_labels_table_entry_v32
|
||||
PARAMS ((unsigned char *, size_t, bfd_sym_contained_labels_table_entry *));
|
||||
(unsigned char *, size_t, bfd_sym_contained_labels_table_entry *);
|
||||
extern void bfd_sym_parse_type_table_entry_v32
|
||||
PARAMS ((unsigned char *, size_t, bfd_sym_type_table_entry *));
|
||||
(unsigned char *, size_t, bfd_sym_type_table_entry *);
|
||||
extern int bfd_sym_fetch_resources_table_entry
|
||||
PARAMS ((bfd *, bfd_sym_resources_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_resources_table_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_modules_table_entry
|
||||
PARAMS ((bfd *, bfd_sym_modules_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_modules_table_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_file_references_table_entry
|
||||
PARAMS ((bfd *, bfd_sym_file_references_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_file_references_table_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_contained_modules_table_entry
|
||||
PARAMS ((bfd *, bfd_sym_contained_modules_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_contained_modules_table_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_contained_variables_table_entry
|
||||
PARAMS ((bfd *, bfd_sym_contained_variables_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_contained_variables_table_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_contained_statements_table_entry
|
||||
PARAMS ((bfd *, bfd_sym_contained_statements_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_contained_statements_table_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_contained_labels_table_entry
|
||||
PARAMS ((bfd *, bfd_sym_contained_labels_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_contained_labels_table_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_contained_types_table_entry
|
||||
PARAMS ((bfd *, bfd_sym_contained_types_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_contained_types_table_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_file_references_index_table_entry
|
||||
PARAMS ((bfd *, bfd_sym_file_references_index_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_file_references_index_table_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_constant_pool_entry
|
||||
PARAMS ((bfd *, bfd_sym_constant_pool_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_constant_pool_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_type_table_entry
|
||||
PARAMS ((bfd *, bfd_sym_type_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_type_table_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_type_information_table_entry
|
||||
PARAMS ((bfd *, bfd_sym_type_information_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_type_information_table_entry *, unsigned long);
|
||||
extern int bfd_sym_fetch_type_table_information
|
||||
PARAMS ((bfd *, bfd_sym_type_information_table_entry *, unsigned long));
|
||||
(bfd *, bfd_sym_type_information_table_entry *, unsigned long);
|
||||
extern const unsigned char * bfd_sym_symbol_name
|
||||
PARAMS ((bfd *, unsigned long));
|
||||
(bfd *, unsigned long);
|
||||
extern const unsigned char * bfd_sym_module_name
|
||||
PARAMS ((bfd *, unsigned long));
|
||||
(bfd *, unsigned long);
|
||||
extern const char * bfd_sym_unparse_storage_kind
|
||||
PARAMS ((enum bfd_sym_storage_kind));
|
||||
(enum bfd_sym_storage_kind);
|
||||
extern const char * bfd_sym_unparse_storage_class
|
||||
PARAMS ((enum bfd_sym_storage_class));
|
||||
(enum bfd_sym_storage_class);
|
||||
extern const char * bfd_sym_unparse_module_kind
|
||||
PARAMS ((enum bfd_sym_module_kind));
|
||||
(enum bfd_sym_module_kind);
|
||||
extern const char * bfd_sym_unparse_symbol_scope
|
||||
PARAMS ((enum bfd_sym_symbol_scope));
|
||||
(enum bfd_sym_symbol_scope);
|
||||
extern void bfd_sym_print_file_reference
|
||||
PARAMS ((bfd *, FILE *, bfd_sym_file_reference *));
|
||||
(bfd *, FILE *, bfd_sym_file_reference *);
|
||||
extern void bfd_sym_print_resources_table_entry
|
||||
PARAMS ((bfd *, FILE *, bfd_sym_resources_table_entry *));
|
||||
(bfd *, FILE *, bfd_sym_resources_table_entry *);
|
||||
extern void bfd_sym_print_modules_table_entry
|
||||
PARAMS ((bfd *, FILE *, bfd_sym_modules_table_entry *));
|
||||
(bfd *, FILE *, bfd_sym_modules_table_entry *);
|
||||
extern void bfd_sym_print_file_references_table_entry
|
||||
PARAMS ((bfd *, FILE *, bfd_sym_file_references_table_entry *));
|
||||
(bfd *, FILE *, bfd_sym_file_references_table_entry *);
|
||||
extern void bfd_sym_print_contained_modules_table_entry
|
||||
PARAMS ((bfd *, FILE *, bfd_sym_contained_modules_table_entry *));
|
||||
(bfd *, FILE *, bfd_sym_contained_modules_table_entry *);
|
||||
extern void bfd_sym_print_contained_variables_table_entry
|
||||
PARAMS ((bfd *, FILE *f, bfd_sym_contained_variables_table_entry *));
|
||||
(bfd *, FILE *f, bfd_sym_contained_variables_table_entry *);
|
||||
extern void bfd_sym_print_contained_statements_table_entry
|
||||
PARAMS ((bfd *, FILE *, bfd_sym_contained_statements_table_entry *));
|
||||
(bfd *, FILE *, bfd_sym_contained_statements_table_entry *);
|
||||
extern void bfd_sym_print_contained_labels_table_entry
|
||||
PARAMS ((bfd *, FILE *, bfd_sym_contained_labels_table_entry *));
|
||||
(bfd *, FILE *, bfd_sym_contained_labels_table_entry *);
|
||||
extern void bfd_sym_print_contained_types_table_entry
|
||||
PARAMS ((bfd *, FILE *, bfd_sym_contained_types_table_entry *));
|
||||
(bfd *, FILE *, bfd_sym_contained_types_table_entry *);
|
||||
extern const char * bfd_sym_type_operator_name
|
||||
PARAMS ((unsigned char));
|
||||
(unsigned char);
|
||||
extern const char * bfd_sym_type_basic_name
|
||||
PARAMS ((unsigned char));
|
||||
(unsigned char);
|
||||
extern int bfd_sym_fetch_long
|
||||
PARAMS ((unsigned char *, unsigned long, unsigned long, unsigned long *, long *));
|
||||
(unsigned char *, unsigned long, unsigned long, unsigned long *, long *);
|
||||
extern void bfd_sym_print_type_information
|
||||
PARAMS ((bfd *, FILE *, unsigned char *, unsigned long, unsigned long, unsigned long *));
|
||||
(bfd *, FILE *, unsigned char *, unsigned long, unsigned long, unsigned long *);
|
||||
extern void bfd_sym_print_type_information_table_entry
|
||||
PARAMS ((bfd *, FILE *, bfd_sym_type_information_table_entry *));
|
||||
(bfd *, FILE *, bfd_sym_type_information_table_entry *);
|
||||
extern void bfd_sym_print_file_references_index_table_entry
|
||||
PARAMS ((bfd *, FILE *, bfd_sym_file_references_index_table_entry *));
|
||||
(bfd *, FILE *, bfd_sym_file_references_index_table_entry *);
|
||||
extern void bfd_sym_print_constant_pool_entry
|
||||
PARAMS ((bfd *, FILE *, bfd_sym_constant_pool_entry *));
|
||||
(bfd *, FILE *, bfd_sym_constant_pool_entry *);
|
||||
extern unsigned char * bfd_sym_display_name_table_entry
|
||||
PARAMS ((bfd *, FILE *, unsigned char *));
|
||||
(bfd *, FILE *, unsigned char *);
|
||||
extern void bfd_sym_display_name_table
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern void bfd_sym_display_resources_table
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern void bfd_sym_display_modules_table
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern void bfd_sym_display_file_references_table
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern void bfd_sym_display_contained_modules_table
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern void bfd_sym_display_contained_variables_table
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern void bfd_sym_display_contained_statements_table
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern void bfd_sym_display_contained_labels_table
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern void bfd_sym_display_contained_types_table
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern void bfd_sym_display_file_references_index_table
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern void bfd_sym_display_constant_pool
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern void bfd_sym_display_type_information_table
|
||||
PARAMS ((bfd *, FILE *));
|
||||
(bfd *, FILE *);
|
||||
extern int bfd_sym_scan
|
||||
PARAMS ((bfd *, bfd_sym_version, bfd_sym_data_struct *));
|
||||
(bfd *, bfd_sym_version, bfd_sym_data_struct *);
|
||||
extern const bfd_target * bfd_sym_object_p
|
||||
PARAMS ((bfd *));
|
||||
(bfd *);
|
||||
extern asymbol * bfd_sym_make_empty_symbol
|
||||
PARAMS ((bfd *));
|
||||
(bfd *);
|
||||
extern void bfd_sym_get_symbol_info
|
||||
PARAMS ((bfd *, asymbol *, symbol_info *));
|
||||
(bfd *, asymbol *, symbol_info *);
|
||||
extern long bfd_sym_get_symtab_upper_bound
|
||||
PARAMS ((bfd *));
|
||||
(bfd *);
|
||||
extern long bfd_sym_canonicalize_symtab
|
||||
PARAMS ((bfd *, asymbol **));
|
||||
(bfd *, asymbol **);
|
||||
extern int bfd_sym_sizeof_headers
|
||||
PARAMS ((bfd *, bfd_boolean));
|
||||
(bfd *, bfd_boolean);
|
||||
|
||||
#endif /* __xSYM_H__ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user