Convert to ISO C90 formatting.
This commit is contained in:
parent
28a094c2cc
commit
c8e7bf0d21
8 changed files with 852 additions and 1318 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
2005-03-22 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
* binary.c: Convert to ISO C90 formatting.
|
||||||
|
* coff-arm.c: Convert to ISO C90 formatting.
|
||||||
|
* coffgen.c: Convert to ISO C90 formatting.
|
||||||
|
* elf32-gen.c: Convert to ISO C90 formatting.
|
||||||
|
* elf64-gen.c: Convert to ISO C90 formatting.
|
||||||
|
* hash.c: Convert to ISO C90 formatting.
|
||||||
|
* ieee.c: Convert to ISO C90 formatting.
|
||||||
|
|
||||||
2005-03-22 Daniel Jacobowitz <dan@codesourcery.com>
|
2005-03-22 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
* elf32-arm.c (elf32_arm_final_link_relocate): Don't fail for
|
* elf32-arm.c (elf32_arm_final_link_relocate): Don't fail for
|
||||||
|
|
135
bfd/binary.c
135
bfd/binary.c
|
@ -1,6 +1,6 @@
|
||||||
/* BFD back-end for binary objects.
|
/* BFD back-end for binary objects.
|
||||||
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
2004 Free Software Foundation, Inc.
|
2004, 2005 Free Software Foundation, Inc.
|
||||||
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
|
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
|
||||||
|
|
||||||
This file is part of BFD, the Binary File Descriptor library.
|
This file is part of BFD, the Binary File Descriptor library.
|
||||||
|
@ -41,18 +41,6 @@
|
||||||
a start symbol, an end symbol, and an absolute length symbol. */
|
a start symbol, an end symbol, and an absolute length symbol. */
|
||||||
#define BIN_SYMS 3
|
#define BIN_SYMS 3
|
||||||
|
|
||||||
static bfd_boolean binary_mkobject PARAMS ((bfd *));
|
|
||||||
static const bfd_target *binary_object_p PARAMS ((bfd *));
|
|
||||||
static bfd_boolean binary_get_section_contents
|
|
||||||
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
|
|
||||||
static long binary_get_symtab_upper_bound PARAMS ((bfd *));
|
|
||||||
static char *mangle_name PARAMS ((bfd *, char *));
|
|
||||||
static long binary_canonicalize_symtab PARAMS ((bfd *, asymbol **));
|
|
||||||
static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
|
|
||||||
static bfd_boolean binary_set_section_contents
|
|
||||||
PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
|
|
||||||
static int binary_sizeof_headers PARAMS ((bfd *, bfd_boolean));
|
|
||||||
|
|
||||||
/* Set by external programs - specifies the BFD architecture and
|
/* Set by external programs - specifies the BFD architecture and
|
||||||
machine number to be uses when creating binary BFDs. */
|
machine number to be uses when creating binary BFDs. */
|
||||||
enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown;
|
enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown;
|
||||||
|
@ -61,8 +49,7 @@ unsigned long bfd_external_machine = 0;
|
||||||
/* Create a binary object. Invoked via bfd_set_format. */
|
/* Create a binary object. Invoked via bfd_set_format. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
binary_mkobject (abfd)
|
binary_mkobject (bfd *abfd ATTRIBUTE_UNUSED)
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -72,8 +59,7 @@ binary_mkobject (abfd)
|
||||||
being binary. */
|
being binary. */
|
||||||
|
|
||||||
static const bfd_target *
|
static const bfd_target *
|
||||||
binary_object_p (abfd)
|
binary_object_p (bfd *abfd)
|
||||||
bfd *abfd;
|
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
asection *sec;
|
asection *sec;
|
||||||
|
@ -102,7 +88,7 @@ binary_object_p (abfd)
|
||||||
sec->size = statbuf.st_size;
|
sec->size = statbuf.st_size;
|
||||||
sec->filepos = 0;
|
sec->filepos = 0;
|
||||||
|
|
||||||
abfd->tdata.any = (PTR) sec;
|
abfd->tdata.any = (void *) sec;
|
||||||
|
|
||||||
if (bfd_get_arch_info (abfd) != NULL)
|
if (bfd_get_arch_info (abfd) != NULL)
|
||||||
{
|
{
|
||||||
|
@ -115,19 +101,18 @@ binary_object_p (abfd)
|
||||||
return abfd->xvec;
|
return abfd->xvec;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define binary_close_and_cleanup _bfd_generic_close_and_cleanup
|
#define binary_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||||
#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
||||||
#define binary_new_section_hook _bfd_generic_new_section_hook
|
#define binary_new_section_hook _bfd_generic_new_section_hook
|
||||||
|
|
||||||
/* Get contents of the only section. */
|
/* Get contents of the only section. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
binary_get_section_contents (abfd, section, location, offset, count)
|
binary_get_section_contents (bfd *abfd,
|
||||||
bfd *abfd;
|
asection *section ATTRIBUTE_UNUSED,
|
||||||
asection *section ATTRIBUTE_UNUSED;
|
void * location,
|
||||||
PTR location;
|
file_ptr offset,
|
||||||
file_ptr offset;
|
bfd_size_type count)
|
||||||
bfd_size_type count;
|
|
||||||
{
|
{
|
||||||
if (bfd_seek (abfd, offset, SEEK_SET) != 0
|
if (bfd_seek (abfd, offset, SEEK_SET) != 0
|
||||||
|| bfd_bread (location, count, abfd) != count)
|
|| bfd_bread (location, count, abfd) != count)
|
||||||
|
@ -138,8 +123,7 @@ binary_get_section_contents (abfd, section, location, offset, count)
|
||||||
/* Return the amount of memory needed to read the symbol table. */
|
/* Return the amount of memory needed to read the symbol table. */
|
||||||
|
|
||||||
static long
|
static long
|
||||||
binary_get_symtab_upper_bound (abfd)
|
binary_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED)
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
return (BIN_SYMS + 1) * sizeof (asymbol *);
|
return (BIN_SYMS + 1) * sizeof (asymbol *);
|
||||||
}
|
}
|
||||||
|
@ -147,9 +131,7 @@ binary_get_symtab_upper_bound (abfd)
|
||||||
/* Create a symbol name based on the bfd's filename. */
|
/* Create a symbol name based on the bfd's filename. */
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
mangle_name (abfd, suffix)
|
mangle_name (bfd *abfd, char *suffix)
|
||||||
bfd *abfd;
|
|
||||||
char *suffix;
|
|
||||||
{
|
{
|
||||||
bfd_size_type size;
|
bfd_size_type size;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
@ -159,7 +141,7 @@ mangle_name (abfd, suffix)
|
||||||
+ strlen (suffix)
|
+ strlen (suffix)
|
||||||
+ sizeof "_binary__");
|
+ sizeof "_binary__");
|
||||||
|
|
||||||
buf = (char *) bfd_alloc (abfd, size);
|
buf = bfd_alloc (abfd, size);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
@ -176,16 +158,14 @@ mangle_name (abfd, suffix)
|
||||||
/* Return the symbol table. */
|
/* Return the symbol table. */
|
||||||
|
|
||||||
static long
|
static long
|
||||||
binary_canonicalize_symtab (abfd, alocation)
|
binary_canonicalize_symtab (bfd *abfd, asymbol **alocation)
|
||||||
bfd *abfd;
|
|
||||||
asymbol **alocation;
|
|
||||||
{
|
{
|
||||||
asection *sec = (asection *) abfd->tdata.any;
|
asection *sec = (asection *) abfd->tdata.any;
|
||||||
asymbol *syms;
|
asymbol *syms;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
bfd_size_type amt = BIN_SYMS * sizeof (asymbol);
|
bfd_size_type amt = BIN_SYMS * sizeof (asymbol);
|
||||||
|
|
||||||
syms = (asymbol *) bfd_alloc (abfd, amt);
|
syms = bfd_alloc (abfd, amt);
|
||||||
if (syms == NULL)
|
if (syms == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -220,33 +200,29 @@ binary_canonicalize_symtab (abfd, alocation)
|
||||||
return BIN_SYMS;
|
return BIN_SYMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define binary_make_empty_symbol _bfd_generic_make_empty_symbol
|
#define binary_make_empty_symbol _bfd_generic_make_empty_symbol
|
||||||
#define binary_print_symbol _bfd_nosymbols_print_symbol
|
#define binary_print_symbol _bfd_nosymbols_print_symbol
|
||||||
|
|
||||||
/* Get information about a symbol. */
|
/* Get information about a symbol. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
binary_get_symbol_info (ignore_abfd, symbol, ret)
|
binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
|
||||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
asymbol *symbol,
|
||||||
asymbol *symbol;
|
symbol_info *ret)
|
||||||
symbol_info *ret;
|
|
||||||
{
|
{
|
||||||
bfd_symbol_info (symbol, ret);
|
bfd_symbol_info (symbol, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name
|
||||||
|
#define binary_get_lineno _bfd_nosymbols_get_lineno
|
||||||
|
#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line
|
||||||
|
#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||||
|
#define binary_read_minisymbols _bfd_generic_read_minisymbols
|
||||||
|
#define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
||||||
|
#define binary_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
||||||
|
#define binary_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l)
|
||||||
|
#define binary_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l)
|
||||||
#define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
#define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
||||||
#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name
|
|
||||||
#define binary_get_lineno _bfd_nosymbols_get_lineno
|
|
||||||
#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line
|
|
||||||
#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
|
||||||
#define binary_read_minisymbols _bfd_generic_read_minisymbols
|
|
||||||
#define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
|
||||||
|
|
||||||
#define binary_get_reloc_upper_bound \
|
|
||||||
((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
|
|
||||||
#define binary_canonicalize_reloc \
|
|
||||||
((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
|
|
||||||
#define binary_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
|
||||||
|
|
||||||
/* Set the architecture of a binary file. */
|
/* Set the architecture of a binary file. */
|
||||||
#define binary_set_arch_mach _bfd_generic_set_arch_mach
|
#define binary_set_arch_mach _bfd_generic_set_arch_mach
|
||||||
|
@ -254,12 +230,11 @@ binary_get_symbol_info (ignore_abfd, symbol, ret)
|
||||||
/* Write section contents of a binary file. */
|
/* Write section contents of a binary file. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
binary_set_section_contents (abfd, sec, data, offset, size)
|
binary_set_section_contents (bfd *abfd,
|
||||||
bfd *abfd;
|
asection *sec,
|
||||||
asection *sec;
|
const void * data,
|
||||||
const PTR data;
|
file_ptr offset,
|
||||||
file_ptr offset;
|
bfd_size_type size)
|
||||||
bfd_size_type size;
|
|
||||||
{
|
{
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -328,30 +303,26 @@ binary_set_section_contents (abfd, sec, data, offset, size)
|
||||||
/* No space is required for header information. */
|
/* No space is required for header information. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
binary_sizeof_headers (abfd, exec)
|
binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
bfd_boolean exec ATTRIBUTE_UNUSED)
|
||||||
bfd_boolean exec ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define binary_bfd_get_relocated_section_contents \
|
#define binary_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
|
||||||
bfd_generic_get_relocated_section_contents
|
#define binary_bfd_relax_section bfd_generic_relax_section
|
||||||
#define binary_bfd_relax_section bfd_generic_relax_section
|
#define binary_bfd_gc_sections bfd_generic_gc_sections
|
||||||
#define binary_bfd_gc_sections bfd_generic_gc_sections
|
#define binary_bfd_merge_sections bfd_generic_merge_sections
|
||||||
#define binary_bfd_merge_sections bfd_generic_merge_sections
|
#define binary_bfd_is_group_section bfd_generic_is_group_section
|
||||||
#define binary_bfd_is_group_section bfd_generic_is_group_section
|
#define binary_bfd_discard_group bfd_generic_discard_group
|
||||||
#define binary_bfd_discard_group bfd_generic_discard_group
|
#define binary_section_already_linked _bfd_generic_section_already_linked
|
||||||
#define binary_section_already_linked \
|
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||||
_bfd_generic_section_already_linked
|
#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
||||||
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
|
||||||
#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||||
#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
|
#define binary_bfd_final_link _bfd_generic_final_link
|
||||||
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
#define binary_bfd_link_split_section _bfd_generic_link_split_section
|
||||||
#define binary_bfd_final_link _bfd_generic_final_link
|
#define binary_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
||||||
#define binary_bfd_link_split_section _bfd_generic_link_split_section
|
|
||||||
#define binary_get_section_contents_in_window \
|
|
||||||
_bfd_generic_get_section_contents_in_window
|
|
||||||
|
|
||||||
const bfd_target binary_vec =
|
const bfd_target binary_vec =
|
||||||
{
|
{
|
||||||
|
@ -373,7 +344,7 @@ const bfd_target binary_vec =
|
||||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
||||||
{ /* bfd_check_format */
|
{ /* bfd_check_format */
|
||||||
_bfd_dummy_target,
|
_bfd_dummy_target,
|
||||||
binary_object_p, /* bfd_check_format */
|
binary_object_p,
|
||||||
_bfd_dummy_target,
|
_bfd_dummy_target,
|
||||||
_bfd_dummy_target,
|
_bfd_dummy_target,
|
||||||
},
|
},
|
||||||
|
|
460
bfd/coff-arm.c
460
bfd/coff-arm.c
|
@ -23,9 +23,7 @@
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
#include "libbfd.h"
|
#include "libbfd.h"
|
||||||
|
|
||||||
#include "coff/arm.h"
|
#include "coff/arm.h"
|
||||||
|
|
||||||
#include "coff/internal.h"
|
#include "coff/internal.h"
|
||||||
|
|
||||||
#ifdef COFF_WITH_PE
|
#ifdef COFF_WITH_PE
|
||||||
|
@ -75,75 +73,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum {bunknown, b9, b12, b23} thumb_pcrel_branchtype;
|
typedef enum {bunknown, b9, b12, b23} thumb_pcrel_branchtype;
|
||||||
/* some typedefs for holding instructions */
|
/* Some typedefs for holding instructions. */
|
||||||
typedef unsigned long int insn32;
|
typedef unsigned long int insn32;
|
||||||
typedef unsigned short int insn16;
|
typedef unsigned short int insn16;
|
||||||
|
|
||||||
/* Forward declarations for stupid compilers. */
|
|
||||||
static bfd_boolean coff_arm_relocate_section
|
|
||||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
|
||||||
struct internal_reloc *, struct internal_syment *, asection **));
|
|
||||||
static bfd_reloc_status_type aoutarm_fix_pcrel_26_done
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
static bfd_reloc_status_type aoutarm_fix_pcrel_26
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
#ifndef ARM_WINCE
|
|
||||||
static bfd_reloc_status_type coff_thumb_pcrel_23
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
static bfd_reloc_status_type coff_thumb_pcrel_9
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
static insn32 insert_thumb_branch
|
|
||||||
PARAMS ((insn32, int));
|
|
||||||
#endif
|
|
||||||
static bfd_reloc_status_type coff_thumb_pcrel_12
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
static bfd_reloc_status_type coff_arm_reloc
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
static bfd_boolean coff_arm_adjust_symndx
|
|
||||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *,
|
|
||||||
asection *, struct internal_reloc *, bfd_boolean *));
|
|
||||||
static reloc_howto_type * coff_arm_rtype_to_howto
|
|
||||||
PARAMS ((bfd *, asection *, struct internal_reloc *,
|
|
||||||
struct coff_link_hash_entry *, struct internal_syment *,
|
|
||||||
bfd_vma *));
|
|
||||||
static bfd_reloc_status_type coff_thumb_pcrel_common
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **,
|
|
||||||
thumb_pcrel_branchtype));
|
|
||||||
static const struct reloc_howto_struct * coff_arm_reloc_type_lookup
|
|
||||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
|
||||||
static struct bfd_link_hash_table * coff_arm_link_hash_table_create
|
|
||||||
PARAMS ((bfd *));
|
|
||||||
#ifndef ARM_WINCE
|
|
||||||
static struct coff_link_hash_entry * find_thumb_glue
|
|
||||||
PARAMS ((struct bfd_link_info *, const char *, bfd *));
|
|
||||||
#endif
|
|
||||||
static struct coff_link_hash_entry * find_arm_glue
|
|
||||||
PARAMS ((struct bfd_link_info *, const char *, bfd *));
|
|
||||||
#ifndef COFF_IMAGE_WITH_PE
|
|
||||||
static void record_arm_to_thumb_glue
|
|
||||||
PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *));
|
|
||||||
#ifndef ARM_WINCE
|
|
||||||
static void record_thumb_to_arm_glue
|
|
||||||
PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *));
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
static bfd_boolean coff_arm_merge_private_bfd_data
|
|
||||||
PARAMS ((bfd *, bfd *));
|
|
||||||
static bfd_boolean coff_arm_print_private_bfd_data
|
|
||||||
PARAMS ((bfd *, PTR));
|
|
||||||
static bfd_boolean _bfd_coff_arm_set_private_flags
|
|
||||||
PARAMS ((bfd *, flagword));
|
|
||||||
static bfd_boolean coff_arm_copy_private_bfd_data
|
|
||||||
PARAMS ((bfd *, bfd *));
|
|
||||||
static bfd_boolean coff_arm_is_local_label_name
|
|
||||||
PARAMS ((bfd *, const char *));
|
|
||||||
static bfd_boolean coff_arm_link_output_has_begun
|
|
||||||
PARAMS ((bfd *, struct coff_final_link_info *));
|
|
||||||
static bfd_boolean coff_arm_final_link_postscript
|
|
||||||
PARAMS ((bfd *, struct coff_final_link_info *));
|
|
||||||
static void arm_emit_base_file_entry
|
|
||||||
PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_vma));
|
|
||||||
|
|
||||||
/* The linker script knows the section names for placement.
|
/* The linker script knows the section names for placement.
|
||||||
The entry_names are used to do simple name mangling on the stubs.
|
The entry_names are used to do simple name mangling on the stubs.
|
||||||
Given a function name, and its type, the stub can be found. The
|
Given a function name, and its type, the stub can be found. The
|
||||||
|
@ -158,18 +91,17 @@ static void arm_emit_base_file_entry
|
||||||
/* Used by the assembler. */
|
/* Used by the assembler. */
|
||||||
|
|
||||||
static bfd_reloc_status_type
|
static bfd_reloc_status_type
|
||||||
coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
|
coff_arm_reloc (bfd *abfd,
|
||||||
error_message)
|
arelent *reloc_entry,
|
||||||
bfd *abfd;
|
asymbol *symbol ATTRIBUTE_UNUSED,
|
||||||
arelent *reloc_entry;
|
void * data,
|
||||||
asymbol *symbol ATTRIBUTE_UNUSED;
|
asection *input_section ATTRIBUTE_UNUSED,
|
||||||
PTR data;
|
bfd *output_bfd,
|
||||||
asection *input_section ATTRIBUTE_UNUSED;
|
char **error_message ATTRIBUTE_UNUSED)
|
||||||
bfd *output_bfd;
|
|
||||||
char **error_message ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
symvalue diff;
|
symvalue diff;
|
||||||
if (output_bfd == (bfd *) NULL)
|
|
||||||
|
if (output_bfd == NULL)
|
||||||
return bfd_reloc_continue;
|
return bfd_reloc_continue;
|
||||||
|
|
||||||
diff = reloc_entry->addend;
|
diff = reloc_entry->addend;
|
||||||
|
@ -239,7 +171,7 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
|
||||||
#define ARM_DISP16 5
|
#define ARM_DISP16 5
|
||||||
#define ARM_DISP32 6
|
#define ARM_DISP32 6
|
||||||
#define ARM_26D 7
|
#define ARM_26D 7
|
||||||
/* 8 is unused */
|
/* 8 is unused. */
|
||||||
#define ARM_NEG16 9
|
#define ARM_NEG16 9
|
||||||
#define ARM_NEG32 10
|
#define ARM_NEG32 10
|
||||||
#define ARM_RVA32 11
|
#define ARM_RVA32 11
|
||||||
|
@ -263,6 +195,19 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
|
||||||
#define ARM_SECREL 15
|
#define ARM_SECREL 15
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static bfd_reloc_status_type aoutarm_fix_pcrel_26_done
|
||||||
|
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
|
||||||
|
static bfd_reloc_status_type aoutarm_fix_pcrel_26
|
||||||
|
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
|
||||||
|
static bfd_reloc_status_type coff_thumb_pcrel_9
|
||||||
|
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
|
||||||
|
static bfd_reloc_status_type coff_thumb_pcrel_12
|
||||||
|
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
|
||||||
|
#ifndef ARM_WINCE
|
||||||
|
static bfd_reloc_status_type coff_thumb_pcrel_23
|
||||||
|
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
|
||||||
|
#endif
|
||||||
|
|
||||||
static reloc_howto_type aoutarm_std_reloc_howto[] =
|
static reloc_howto_type aoutarm_std_reloc_howto[] =
|
||||||
{
|
{
|
||||||
#ifdef ARM_WINCE
|
#ifdef ARM_WINCE
|
||||||
|
@ -367,19 +312,19 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
|
||||||
0xffffffff,
|
0xffffffff,
|
||||||
PCRELOFFSET),
|
PCRELOFFSET),
|
||||||
#else /* not ARM_WINCE */
|
#else /* not ARM_WINCE */
|
||||||
HOWTO (ARM_8, /* type */
|
HOWTO (ARM_8,
|
||||||
0, /* rightshift */
|
0,
|
||||||
0, /* size */
|
0,
|
||||||
8, /* bitsize */
|
8,
|
||||||
FALSE, /* pc_relative */
|
FALSE,
|
||||||
0, /* bitpos */
|
0,
|
||||||
complain_overflow_bitfield, /* complain_on_overflow */
|
complain_overflow_bitfield,
|
||||||
coff_arm_reloc, /* special_function */
|
coff_arm_reloc,
|
||||||
"ARM_8", /* name */
|
"ARM_8",
|
||||||
TRUE, /* partial_inplace */
|
TRUE,
|
||||||
0x000000ff, /* src_mask */
|
0x000000ff,
|
||||||
0x000000ff, /* dst_mask */
|
0x000000ff,
|
||||||
PCRELOFFSET /* pcrel_offset */),
|
PCRELOFFSET),
|
||||||
HOWTO (ARM_16,
|
HOWTO (ARM_16,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
|
@ -557,14 +502,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
|
||||||
#define NUM_RELOCS NUM_ELEM (aoutarm_std_reloc_howto)
|
#define NUM_RELOCS NUM_ELEM (aoutarm_std_reloc_howto)
|
||||||
|
|
||||||
#ifdef COFF_WITH_PE
|
#ifdef COFF_WITH_PE
|
||||||
static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
|
|
||||||
/* Return TRUE if this relocation should
|
/* Return TRUE if this relocation should
|
||||||
appear in the output .reloc section. */
|
appear in the output .reloc section. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
in_reloc_p (abfd, howto)
|
in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED,
|
||||||
bfd * abfd ATTRIBUTE_UNUSED;
|
reloc_howto_type * howto)
|
||||||
reloc_howto_type * howto;
|
|
||||||
{
|
{
|
||||||
return !howto->pc_relative && howto->type != ARM_RVA32;
|
return !howto->pc_relative && howto->type != ARM_RVA32;
|
||||||
}
|
}
|
||||||
|
@ -579,13 +522,12 @@ in_reloc_p (abfd, howto)
|
||||||
#define coff_rtype_to_howto coff_arm_rtype_to_howto
|
#define coff_rtype_to_howto coff_arm_rtype_to_howto
|
||||||
|
|
||||||
static reloc_howto_type *
|
static reloc_howto_type *
|
||||||
coff_arm_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
|
coff_arm_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
asection *sec,
|
||||||
asection *sec;
|
struct internal_reloc *rel,
|
||||||
struct internal_reloc *rel;
|
struct coff_link_hash_entry *h ATTRIBUTE_UNUSED,
|
||||||
struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
|
struct internal_syment *sym ATTRIBUTE_UNUSED,
|
||||||
struct internal_syment *sym ATTRIBUTE_UNUSED;
|
bfd_vma *addendp)
|
||||||
bfd_vma *addendp;
|
|
||||||
{
|
{
|
||||||
reloc_howto_type * howto;
|
reloc_howto_type * howto;
|
||||||
|
|
||||||
|
@ -603,15 +545,13 @@ coff_arm_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
|
||||||
/* Used by the assembler. */
|
/* Used by the assembler. */
|
||||||
|
|
||||||
static bfd_reloc_status_type
|
static bfd_reloc_status_type
|
||||||
aoutarm_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section,
|
aoutarm_fix_pcrel_26_done (bfd *abfd ATTRIBUTE_UNUSED,
|
||||||
output_bfd, error_message)
|
arelent *reloc_entry ATTRIBUTE_UNUSED,
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
asymbol *symbol ATTRIBUTE_UNUSED,
|
||||||
arelent *reloc_entry ATTRIBUTE_UNUSED;
|
void * data ATTRIBUTE_UNUSED,
|
||||||
asymbol *symbol ATTRIBUTE_UNUSED;
|
asection *input_section ATTRIBUTE_UNUSED,
|
||||||
PTR data ATTRIBUTE_UNUSED;
|
bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||||
asection *input_section ATTRIBUTE_UNUSED;
|
char **error_message ATTRIBUTE_UNUSED)
|
||||||
bfd *output_bfd ATTRIBUTE_UNUSED;
|
|
||||||
char **error_message ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
/* This is dead simple at present. */
|
/* This is dead simple at present. */
|
||||||
return bfd_reloc_ok;
|
return bfd_reloc_ok;
|
||||||
|
@ -620,15 +560,13 @@ aoutarm_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section,
|
||||||
/* Used by the assembler. */
|
/* Used by the assembler. */
|
||||||
|
|
||||||
static bfd_reloc_status_type
|
static bfd_reloc_status_type
|
||||||
aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
|
aoutarm_fix_pcrel_26 (bfd *abfd,
|
||||||
output_bfd, error_message)
|
arelent *reloc_entry,
|
||||||
bfd *abfd;
|
asymbol *symbol,
|
||||||
arelent *reloc_entry;
|
void * data,
|
||||||
asymbol *symbol;
|
asection *input_section,
|
||||||
PTR data;
|
bfd *output_bfd,
|
||||||
asection *input_section;
|
char **error_message ATTRIBUTE_UNUSED)
|
||||||
bfd *output_bfd;
|
|
||||||
char **error_message ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
bfd_vma relocation;
|
bfd_vma relocation;
|
||||||
bfd_size_type addr = reloc_entry->address;
|
bfd_size_type addr = reloc_entry->address;
|
||||||
|
@ -680,16 +618,14 @@ aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bfd_reloc_status_type
|
static bfd_reloc_status_type
|
||||||
coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section,
|
coff_thumb_pcrel_common (bfd *abfd,
|
||||||
output_bfd, error_message, btype)
|
arelent *reloc_entry,
|
||||||
bfd *abfd;
|
asymbol *symbol,
|
||||||
arelent *reloc_entry;
|
void * data,
|
||||||
asymbol *symbol;
|
asection *input_section,
|
||||||
PTR data;
|
bfd *output_bfd,
|
||||||
asection *input_section;
|
char **error_message ATTRIBUTE_UNUSED,
|
||||||
bfd *output_bfd;
|
thumb_pcrel_branchtype btype)
|
||||||
char **error_message ATTRIBUTE_UNUSED;
|
|
||||||
thumb_pcrel_branchtype btype;
|
|
||||||
{
|
{
|
||||||
bfd_vma relocation = 0;
|
bfd_vma relocation = 0;
|
||||||
bfd_size_type addr = reloc_entry->address;
|
bfd_size_type addr = reloc_entry->address;
|
||||||
|
@ -701,7 +637,6 @@ coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section,
|
||||||
|
|
||||||
/* NOTE: This routine is currently used by GAS, but not by the link
|
/* NOTE: This routine is currently used by GAS, but not by the link
|
||||||
phase. */
|
phase. */
|
||||||
|
|
||||||
switch (btype)
|
switch (btype)
|
||||||
{
|
{
|
||||||
case b9:
|
case b9:
|
||||||
|
@ -809,15 +744,13 @@ coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section,
|
||||||
|
|
||||||
#ifndef ARM_WINCE
|
#ifndef ARM_WINCE
|
||||||
static bfd_reloc_status_type
|
static bfd_reloc_status_type
|
||||||
coff_thumb_pcrel_23 (abfd, reloc_entry, symbol, data, input_section,
|
coff_thumb_pcrel_23 (bfd *abfd,
|
||||||
output_bfd, error_message)
|
arelent *reloc_entry,
|
||||||
bfd *abfd;
|
asymbol *symbol,
|
||||||
arelent *reloc_entry;
|
void * data,
|
||||||
asymbol *symbol;
|
asection *input_section,
|
||||||
PTR data;
|
bfd *output_bfd,
|
||||||
asection *input_section;
|
char **error_message)
|
||||||
bfd *output_bfd;
|
|
||||||
char **error_message;
|
|
||||||
{
|
{
|
||||||
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
|
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
|
||||||
input_section, output_bfd, error_message,
|
input_section, output_bfd, error_message,
|
||||||
|
@ -825,15 +758,13 @@ coff_thumb_pcrel_23 (abfd, reloc_entry, symbol, data, input_section,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bfd_reloc_status_type
|
static bfd_reloc_status_type
|
||||||
coff_thumb_pcrel_9 (abfd, reloc_entry, symbol, data, input_section,
|
coff_thumb_pcrel_9 (bfd *abfd,
|
||||||
output_bfd, error_message)
|
arelent *reloc_entry,
|
||||||
bfd *abfd;
|
asymbol *symbol,
|
||||||
arelent *reloc_entry;
|
void * data,
|
||||||
asymbol *symbol;
|
asection *input_section,
|
||||||
PTR data;
|
bfd *output_bfd,
|
||||||
asection *input_section;
|
char **error_message)
|
||||||
bfd *output_bfd;
|
|
||||||
char **error_message;
|
|
||||||
{
|
{
|
||||||
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
|
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
|
||||||
input_section, output_bfd, error_message,
|
input_section, output_bfd, error_message,
|
||||||
|
@ -842,15 +773,13 @@ coff_thumb_pcrel_9 (abfd, reloc_entry, symbol, data, input_section,
|
||||||
#endif /* not ARM_WINCE */
|
#endif /* not ARM_WINCE */
|
||||||
|
|
||||||
static bfd_reloc_status_type
|
static bfd_reloc_status_type
|
||||||
coff_thumb_pcrel_12 (abfd, reloc_entry, symbol, data, input_section,
|
coff_thumb_pcrel_12 (bfd *abfd,
|
||||||
output_bfd, error_message)
|
arelent *reloc_entry,
|
||||||
bfd *abfd;
|
asymbol *symbol,
|
||||||
arelent *reloc_entry;
|
void * data,
|
||||||
asymbol *symbol;
|
asection *input_section,
|
||||||
PTR data;
|
bfd *output_bfd,
|
||||||
asection *input_section;
|
char **error_message)
|
||||||
bfd *output_bfd;
|
|
||||||
char **error_message;
|
|
||||||
{
|
{
|
||||||
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
|
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
|
||||||
input_section, output_bfd, error_message,
|
input_section, output_bfd, error_message,
|
||||||
|
@ -858,9 +787,7 @@ coff_thumb_pcrel_12 (abfd, reloc_entry, symbol, data, input_section,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct reloc_howto_struct *
|
static const struct reloc_howto_struct *
|
||||||
coff_arm_reloc_type_lookup (abfd, code)
|
coff_arm_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code)
|
||||||
bfd * abfd;
|
|
||||||
bfd_reloc_code_real_type code;
|
|
||||||
{
|
{
|
||||||
#define ASTD(i,j) case i: return aoutarm_std_reloc_howto + j
|
#define ASTD(i,j) case i: return aoutarm_std_reloc_howto + j
|
||||||
|
|
||||||
|
@ -871,7 +798,7 @@ coff_arm_reloc_type_lookup (abfd, code)
|
||||||
code = BFD_RELOC_32;
|
code = BFD_RELOC_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return (const struct reloc_howto_struct *) 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (code)
|
switch (code)
|
||||||
|
@ -896,17 +823,17 @@ coff_arm_reloc_type_lookup (abfd, code)
|
||||||
ASTD (BFD_RELOC_THUMB_PCREL_BRANCH23, ARM_THUMB23);
|
ASTD (BFD_RELOC_THUMB_PCREL_BRANCH23, ARM_THUMB23);
|
||||||
ASTD (BFD_RELOC_THUMB_PCREL_BLX, ARM_THUMB23);
|
ASTD (BFD_RELOC_THUMB_PCREL_BLX, ARM_THUMB23);
|
||||||
#endif
|
#endif
|
||||||
default: return (const struct reloc_howto_struct *) 0;
|
default: return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
|
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2
|
||||||
#define COFF_PAGE_SIZE 0x1000
|
#define COFF_PAGE_SIZE 0x1000
|
||||||
/* Turn a howto into a reloc nunmber */
|
|
||||||
|
|
||||||
|
/* Turn a howto into a reloc nunmber. */
|
||||||
#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
|
#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
|
||||||
#define BADMAG(x) ARMBADMAG(x)
|
#define BADMAG(x) ARMBADMAG(x)
|
||||||
#define ARM 1 /* Customize coffcode.h */
|
#define ARM 1 /* Customize coffcode.h. */
|
||||||
|
|
||||||
#ifndef ARM_WINCE
|
#ifndef ARM_WINCE
|
||||||
/* Make sure that the 'r_offset' field is copied properly
|
/* Make sure that the 'r_offset' field is copied properly
|
||||||
|
@ -943,21 +870,20 @@ struct coff_arm_link_hash_table
|
||||||
/* Create an ARM coff linker hash table. */
|
/* Create an ARM coff linker hash table. */
|
||||||
|
|
||||||
static struct bfd_link_hash_table *
|
static struct bfd_link_hash_table *
|
||||||
coff_arm_link_hash_table_create (abfd)
|
coff_arm_link_hash_table_create (bfd * abfd)
|
||||||
bfd * abfd;
|
|
||||||
{
|
{
|
||||||
struct coff_arm_link_hash_table * ret;
|
struct coff_arm_link_hash_table * ret;
|
||||||
bfd_size_type amt = sizeof (struct coff_arm_link_hash_table);
|
bfd_size_type amt = sizeof (struct coff_arm_link_hash_table);
|
||||||
|
|
||||||
ret = (struct coff_arm_link_hash_table *) bfd_malloc (amt);
|
ret = bfd_malloc (amt);
|
||||||
if (ret == (struct coff_arm_link_hash_table *) NULL)
|
if (ret == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (! _bfd_coff_link_hash_table_init
|
if (! _bfd_coff_link_hash_table_init
|
||||||
(& ret->root, abfd, _bfd_coff_link_hash_newfunc))
|
(& ret->root, abfd, _bfd_coff_link_hash_newfunc))
|
||||||
{
|
{
|
||||||
free (ret);
|
free (ret);
|
||||||
return (struct bfd_link_hash_table *) NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret->thumb_glue_size = 0;
|
ret->thumb_glue_size = 0;
|
||||||
|
@ -968,11 +894,10 @@ coff_arm_link_hash_table_create (abfd)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
|
arm_emit_base_file_entry (struct bfd_link_info *info,
|
||||||
struct bfd_link_info *info;
|
bfd *output_bfd,
|
||||||
bfd *output_bfd;
|
asection *input_section,
|
||||||
asection *input_section;
|
bfd_vma reloc_offset)
|
||||||
bfd_vma reloc_offset;
|
|
||||||
{
|
{
|
||||||
bfd_vma addr = reloc_offset
|
bfd_vma addr = reloc_offset
|
||||||
- input_section->vma
|
- input_section->vma
|
||||||
|
@ -1018,18 +943,16 @@ arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
|
||||||
#define HI_LOW_ORDER 0xF000F800
|
#define HI_LOW_ORDER 0xF000F800
|
||||||
|
|
||||||
static insn32
|
static insn32
|
||||||
insert_thumb_branch (br_insn, rel_off)
|
insert_thumb_branch (insn32 br_insn, int rel_off)
|
||||||
insn32 br_insn;
|
|
||||||
int rel_off;
|
|
||||||
{
|
{
|
||||||
unsigned int low_bits;
|
unsigned int low_bits;
|
||||||
unsigned int high_bits;
|
unsigned int high_bits;
|
||||||
|
|
||||||
BFD_ASSERT((rel_off & 1) != 1);
|
BFD_ASSERT ((rel_off & 1) != 1);
|
||||||
|
|
||||||
rel_off >>= 1; /* half word aligned address */
|
rel_off >>= 1; /* Half word aligned address. */
|
||||||
low_bits = rel_off & 0x000007FF; /* the bottom 11 bits */
|
low_bits = rel_off & 0x000007FF; /* The bottom 11 bits. */
|
||||||
high_bits = (rel_off >> 11) & 0x000007FF; /* the top 11 bits */
|
high_bits = (rel_off >> 11) & 0x000007FF; /* The top 11 bits. */
|
||||||
|
|
||||||
if ((br_insn & LOW_HI_ORDER) == LOW_HI_ORDER)
|
if ((br_insn & LOW_HI_ORDER) == LOW_HI_ORDER)
|
||||||
br_insn = LOW_HI_ORDER | (low_bits << 16) | high_bits;
|
br_insn = LOW_HI_ORDER | (low_bits << 16) | high_bits;
|
||||||
|
@ -1045,16 +968,15 @@ insert_thumb_branch (br_insn, rel_off)
|
||||||
|
|
||||||
|
|
||||||
static struct coff_link_hash_entry *
|
static struct coff_link_hash_entry *
|
||||||
find_thumb_glue (info, name, input_bfd)
|
find_thumb_glue (struct bfd_link_info *info,
|
||||||
struct bfd_link_info *info;
|
const char *name,
|
||||||
const char *name;
|
bfd *input_bfd)
|
||||||
bfd *input_bfd;
|
|
||||||
{
|
{
|
||||||
char *tmp_name;
|
char *tmp_name;
|
||||||
struct coff_link_hash_entry *myh;
|
struct coff_link_hash_entry *myh;
|
||||||
bfd_size_type amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1;
|
bfd_size_type amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1;
|
||||||
|
|
||||||
tmp_name = (char *) bfd_malloc (amt);
|
tmp_name = bfd_malloc (amt);
|
||||||
|
|
||||||
BFD_ASSERT (tmp_name);
|
BFD_ASSERT (tmp_name);
|
||||||
|
|
||||||
|
@ -1075,16 +997,15 @@ find_thumb_glue (info, name, input_bfd)
|
||||||
#endif /* not ARM_WINCE */
|
#endif /* not ARM_WINCE */
|
||||||
|
|
||||||
static struct coff_link_hash_entry *
|
static struct coff_link_hash_entry *
|
||||||
find_arm_glue (info, name, input_bfd)
|
find_arm_glue (struct bfd_link_info *info,
|
||||||
struct bfd_link_info *info;
|
const char *name,
|
||||||
const char *name;
|
bfd *input_bfd)
|
||||||
bfd *input_bfd;
|
|
||||||
{
|
{
|
||||||
char *tmp_name;
|
char *tmp_name;
|
||||||
struct coff_link_hash_entry * myh;
|
struct coff_link_hash_entry * myh;
|
||||||
bfd_size_type amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1;
|
bfd_size_type amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1;
|
||||||
|
|
||||||
tmp_name = (char *) bfd_malloc (amt);
|
tmp_name = bfd_malloc (amt);
|
||||||
|
|
||||||
BFD_ASSERT (tmp_name);
|
BFD_ASSERT (tmp_name);
|
||||||
|
|
||||||
|
@ -1193,16 +1114,14 @@ static const insn32 t2a6_bx_insn = 0xe12fff1e;
|
||||||
is different from the original. */
|
is different from the original. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|
coff_arm_relocate_section (bfd *output_bfd,
|
||||||
contents, relocs, syms, sections)
|
struct bfd_link_info *info,
|
||||||
bfd *output_bfd;
|
bfd *input_bfd,
|
||||||
struct bfd_link_info *info;
|
asection *input_section,
|
||||||
bfd *input_bfd;
|
bfd_byte *contents,
|
||||||
asection *input_section;
|
struct internal_reloc *relocs,
|
||||||
bfd_byte *contents;
|
struct internal_syment *syms,
|
||||||
struct internal_reloc *relocs;
|
asection **sections)
|
||||||
struct internal_syment *syms;
|
|
||||||
asection **sections;
|
|
||||||
{
|
{
|
||||||
struct internal_reloc * rel;
|
struct internal_reloc * rel;
|
||||||
struct internal_reloc * relend;
|
struct internal_reloc * relend;
|
||||||
|
@ -1285,7 +1204,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
addend -= rel->r_vaddr - input_section->vma;
|
addend -= rel->r_vaddr - input_section->vma;
|
||||||
#ifdef ARM_WINCE
|
#ifdef ARM_WINCE
|
||||||
/* FIXME: I don't know why, but the hack is necessary for correct
|
/* FIXME: I don't know why, but the hack is necessary for correct
|
||||||
generation of bl's instruction offset. */
|
generation of bl's instruction offset. */
|
||||||
addend -= 8;
|
addend -= 8;
|
||||||
#endif
|
#endif
|
||||||
howto = &fake_arm26_reloc;
|
howto = &fake_arm26_reloc;
|
||||||
|
@ -1453,7 +1372,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
|| h->class == C_STAT
|
|| h->class == C_STAT
|
||||||
|| h->class == C_LABEL)
|
|| h->class == C_LABEL)
|
||||||
{
|
{
|
||||||
/* Thumb code calling an ARM function */
|
/* Thumb code calling an ARM function. */
|
||||||
asection * s = 0;
|
asection * s = 0;
|
||||||
bfd_vma my_offset;
|
bfd_vma my_offset;
|
||||||
unsigned long int tmp;
|
unsigned long int tmp;
|
||||||
|
@ -1532,13 +1451,19 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
s->contents + my_offset + 2);
|
s->contents + my_offset + 2);
|
||||||
|
|
||||||
ret_offset =
|
ret_offset =
|
||||||
((bfd_signed_vma) h_val) /* Address of destination of the stub. */
|
/* Address of destination of the stub. */
|
||||||
|
((bfd_signed_vma) h_val)
|
||||||
- ((bfd_signed_vma)
|
- ((bfd_signed_vma)
|
||||||
(s->output_offset /* Offset from the start of the current section to the start of the stubs. */
|
/* Offset from the start of the current section to the start of the stubs. */
|
||||||
+ my_offset /* Offset of the start of this stub from the start of the stubs. */
|
(s->output_offset
|
||||||
+ s->output_section->vma) /* Address of the start of the current section. */
|
/* Offset of the start of this stub from the start of the stubs. */
|
||||||
+ 4 /* The branch instruction is 4 bytes into the stub. */
|
+ my_offset
|
||||||
+ 8); /* ARM branches work from the pc of the instruction + 8. */
|
/* Address of the start of the current section. */
|
||||||
|
+ s->output_section->vma)
|
||||||
|
/* The branch instruction is 4 bytes into the stub. */
|
||||||
|
+ 4
|
||||||
|
/* ARM branches work from the pc of the instruction + 8. */
|
||||||
|
+ 8);
|
||||||
|
|
||||||
bfd_put_32 (output_bfd,
|
bfd_put_32 (output_bfd,
|
||||||
(bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
|
(bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
|
||||||
|
@ -1610,7 +1535,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
if (done)
|
if (done)
|
||||||
rstat = bfd_reloc_ok;
|
rstat = bfd_reloc_ok;
|
||||||
#ifndef ARM_WINCE
|
#ifndef ARM_WINCE
|
||||||
/* Only perform this fix during the final link, not a relocatable link. nickc@cygnus.com */
|
/* Only perform this fix during the final link, not a relocatable link. */
|
||||||
else if (! info->relocatable
|
else if (! info->relocatable
|
||||||
&& howto->type == ARM_THUMB23)
|
&& howto->type == ARM_THUMB23)
|
||||||
{
|
{
|
||||||
|
@ -1734,16 +1659,12 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
contents,
|
contents,
|
||||||
rel->r_vaddr - input_section->vma,
|
rel->r_vaddr - input_section->vma,
|
||||||
val, addend);
|
val, addend);
|
||||||
/* FIXME:
|
/* Only perform this fix during the final link, not a relocatable link. */
|
||||||
Is this the best way to fix up thumb addresses? krk@cygnus.com
|
|
||||||
Probably not, but it works, and if it works it don't need fixing! nickc@cygnus.com */
|
|
||||||
/* Only perform this fix during the final link, not a relocatable link. nickc@cygnus.com */
|
|
||||||
if (! info->relocatable
|
if (! info->relocatable
|
||||||
&& (rel->r_type == ARM_32 || rel->r_type == ARM_RVA32))
|
&& (rel->r_type == ARM_32 || rel->r_type == ARM_RVA32))
|
||||||
{
|
{
|
||||||
/* Determine if we need to set the bottom bit of a relocated address
|
/* Determine if we need to set the bottom bit of a relocated address
|
||||||
because the address is the address of a Thumb code symbol. */
|
because the address is the address of a Thumb code symbol. */
|
||||||
|
|
||||||
int patchit = FALSE;
|
int patchit = FALSE;
|
||||||
|
|
||||||
if (h != NULL
|
if (h != NULL
|
||||||
|
@ -1756,7 +1677,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
&& sym->n_scnum > N_UNDEF)
|
&& sym->n_scnum > N_UNDEF)
|
||||||
{
|
{
|
||||||
/* No hash entry - use the symbol instead. */
|
/* No hash entry - use the symbol instead. */
|
||||||
|
|
||||||
if ( sym->n_sclass == C_THUMBSTATFUNC
|
if ( sym->n_sclass == C_THUMBSTATFUNC
|
||||||
|| sym->n_sclass == C_THUMBEXTFUNC)
|
|| sym->n_sclass == C_THUMBEXTFUNC)
|
||||||
patchit = TRUE;
|
patchit = TRUE;
|
||||||
|
@ -1813,8 +1733,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
#ifndef COFF_IMAGE_WITH_PE
|
#ifndef COFF_IMAGE_WITH_PE
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
bfd_arm_allocate_interworking_sections (info)
|
bfd_arm_allocate_interworking_sections (struct bfd_link_info * info)
|
||||||
struct bfd_link_info * info;
|
|
||||||
{
|
{
|
||||||
asection * s;
|
asection * s;
|
||||||
bfd_byte * foo;
|
bfd_byte * foo;
|
||||||
|
@ -1833,8 +1752,7 @@ bfd_arm_allocate_interworking_sections (info)
|
||||||
|
|
||||||
BFD_ASSERT (s != NULL);
|
BFD_ASSERT (s != NULL);
|
||||||
|
|
||||||
foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
|
foo = bfd_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size);
|
||||||
globals->arm_glue_size);
|
|
||||||
|
|
||||||
s->size = globals->arm_glue_size;
|
s->size = globals->arm_glue_size;
|
||||||
s->contents = foo;
|
s->contents = foo;
|
||||||
|
@ -1849,8 +1767,7 @@ bfd_arm_allocate_interworking_sections (info)
|
||||||
|
|
||||||
BFD_ASSERT (s != NULL);
|
BFD_ASSERT (s != NULL);
|
||||||
|
|
||||||
foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
|
foo = bfd_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size);
|
||||||
globals->thumb_glue_size);
|
|
||||||
|
|
||||||
s->size = globals->thumb_glue_size;
|
s->size = globals->thumb_glue_size;
|
||||||
s->contents = foo;
|
s->contents = foo;
|
||||||
|
@ -1860,9 +1777,8 @@ bfd_arm_allocate_interworking_sections (info)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
record_arm_to_thumb_glue (info, h)
|
record_arm_to_thumb_glue (struct bfd_link_info * info,
|
||||||
struct bfd_link_info * info;
|
struct coff_link_hash_entry * h)
|
||||||
struct coff_link_hash_entry * h;
|
|
||||||
{
|
{
|
||||||
const char * name = h->root.root.string;
|
const char * name = h->root.root.string;
|
||||||
register asection * s;
|
register asection * s;
|
||||||
|
@ -1884,7 +1800,7 @@ record_arm_to_thumb_glue (info, h)
|
||||||
BFD_ASSERT (s != NULL);
|
BFD_ASSERT (s != NULL);
|
||||||
|
|
||||||
amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1;
|
amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1;
|
||||||
tmp_name = (char *) bfd_malloc (amt);
|
tmp_name = bfd_malloc (amt);
|
||||||
|
|
||||||
BFD_ASSERT (tmp_name);
|
BFD_ASSERT (tmp_name);
|
||||||
|
|
||||||
|
@ -1896,13 +1812,13 @@ record_arm_to_thumb_glue (info, h)
|
||||||
if (myh != NULL)
|
if (myh != NULL)
|
||||||
{
|
{
|
||||||
free (tmp_name);
|
free (tmp_name);
|
||||||
return; /* we've already seen this guy */
|
/* We've already seen this guy. */
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The only trick here is using globals->arm_glue_size as the value. Even
|
/* The only trick here is using globals->arm_glue_size as the value. Even
|
||||||
though the section isn't allocated yet, this is where we will be putting
|
though the section isn't allocated yet, this is where we will be putting
|
||||||
it. */
|
it. */
|
||||||
|
|
||||||
bh = NULL;
|
bh = NULL;
|
||||||
val = globals->arm_glue_size + 1;
|
val = globals->arm_glue_size + 1;
|
||||||
bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
|
bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
|
||||||
|
@ -1917,12 +1833,11 @@ record_arm_to_thumb_glue (info, h)
|
||||||
|
|
||||||
#ifndef ARM_WINCE
|
#ifndef ARM_WINCE
|
||||||
static void
|
static void
|
||||||
record_thumb_to_arm_glue (info, h)
|
record_thumb_to_arm_glue (struct bfd_link_info * info,
|
||||||
struct bfd_link_info * info;
|
struct coff_link_hash_entry * h)
|
||||||
struct coff_link_hash_entry * h;
|
|
||||||
{
|
{
|
||||||
const char * name = h->root.root.string;
|
const char * name = h->root.root.string;
|
||||||
register asection * s;
|
asection * s;
|
||||||
char * tmp_name;
|
char * tmp_name;
|
||||||
struct coff_link_hash_entry * myh;
|
struct coff_link_hash_entry * myh;
|
||||||
struct bfd_link_hash_entry * bh;
|
struct bfd_link_hash_entry * bh;
|
||||||
|
@ -1941,7 +1856,7 @@ record_thumb_to_arm_glue (info, h)
|
||||||
BFD_ASSERT (s != NULL);
|
BFD_ASSERT (s != NULL);
|
||||||
|
|
||||||
amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1;
|
amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1;
|
||||||
tmp_name = (char *) bfd_malloc (amt);
|
tmp_name = bfd_malloc (amt);
|
||||||
|
|
||||||
BFD_ASSERT (tmp_name);
|
BFD_ASSERT (tmp_name);
|
||||||
|
|
||||||
|
@ -1953,7 +1868,8 @@ record_thumb_to_arm_glue (info, h)
|
||||||
if (myh != NULL)
|
if (myh != NULL)
|
||||||
{
|
{
|
||||||
free (tmp_name);
|
free (tmp_name);
|
||||||
return; /* we've already seen this guy */
|
/* We've already seen this guy. */
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bh = NULL;
|
bh = NULL;
|
||||||
|
@ -1973,7 +1889,7 @@ record_thumb_to_arm_glue (info, h)
|
||||||
#define BACK_FROM_ARM "__%s_back_from_arm"
|
#define BACK_FROM_ARM "__%s_back_from_arm"
|
||||||
|
|
||||||
amt = strlen (name) + strlen (CHANGE_TO_ARM) + 1;
|
amt = strlen (name) + strlen (CHANGE_TO_ARM) + 1;
|
||||||
tmp_name = (char *) bfd_malloc (amt);
|
tmp_name = bfd_malloc (amt);
|
||||||
|
|
||||||
BFD_ASSERT (tmp_name);
|
BFD_ASSERT (tmp_name);
|
||||||
|
|
||||||
|
@ -1997,9 +1913,8 @@ record_thumb_to_arm_glue (info, h)
|
||||||
{armcoff/pe}.em */
|
{armcoff/pe}.em */
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
bfd_arm_get_bfd_for_interworking (abfd, info)
|
bfd_arm_get_bfd_for_interworking (bfd * abfd,
|
||||||
bfd * abfd;
|
struct bfd_link_info * info)
|
||||||
struct bfd_link_info * info;
|
|
||||||
{
|
{
|
||||||
struct coff_arm_link_hash_table * globals;
|
struct coff_arm_link_hash_table * globals;
|
||||||
flagword flags;
|
flagword flags;
|
||||||
|
@ -2052,10 +1967,9 @@ bfd_arm_get_bfd_for_interworking (abfd, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
bfd_arm_process_before_allocation (abfd, info, support_old_code)
|
bfd_arm_process_before_allocation (bfd * abfd,
|
||||||
bfd * abfd;
|
struct bfd_link_info * info,
|
||||||
struct bfd_link_info * info;
|
int support_old_code)
|
||||||
int support_old_code;
|
|
||||||
{
|
{
|
||||||
asection * sec;
|
asection * sec;
|
||||||
struct coff_arm_link_hash_table * globals;
|
struct coff_arm_link_hash_table * globals;
|
||||||
|
@ -2067,7 +1981,6 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
|
||||||
|
|
||||||
/* Here we have a bfd that is to be included on the link. We have a hook
|
/* Here we have a bfd that is to be included on the link. We have a hook
|
||||||
to do reloc rummaging, before section sizes are nailed down. */
|
to do reloc rummaging, before section sizes are nailed down. */
|
||||||
|
|
||||||
_bfd_coff_get_external_symbols (abfd);
|
_bfd_coff_get_external_symbols (abfd);
|
||||||
|
|
||||||
globals = coff_arm_hash_table (info);
|
globals = coff_arm_hash_table (info);
|
||||||
|
@ -2093,7 +2006,6 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
|
||||||
|
|
||||||
/* Load the relocs. */
|
/* Load the relocs. */
|
||||||
/* FIXME: there may be a storage leak here. */
|
/* FIXME: there may be a storage leak here. */
|
||||||
|
|
||||||
i = _bfd_coff_read_internal_relocs (abfd, sec, 1, 0, 0, 0);
|
i = _bfd_coff_read_internal_relocs (abfd, sec, 1, 0, 0, 0);
|
||||||
|
|
||||||
BFD_ASSERT (i != 0);
|
BFD_ASSERT (i != 0);
|
||||||
|
@ -2186,13 +2098,12 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
|
||||||
into ARM_26D relocs. */
|
into ARM_26D relocs. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
|
coff_arm_adjust_symndx (bfd *obfd ATTRIBUTE_UNUSED,
|
||||||
bfd *obfd ATTRIBUTE_UNUSED;
|
struct bfd_link_info *info ATTRIBUTE_UNUSED,
|
||||||
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
bfd *ibfd,
|
||||||
bfd *ibfd;
|
asection *sec,
|
||||||
asection *sec;
|
struct internal_reloc *irel,
|
||||||
struct internal_reloc *irel;
|
bfd_boolean *adjustedp)
|
||||||
bfd_boolean *adjustedp;
|
|
||||||
{
|
{
|
||||||
if (irel->r_type == ARM_26)
|
if (irel->r_type == ARM_26)
|
||||||
{
|
{
|
||||||
|
@ -2215,9 +2126,7 @@ coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
|
||||||
targets, eg different CPUs or different APCS's. */
|
targets, eg different CPUs or different APCS's. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
coff_arm_merge_private_bfd_data (ibfd, obfd)
|
coff_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
|
||||||
bfd * ibfd;
|
|
||||||
bfd * obfd;
|
|
||||||
{
|
{
|
||||||
BFD_ASSERT (ibfd != NULL && obfd != NULL);
|
BFD_ASSERT (ibfd != NULL && obfd != NULL);
|
||||||
|
|
||||||
|
@ -2330,9 +2239,7 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
|
||||||
/* Display the flags field. */
|
/* Display the flags field. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
coff_arm_print_private_bfd_data (abfd, ptr)
|
coff_arm_print_private_bfd_data (bfd * abfd, void * ptr)
|
||||||
bfd * abfd;
|
|
||||||
PTR ptr;
|
|
||||||
{
|
{
|
||||||
FILE * file = (FILE *) ptr;
|
FILE * file = (FILE *) ptr;
|
||||||
|
|
||||||
|
@ -2377,9 +2284,7 @@ coff_arm_print_private_bfd_data (abfd, ptr)
|
||||||
called from both coffcode.h and peicode.h. */
|
called from both coffcode.h and peicode.h. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
_bfd_coff_arm_set_private_flags (abfd, flags)
|
_bfd_coff_arm_set_private_flags (bfd * abfd, flagword flags)
|
||||||
bfd * abfd;
|
|
||||||
flagword flags;
|
|
||||||
{
|
{
|
||||||
flagword flag;
|
flagword flag;
|
||||||
|
|
||||||
|
@ -2428,9 +2333,7 @@ _bfd_coff_arm_set_private_flags (abfd, flags)
|
||||||
from one instance of a BFD to another. */
|
from one instance of a BFD to another. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
coff_arm_copy_private_bfd_data (src, dest)
|
coff_arm_copy_private_bfd_data (bfd * src, bfd * dest)
|
||||||
bfd * src;
|
|
||||||
bfd * dest;
|
|
||||||
{
|
{
|
||||||
BFD_ASSERT (src != NULL && dest != NULL);
|
BFD_ASSERT (src != NULL && dest != NULL);
|
||||||
|
|
||||||
|
@ -2442,7 +2345,7 @@ coff_arm_copy_private_bfd_data (src, dest)
|
||||||
if (src->xvec != dest->xvec)
|
if (src->xvec != dest->xvec)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* copy the flags field */
|
/* Copy the flags field. */
|
||||||
if (APCS_SET (src))
|
if (APCS_SET (src))
|
||||||
{
|
{
|
||||||
if (APCS_SET (dest))
|
if (APCS_SET (dest))
|
||||||
|
@ -2502,10 +2405,10 @@ Warning: Clearing the interworking flag of %B because non-interworking code in %
|
||||||
non-local.
|
non-local.
|
||||||
b) Allow other prefixes than ".", e.g. an empty prefix would cause all
|
b) Allow other prefixes than ".", e.g. an empty prefix would cause all
|
||||||
labels of the form Lxxx to be stripped. */
|
labels of the form Lxxx to be stripped. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
coff_arm_is_local_label_name (abfd, name)
|
coff_arm_is_local_label_name (bfd * abfd ATTRIBUTE_UNUSED,
|
||||||
bfd * abfd ATTRIBUTE_UNUSED;
|
const char * name)
|
||||||
const char * name;
|
|
||||||
{
|
{
|
||||||
#ifdef USER_LABEL_PREFIX
|
#ifdef USER_LABEL_PREFIX
|
||||||
if (USER_LABEL_PREFIX[0] != 0)
|
if (USER_LABEL_PREFIX[0] != 0)
|
||||||
|
@ -2540,23 +2443,18 @@ coff_arm_is_local_label_name (abfd, name)
|
||||||
the glue section is written last.
|
the glue section is written last.
|
||||||
|
|
||||||
This does depend on bfd_make_section attaching a new section to the
|
This does depend on bfd_make_section attaching a new section to the
|
||||||
end of the section list for the bfd.
|
end of the section list for the bfd. */
|
||||||
|
|
||||||
krk@cygnus.com */
|
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
coff_arm_link_output_has_begun (sub, info)
|
coff_arm_link_output_has_begun (bfd * sub, struct coff_final_link_info * info)
|
||||||
bfd * sub;
|
|
||||||
struct coff_final_link_info * info;
|
|
||||||
{
|
{
|
||||||
return (sub->output_has_begun
|
return (sub->output_has_begun
|
||||||
|| sub == coff_arm_hash_table (info->info)->bfd_of_glue_owner);
|
|| sub == coff_arm_hash_table (info->info)->bfd_of_glue_owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
coff_arm_final_link_postscript (abfd, pfinfo)
|
coff_arm_final_link_postscript (bfd * abfd ATTRIBUTE_UNUSED,
|
||||||
bfd * abfd ATTRIBUTE_UNUSED;
|
struct coff_final_link_info * pfinfo)
|
||||||
struct coff_final_link_info * pfinfo;
|
|
||||||
{
|
{
|
||||||
struct coff_arm_link_hash_table * globals;
|
struct coff_arm_link_hash_table * globals;
|
||||||
|
|
||||||
|
|
603
bfd/coffgen.c
603
bfd/coffgen.c
File diff suppressed because it is too large
Load diff
|
@ -1,22 +1,22 @@
|
||||||
/* Generic support for 32-bit ELF
|
/* Generic support for 32-bit ELF
|
||||||
Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004
|
Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005
|
||||||
Free Software Foundation, Inc.
|
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
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
|
@ -41,53 +41,48 @@ static reloc_howto_type dummy =
|
||||||
0, /* dst_mask */
|
0, /* dst_mask */
|
||||||
FALSE); /* pcrel_offset */
|
FALSE); /* pcrel_offset */
|
||||||
|
|
||||||
static void elf_generic_info_to_howto
|
|
||||||
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
|
|
||||||
static void elf_generic_info_to_howto_rel
|
|
||||||
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
|
|
||||||
static bfd_boolean elf32_generic_link_add_symbols
|
|
||||||
PARAMS ((bfd *, struct bfd_link_info *));
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
|
elf_generic_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
arelent *bfd_reloc,
|
||||||
arelent *bfd_reloc;
|
Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED)
|
||||||
Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
bfd_reloc->howto = &dummy;
|
bfd_reloc->howto = &dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
|
elf_generic_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
arelent *bfd_reloc,
|
||||||
arelent *bfd_reloc;
|
Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED)
|
||||||
Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
bfd_reloc->howto = &dummy;
|
bfd_reloc->howto = &dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
check_for_relocs (bfd * abfd, asection * o, void * failed)
|
||||||
|
{
|
||||||
|
if ((o->flags & SEC_RELOC) != 0)
|
||||||
|
{
|
||||||
|
Elf_Internal_Ehdr *ehdrp;
|
||||||
|
|
||||||
|
ehdrp = elf_elfheader (abfd);
|
||||||
|
_bfd_error_handler (_("%B: Relocations in generic ELF (EM: %d)"),
|
||||||
|
abfd, ehdrp->e_machine);
|
||||||
|
|
||||||
|
bfd_set_error (bfd_error_wrong_format);
|
||||||
|
* (bfd_boolean *) failed = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
elf32_generic_link_add_symbols (abfd, info)
|
elf32_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||||
bfd *abfd;
|
|
||||||
struct bfd_link_info *info;
|
|
||||||
{
|
{
|
||||||
asection *o;
|
bfd_boolean failed = FALSE;
|
||||||
|
|
||||||
/* Check if there are any relocations. */
|
/* Check if there are any relocations. */
|
||||||
for (o = abfd->sections; o != NULL; o = o->next)
|
bfd_map_over_sections (abfd, check_for_relocs, & failed);
|
||||||
if ((o->flags & SEC_RELOC) != 0)
|
|
||||||
{
|
|
||||||
Elf_Internal_Ehdr *ehdrp;
|
|
||||||
|
|
||||||
ehdrp = elf_elfheader (abfd);
|
|
||||||
(*_bfd_error_handler) (_("%B: Relocations in generic ELF (EM: %d)"),
|
|
||||||
abfd,
|
|
||||||
ehdrp->e_machine);
|
|
||||||
|
|
||||||
bfd_set_error (bfd_error_wrong_format);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (failed)
|
||||||
|
return FALSE;
|
||||||
return bfd_elf_link_add_symbols (abfd, info);
|
return bfd_elf_link_add_symbols (abfd, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
/* Generic support for 64-bit ELF
|
/* Generic support for 64-bit ELF
|
||||||
Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004
|
Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005
|
||||||
Free Software Foundation, Inc.
|
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
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
|
@ -41,52 +41,48 @@ static reloc_howto_type dummy =
|
||||||
0, /* dst_mask */
|
0, /* dst_mask */
|
||||||
FALSE); /* pcrel_offset */
|
FALSE); /* pcrel_offset */
|
||||||
|
|
||||||
static void elf_generic_info_to_howto
|
|
||||||
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
|
|
||||||
static void elf_generic_info_to_howto_rel
|
|
||||||
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
|
|
||||||
static bfd_boolean elf64_generic_link_add_symbols
|
|
||||||
PARAMS ((bfd *, struct bfd_link_info *));
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
|
elf_generic_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
arelent *bfd_reloc,
|
||||||
arelent *bfd_reloc;
|
Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED)
|
||||||
Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
bfd_reloc->howto = &dummy;
|
bfd_reloc->howto = &dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
|
elf_generic_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
arelent *bfd_reloc,
|
||||||
arelent *bfd_reloc;
|
Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED)
|
||||||
Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
bfd_reloc->howto = &dummy;
|
bfd_reloc->howto = &dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
check_for_relocs (bfd * abfd, asection * o, void * failed)
|
||||||
|
{
|
||||||
|
if ((o->flags & SEC_RELOC) != 0)
|
||||||
|
{
|
||||||
|
Elf_Internal_Ehdr *ehdrp;
|
||||||
|
|
||||||
|
ehdrp = elf_elfheader (abfd);
|
||||||
|
_bfd_error_handler (_("%B: Relocations in generic ELF (EM: %d)"),
|
||||||
|
abfd, ehdrp->e_machine);
|
||||||
|
|
||||||
|
bfd_set_error (bfd_error_wrong_format);
|
||||||
|
* (bfd_boolean *) failed = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
elf64_generic_link_add_symbols (abfd, info)
|
elf64_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||||
bfd *abfd;
|
|
||||||
struct bfd_link_info *info;
|
|
||||||
{
|
{
|
||||||
asection *o;
|
bfd_boolean failed = FALSE;
|
||||||
|
|
||||||
/* Check if there are any relocations. */
|
/* Check if there are any relocations. */
|
||||||
for (o = abfd->sections; o != NULL; o = o->next)
|
bfd_map_over_sections (abfd, check_for_relocs, & failed);
|
||||||
if ((o->flags & SEC_RELOC) != 0)
|
|
||||||
{
|
|
||||||
Elf_Internal_Ehdr *ehdrp;
|
|
||||||
|
|
||||||
ehdrp = elf_elfheader (abfd);
|
|
||||||
(*_bfd_error_handler) (_("%B: Relocations in generic ELF (EM: %d)"),
|
|
||||||
abfd, ehdrp->e_machine);
|
|
||||||
|
|
||||||
bfd_set_error (bfd_error_wrong_format);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (failed)
|
||||||
|
return FALSE;
|
||||||
return bfd_elf_link_add_symbols (abfd, info);
|
return bfd_elf_link_add_symbols (abfd, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
201
bfd/hash.c
201
bfd/hash.c
|
@ -1,5 +1,5 @@
|
||||||
/* hash.c -- hash table routines for BFD
|
/* hash.c -- hash table routines for BFD
|
||||||
Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003, 2004
|
Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003, 2004, 2005
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
Written by Steve Chamberlain <sac@cygnus.com>
|
Written by Steve Chamberlain <sac@cygnus.com>
|
||||||
|
|
||||||
|
@ -230,20 +230,18 @@ SUBSUBSECTION
|
||||||
EXAMPLE
|
EXAMPLE
|
||||||
|
|
||||||
.struct bfd_hash_entry *
|
.struct bfd_hash_entry *
|
||||||
.@var{function_name} (entry, table, string)
|
.@var{function_name} (struct bfd_hash_entry *entry,
|
||||||
. struct bfd_hash_entry *entry;
|
. struct bfd_hash_table *table,
|
||||||
. struct bfd_hash_table *table;
|
. const char *string)
|
||||||
. const char *string;
|
|
||||||
.{
|
.{
|
||||||
. struct @var{entry_type} *ret = (@var{entry_type} *) entry;
|
. struct @var{entry_type} *ret = (@var{entry_type} *) entry;
|
||||||
.
|
.
|
||||||
. {* Allocate the structure if it has not already been allocated by a
|
. {* Allocate the structure if it has not already been allocated by a
|
||||||
. derived class. *}
|
. derived class. *}
|
||||||
. if (ret == (@var{entry_type} *) NULL)
|
. if (ret == NULL)
|
||||||
. {
|
. {
|
||||||
. ret = ((@var{entry_type} *)
|
. ret = bfd_hash_allocate (table, sizeof (* ret));
|
||||||
. bfd_hash_allocate (table, sizeof (@var{entry_type})));
|
. if (ret == NULL)
|
||||||
. if (ret == (@var{entry_type} *) NULL)
|
|
||||||
. return NULL;
|
. return NULL;
|
||||||
. }
|
. }
|
||||||
.
|
.
|
||||||
|
@ -306,31 +304,29 @@ static size_t bfd_default_hash_table_size = DEFAULT_SIZE;
|
||||||
/* Create a new hash table, given a number of entries. */
|
/* Create a new hash table, given a number of entries. */
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
bfd_hash_table_init_n (table, newfunc, size)
|
bfd_hash_table_init_n (struct bfd_hash_table *table,
|
||||||
struct bfd_hash_table *table;
|
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
|
||||||
struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
|
struct bfd_hash_table *,
|
||||||
struct bfd_hash_table *,
|
const char *),
|
||||||
const char *));
|
unsigned int size)
|
||||||
unsigned int size;
|
|
||||||
{
|
{
|
||||||
unsigned int alloc;
|
unsigned int alloc;
|
||||||
|
|
||||||
alloc = size * sizeof (struct bfd_hash_entry *);
|
alloc = size * sizeof (struct bfd_hash_entry *);
|
||||||
|
|
||||||
table->memory = (PTR) objalloc_create ();
|
table->memory = (void *) objalloc_create ();
|
||||||
if (table->memory == NULL)
|
if (table->memory == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
table->table = ((struct bfd_hash_entry **)
|
table->table = objalloc_alloc ((struct objalloc *) table->memory, alloc);
|
||||||
objalloc_alloc ((struct objalloc *) table->memory, alloc));
|
|
||||||
if (table->table == NULL)
|
if (table->table == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
memset ((PTR) table->table, 0, alloc);
|
memset ((void *) table->table, 0, alloc);
|
||||||
table->size = size;
|
table->size = size;
|
||||||
table->newfunc = newfunc;
|
table->newfunc = newfunc;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -339,11 +335,10 @@ bfd_hash_table_init_n (table, newfunc, size)
|
||||||
/* Create a new hash table with the default number of entries. */
|
/* Create a new hash table with the default number of entries. */
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
bfd_hash_table_init (table, newfunc)
|
bfd_hash_table_init (struct bfd_hash_table *table,
|
||||||
struct bfd_hash_table *table;
|
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
|
||||||
struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
|
struct bfd_hash_table *,
|
||||||
struct bfd_hash_table *,
|
const char *))
|
||||||
const char *));
|
|
||||||
{
|
{
|
||||||
return bfd_hash_table_init_n (table, newfunc, bfd_default_hash_table_size);
|
return bfd_hash_table_init_n (table, newfunc, bfd_default_hash_table_size);
|
||||||
}
|
}
|
||||||
|
@ -351,25 +346,23 @@ bfd_hash_table_init (table, newfunc)
|
||||||
/* Free a hash table. */
|
/* Free a hash table. */
|
||||||
|
|
||||||
void
|
void
|
||||||
bfd_hash_table_free (table)
|
bfd_hash_table_free (struct bfd_hash_table *table)
|
||||||
struct bfd_hash_table *table;
|
|
||||||
{
|
{
|
||||||
objalloc_free ((struct objalloc *) table->memory);
|
objalloc_free (table->memory);
|
||||||
table->memory = NULL;
|
table->memory = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look up a string in a hash table. */
|
/* Look up a string in a hash table. */
|
||||||
|
|
||||||
struct bfd_hash_entry *
|
struct bfd_hash_entry *
|
||||||
bfd_hash_lookup (table, string, create, copy)
|
bfd_hash_lookup (struct bfd_hash_table *table,
|
||||||
struct bfd_hash_table *table;
|
const char *string,
|
||||||
const char *string;
|
bfd_boolean create,
|
||||||
bfd_boolean create;
|
bfd_boolean copy)
|
||||||
bfd_boolean copy;
|
|
||||||
{
|
{
|
||||||
register const unsigned char *s;
|
const unsigned char *s;
|
||||||
register unsigned long hash;
|
unsigned long hash;
|
||||||
register unsigned int c;
|
unsigned int c;
|
||||||
struct bfd_hash_entry *hashp;
|
struct bfd_hash_entry *hashp;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
|
@ -388,7 +381,7 @@ bfd_hash_lookup (table, string, create, copy)
|
||||||
|
|
||||||
index = hash % table->size;
|
index = hash % table->size;
|
||||||
for (hashp = table->table[index];
|
for (hashp = table->table[index];
|
||||||
hashp != (struct bfd_hash_entry *) NULL;
|
hashp != NULL;
|
||||||
hashp = hashp->next)
|
hashp = hashp->next)
|
||||||
{
|
{
|
||||||
if (hashp->hash == hash
|
if (hashp->hash == hash
|
||||||
|
@ -397,21 +390,20 @@ bfd_hash_lookup (table, string, create, copy)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! create)
|
if (! create)
|
||||||
return (struct bfd_hash_entry *) NULL;
|
return NULL;
|
||||||
|
|
||||||
hashp = (*table->newfunc) ((struct bfd_hash_entry *) NULL, table, string);
|
hashp = (*table->newfunc) (NULL, table, string);
|
||||||
if (hashp == (struct bfd_hash_entry *) NULL)
|
if (hashp == NULL)
|
||||||
return (struct bfd_hash_entry *) NULL;
|
return NULL;
|
||||||
if (copy)
|
if (copy)
|
||||||
{
|
{
|
||||||
char *new;
|
char *new;
|
||||||
|
|
||||||
new = (char *) objalloc_alloc ((struct objalloc *) table->memory,
|
new = objalloc_alloc ((struct objalloc *) table->memory, len + 1);
|
||||||
len + 1);
|
|
||||||
if (!new)
|
if (!new)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return (struct bfd_hash_entry *) NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memcpy (new, string, len + 1);
|
memcpy (new, string, len + 1);
|
||||||
string = new;
|
string = new;
|
||||||
|
@ -427,17 +419,16 @@ bfd_hash_lookup (table, string, create, copy)
|
||||||
/* Replace an entry in a hash table. */
|
/* Replace an entry in a hash table. */
|
||||||
|
|
||||||
void
|
void
|
||||||
bfd_hash_replace (table, old, nw)
|
bfd_hash_replace (struct bfd_hash_table *table,
|
||||||
struct bfd_hash_table *table;
|
struct bfd_hash_entry *old,
|
||||||
struct bfd_hash_entry *old;
|
struct bfd_hash_entry *nw)
|
||||||
struct bfd_hash_entry *nw;
|
|
||||||
{
|
{
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
struct bfd_hash_entry **pph;
|
struct bfd_hash_entry **pph;
|
||||||
|
|
||||||
index = old->hash % table->size;
|
index = old->hash % table->size;
|
||||||
for (pph = &table->table[index];
|
for (pph = &table->table[index];
|
||||||
(*pph) != (struct bfd_hash_entry *) NULL;
|
(*pph) != NULL;
|
||||||
pph = &(*pph)->next)
|
pph = &(*pph)->next)
|
||||||
{
|
{
|
||||||
if (*pph == old)
|
if (*pph == old)
|
||||||
|
@ -450,28 +441,13 @@ bfd_hash_replace (table, old, nw)
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Base method for creating a new hash table entry. */
|
|
||||||
|
|
||||||
struct bfd_hash_entry *
|
|
||||||
bfd_hash_newfunc (entry, table, string)
|
|
||||||
struct bfd_hash_entry *entry;
|
|
||||||
struct bfd_hash_table *table;
|
|
||||||
const char *string ATTRIBUTE_UNUSED;
|
|
||||||
{
|
|
||||||
if (entry == (struct bfd_hash_entry *) NULL)
|
|
||||||
entry = ((struct bfd_hash_entry *)
|
|
||||||
bfd_hash_allocate (table, sizeof (struct bfd_hash_entry)));
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate space in a hash table. */
|
/* Allocate space in a hash table. */
|
||||||
|
|
||||||
PTR
|
void *
|
||||||
bfd_hash_allocate (table, size)
|
bfd_hash_allocate (struct bfd_hash_table *table,
|
||||||
struct bfd_hash_table *table;
|
unsigned int size)
|
||||||
unsigned int size;
|
|
||||||
{
|
{
|
||||||
PTR ret;
|
void * ret;
|
||||||
|
|
||||||
ret = objalloc_alloc ((struct objalloc *) table->memory, size);
|
ret = objalloc_alloc ((struct objalloc *) table->memory, size);
|
||||||
if (ret == NULL && size != 0)
|
if (ret == NULL && size != 0)
|
||||||
|
@ -479,13 +455,24 @@ bfd_hash_allocate (table, size)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Base method for creating a new hash table entry. */
|
||||||
|
|
||||||
|
struct bfd_hash_entry *
|
||||||
|
bfd_hash_newfunc (struct bfd_hash_entry *entry,
|
||||||
|
struct bfd_hash_table *table,
|
||||||
|
const char *string ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
if (entry == NULL)
|
||||||
|
entry = bfd_hash_allocate (table, sizeof (* entry));
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
/* Traverse a hash table. */
|
/* Traverse a hash table. */
|
||||||
|
|
||||||
void
|
void
|
||||||
bfd_hash_traverse (table, func, info)
|
bfd_hash_traverse (struct bfd_hash_table *table,
|
||||||
struct bfd_hash_table *table;
|
bfd_boolean (*func) (struct bfd_hash_entry *, void *),
|
||||||
bfd_boolean (*func) PARAMS ((struct bfd_hash_entry *, PTR));
|
void * info)
|
||||||
PTR info;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
@ -494,10 +481,8 @@ bfd_hash_traverse (table, func, info)
|
||||||
struct bfd_hash_entry *p;
|
struct bfd_hash_entry *p;
|
||||||
|
|
||||||
for (p = table->table[i]; p != NULL; p = p->next)
|
for (p = table->table[i]; p != NULL; p = p->next)
|
||||||
{
|
if (! (*func) (p, info))
|
||||||
if (! (*func) (p, info))
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,30 +543,25 @@ struct bfd_strtab_hash
|
||||||
bfd_boolean xcoff;
|
bfd_boolean xcoff;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct bfd_hash_entry *strtab_hash_newfunc
|
|
||||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
|
||||||
|
|
||||||
/* Routine to create an entry in a strtab. */
|
/* Routine to create an entry in a strtab. */
|
||||||
|
|
||||||
static struct bfd_hash_entry *
|
static struct bfd_hash_entry *
|
||||||
strtab_hash_newfunc (entry, table, string)
|
strtab_hash_newfunc (struct bfd_hash_entry *entry,
|
||||||
struct bfd_hash_entry *entry;
|
struct bfd_hash_table *table,
|
||||||
struct bfd_hash_table *table;
|
const char *string)
|
||||||
const char *string;
|
|
||||||
{
|
{
|
||||||
struct strtab_hash_entry *ret = (struct strtab_hash_entry *) entry;
|
struct strtab_hash_entry *ret = (struct strtab_hash_entry *) entry;
|
||||||
|
|
||||||
/* Allocate the structure if it has not already been allocated by a
|
/* Allocate the structure if it has not already been allocated by a
|
||||||
subclass. */
|
subclass. */
|
||||||
if (ret == (struct strtab_hash_entry *) NULL)
|
if (ret == NULL)
|
||||||
ret = ((struct strtab_hash_entry *)
|
ret = bfd_hash_allocate (table, sizeof (* entry));
|
||||||
bfd_hash_allocate (table, sizeof (struct strtab_hash_entry)));
|
if (ret == NULL)
|
||||||
if (ret == (struct strtab_hash_entry *) NULL)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct strtab_hash_entry *)
|
ret = (struct strtab_hash_entry *)
|
||||||
bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
|
bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -602,16 +582,16 @@ strtab_hash_newfunc (entry, table, string)
|
||||||
/* Create a new strtab. */
|
/* Create a new strtab. */
|
||||||
|
|
||||||
struct bfd_strtab_hash *
|
struct bfd_strtab_hash *
|
||||||
_bfd_stringtab_init ()
|
_bfd_stringtab_init (void)
|
||||||
{
|
{
|
||||||
struct bfd_strtab_hash *table;
|
struct bfd_strtab_hash *table;
|
||||||
bfd_size_type amt = sizeof (struct bfd_strtab_hash);
|
bfd_size_type amt = sizeof (* table);
|
||||||
|
|
||||||
table = (struct bfd_strtab_hash *) bfd_malloc (amt);
|
table = bfd_malloc (amt);
|
||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (! bfd_hash_table_init (&table->table, strtab_hash_newfunc))
|
if (! bfd_hash_table_init (& table->table, strtab_hash_newfunc))
|
||||||
{
|
{
|
||||||
free (table);
|
free (table);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -630,7 +610,7 @@ _bfd_stringtab_init ()
|
||||||
string. */
|
string. */
|
||||||
|
|
||||||
struct bfd_strtab_hash *
|
struct bfd_strtab_hash *
|
||||||
_bfd_xcoff_stringtab_init ()
|
_bfd_xcoff_stringtab_init (void)
|
||||||
{
|
{
|
||||||
struct bfd_strtab_hash *ret;
|
struct bfd_strtab_hash *ret;
|
||||||
|
|
||||||
|
@ -643,8 +623,7 @@ _bfd_xcoff_stringtab_init ()
|
||||||
/* Free a strtab. */
|
/* Free a strtab. */
|
||||||
|
|
||||||
void
|
void
|
||||||
_bfd_stringtab_free (table)
|
_bfd_stringtab_free (struct bfd_strtab_hash *table)
|
||||||
struct bfd_strtab_hash *table;
|
|
||||||
{
|
{
|
||||||
bfd_hash_table_free (&table->table);
|
bfd_hash_table_free (&table->table);
|
||||||
free (table);
|
free (table);
|
||||||
|
@ -655,13 +634,12 @@ _bfd_stringtab_free (table)
|
||||||
table, and we don't eliminate duplicate strings. */
|
table, and we don't eliminate duplicate strings. */
|
||||||
|
|
||||||
bfd_size_type
|
bfd_size_type
|
||||||
_bfd_stringtab_add (tab, str, hash, copy)
|
_bfd_stringtab_add (struct bfd_strtab_hash *tab,
|
||||||
struct bfd_strtab_hash *tab;
|
const char *str,
|
||||||
const char *str;
|
bfd_boolean hash,
|
||||||
bfd_boolean hash;
|
bfd_boolean copy)
|
||||||
bfd_boolean copy;
|
|
||||||
{
|
{
|
||||||
register struct strtab_hash_entry *entry;
|
struct strtab_hash_entry *entry;
|
||||||
|
|
||||||
if (hash)
|
if (hash)
|
||||||
{
|
{
|
||||||
|
@ -671,9 +649,7 @@ _bfd_stringtab_add (tab, str, hash, copy)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entry = ((struct strtab_hash_entry *)
|
entry = bfd_hash_allocate (&tab->table, sizeof (* entry));
|
||||||
bfd_hash_allocate (&tab->table,
|
|
||||||
sizeof (struct strtab_hash_entry)));
|
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
return (bfd_size_type) -1;
|
return (bfd_size_type) -1;
|
||||||
if (! copy)
|
if (! copy)
|
||||||
|
@ -682,7 +658,7 @@ _bfd_stringtab_add (tab, str, hash, copy)
|
||||||
{
|
{
|
||||||
char *n;
|
char *n;
|
||||||
|
|
||||||
n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1);
|
n = bfd_hash_allocate (&tab->table, strlen (str) + 1);
|
||||||
if (n == NULL)
|
if (n == NULL)
|
||||||
return (bfd_size_type) -1;
|
return (bfd_size_type) -1;
|
||||||
entry->root.string = n;
|
entry->root.string = n;
|
||||||
|
@ -713,8 +689,7 @@ _bfd_stringtab_add (tab, str, hash, copy)
|
||||||
/* Get the number of bytes in a strtab. */
|
/* Get the number of bytes in a strtab. */
|
||||||
|
|
||||||
bfd_size_type
|
bfd_size_type
|
||||||
_bfd_stringtab_size (tab)
|
_bfd_stringtab_size (struct bfd_strtab_hash *tab)
|
||||||
struct bfd_strtab_hash *tab;
|
|
||||||
{
|
{
|
||||||
return tab->size;
|
return tab->size;
|
||||||
}
|
}
|
||||||
|
@ -723,12 +698,10 @@ _bfd_stringtab_size (tab)
|
||||||
the file. */
|
the file. */
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
_bfd_stringtab_emit (abfd, tab)
|
_bfd_stringtab_emit (bfd *abfd, struct bfd_strtab_hash *tab)
|
||||||
register bfd *abfd;
|
|
||||||
struct bfd_strtab_hash *tab;
|
|
||||||
{
|
{
|
||||||
register bfd_boolean xcoff;
|
bfd_boolean xcoff;
|
||||||
register struct strtab_hash_entry *entry;
|
struct strtab_hash_entry *entry;
|
||||||
|
|
||||||
xcoff = tab->xcoff;
|
xcoff = tab->xcoff;
|
||||||
|
|
||||||
|
@ -746,11 +719,11 @@ _bfd_stringtab_emit (abfd, tab)
|
||||||
|
|
||||||
/* The output length includes the null byte. */
|
/* The output length includes the null byte. */
|
||||||
bfd_put_16 (abfd, (bfd_vma) len, buf);
|
bfd_put_16 (abfd, (bfd_vma) len, buf);
|
||||||
if (bfd_bwrite ((PTR) buf, (bfd_size_type) 2, abfd) != 2)
|
if (bfd_bwrite ((void *) buf, (bfd_size_type) 2, abfd) != 2)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
|
if (bfd_bwrite ((void *) str, (bfd_size_type) len, abfd) != len)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
592
bfd/ieee.c
592
bfd/ieee.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue