+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>
* elf32-arm.c (elf32_arm_final_link_relocate): Don't fail for
/* BFD back-end for binary objects.
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>
This file is part of BFD, the Binary File Descriptor library.
a start symbol, an end symbol, and an absolute length symbol. */
#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
machine number to be uses when creating binary BFDs. */
enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown;
/* Create a binary object. Invoked via bfd_set_format. */
static bfd_boolean
-binary_mkobject (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+binary_mkobject (bfd *abfd ATTRIBUTE_UNUSED)
{
return TRUE;
}
being binary. */
static const bfd_target *
-binary_object_p (abfd)
- bfd *abfd;
+binary_object_p (bfd *abfd)
{
struct stat statbuf;
asection *sec;
sec->size = statbuf.st_size;
sec->filepos = 0;
- abfd->tdata.any = (PTR) sec;
+ abfd->tdata.any = (void *) sec;
if (bfd_get_arch_info (abfd) != NULL)
{
return abfd->xvec;
}
-#define binary_close_and_cleanup _bfd_generic_close_and_cleanup
-#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-#define binary_new_section_hook _bfd_generic_new_section_hook
+#define binary_close_and_cleanup _bfd_generic_close_and_cleanup
+#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
+#define binary_new_section_hook _bfd_generic_new_section_hook
/* Get contents of the only section. */
static bfd_boolean
-binary_get_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section ATTRIBUTE_UNUSED;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
+binary_get_section_contents (bfd *abfd,
+ asection *section ATTRIBUTE_UNUSED,
+ void * location,
+ file_ptr offset,
+ bfd_size_type count)
{
if (bfd_seek (abfd, offset, SEEK_SET) != 0
|| bfd_bread (location, count, abfd) != count)
/* Return the amount of memory needed to read the symbol table. */
static long
-binary_get_symtab_upper_bound (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+binary_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED)
{
return (BIN_SYMS + 1) * sizeof (asymbol *);
}
/* Create a symbol name based on the bfd's filename. */
static char *
-mangle_name (abfd, suffix)
- bfd *abfd;
- char *suffix;
+mangle_name (bfd *abfd, char *suffix)
{
bfd_size_type size;
char *buf;
+ strlen (suffix)
+ sizeof "_binary__");
- buf = (char *) bfd_alloc (abfd, size);
+ buf = bfd_alloc (abfd, size);
if (buf == NULL)
return "";
/* Return the symbol table. */
static long
-binary_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
+binary_canonicalize_symtab (bfd *abfd, asymbol **alocation)
{
asection *sec = (asection *) abfd->tdata.any;
asymbol *syms;
unsigned int i;
bfd_size_type amt = BIN_SYMS * sizeof (asymbol);
- syms = (asymbol *) bfd_alloc (abfd, amt);
+ syms = bfd_alloc (abfd, amt);
if (syms == NULL)
return 0;
return BIN_SYMS;
}
-#define binary_make_empty_symbol _bfd_generic_make_empty_symbol
-#define binary_print_symbol _bfd_nosymbols_print_symbol
+#define binary_make_empty_symbol _bfd_generic_make_empty_symbol
+#define binary_print_symbol _bfd_nosymbols_print_symbol
/* Get information about a symbol. */
static void
-binary_get_symbol_info (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
+binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol,
+ symbol_info *ret)
{
bfd_symbol_info (symbol, ret);
}
+#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name
+#define binary_get_lineno _bfd_nosymbols_get_lineno
+#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line
+#define binary_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_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. */
#define binary_set_arch_mach _bfd_generic_set_arch_mach
/* Write section contents of a binary file. */
static bfd_boolean
-binary_set_section_contents (abfd, sec, data, offset, size)
- bfd *abfd;
- asection *sec;
- const PTR data;
- file_ptr offset;
- bfd_size_type size;
+binary_set_section_contents (bfd *abfd,
+ asection *sec,
+ const void * data,
+ file_ptr offset,
+ bfd_size_type size)
{
if (size == 0)
return TRUE;
/* No space is required for header information. */
static int
-binary_sizeof_headers (abfd, exec)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean exec ATTRIBUTE_UNUSED;
+binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_boolean exec ATTRIBUTE_UNUSED)
{
return 0;
}
-#define binary_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#define binary_bfd_relax_section bfd_generic_relax_section
-#define binary_bfd_gc_sections bfd_generic_gc_sections
-#define binary_bfd_merge_sections bfd_generic_merge_sections
-#define binary_bfd_is_group_section bfd_generic_is_group_section
-#define binary_bfd_discard_group bfd_generic_discard_group
-#define binary_section_already_linked \
- _bfd_generic_section_already_linked
-#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
-#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define binary_bfd_final_link _bfd_generic_final_link
-#define binary_bfd_link_split_section _bfd_generic_link_split_section
-#define binary_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
+#define binary_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
+#define binary_bfd_relax_section bfd_generic_relax_section
+#define binary_bfd_gc_sections bfd_generic_gc_sections
+#define binary_bfd_merge_sections bfd_generic_merge_sections
+#define binary_bfd_is_group_section bfd_generic_is_group_section
+#define binary_bfd_discard_group bfd_generic_discard_group
+#define binary_section_already_linked _bfd_generic_section_already_linked
+#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
+#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
+#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
+#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define binary_bfd_final_link _bfd_generic_final_link
+#define binary_bfd_link_split_section _bfd_generic_link_split_section
+#define binary_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
const bfd_target binary_vec =
{
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{ /* bfd_check_format */
_bfd_dummy_target,
- binary_object_p, /* bfd_check_format */
+ binary_object_p,
_bfd_dummy_target,
_bfd_dummy_target,
},
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
-
#include "coff/arm.h"
-
#include "coff/internal.h"
#ifdef COFF_WITH_PE
#endif
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 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 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
/* Used by the assembler. */
static bfd_reloc_status_type
-coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
+coff_arm_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * data,
+ asection *input_section ATTRIBUTE_UNUSED,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
symvalue diff;
- if (output_bfd == (bfd *) NULL)
+
+ if (output_bfd == NULL)
return bfd_reloc_continue;
diff = reloc_entry->addend;
#define ARM_DISP16 5
#define ARM_DISP32 6
#define ARM_26D 7
-/* 8 is unused */
+/* 8 is unused. */
#define ARM_NEG16 9
#define ARM_NEG32 10
#define ARM_RVA32 11
#define ARM_SECREL 15
#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[] =
{
#ifdef ARM_WINCE
0xffffffff,
PCRELOFFSET),
#else /* not ARM_WINCE */
- HOWTO (ARM_8, /* type */
- 0, /* rightshift */
- 0, /* size */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_arm_reloc, /* special_function */
- "ARM_8", /* name */
- TRUE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- PCRELOFFSET /* pcrel_offset */),
+ HOWTO (ARM_8,
+ 0,
+ 0,
+ 8,
+ FALSE,
+ 0,
+ complain_overflow_bitfield,
+ coff_arm_reloc,
+ "ARM_8",
+ TRUE,
+ 0x000000ff,
+ 0x000000ff,
+ PCRELOFFSET),
HOWTO (ARM_16,
0,
1,
#define NUM_RELOCS NUM_ELEM (aoutarm_std_reloc_howto)
#ifdef COFF_WITH_PE
-static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
/* Return TRUE if this relocation should
appear in the output .reloc section. */
static bfd_boolean
-in_reloc_p (abfd, howto)
- bfd * abfd ATTRIBUTE_UNUSED;
- reloc_howto_type * howto;
+in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED,
+ reloc_howto_type * howto)
{
return !howto->pc_relative && howto->type != ARM_RVA32;
}
#define coff_rtype_to_howto coff_arm_rtype_to_howto
static reloc_howto_type *
-coff_arm_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec;
- struct internal_reloc *rel;
- struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- bfd_vma *addendp;
+coff_arm_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec,
+ struct internal_reloc *rel,
+ struct coff_link_hash_entry *h ATTRIBUTE_UNUSED,
+ struct internal_syment *sym ATTRIBUTE_UNUSED,
+ bfd_vma *addendp)
{
reloc_howto_type * howto;
/* Used by the assembler. */
static bfd_reloc_status_type
-aoutarm_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;
+aoutarm_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;
/* Used by the assembler. */
static bfd_reloc_status_type
-aoutarm_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;
+aoutarm_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;
}
static bfd_reloc_status_type
-coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message, btype)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
- thumb_pcrel_branchtype btype;
+coff_thumb_pcrel_common (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED,
+ thumb_pcrel_branchtype btype)
{
bfd_vma relocation = 0;
bfd_size_type addr = reloc_entry->address;
/* NOTE: This routine is currently used by GAS, but not by the link
phase. */
-
switch (btype)
{
case b9:
#ifndef ARM_WINCE
static bfd_reloc_status_type
-coff_thumb_pcrel_23 (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;
+coff_thumb_pcrel_23 (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message)
{
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message,
}
static bfd_reloc_status_type
-coff_thumb_pcrel_9 (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;
+coff_thumb_pcrel_9 (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message)
{
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message,
#endif /* not ARM_WINCE */
static bfd_reloc_status_type
-coff_thumb_pcrel_12 (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;
+coff_thumb_pcrel_12 (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message)
{
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message,
}
static const struct reloc_howto_struct *
-coff_arm_reloc_type_lookup (abfd, code)
- bfd * abfd;
- bfd_reloc_code_real_type code;
+coff_arm_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code)
{
#define ASTD(i,j) case i: return aoutarm_std_reloc_howto + j
code = BFD_RELOC_32;
break;
default:
- return (const struct reloc_howto_struct *) 0;
+ return NULL;
}
switch (code)
ASTD (BFD_RELOC_THUMB_PCREL_BRANCH23, ARM_THUMB23);
ASTD (BFD_RELOC_THUMB_PCREL_BLX, ARM_THUMB23);
#endif
- default: return (const struct reloc_howto_struct *) 0;
+ default: return NULL;
}
}
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
-#define COFF_PAGE_SIZE 0x1000
-/* Turn a howto into a reloc nunmber */
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2
+#define COFF_PAGE_SIZE 0x1000
+/* Turn a howto into a reloc nunmber. */
#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
-#define BADMAG(x) ARMBADMAG(x)
-#define ARM 1 /* Customize coffcode.h */
+#define BADMAG(x) ARMBADMAG(x)
+#define ARM 1 /* Customize coffcode.h. */
#ifndef ARM_WINCE
/* Make sure that the 'r_offset' field is copied properly
/* Create an ARM coff linker hash table. */
static struct bfd_link_hash_table *
-coff_arm_link_hash_table_create (abfd)
- bfd * abfd;
+coff_arm_link_hash_table_create (bfd * abfd)
{
struct coff_arm_link_hash_table * ret;
bfd_size_type amt = sizeof (struct coff_arm_link_hash_table);
- ret = (struct coff_arm_link_hash_table *) bfd_malloc (amt);
- if (ret == (struct coff_arm_link_hash_table *) NULL)
+ ret = bfd_malloc (amt);
+ if (ret == NULL)
return NULL;
if (! _bfd_coff_link_hash_table_init
(& ret->root, abfd, _bfd_coff_link_hash_newfunc))
{
free (ret);
- return (struct bfd_link_hash_table *) NULL;
+ return NULL;
}
ret->thumb_glue_size = 0;
}
static void
-arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
- struct bfd_link_info *info;
- bfd *output_bfd;
- asection *input_section;
- bfd_vma reloc_offset;
+arm_emit_base_file_entry (struct bfd_link_info *info,
+ bfd *output_bfd,
+ asection *input_section,
+ bfd_vma reloc_offset)
{
bfd_vma addr = reloc_offset
- input_section->vma
#define HI_LOW_ORDER 0xF000F800
static insn32
-insert_thumb_branch (br_insn, rel_off)
- insn32 br_insn;
- int rel_off;
+insert_thumb_branch (insn32 br_insn, int rel_off)
{
unsigned int low_bits;
unsigned int high_bits;
- BFD_ASSERT((rel_off & 1) != 1);
+ BFD_ASSERT ((rel_off & 1) != 1);
- rel_off >>= 1; /* half word aligned address */
- low_bits = rel_off & 0x000007FF; /* the bottom 11 bits */
- high_bits = (rel_off >> 11) & 0x000007FF; /* the top 11 bits */
+ rel_off >>= 1; /* Half word aligned address. */
+ low_bits = rel_off & 0x000007FF; /* The bottom 11 bits. */
+ high_bits = (rel_off >> 11) & 0x000007FF; /* The top 11 bits. */
if ((br_insn & LOW_HI_ORDER) == LOW_HI_ORDER)
br_insn = LOW_HI_ORDER | (low_bits << 16) | high_bits;
\f
static struct coff_link_hash_entry *
-find_thumb_glue (info, name, input_bfd)
- struct bfd_link_info *info;
- const char *name;
- bfd *input_bfd;
+find_thumb_glue (struct bfd_link_info *info,
+ const char *name,
+ bfd *input_bfd)
{
char *tmp_name;
struct coff_link_hash_entry *myh;
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);
#endif /* not ARM_WINCE */
static struct coff_link_hash_entry *
-find_arm_glue (info, name, input_bfd)
- struct bfd_link_info *info;
- const char *name;
- bfd *input_bfd;
+find_arm_glue (struct bfd_link_info *info,
+ const char *name,
+ bfd *input_bfd)
{
char *tmp_name;
struct coff_link_hash_entry * myh;
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);
is different from the original. */
static bfd_boolean
-coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, syms, sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- struct internal_reloc *relocs;
- struct internal_syment *syms;
- asection **sections;
+coff_arm_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ struct internal_reloc *relocs,
+ struct internal_syment *syms,
+ asection **sections)
{
struct internal_reloc * rel;
struct internal_reloc * relend;
addend -= rel->r_vaddr - input_section->vma;
#ifdef ARM_WINCE
/* 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;
#endif
howto = &fake_arm26_reloc;
|| h->class == C_STAT
|| h->class == C_LABEL)
{
- /* Thumb code calling an ARM function */
+ /* Thumb code calling an ARM function. */
asection * s = 0;
bfd_vma my_offset;
unsigned long int tmp;
s->contents + my_offset + 2);
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)
- (s->output_offset /* 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_section->vma) /* Address of the start of the current section. */
- + 4 /* The branch instruction is 4 bytes into the stub. */
- + 8); /* ARM branches work from the pc of the instruction + 8. */
+ /* Offset from the start of the current section to the start of the stubs. */
+ (s->output_offset
+ /* Offset of the start of this stub from the start of the stubs. */
+ + my_offset
+ /* 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_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
if (done)
rstat = bfd_reloc_ok;
#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
&& howto->type == ARM_THUMB23)
{
contents,
rel->r_vaddr - input_section->vma,
val, addend);
- /* FIXME:
- 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 */
+ /* Only perform this fix during the final link, not a relocatable link. */
if (! info->relocatable
&& (rel->r_type == ARM_32 || rel->r_type == ARM_RVA32))
{
/* Determine if we need to set the bottom bit of a relocated address
because the address is the address of a Thumb code symbol. */
-
int patchit = FALSE;
if (h != NULL
&& sym->n_scnum > N_UNDEF)
{
/* No hash entry - use the symbol instead. */
-
if ( sym->n_sclass == C_THUMBSTATFUNC
|| sym->n_sclass == C_THUMBEXTFUNC)
patchit = TRUE;
#ifndef COFF_IMAGE_WITH_PE
bfd_boolean
-bfd_arm_allocate_interworking_sections (info)
- struct bfd_link_info * info;
+bfd_arm_allocate_interworking_sections (struct bfd_link_info * info)
{
asection * s;
bfd_byte * foo;
BFD_ASSERT (s != NULL);
- foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
- globals->arm_glue_size);
+ foo = bfd_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size);
s->size = globals->arm_glue_size;
s->contents = foo;
BFD_ASSERT (s != NULL);
- foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
- globals->thumb_glue_size);
+ foo = bfd_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size);
s->size = globals->thumb_glue_size;
s->contents = foo;
}
static void
-record_arm_to_thumb_glue (info, h)
- struct bfd_link_info * info;
- struct coff_link_hash_entry * h;
+record_arm_to_thumb_glue (struct bfd_link_info * info,
+ struct coff_link_hash_entry * h)
{
const char * name = h->root.root.string;
register asection * s;
BFD_ASSERT (s != NULL);
amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1;
- tmp_name = (char *) bfd_malloc (amt);
+ tmp_name = bfd_malloc (amt);
BFD_ASSERT (tmp_name);
if (myh != NULL)
{
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
though the section isn't allocated yet, this is where we will be putting
it. */
-
bh = NULL;
val = globals->arm_glue_size + 1;
bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
#ifndef ARM_WINCE
static void
-record_thumb_to_arm_glue (info, h)
- struct bfd_link_info * info;
- struct coff_link_hash_entry * h;
+record_thumb_to_arm_glue (struct bfd_link_info * info,
+ struct coff_link_hash_entry * h)
{
const char * name = h->root.root.string;
- register asection * s;
+ asection * s;
char * tmp_name;
struct coff_link_hash_entry * myh;
struct bfd_link_hash_entry * bh;
BFD_ASSERT (s != NULL);
amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1;
- tmp_name = (char *) bfd_malloc (amt);
+ tmp_name = bfd_malloc (amt);
BFD_ASSERT (tmp_name);
if (myh != NULL)
{
free (tmp_name);
- return; /* we've already seen this guy */
+ /* We've already seen this guy. */
+ return;
}
bh = NULL;
#define BACK_FROM_ARM "__%s_back_from_arm"
amt = strlen (name) + strlen (CHANGE_TO_ARM) + 1;
- tmp_name = (char *) bfd_malloc (amt);
+ tmp_name = bfd_malloc (amt);
BFD_ASSERT (tmp_name);
{armcoff/pe}.em */
bfd_boolean
-bfd_arm_get_bfd_for_interworking (abfd, info)
- bfd * abfd;
- struct bfd_link_info * info;
+bfd_arm_get_bfd_for_interworking (bfd * abfd,
+ struct bfd_link_info * info)
{
struct coff_arm_link_hash_table * globals;
flagword flags;
}
bfd_boolean
-bfd_arm_process_before_allocation (abfd, info, support_old_code)
- bfd * abfd;
- struct bfd_link_info * info;
- int support_old_code;
+bfd_arm_process_before_allocation (bfd * abfd,
+ struct bfd_link_info * info,
+ int support_old_code)
{
asection * sec;
struct coff_arm_link_hash_table * globals;
/* 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. */
-
_bfd_coff_get_external_symbols (abfd);
globals = coff_arm_hash_table (info);
/* Load the relocs. */
/* FIXME: there may be a storage leak here. */
-
i = _bfd_coff_read_internal_relocs (abfd, sec, 1, 0, 0, 0);
BFD_ASSERT (i != 0);
into ARM_26D relocs. */
static bfd_boolean
-coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
- bfd *obfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- bfd *ibfd;
- asection *sec;
- struct internal_reloc *irel;
- bfd_boolean *adjustedp;
+coff_arm_adjust_symndx (bfd *obfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ bfd *ibfd,
+ asection *sec,
+ struct internal_reloc *irel,
+ bfd_boolean *adjustedp)
{
if (irel->r_type == ARM_26)
{
targets, eg different CPUs or different APCS's. */
static bfd_boolean
-coff_arm_merge_private_bfd_data (ibfd, obfd)
- bfd * ibfd;
- bfd * obfd;
+coff_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
{
BFD_ASSERT (ibfd != NULL && obfd != NULL);
/* Display the flags field. */
static bfd_boolean
-coff_arm_print_private_bfd_data (abfd, ptr)
- bfd * abfd;
- PTR ptr;
+coff_arm_print_private_bfd_data (bfd * abfd, void * ptr)
{
FILE * file = (FILE *) ptr;
called from both coffcode.h and peicode.h. */
static bfd_boolean
-_bfd_coff_arm_set_private_flags (abfd, flags)
- bfd * abfd;
- flagword flags;
+_bfd_coff_arm_set_private_flags (bfd * abfd, flagword flags)
{
flagword flag;
from one instance of a BFD to another. */
static bfd_boolean
-coff_arm_copy_private_bfd_data (src, dest)
- bfd * src;
- bfd * dest;
+coff_arm_copy_private_bfd_data (bfd * src, bfd * dest)
{
BFD_ASSERT (src != NULL && dest != NULL);
if (src->xvec != dest->xvec)
return TRUE;
- /* copy the flags field */
+ /* Copy the flags field. */
if (APCS_SET (src))
{
if (APCS_SET (dest))
non-local.
b) Allow other prefixes than ".", e.g. an empty prefix would cause all
labels of the form Lxxx to be stripped. */
+
static bfd_boolean
-coff_arm_is_local_label_name (abfd, name)
- bfd * abfd ATTRIBUTE_UNUSED;
- const char * name;
+coff_arm_is_local_label_name (bfd * abfd ATTRIBUTE_UNUSED,
+ const char * name)
{
#ifdef USER_LABEL_PREFIX
if (USER_LABEL_PREFIX[0] != 0)
the glue section is written last.
This does depend on bfd_make_section attaching a new section to the
- end of the section list for the bfd.
-
- krk@cygnus.com */
+ end of the section list for the bfd. */
static bfd_boolean
-coff_arm_link_output_has_begun (sub, info)
- bfd * sub;
- struct coff_final_link_info * info;
+coff_arm_link_output_has_begun (bfd * sub, struct coff_final_link_info * info)
{
return (sub->output_has_begun
|| sub == coff_arm_hash_table (info->info)->bfd_of_glue_owner);
}
static bfd_boolean
-coff_arm_final_link_postscript (abfd, pfinfo)
- bfd * abfd ATTRIBUTE_UNUSED;
- struct coff_final_link_info * pfinfo;
+coff_arm_final_link_postscript (bfd * abfd ATTRIBUTE_UNUSED,
+ struct coff_final_link_info * pfinfo)
{
struct coff_arm_link_hash_table * globals;
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. */
/* Most of this hacked by Steve Chamberlain, sac@cygnus.com.
Split out of coffcode.h by Ian Taylor, ian@cygnus.com. */
#include "coff/internal.h"
#include "libcoff.h"
-static void coff_fix_symbol_name
- PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_size_type *,
- asection **, bfd_size_type *));
-static bfd_boolean coff_write_symbol
- PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_vma *,
- bfd_size_type *, asection **, bfd_size_type *));
-static bfd_boolean coff_write_alien_symbol
- PARAMS ((bfd *, asymbol *, bfd_vma *, bfd_size_type *,
- asection **, bfd_size_type *));
-static bfd_boolean coff_write_native_symbol
- PARAMS ((bfd *, coff_symbol_type *, bfd_vma *, bfd_size_type *,
- asection **, bfd_size_type *));
-static void coff_pointerize_aux
- PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
- unsigned int, combined_entry_type *));
-static bfd_boolean make_a_section_from_file
- PARAMS ((bfd *, struct internal_scnhdr *, unsigned int));
-static const bfd_target *coff_real_object_p
- PARAMS ((bfd *, unsigned, struct internal_filehdr *,
- struct internal_aouthdr *));
-static void fixup_symbol_value
- PARAMS ((bfd *, coff_symbol_type *, struct internal_syment *));
-static char *build_debug_section
- PARAMS ((bfd *));
-static char *copy_name
- PARAMS ((bfd *, char *, size_t));
-
-#define STRING_SIZE_SIZE (4)
-
/* Take a section header read from a coff file (in HOST byte order),
and make a BFD "section" out of it. This is used by ECOFF. */
+
static bfd_boolean
-make_a_section_from_file (abfd, hdr, target_index)
- bfd *abfd;
- struct internal_scnhdr *hdr;
- unsigned int target_index;
+make_a_section_from_file (bfd *abfd,
+ struct internal_scnhdr *hdr,
+ unsigned int target_index)
{
asection *return_section;
char *name;
return_section->lineno_count = hdr->s_nlnno;
return_section->userdata = NULL;
- return_section->next = (asection *) NULL;
+ return_section->next = NULL;
return_section->target_index = target_index;
if (! bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name, return_section,
if (hdr->s_nreloc != 0)
return_section->flags |= SEC_RELOC;
- /* FIXME: should this check 'hdr->s_size > 0' */
+ /* FIXME: should this check 'hdr->s_size > 0'. */
if (hdr->s_scnptr != 0)
return_section->flags |= SEC_HAS_CONTENTS;
ECOFF as well. */
static const bfd_target *
-coff_real_object_p (abfd, nscns, internal_f, internal_a)
- bfd *abfd;
- unsigned nscns;
- struct internal_filehdr *internal_f;
- struct internal_aouthdr *internal_a;
+coff_real_object_p (bfd *abfd,
+ unsigned nscns,
+ struct internal_filehdr *internal_f,
+ struct internal_aouthdr *internal_a)
{
flagword oflags = abfd->flags;
bfd_vma ostart = bfd_get_start_address (abfd);
- PTR tdata;
- PTR tdata_save;
- bfd_size_type readsize; /* length of file_info */
+ void * tdata;
+ void * tdata_save;
+ bfd_size_type readsize; /* Length of file_info. */
unsigned int scnhsz;
char *external_sections;
/* Set up the tdata area. ECOFF uses its own routine, and overrides
abfd->flags. */
tdata_save = abfd->tdata.any;
- tdata = bfd_coff_mkobject_hook (abfd, (PTR) internal_f, (PTR) internal_a);
+ tdata = bfd_coff_mkobject_hook (abfd, (void *) internal_f, (void *) internal_a);
if (tdata == NULL)
goto fail2;
scnhsz = bfd_coff_scnhsz (abfd);
readsize = (bfd_size_type) nscns * scnhsz;
- external_sections = (char *) bfd_alloc (abfd, readsize);
+ external_sections = bfd_alloc (abfd, readsize);
if (!external_sections)
goto fail;
- if (bfd_bread ((PTR) external_sections, readsize, abfd) != readsize)
+ if (bfd_bread ((void *) external_sections, readsize, abfd) != readsize)
goto fail;
/* Set the arch/mach *before* swapping in sections; section header swapping
may depend on arch/mach info. */
- if (! bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f))
+ if (! bfd_coff_set_arch_mach_hook (abfd, (void *) internal_f))
goto fail;
/* Now copy data as required; construct all asections etc. */
{
struct internal_scnhdr tmp;
bfd_coff_swap_scnhdr_in (abfd,
- (PTR) (external_sections + i * scnhsz),
- (PTR) & tmp);
+ (void *) (external_sections + i * scnhsz),
+ (void *) & tmp);
if (! make_a_section_from_file (abfd, &tmp, i + 1))
goto fail;
}
not a COFF file. This is also used by ECOFF. */
const bfd_target *
-coff_object_p (abfd)
- bfd *abfd;
+coff_object_p (bfd *abfd)
{
bfd_size_type filhsz;
bfd_size_type aoutsz;
unsigned int nscns;
- PTR filehdr;
+ void * filehdr;
struct internal_filehdr internal_f;
struct internal_aouthdr internal_a;
- /* figure out how much to read */
+ /* Figure out how much to read. */
filhsz = bfd_coff_filhsz (abfd);
aoutsz = bfd_coff_aoutsz (abfd);
if (internal_f.f_opthdr)
{
- PTR opthdr;
+ void * opthdr;
opthdr = bfd_alloc (abfd, aoutsz);
if (opthdr == NULL)
bfd_release (abfd, opthdr);
return NULL;
}
- bfd_coff_swap_aouthdr_in (abfd, opthdr, (PTR) &internal_a);
+ bfd_coff_swap_aouthdr_in (abfd, opthdr, (void *) &internal_a);
bfd_release (abfd, opthdr);
}
/* Get the BFD section from a COFF symbol section number. */
asection *
-coff_section_from_bfd_index (abfd, index)
- bfd *abfd;
- int index;
+coff_section_from_bfd_index (bfd *abfd, int index)
{
struct bfd_section *answer = abfd->sections;
/* Get the upper bound of a COFF symbol table. */
long
-coff_get_symtab_upper_bound (abfd)
- bfd *abfd;
+coff_get_symtab_upper_bound (bfd *abfd)
{
if (!bfd_coff_slurp_symbol_table (abfd))
return -1;
/* Canonicalize a COFF symbol table. */
long
-coff_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
+coff_canonicalize_symtab (bfd *abfd, asymbol **alocation)
{
unsigned int counter;
coff_symbol_type *symbase;
>= SYMNMLEN + 1. */
const char *
-_bfd_coff_internal_syment_name (abfd, sym, buf)
- bfd *abfd;
- const struct internal_syment *sym;
- char *buf;
+_bfd_coff_internal_syment_name (bfd *abfd,
+ const struct internal_syment *sym,
+ char *buf)
{
/* FIXME: It's not clear this will work correctly if sizeof
(_n_zeroes) != 4. */
value must be INTERNAL_RELOCS. The function returns NULL on error. */
struct internal_reloc *
-_bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
- require_internal, internal_relocs)
- bfd *abfd;
- asection *sec;
- bfd_boolean cache;
- bfd_byte *external_relocs;
- bfd_boolean require_internal;
- struct internal_reloc *internal_relocs;
+_bfd_coff_read_internal_relocs (bfd *abfd,
+ asection *sec,
+ bfd_boolean cache,
+ bfd_byte *external_relocs,
+ bfd_boolean require_internal,
+ struct internal_reloc *internal_relocs)
{
bfd_size_type relsz;
bfd_byte *free_external = NULL;
amt = sec->reloc_count * relsz;
if (external_relocs == NULL)
{
- free_external = (bfd_byte *) bfd_malloc (amt);
+ free_external = bfd_malloc (amt);
if (free_external == NULL && sec->reloc_count > 0)
goto error_return;
external_relocs = free_external;
{
amt = sec->reloc_count;
amt *= sizeof (struct internal_reloc);
- free_internal = (struct internal_reloc *) bfd_malloc (amt);
+ free_internal = bfd_malloc (amt);
if (free_internal == NULL && sec->reloc_count > 0)
goto error_return;
internal_relocs = free_internal;
erel_end = erel + relsz * sec->reloc_count;
irel = internal_relocs;
for (; erel < erel_end; erel += relsz, irel++)
- bfd_coff_swap_reloc_in (abfd, (PTR) erel, (PTR) irel);
+ bfd_coff_swap_reloc_in (abfd, (void *) erel, (void *) irel);
if (free_external != NULL)
{
if (coff_section_data (abfd, sec) == NULL)
{
amt = sizeof (struct coff_section_tdata);
- sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
+ sec->used_by_bfd = bfd_zalloc (abfd, amt);
if (sec->used_by_bfd == NULL)
goto error_return;
coff_section_data (abfd, sec)->contents = NULL;
/* Set lineno_count for the output sections of a COFF file. */
int
-coff_count_linenumbers (abfd)
- bfd *abfd;
+coff_count_linenumbers (bfd *abfd)
{
unsigned int limit = bfd_get_symcount (abfd);
unsigned int i;
area of the symbol if there is one. */
coff_symbol_type *
-coff_symbol_from (ignore_abfd, symbol)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
+coff_symbol_from (bfd *ignore_abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol)
{
if (!bfd_family_coff (bfd_asymbol_bfd (symbol)))
return (coff_symbol_type *) NULL;
}
static void
-fixup_symbol_value (abfd, coff_symbol_ptr, syment)
- bfd *abfd;
- coff_symbol_type *coff_symbol_ptr;
- struct internal_syment *syment;
+fixup_symbol_value (bfd *abfd,
+ coff_symbol_type *coff_symbol_ptr,
+ struct internal_syment *syment)
{
-
- /* Normalize the symbol flags */
+ /* Normalize the symbol flags. */
if (bfd_is_com_section (coff_symbol_ptr->symbol.section))
{
- /* a common symbol is undefined with a value */
+ /* A common symbol is undefined with a value. */
syment->n_scnum = N_UNDEF;
syment->n_value = coff_symbol_ptr->symbol.value;
}
do that here too. */
bfd_boolean
-coff_renumber_symbols (bfd_ptr, first_undef)
- bfd *bfd_ptr;
- int *first_undef;
+coff_renumber_symbols (bfd *bfd_ptr, int *first_undef)
{
unsigned int symbol_count = bfd_get_symcount (bfd_ptr);
asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols;
unsigned int native_index = 0;
- struct internal_syment *last_file = (struct internal_syment *) NULL;
+ struct internal_syment *last_file = NULL;
unsigned int symbol_index;
/* COFF demands that undefined symbols come after all other symbols.
bfd_size_type amt;
amt = sizeof (asymbol *) * ((bfd_size_type) symbol_count + 1);
- newsyms = (asymbol **) bfd_alloc (bfd_ptr, amt);
+ newsyms = bfd_alloc (bfd_ptr, amt);
if (!newsyms)
return FALSE;
bfd_ptr->outsymbols = newsyms;
if (s->u.syment.n_sclass == C_FILE)
{
- if (last_file != (struct internal_syment *) NULL)
+ if (last_file != NULL)
last_file->n_value = native_index;
last_file = &(s->u.syment);
}
else
- {
-
- /* Modify the symbol values according to their section and
- type */
+ /* Modify the symbol values according to their section and
+ type. */
+ fixup_symbol_value (bfd_ptr, coff_symbol_ptr, &(s->u.syment));
- fixup_symbol_value (bfd_ptr, coff_symbol_ptr, &(s->u.syment));
- }
for (i = 0; i < s->u.syment.n_numaux + 1; i++)
s[i].offset = native_index++;
}
else
- {
- native_index++;
- }
+ native_index++;
}
+
obj_conv_table_size (bfd_ptr) = native_index;
return TRUE;
symbol table. */
void
-coff_mangle_symbols (bfd_ptr)
- bfd *bfd_ptr;
+coff_mangle_symbols (bfd *bfd_ptr)
{
unsigned int symbol_count = bfd_get_symcount (bfd_ptr);
asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols;
}
static void
-coff_fix_symbol_name (abfd, symbol, native, string_size_p,
- debug_string_section_p, debug_string_size_p)
- bfd *abfd;
- asymbol *symbol;
- combined_entry_type *native;
- bfd_size_type *string_size_p;
- asection **debug_string_section_p;
- bfd_size_type *debug_string_size_p;
+coff_fix_symbol_name (bfd *abfd,
+ asymbol *symbol,
+ combined_entry_type *native,
+ bfd_size_type *string_size_p,
+ asection **debug_string_section_p,
+ bfd_size_type *debug_string_size_p)
{
unsigned int name_length;
union internal_auxent *auxent;
char *name = (char *) (symbol->name);
- if (name == (char *) NULL)
+ if (name == NULL)
{
- /* coff symbols always have names, so we'll make one up */
+ /* COFF symbols always have names, so we'll make one up. */
symbol->name = "strange";
name = (char *) symbol->name;
}
if (bfd_coff_long_filenames (abfd))
{
if (name_length <= filnmlen)
- {
- strncpy (auxent->x_file.x_fname, name, filnmlen);
- }
+ strncpy (auxent->x_file.x_fname, name, filnmlen);
else
{
auxent->x_file.x_n.x_offset = *string_size_p + STRING_SIZE_SIZE;
else
{
if (name_length <= SYMNMLEN && !bfd_coff_force_symnames_in_strings (abfd))
- {
- /* This name will fit into the symbol neatly */
- strncpy (native->u.syment._n._n_name, symbol->name, SYMNMLEN);
- }
+ /* This name will fit into the symbol neatly. */
+ strncpy (native->u.syment._n._n_name, symbol->name, SYMNMLEN);
+
else if (!bfd_coff_symname_in_debug (abfd, &native->u.syment))
{
native->u.syment._n._n_n._n_offset = (*string_size_p
if (!bfd_set_section_contents (abfd,
*debug_string_section_p,
- (PTR) buf,
+ (void *) buf,
(file_ptr) *debug_string_size_p,
(bfd_size_type) prefix_len)
|| !bfd_set_section_contents (abfd,
*debug_string_section_p,
- (PTR) symbol->name,
+ (void *) symbol->name,
(file_ptr) (*debug_string_size_p
+ prefix_len),
(bfd_size_type) name_length + 1))
/* Write a symbol out to a COFF file. */
static bfd_boolean
-coff_write_symbol (abfd, symbol, native, written, string_size_p,
- debug_string_section_p, debug_string_size_p)
- bfd *abfd;
- asymbol *symbol;
- combined_entry_type *native;
- bfd_vma *written;
- bfd_size_type *string_size_p;
- asection **debug_string_section_p;
- bfd_size_type *debug_string_size_p;
+coff_write_symbol (bfd *abfd,
+ asymbol *symbol,
+ combined_entry_type *native,
+ bfd_vma *written,
+ bfd_size_type *string_size_p,
+ asection **debug_string_section_p,
+ bfd_size_type *debug_string_size_p)
{
unsigned int numaux = native->u.syment.n_numaux;
int type = native->u.syment.n_type;
int class = native->u.syment.n_sclass;
- PTR buf;
+ void * buf;
bfd_size_type symesz;
if (native->u.syment.n_sclass == C_FILE)
if (symbol->flags & BSF_DEBUGGING
&& bfd_is_abs_section (symbol->section))
- {
- native->u.syment.n_scnum = N_DEBUG;
- }
+ native->u.syment.n_scnum = N_DEBUG;
+
else if (bfd_is_abs_section (symbol->section))
- {
- native->u.syment.n_scnum = N_ABS;
- }
+ native->u.syment.n_scnum = N_ABS;
+
else if (bfd_is_und_section (symbol->section))
- {
- native->u.syment.n_scnum = N_UNDEF;
- }
+ native->u.syment.n_scnum = N_UNDEF;
+
else
- {
- native->u.syment.n_scnum =
- symbol->section->output_section->target_index;
- }
+ native->u.syment.n_scnum =
+ symbol->section->output_section->target_index;
coff_fix_symbol_name (abfd, symbol, native, string_size_p,
debug_string_section_p, debug_string_size_p);
{
bfd_coff_swap_aux_out (abfd,
&((native + j + 1)->u.auxent),
- type,
- class,
- (int) j,
+ type, class, (int) j,
native->u.syment.n_numaux,
buf);
if (bfd_bwrite (buf, auxesz, abfd) != auxesz)
or we may be linking a non COFF file to a COFF file. */
static bfd_boolean
-coff_write_alien_symbol (abfd, symbol, written, string_size_p,
- debug_string_section_p, debug_string_size_p)
- bfd *abfd;
- asymbol *symbol;
- bfd_vma *written;
- bfd_size_type *string_size_p;
- asection **debug_string_section_p;
- bfd_size_type *debug_string_size_p;
+coff_write_alien_symbol (bfd *abfd,
+ asymbol *symbol,
+ bfd_vma *written,
+ bfd_size_type *string_size_p,
+ asection **debug_string_section_p,
+ bfd_size_type *debug_string_size_p)
{
combined_entry_type *native;
combined_entry_type dummy;
/* Write a native symbol to a COFF file. */
static bfd_boolean
-coff_write_native_symbol (abfd, symbol, written, string_size_p,
- debug_string_section_p, debug_string_size_p)
- bfd *abfd;
- coff_symbol_type *symbol;
- bfd_vma *written;
- bfd_size_type *string_size_p;
- asection **debug_string_section_p;
- bfd_size_type *debug_string_size_p;
+coff_write_native_symbol (bfd *abfd,
+ coff_symbol_type *symbol,
+ bfd_vma *written,
+ bfd_size_type *string_size_p,
+ asection **debug_string_section_p,
+ bfd_size_type *debug_string_size_p)
{
combined_entry_type *native = symbol->native;
alent *lineno = symbol->lineno;
if (lineno && !symbol->done_lineno && symbol->symbol.section->owner != NULL)
{
unsigned int count = 0;
+
lineno[count].u.offset = *written;
if (native->u.syment.n_numaux)
{
/* Write out the COFF symbols. */
bfd_boolean
-coff_write_symbols (abfd)
- bfd *abfd;
+coff_write_symbols (bfd *abfd)
{
bfd_size_type string_size;
asection *debug_string_section;
}
}
- /* Seek to the right place */
+ /* Seek to the right place. */
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
return FALSE;
- /* Output all the symbols we have */
-
+ /* Output all the symbols we have. */
written = 0;
for (p = abfd->outsymbols, i = 0; i < limit; i++, p++)
{
obj_raw_syment_count (abfd) = written;
- /* Now write out strings */
-
+ /* Now write out strings. */
if (string_size != 0)
{
unsigned int size = string_size + STRING_SIZE_SIZE;
#else
#error Change H_PUT_32
#endif
- if (bfd_bwrite ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd)
+ if (bfd_bwrite ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd)
!= sizeof (buffer))
return FALSE;
if (c_symbol == NULL
|| c_symbol->native == NULL)
- {
- /* This is not a COFF symbol, so it certainly is not a
- file name, nor does it go in the .debug section. */
- maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN;
- }
+ /* This is not a COFF symbol, so it certainly is not a
+ file name, nor does it go in the .debug section. */
+ maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN;
+
else if (bfd_coff_symname_in_debug (abfd,
&c_symbol->native->u.syment))
- {
- /* This symbol name is in the XCOFF .debug section.
- Don't write it into the string table. */
- maxlen = name_length;
- }
+ /* This symbol name is in the XCOFF .debug section.
+ Don't write it into the string table. */
+ maxlen = name_length;
+
else if (c_symbol->native->u.syment.n_sclass == C_FILE
&& c_symbol->native->u.syment.n_numaux > 0)
{
if (name_length > maxlen)
{
- if (bfd_bwrite ((PTR) (q->name), (bfd_size_type) name_length + 1,
+ if (bfd_bwrite ((void *) (q->name), (bfd_size_type) name_length + 1,
abfd) != name_length + 1)
return FALSE;
}
#else
#error Change H_PUT_32
#endif
- if (bfd_bwrite ((PTR) buffer, (bfd_size_type) STRING_SIZE_SIZE, abfd)
+ if (bfd_bwrite ((void *) buffer, (bfd_size_type) STRING_SIZE_SIZE, abfd)
!= STRING_SIZE_SIZE)
return FALSE;
}
}
bfd_boolean
-coff_write_linenumbers (abfd)
- bfd *abfd;
+coff_write_linenumbers (bfd *abfd)
{
asection *s;
bfd_size_type linesz;
- PTR buff;
+ void * buff;
linesz = bfd_coff_linesz (abfd);
buff = bfd_alloc (abfd, linesz);
asymbol **q = abfd->outsymbols;
if (bfd_seek (abfd, s->line_filepos, SEEK_SET) != 0)
return FALSE;
- /* Find all the linenumbers in this section */
+ /* Find all the linenumbers in this section. */
while (*q)
{
asymbol *p = *q;
(bfd_asymbol_bfd (p), p));
if (l)
{
- /* Found a linenumber entry, output */
+ /* Found a linenumber entry, output. */
struct internal_lineno out;
- memset ((PTR) & out, 0, sizeof (out));
+ memset ((void *) & out, 0, sizeof (out));
out.l_lnno = 0;
out.l_addr.l_symndx = l->u.offset;
bfd_coff_swap_lineno_out (abfd, &out, buff);
}
alent *
-coff_get_lineno (ignore_abfd, symbol)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
+coff_get_lineno (bfd *ignore_abfd ATTRIBUTE_UNUSED, asymbol *symbol)
{
return coffsymbol (symbol)->lineno;
}
pointers to syments. */
static void
-coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent)
- bfd *abfd;
- combined_entry_type *table_base;
- combined_entry_type *symbol;
- unsigned int indaux;
- combined_entry_type *auxent;
+coff_pointerize_aux (bfd *abfd,
+ combined_entry_type *table_base,
+ combined_entry_type *symbol,
+ unsigned int indaux,
+ combined_entry_type *auxent)
{
unsigned int type = symbol->u.syment.n_type;
unsigned int class = symbol->u.syment.n_sclass;
return;
}
- /* Don't bother if this is a file or a section */
+ /* Don't bother if this is a file or a section. */
if (class == C_STAT && type == T_NULL)
return;
if (class == C_FILE)
return;
- /* Otherwise patch up */
-#define N_TMASK coff_data (abfd)->local_n_tmask
+ /* Otherwise patch up. */
+#define N_TMASK coff_data (abfd)->local_n_tmask
#define N_BTSHFT coff_data (abfd)->local_n_btshft
+
if ((ISFCN (type) || ISTAG (class) || class == C_BLOCK || class == C_FCN)
&& auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0)
{
we didn't want to go to the trouble until someone needed it. */
static char *
-build_debug_section (abfd)
- bfd *abfd;
+build_debug_section (bfd *abfd)
{
char *debug_section;
file_ptr position;
}
sec_size = sect->size;
- debug_section = (PTR) bfd_alloc (abfd, sec_size);
+ debug_section = bfd_alloc (abfd, sec_size);
if (debug_section == NULL)
return NULL;
/* Return a pointer to a malloc'd copy of 'name'. 'name' may not be
\0-terminated, but will not exceed 'maxlen' characters. The copy *will*
be \0-terminated. */
+
static char *
-copy_name (abfd, name, maxlen)
- bfd *abfd;
- char *name;
- size_t maxlen;
+copy_name (bfd *abfd, char *name, size_t maxlen)
{
size_t len;
char *newname;
for (len = 0; len < maxlen; ++len)
- {
- if (name[len] == '\0')
- {
- break;
- }
- }
+ if (name[len] == '\0')
+ break;
+
+ if ((newname = bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
+ return NULL;
- if ((newname = (PTR) bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
- return (NULL);
strncpy (newname, name, len);
newname[len] = '\0';
return newname;
/* Read in the external symbols. */
bfd_boolean
-_bfd_coff_get_external_symbols (abfd)
- bfd *abfd;
+_bfd_coff_get_external_symbols (bfd *abfd)
{
bfd_size_type symesz;
bfd_size_type size;
- PTR syms;
+ void * syms;
if (obj_coff_external_syms (abfd) != NULL)
return TRUE;
size = obj_raw_syment_count (abfd) * symesz;
- syms = (PTR) bfd_malloc (size);
+ syms = bfd_malloc (size);
if (syms == NULL && size != 0)
return FALSE;
detecting a missing string table in an archive. */
const char *
-_bfd_coff_read_string_table (abfd)
- bfd *abfd;
+_bfd_coff_read_string_table (bfd *abfd)
{
char extstrsize[STRING_SIZE_SIZE];
bfd_size_type strsize;
return NULL;
}
- strings = (char *) bfd_malloc (strsize);
+ strings = bfd_malloc (strsize);
if (strings == NULL)
return NULL;
/* Free up the external symbols and strings read from a COFF file. */
bfd_boolean
-_bfd_coff_free_symbols (abfd)
- bfd *abfd;
+_bfd_coff_free_symbols (bfd *abfd)
{
if (obj_coff_external_syms (abfd) != NULL
&& ! obj_coff_keep_syms (abfd))
terminated string. */
combined_entry_type *
-coff_get_normalized_symtab (abfd)
- bfd *abfd;
+coff_get_normalized_symtab (bfd *abfd)
{
combined_entry_type *internal;
combined_entry_type *internal_ptr;
return obj_raw_syments (abfd);
size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
- internal = (combined_entry_type *) bfd_zalloc (abfd, size);
+ internal = bfd_zalloc (abfd, size);
if (internal == NULL && size != 0)
return NULL;
internal_end = internal + obj_raw_syment_count (abfd);
raw_src = (char *) obj_coff_external_syms (abfd);
- /* mark the end of the symbols */
+ /* Mark the end of the symbols. */
symesz = bfd_coff_symesz (abfd);
raw_end = (char *) raw_src + obj_raw_syment_count (abfd) * symesz;
/* FIXME SOMEDAY. A string table size of zero is very weird, but
probably possible. If one shows up, it will probably kill us. */
- /* Swap all the raw entries */
+ /* Swap all the raw entries. */
for (internal_ptr = internal;
raw_src < raw_end;
raw_src += symesz, internal_ptr++)
{
unsigned int i;
- bfd_coff_swap_sym_in (abfd, (PTR) raw_src,
- (PTR) & internal_ptr->u.syment);
+ bfd_coff_swap_sym_in (abfd, (void *) raw_src,
+ (void *) & internal_ptr->u.syment);
symbol_ptr = internal_ptr;
for (i = 0;
{
internal_ptr++;
raw_src += symesz;
- bfd_coff_swap_aux_in (abfd, (PTR) raw_src,
+ bfd_coff_swap_aux_in (abfd, (void *) raw_src,
symbol_ptr->u.syment.n_type,
symbol_ptr->u.syment.n_sclass,
(int) i, symbol_ptr->u.syment.n_numaux,
if (internal_ptr->u.syment.n_sclass == C_FILE
&& internal_ptr->u.syment.n_numaux > 0)
{
- /* make a file symbol point to the name in the auxent, since
- the text ".file" is redundant */
+ /* Make a file symbol point to the name in the auxent, since
+ the text ".file" is redundant. */
if ((internal_ptr + 1)->u.auxent.x_file.x_n.x_zeroes == 0)
{
- /* the filename is a long one, point into the string table */
+ /* The filename is a long one, point into the string table. */
if (string_table == NULL)
{
string_table = _bfd_coff_read_string_table (abfd);
multiple AUX entries. */
if (internal_ptr->u.syment.n_numaux > 1
&& coff_data (abfd)->pe)
- {
- internal_ptr->u.syment._n._n_n._n_offset =
- ((long)
- copy_name (abfd,
- (internal_ptr + 1)->u.auxent.x_file.x_fname,
- internal_ptr->u.syment.n_numaux * symesz));
- }
+ internal_ptr->u.syment._n._n_n._n_offset =
+ ((long)
+ copy_name (abfd,
+ (internal_ptr + 1)->u.auxent.x_file.x_fname,
+ internal_ptr->u.syment.n_numaux * symesz));
else
- {
- internal_ptr->u.syment._n._n_n._n_offset =
- ((long)
- copy_name (abfd,
- (internal_ptr + 1)->u.auxent.x_file.x_fname,
- (size_t) bfd_coff_filnmlen (abfd)));
- }
+ internal_ptr->u.syment._n._n_n._n_offset =
+ ((long)
+ copy_name (abfd,
+ (internal_ptr + 1)->u.auxent.x_file.x_fname,
+ (size_t) bfd_coff_filnmlen (abfd)));
}
}
else
size_t i;
char *newstring;
- /* find the length of this string without walking into memory
+ /* Find the length of this string without walking into memory
that isn't ours. */
for (i = 0; i < 8; ++i)
if (internal_ptr->u.syment._n._n_name[i] == '\0')
break;
- newstring = (PTR) bfd_zalloc (abfd, (bfd_size_type) (i + 1));
+ newstring = bfd_zalloc (abfd, (bfd_size_type) (i + 1));
if (newstring == NULL)
- return (NULL);
+ return NULL;
strncpy (newstring, internal_ptr->u.syment._n._n_name, i);
internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring;
internal_ptr->u.syment._n._n_n._n_zeroes = 0;
BFD_ASSERT (obj_raw_syment_count (abfd)
== (unsigned int) (internal_ptr - internal));
- return (internal);
-} /* coff_get_normalized_symtab() */
+ return internal;
+}
long
-coff_get_reloc_upper_bound (abfd, asect)
- bfd *abfd;
- sec_ptr asect;
+coff_get_reloc_upper_bound (bfd *abfd, sec_ptr asect)
{
if (bfd_get_format (abfd) != bfd_object)
{
}
asymbol *
-coff_make_empty_symbol (abfd)
- bfd *abfd;
+coff_make_empty_symbol (bfd *abfd)
{
bfd_size_type amt = sizeof (coff_symbol_type);
- coff_symbol_type *new = (coff_symbol_type *) bfd_zalloc (abfd, amt);
+ coff_symbol_type *new = bfd_zalloc (abfd, amt);
+
if (new == NULL)
- return (NULL);
+ return NULL;
new->symbol.section = 0;
new->native = 0;
- new->lineno = (alent *) NULL;
+ new->lineno = NULL;
new->done_lineno = FALSE;
new->symbol.the_bfd = abfd;
- return &new->symbol;
+
+ return & new->symbol;
}
/* Make a debugging symbol. */
asymbol *
-coff_bfd_make_debug_symbol (abfd, ptr, sz)
- bfd *abfd;
- PTR ptr ATTRIBUTE_UNUSED;
- unsigned long sz ATTRIBUTE_UNUSED;
+coff_bfd_make_debug_symbol (bfd *abfd,
+ void * ptr ATTRIBUTE_UNUSED,
+ unsigned long sz ATTRIBUTE_UNUSED)
{
bfd_size_type amt = sizeof (coff_symbol_type);
- coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, amt);
+ coff_symbol_type *new = bfd_alloc (abfd, amt);
+
if (new == NULL)
- return (NULL);
+ return NULL;
/* @@ The 10 is a guess at a plausible maximum number of aux entries
(but shouldn't be a constant). */
amt = sizeof (combined_entry_type) * 10;
- new->native = (combined_entry_type *) bfd_zalloc (abfd, amt);
+ new->native = bfd_zalloc (abfd, amt);
if (!new->native)
- return (NULL);
+ return NULL;
new->symbol.section = bfd_abs_section_ptr;
new->symbol.flags = BSF_DEBUGGING;
- new->lineno = (alent *) NULL;
+ new->lineno = NULL;
new->done_lineno = FALSE;
new->symbol.the_bfd = abfd;
- return &new->symbol;
+
+ return & new->symbol;
}
void
-coff_get_symbol_info (abfd, symbol, ret)
- bfd *abfd;
- asymbol *symbol;
- symbol_info *ret;
+coff_get_symbol_info (bfd *abfd, asymbol *symbol, symbol_info *ret)
{
bfd_symbol_info (symbol, ret);
+
if (coffsymbol (symbol)->native != NULL
&& coffsymbol (symbol)->native->fix_value)
- {
- ret->value = coffsymbol (symbol)->native->u.syment.n_value -
- (unsigned long) obj_raw_syments (abfd);
- }
+ ret->value = coffsymbol (symbol)->native->u.syment.n_value -
+ (unsigned long) obj_raw_syments (abfd);
}
/* Return the COFF syment for a symbol. */
bfd_boolean
-bfd_coff_get_syment (abfd, symbol, psyment)
- bfd *abfd;
- asymbol *symbol;
- struct internal_syment *psyment;
+bfd_coff_get_syment (bfd *abfd,
+ asymbol *symbol,
+ struct internal_syment *psyment)
{
coff_symbol_type *csym;
/* Return the COFF auxent for a symbol. */
bfd_boolean
-bfd_coff_get_auxent (abfd, symbol, indx, pauxent)
- bfd *abfd;
- asymbol *symbol;
- int indx;
- union internal_auxent *pauxent;
+bfd_coff_get_auxent (bfd *abfd,
+ asymbol *symbol,
+ int indx,
+ union internal_auxent *pauxent)
{
coff_symbol_type *csym;
combined_entry_type *ent;
/* Print out information about COFF symbol. */
void
-coff_print_symbol (abfd, filep, symbol, how)
- bfd *abfd;
- PTR filep;
- asymbol *symbol;
- bfd_print_symbol_type how;
+coff_print_symbol (bfd *abfd,
+ void * filep,
+ asymbol *symbol,
+ bfd_print_symbol_type how)
{
- FILE *file = (FILE *) filep;
+ FILE * file = (FILE *) filep;
switch (how)
{
(unsigned long) val,
symbol->name);
#else
- /* Print out the wide, 64 bit, symbol value */
+ /* Print out the wide, 64 bit, symbol value. */
fprintf (file,
"(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x%016llx %s",
combined->u.syment.n_scnum,
case C_STAT:
if (combined->u.syment.n_type == T_NULL)
- /* probably a section symbol? */
+ /* Probably a section symbol ? */
{
fprintf (file, "AUX scnlen 0x%lx nreloc %d nlnno %d",
(long) auxp->u.auxent.x_scn.x_scnlen,
auxp->u.auxent.x_scn.x_comdat);
break;
}
- /* else fall through */
+ /* Otherwise fall through. */
case C_EXT:
if (ISFCN (combined->u.syment.n_type))
{
llnos, next);
break;
}
- /* else fall through */
+ /* Otherwise fall through. */
default:
fprintf (file, "AUX lnno %d size 0x%x tagndx %ld",
auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno,
}
else
{
- bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
+ bfd_print_symbol_vandf (abfd, (void *) file, symbol);
fprintf (file, " %-5s %s %s %s",
symbol->section->name,
coffsymbol (symbol)->native ? "n" : "g",
override it. */
bfd_boolean
-_bfd_coff_is_local_label_name (abfd, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *name;
+_bfd_coff_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *name)
{
return name[0] == '.' && name[1] == 'L';
}
nearest to the wanted location. */
bfd_boolean
-coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
- functionname_ptr, line_ptr)
- bfd *abfd;
- asection *section;
- asymbol **symbols;
- bfd_vma offset;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *line_ptr;
+coff_find_nearest_line (bfd *abfd,
+ asection *section,
+ asymbol **symbols,
+ bfd_vma offset,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *line_ptr)
{
bfd_boolean found;
unsigned int i;
unsigned int line_base;
coff_data_type *cof = coff_data (abfd);
- /* Run through the raw syments if available */
+ /* Run through the raw syments if available. */
combined_entry_type *p;
combined_entry_type *pend;
alent *l;
*functionname_ptr = 0;
*line_ptr = 0;
- /* Don't try and find line numbers in a non coff file */
+ /* Don't try and find line numbers in a non coff file. */
if (!bfd_family_coff (abfd))
return FALSE;
}
}
- /* Now wander though the raw linenumbers of the section */
- /* If we have been called on this section before, and the offset we
+ /* Now wander though the raw linenumbers of the section. */
+ /* If we have been called on this section before, and th. e offset we
want is further down then we can prime the lookup loop. */
sec_data = coff_section_data (abfd, section);
if (sec_data != NULL
{
if (l->line_number == 0)
{
- /* Get the symbol this line number points at */
+ /* Get the symbol this line number points at. */
coff_symbol_type *coff = (coff_symbol_type *) (l->u.sym);
if (coff->symbol.value > offset)
break;
if (sec_data == NULL && section->owner == abfd)
{
amt = sizeof (struct coff_section_tdata);
- section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
+ section->used_by_bfd = bfd_zalloc (abfd, amt);
sec_data = (struct coff_section_tdata *) section->used_by_bfd;
}
if (sec_data != NULL)
}
int
-coff_sizeof_headers (abfd, reloc)
- bfd *abfd;
- bfd_boolean reloc;
+coff_sizeof_headers (bfd *abfd, bfd_boolean reloc)
{
size_t size;
if (! reloc)
- {
- size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
- }
+ size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
else
- {
- size = bfd_coff_filhsz (abfd);
- }
+ size = bfd_coff_filhsz (abfd);
size += abfd->section_count * bfd_coff_scnhsz (abfd);
return size;
}
/* Change the class of a coff symbol held by BFD. */
+
bfd_boolean
-bfd_coff_set_symbol_class (abfd, symbol, class)
- bfd * abfd;
- asymbol * symbol;
- unsigned int class;
+bfd_coff_set_symbol_class (bfd * abfd,
+ asymbol * symbol,
+ unsigned int class)
{
coff_symbol_type * csym;
combined_entry_type * native;
bfd_size_type amt = sizeof (* native);
- native = (combined_entry_type *) bfd_zalloc (abfd, amt);
+ native = bfd_zalloc (abfd, amt);
if (native == NULL)
return FALSE;
csym->native = native;
}
else
- {
- csym->native->u.syment.n_sclass = class;
- }
+ csym->native->u.syment.n_sclass = class;
return TRUE;
}
/* 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.
-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"
0, /* dst_mask */
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
-elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *bfd_reloc;
- Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
+elf_generic_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *bfd_reloc,
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED)
{
bfd_reloc->howto = &dummy;
}
static void
-elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *bfd_reloc;
- Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
+elf_generic_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *bfd_reloc,
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED)
{
bfd_reloc->howto = &dummy;
}
-static bfd_boolean
-elf32_generic_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+static void
+check_for_relocs (bfd * abfd, asection * o, void * failed)
{
- asection *o;
+ if ((o->flags & SEC_RELOC) != 0)
+ {
+ Elf_Internal_Ehdr *ehdrp;
- /* Check if there are any relocations. */
- for (o = abfd->sections; o != NULL; o = o->next)
- 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);
- 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;
+ }
+}
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
+static bfd_boolean
+elf32_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
+{
+ bfd_boolean failed = FALSE;
+
+ /* Check if there are any relocations. */
+ bfd_map_over_sections (abfd, check_for_relocs, & failed);
+ if (failed)
+ return FALSE;
return bfd_elf_link_add_symbols (abfd, info);
}
/* 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.
-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"
0, /* dst_mask */
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
-elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *bfd_reloc;
- Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
+elf_generic_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *bfd_reloc,
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED)
{
bfd_reloc->howto = &dummy;
}
static void
-elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *bfd_reloc;
- Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
+elf_generic_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *bfd_reloc,
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED)
{
bfd_reloc->howto = &dummy;
}
-static bfd_boolean
-elf64_generic_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+static void
+check_for_relocs (bfd * abfd, asection * o, void * failed)
{
- asection *o;
+ if ((o->flags & SEC_RELOC) != 0)
+ {
+ Elf_Internal_Ehdr *ehdrp;
- /* Check if there are any relocations. */
- for (o = abfd->sections; o != NULL; o = o->next)
- 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);
- 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;
+ }
+}
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
+static bfd_boolean
+elf64_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
+{
+ bfd_boolean failed = FALSE;
+
+ /* Check if there are any relocations. */
+ bfd_map_over_sections (abfd, check_for_relocs, & failed);
+ if (failed)
+ return FALSE;
return bfd_elf_link_add_symbols (abfd, info);
}
/* 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.
Written by Steve Chamberlain <sac@cygnus.com>
EXAMPLE
.struct bfd_hash_entry *
-.@var{function_name} (entry, table, string)
-. struct bfd_hash_entry *entry;
-. struct bfd_hash_table *table;
-. const char *string;
+.@var{function_name} (struct bfd_hash_entry *entry,
+. struct bfd_hash_table *table,
+. const char *string)
.{
. struct @var{entry_type} *ret = (@var{entry_type} *) entry;
.
. {* Allocate the structure if it has not already been allocated by a
. derived class. *}
-. if (ret == (@var{entry_type} *) NULL)
+. if (ret == NULL)
. {
-. ret = ((@var{entry_type} *)
-. bfd_hash_allocate (table, sizeof (@var{entry_type})));
-. if (ret == (@var{entry_type} *) NULL)
+. ret = bfd_hash_allocate (table, sizeof (* ret));
+. if (ret == NULL)
. return NULL;
. }
.
/* Create a new hash table, given a number of entries. */
bfd_boolean
-bfd_hash_table_init_n (table, newfunc, size)
- struct bfd_hash_table *table;
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
- unsigned int size;
+bfd_hash_table_init_n (struct bfd_hash_table *table,
+ struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *),
+ unsigned int size)
{
unsigned int alloc;
alloc = size * sizeof (struct bfd_hash_entry *);
- table->memory = (PTR) objalloc_create ();
+ table->memory = (void *) objalloc_create ();
if (table->memory == NULL)
{
bfd_set_error (bfd_error_no_memory);
return FALSE;
}
- table->table = ((struct bfd_hash_entry **)
- objalloc_alloc ((struct objalloc *) table->memory, alloc));
+ table->table = objalloc_alloc ((struct objalloc *) table->memory, alloc);
if (table->table == NULL)
{
bfd_set_error (bfd_error_no_memory);
return FALSE;
}
- memset ((PTR) table->table, 0, alloc);
+ memset ((void *) table->table, 0, alloc);
table->size = size;
table->newfunc = newfunc;
return TRUE;
/* Create a new hash table with the default number of entries. */
bfd_boolean
-bfd_hash_table_init (table, newfunc)
- struct bfd_hash_table *table;
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
+bfd_hash_table_init (struct bfd_hash_table *table,
+ struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *))
{
return bfd_hash_table_init_n (table, newfunc, bfd_default_hash_table_size);
}
/* Free a hash table. */
void
-bfd_hash_table_free (table)
- struct bfd_hash_table *table;
+bfd_hash_table_free (struct bfd_hash_table *table)
{
- objalloc_free ((struct objalloc *) table->memory);
+ objalloc_free (table->memory);
table->memory = NULL;
}
/* Look up a string in a hash table. */
struct bfd_hash_entry *
-bfd_hash_lookup (table, string, create, copy)
- struct bfd_hash_table *table;
- const char *string;
- bfd_boolean create;
- bfd_boolean copy;
+bfd_hash_lookup (struct bfd_hash_table *table,
+ const char *string,
+ bfd_boolean create,
+ bfd_boolean copy)
{
- register const unsigned char *s;
- register unsigned long hash;
- register unsigned int c;
+ const unsigned char *s;
+ unsigned long hash;
+ unsigned int c;
struct bfd_hash_entry *hashp;
unsigned int len;
unsigned int index;
index = hash % table->size;
for (hashp = table->table[index];
- hashp != (struct bfd_hash_entry *) NULL;
+ hashp != NULL;
hashp = hashp->next)
{
if (hashp->hash == hash
}
if (! create)
- return (struct bfd_hash_entry *) NULL;
+ return NULL;
- hashp = (*table->newfunc) ((struct bfd_hash_entry *) NULL, table, string);
- if (hashp == (struct bfd_hash_entry *) NULL)
- return (struct bfd_hash_entry *) NULL;
+ hashp = (*table->newfunc) (NULL, table, string);
+ if (hashp == NULL)
+ return NULL;
if (copy)
{
char *new;
- new = (char *) objalloc_alloc ((struct objalloc *) table->memory,
- len + 1);
+ new = objalloc_alloc ((struct objalloc *) table->memory, len + 1);
if (!new)
{
bfd_set_error (bfd_error_no_memory);
- return (struct bfd_hash_entry *) NULL;
+ return NULL;
}
memcpy (new, string, len + 1);
string = new;
/* Replace an entry in a hash table. */
void
-bfd_hash_replace (table, old, nw)
- struct bfd_hash_table *table;
- struct bfd_hash_entry *old;
- struct bfd_hash_entry *nw;
+bfd_hash_replace (struct bfd_hash_table *table,
+ struct bfd_hash_entry *old,
+ struct bfd_hash_entry *nw)
{
unsigned int index;
struct bfd_hash_entry **pph;
index = old->hash % table->size;
for (pph = &table->table[index];
- (*pph) != (struct bfd_hash_entry *) NULL;
+ (*pph) != NULL;
pph = &(*pph)->next)
{
if (*pph == old)
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. */
-PTR
-bfd_hash_allocate (table, size)
- struct bfd_hash_table *table;
- unsigned int size;
+void *
+bfd_hash_allocate (struct bfd_hash_table *table,
+ unsigned int size)
{
- PTR ret;
+ void * ret;
ret = objalloc_alloc ((struct objalloc *) table->memory, size);
if (ret == NULL && size != 0)
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. */
void
-bfd_hash_traverse (table, func, info)
- struct bfd_hash_table *table;
- bfd_boolean (*func) PARAMS ((struct bfd_hash_entry *, PTR));
- PTR info;
+bfd_hash_traverse (struct bfd_hash_table *table,
+ bfd_boolean (*func) (struct bfd_hash_entry *, void *),
+ void * info)
{
unsigned int i;
struct bfd_hash_entry *p;
for (p = table->table[i]; p != NULL; p = p->next)
- {
- if (! (*func) (p, info))
- return;
- }
+ if (! (*func) (p, info))
+ return;
}
}
\f
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. */
static struct bfd_hash_entry *
-strtab_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+strtab_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
struct strtab_hash_entry *ret = (struct strtab_hash_entry *) entry;
/* Allocate the structure if it has not already been allocated by a
subclass. */
- if (ret == (struct strtab_hash_entry *) NULL)
- ret = ((struct strtab_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct strtab_hash_entry)));
- if (ret == (struct strtab_hash_entry *) NULL)
+ if (ret == NULL)
+ ret = bfd_hash_allocate (table, sizeof (* entry));
+ if (ret == NULL)
return NULL;
/* Call the allocation method of the superclass. */
- ret = ((struct strtab_hash_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
+ ret = (struct strtab_hash_entry *)
+ bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string);
if (ret)
{
/* Create a new strtab. */
struct bfd_strtab_hash *
-_bfd_stringtab_init ()
+_bfd_stringtab_init (void)
{
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)
return NULL;
- if (! bfd_hash_table_init (&table->table, strtab_hash_newfunc))
+ if (! bfd_hash_table_init (& table->table, strtab_hash_newfunc))
{
free (table);
return NULL;
string. */
struct bfd_strtab_hash *
-_bfd_xcoff_stringtab_init ()
+_bfd_xcoff_stringtab_init (void)
{
struct bfd_strtab_hash *ret;
/* Free a strtab. */
void
-_bfd_stringtab_free (table)
- struct bfd_strtab_hash *table;
+_bfd_stringtab_free (struct bfd_strtab_hash *table)
{
bfd_hash_table_free (&table->table);
free (table);
table, and we don't eliminate duplicate strings. */
bfd_size_type
-_bfd_stringtab_add (tab, str, hash, copy)
- struct bfd_strtab_hash *tab;
- const char *str;
- bfd_boolean hash;
- bfd_boolean copy;
+_bfd_stringtab_add (struct bfd_strtab_hash *tab,
+ const char *str,
+ bfd_boolean hash,
+ bfd_boolean copy)
{
- register struct strtab_hash_entry *entry;
+ struct strtab_hash_entry *entry;
if (hash)
{
}
else
{
- entry = ((struct strtab_hash_entry *)
- bfd_hash_allocate (&tab->table,
- sizeof (struct strtab_hash_entry)));
+ entry = bfd_hash_allocate (&tab->table, sizeof (* entry));
if (entry == NULL)
return (bfd_size_type) -1;
if (! copy)
{
char *n;
- n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1);
+ n = bfd_hash_allocate (&tab->table, strlen (str) + 1);
if (n == NULL)
return (bfd_size_type) -1;
entry->root.string = n;
/* Get the number of bytes in a strtab. */
bfd_size_type
-_bfd_stringtab_size (tab)
- struct bfd_strtab_hash *tab;
+_bfd_stringtab_size (struct bfd_strtab_hash *tab)
{
return tab->size;
}
the file. */
bfd_boolean
-_bfd_stringtab_emit (abfd, tab)
- register bfd *abfd;
- struct bfd_strtab_hash *tab;
+_bfd_stringtab_emit (bfd *abfd, struct bfd_strtab_hash *tab)
{
- register bfd_boolean xcoff;
- register struct strtab_hash_entry *entry;
+ bfd_boolean xcoff;
+ struct strtab_hash_entry *entry;
xcoff = tab->xcoff;
/* The output length includes the null byte. */
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;
}
- if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
+ if (bfd_bwrite ((void *) str, (bfd_size_type) len, abfd) != len)
return FALSE;
}
int buffer;
};
-static bfd_boolean ieee_write_byte
- PARAMS ((bfd *, int));
-static bfd_boolean ieee_write_2bytes
- PARAMS ((bfd *, int));
-static bfd_boolean ieee_write_int
- PARAMS ((bfd *, bfd_vma));
-static bfd_boolean ieee_write_id
- PARAMS ((bfd *, const char *));
-static unsigned short read_2bytes
- PARAMS ((common_header_type *));
-static void bfd_get_string
- PARAMS ((common_header_type *, char *, size_t));
-static char *read_id
- PARAMS ((common_header_type *));
-static bfd_boolean ieee_write_expression
- PARAMS ((bfd *, bfd_vma, asymbol *, bfd_boolean, unsigned int));
-static void ieee_write_int5
- PARAMS ((bfd_byte *, bfd_vma));
-static bfd_boolean ieee_write_int5_out
- PARAMS ((bfd *, bfd_vma));
-static bfd_boolean parse_int
- PARAMS ((common_header_type *, bfd_vma *));
-static int parse_i
- PARAMS ((common_header_type *, bfd_boolean *));
-static bfd_vma must_parse_int
- PARAMS ((common_header_type *));
-static void parse_expression
- PARAMS ((ieee_data_type *, bfd_vma *, ieee_symbol_index_type *,
- bfd_boolean *, unsigned int *, asection **));
-static file_ptr ieee_part_after
- PARAMS ((ieee_data_type *, file_ptr));
-static ieee_symbol_type *get_symbol
- PARAMS ((bfd *, ieee_data_type *, ieee_symbol_type *, unsigned int *,
- ieee_symbol_type ***, unsigned int *, int));
-static bfd_boolean ieee_slurp_external_symbols
- PARAMS ((bfd *));
-static bfd_boolean ieee_slurp_symbol_table
- PARAMS ((bfd *));
-static long ieee_get_symtab_upper_bound
- PARAMS ((bfd *));
-static long ieee_canonicalize_symtab
- PARAMS ((bfd *, asymbol **));
-static asection *get_section_entry
- PARAMS ((bfd *, ieee_data_type *i, unsigned int));
-static void ieee_slurp_sections
- PARAMS ((bfd *));
-static bfd_boolean ieee_slurp_debug
- PARAMS ((bfd *));
-const bfd_target *ieee_archive_p
- PARAMS ((bfd *));
-const bfd_target *ieee_object_p
- PARAMS ((bfd *));
-static void ieee_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *));
-static void ieee_print_symbol
- PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
-static bfd_boolean do_one
- PARAMS ((ieee_data_type *, ieee_per_section_type *, unsigned char *,
- asection *, int));
-static bfd_boolean ieee_slurp_section_data
- PARAMS ((bfd *));
-static bfd_boolean ieee_new_section_hook
- PARAMS ((bfd *, asection *));
-static long ieee_get_reloc_upper_bound
- PARAMS ((bfd *, sec_ptr));
-static bfd_boolean ieee_get_section_contents
- PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
-static long ieee_canonicalize_reloc
- PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
-static int comp
- PARAMS ((const PTR, const PTR));
-static bfd_boolean ieee_write_section_part
- PARAMS ((bfd *));
-static bfd_boolean do_with_relocs
- PARAMS ((bfd *, asection *));
-static bfd_boolean do_as_repeat
- PARAMS ((bfd *, asection *));
-static bfd_boolean do_without_relocs
- PARAMS ((bfd *, asection *));
-static bfd_boolean ieee_mkobject
- PARAMS ((bfd *));
-static void fill
- PARAMS ((void));
-static void flush
- PARAMS ((void));
-static void write_int
- PARAMS ((int));
-static void copy_id
- PARAMS ((void));
-static void copy_expression
- PARAMS ((void));
-static void fill_int
- PARAMS ((struct output_buffer_struct *));
-static void drop_int
- PARAMS ((struct output_buffer_struct *));
-static void copy_int
- PARAMS ((void));
-static void f1_record
- PARAMS ((void));
-static void f0_record
- PARAMS ((void));
-static void copy_till_end
- PARAMS ((void));
-static void f2_record
- PARAMS ((void));
-static void f8_record
- PARAMS ((void));
-static void e2_record
- PARAMS ((void));
-static void block
- PARAMS ((void));
-static void relocate_debug
- PARAMS ((bfd *, bfd *));
-static bfd_boolean ieee_write_debug_part
- PARAMS ((bfd *));
-static bfd_boolean ieee_write_data_part
- PARAMS ((bfd *));
-static bfd_boolean init_for_output
- PARAMS ((bfd *));
-static bfd_boolean ieee_set_section_contents
- PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type));
-static bfd_boolean ieee_write_external_part
- PARAMS ((bfd *));
-static bfd_boolean ieee_write_me_part
- PARAMS ((bfd *));
-static bfd_boolean ieee_write_processor
- PARAMS ((bfd *));
-static bfd_boolean ieee_write_object_contents
- PARAMS ((bfd *));
-static asymbol *ieee_make_empty_symbol
- PARAMS ((bfd *));
-static bfd *ieee_openr_next_archived_file
- PARAMS ((bfd *, bfd *));
-static bfd_boolean ieee_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
-static int ieee_generic_stat_arch_elt
- PARAMS ((bfd *, struct stat *));
-static int ieee_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-
/* Functions for writing to ieee files in the strange way that the
- standard requires. */
+ standard requires. */
static bfd_boolean
-ieee_write_byte (abfd, barg)
- bfd *abfd;
- int barg;
+ieee_write_byte (bfd *abfd, int barg)
{
bfd_byte byte;
byte = barg;
- if (bfd_bwrite ((PTR) &byte, (bfd_size_type) 1, abfd) != 1)
+ if (bfd_bwrite ((void *) &byte, (bfd_size_type) 1, abfd) != 1)
return FALSE;
return TRUE;
}
static bfd_boolean
-ieee_write_2bytes (abfd, bytes)
- bfd *abfd;
- int bytes;
+ieee_write_2bytes (bfd *abfd, int bytes)
{
bfd_byte buffer[2];
buffer[0] = bytes >> 8;
buffer[1] = bytes & 0xff;
- if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 2, abfd) != 2)
+ if (bfd_bwrite ((void *) buffer, (bfd_size_type) 2, abfd) != 2)
return FALSE;
return TRUE;
}
static bfd_boolean
-ieee_write_int (abfd, value)
- bfd *abfd;
- bfd_vma value;
+ieee_write_int (bfd *abfd, bfd_vma value)
{
if (value <= 127)
{
}
static bfd_boolean
-ieee_write_id (abfd, id)
- bfd *abfd;
- const char *id;
+ieee_write_id (bfd *abfd, const char *id)
{
size_t length = strlen (id);
return FALSE;
}
- if (bfd_bwrite ((PTR) id, (bfd_size_type) length, abfd) != length)
+ if (bfd_bwrite ((void *) id, (bfd_size_type) length, abfd) != length)
return FALSE;
return TRUE;
}
/* Functions for reading from ieee files in the strange way that the
standard requires. */
-#define this_byte(ieee) *((ieee)->input_p)
-#define next_byte(ieee) ((ieee)->input_p++)
+#define this_byte(ieee) *((ieee)->input_p)
+#define next_byte(ieee) ((ieee)->input_p++)
#define this_byte_and_next(ieee) (*((ieee)->input_p++))
static unsigned short
-read_2bytes (ieee)
- common_header_type *ieee;
+read_2bytes (common_header_type *ieee)
{
unsigned char c1 = this_byte_and_next (ieee);
unsigned char c2 = this_byte_and_next (ieee);
}
static void
-bfd_get_string (ieee, string, length)
- common_header_type *ieee;
- char *string;
- size_t length;
+bfd_get_string (common_header_type *ieee, char *string, size_t length)
{
size_t i;
}
static char *
-read_id (ieee)
- common_header_type *ieee;
+read_id (common_header_type *ieee)
{
size_t length;
char *string;
length = this_byte_and_next (ieee);
if (length <= 0x7f)
- {
- /* Simple string of length 0 to 127. */
- }
+ /* Simple string of length 0 to 127. */
+ ;
+
else if (length == 0xde)
- {
- /* Length is next byte, allowing 0..255. */
- length = this_byte_and_next (ieee);
- }
+ /* Length is next byte, allowing 0..255. */
+ length = this_byte_and_next (ieee);
+
else if (length == 0xdf)
{
/* Length is next two bytes, allowing 0..65535. */
}
static bfd_boolean
-ieee_write_expression (abfd, value, symbol, pcrel, index)
- bfd *abfd;
- bfd_vma value;
- asymbol *symbol;
- bfd_boolean pcrel;
- unsigned int index;
+ieee_write_expression (bfd *abfd,
+ bfd_vma value,
+ asymbol *symbol,
+ bfd_boolean pcrel,
+ unsigned int index)
{
unsigned int term_count = 0;
else if (! bfd_is_abs_section (symbol->section))
{
/* Ref to defined symbol - */
-
if (symbol->flags & BSF_GLOBAL)
{
if (! ieee_write_byte (abfd, ieee_variable_I_enum)
/* Writes any integer into the buffer supplied and always takes 5 bytes. */
static void
-ieee_write_int5 (buffer, value)
- bfd_byte *buffer;
- bfd_vma value;
+ieee_write_int5 (bfd_byte *buffer, bfd_vma value)
{
buffer[0] = (bfd_byte) ieee_number_repeat_4_enum;
buffer[1] = (value >> 24) & 0xff;
}
static bfd_boolean
-ieee_write_int5_out (abfd, value)
- bfd *abfd;
- bfd_vma value;
+ieee_write_int5_out (bfd *abfd, bfd_vma value)
{
bfd_byte b[5];
ieee_write_int5 (b, value);
- if (bfd_bwrite ((PTR) b, (bfd_size_type) 5, abfd) != 5)
+ if (bfd_bwrite ((void *) b, (bfd_size_type) 5, abfd) != 5)
return FALSE;
return TRUE;
}
static bfd_boolean
-parse_int (ieee, value_ptr)
- common_header_type *ieee;
- bfd_vma *value_ptr;
+parse_int (common_header_type *ieee, bfd_vma *value_ptr)
{
int value = this_byte (ieee);
int result;
}
static int
-parse_i (ieee, ok)
- common_header_type *ieee;
- bfd_boolean *ok;
+parse_i (common_header_type *ieee, bfd_boolean *ok)
{
bfd_vma x;
*ok = parse_int (ieee, &x);
}
static bfd_vma
-must_parse_int (ieee)
- common_header_type *ieee;
+must_parse_int (common_header_type *ieee)a
{
bfd_vma result;
BFD_ASSERT (parse_int (ieee, &result));
static ieee_symbol_index_type NOSYMBOL = {0, 0};
static void
-parse_expression (ieee, value, symbol, pcrel, extra, section)
- ieee_data_type *ieee;
- bfd_vma *value;
- ieee_symbol_index_type *symbol;
- bfd_boolean *pcrel;
- unsigned int *extra;
- asection **section;
+parse_expression (ieee_data_type *ieee,
+ bfd_vma *value,
+ ieee_symbol_index_type *symbol,
+ bfd_boolean *pcrel,
+ unsigned int *extra,
+ asection **section)
{
+ bfd_boolean loop = TRUE;
+ ieee_value_type stack[10];
+ ieee_value_type *sp = stack;
+ asection *dummy;
+
#define POS sp[1]
#define TOS sp[0]
#define NOS sp[-1]
#define INC sp++;
#define DEC sp--;
- bfd_boolean loop = TRUE;
- ieee_value_type stack[10];
-
/* The stack pointer always points to the next unused location. */
-#define PUSH(x,y,z) TOS.symbol=x;TOS.section=y;TOS.value=z;INC;
-#define POP(x,y,z) DEC;x=TOS.symbol;y=TOS.section;z=TOS.value;
- ieee_value_type *sp = stack;
- asection *dummy;
+#define PUSH(x,y,z) TOS.symbol = x; TOS.section = y; TOS.value = z; INC;
+#define POP(x,y,z) DEC; x = TOS.symbol; y = TOS.section; z = TOS.value;
while (loop && ieee->h.input_p < ieee->h.last_byte)
{
/* Push the address of variable n. */
{
ieee_symbol_index_type sy;
+
next_byte (&(ieee->h));
sy.index = (int) must_parse_int (&(ieee->h));
sy.letter = 'I';
/* Push the address of external variable n. */
{
ieee_symbol_index_type sy;
+
next_byte (&(ieee->h));
sy.index = (int) (must_parse_int (&(ieee->h)));
sy.letter = 'X';
bfd_vma value1, value2;
asection *section1, *section_dummy;
ieee_symbol_index_type sy;
+
next_byte (&(ieee->h));
POP (sy, section1, value1);
asection *section2;
ieee_symbol_index_type sy1;
ieee_symbol_index_type sy2;
+
next_byte (&(ieee->h));
POP (sy1, section1, value1);
default:
{
bfd_vma va;
+
BFD_ASSERT (this_byte (&(ieee->h)) < (int) ieee_variable_A_enum
|| this_byte (&(ieee->h)) > (int) ieee_variable_Z_enum);
if (parse_int (&(ieee->h), &va))
PUSH (NOSYMBOL, bfd_abs_section_ptr, va);
}
else
- {
- /* Thats all that we can understand. */
- loop = FALSE;
- }
+ /* Thats all that we can understand. */
+ loop = FALSE;
}
}
}
{
asection *section1;
ieee_symbol_index_type sy1;
+
POP (sy1, section1, *extra);
}
/* Find the first part of the ieee file after HERE. */
static file_ptr
-ieee_part_after (ieee, here)
- ieee_data_type *ieee;
- file_ptr here;
+ieee_part_after (ieee_data_type *ieee, file_ptr here)
{
int part;
file_ptr after = ieee->w.r.me_record;
static char last_type; /* Is the index for an X or a D. */
static ieee_symbol_type *
-get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type)
- bfd *abfd ATTRIBUTE_UNUSED;
- ieee_data_type *ieee;
- ieee_symbol_type *last_symbol;
- unsigned int *symbol_count;
- ieee_symbol_type ***pptr;
- unsigned int *max_index;
- int this_type;
+get_symbol (bfd *abfd ATTRIBUTE_UNUSED,
+ ieee_data_type *ieee,
+ ieee_symbol_type *last_symbol,
+ unsigned int *symbol_count,
+ ieee_symbol_type ***pptr,
+ unsigned int *max_index,
+ int this_type)
{
/* Need a new symbol. */
unsigned int new_index = must_parse_int (&(ieee->h));
ieee_symbol_type *new_symbol;
bfd_size_type amt = sizeof (ieee_symbol_type);
- new_symbol = (ieee_symbol_type *) bfd_alloc (ieee->h.abfd, amt);
+ new_symbol = bfd_alloc (ieee->h.abfd, amt);
if (!new_symbol)
return NULL;
}
static bfd_boolean
-ieee_slurp_external_symbols (abfd)
- bfd *abfd;
+ieee_slurp_external_symbols (bfd *abfd)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
file_ptr offset = ieee->w.r.external_part;
ieee_symbol_type **prev_symbols_ptr = &ieee->external_symbols;
ieee_symbol_type **prev_reference_ptr = &ieee->external_reference;
- ieee_symbol_type *symbol = (ieee_symbol_type *) NULL;
+ ieee_symbol_type *symbol = NULL;
unsigned int symbol_count = 0;
bfd_boolean loop = TRUE;
+
last_index = 0xffffff;
ieee->symbol_table_full = TRUE;
next_byte (&(ieee->h));
symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
- &prev_symbols_ptr,
- &ieee->external_symbol_max_index, 'I');
+ & prev_symbols_ptr,
+ & ieee->external_symbol_max_index, 'I');
if (symbol == NULL)
return FALSE;
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id (&(ieee->h));
- symbol->symbol.udata.p = (PTR) NULL;
+ symbol->symbol.udata.p = NULL;
symbol->symbol.flags = BSF_NO_FLAGS;
break;
case ieee_external_symbol_enum:
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id (&(ieee->h));
- symbol->symbol.udata.p = (PTR) NULL;
+ symbol->symbol.udata.p = NULL;
symbol->symbol.flags = BSF_NO_FLAGS;
break;
case ieee_attribute_record_enum >> 8:
unsigned int symbol_type_index;
unsigned int symbol_attribute_def;
bfd_vma value;
+
switch (read_2bytes (&ieee->h))
{
case ieee_attribute_record_enum:
ieee_symbol_index_type symbol_ignore;
bfd_boolean pcrel_ignore;
unsigned int extra;
+
next_byte (&(ieee->h));
next_byte (&(ieee->h));
{
bfd_vma size;
bfd_vma value;
+
next_byte (&(ieee->h));
/* Throw away the external reference index. */
(void) must_parse_int (&(ieee->h));
size = must_parse_int (&(ieee->h));
/* Fetch the default value if available. */
if (! parse_int (&(ieee->h), &value))
- {
- value = 0;
- }
+ value = 0;
/* This turns into a common. */
symbol->symbol.section = bfd_com_section_ptr;
symbol->symbol.value = size;
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id (&(ieee->h));
- symbol->symbol.udata.p = (PTR) NULL;
+ symbol->symbol.udata.p = NULL;
symbol->symbol.section = bfd_und_section_ptr;
symbol->symbol.value = (bfd_vma) 0;
symbol->symbol.flags = 0;
ieee->external_symbol_min_index + 1;
}
else
- {
- ieee->external_symbol_count = 0;
- }
+ ieee->external_symbol_count = 0;
if (ieee->external_reference_max_index != 0)
{
ieee->external_reference_min_index + 1;
}
else
- {
- ieee->external_reference_count = 0;
- }
+ ieee->external_reference_count = 0;
abfd->symcount =
ieee->external_reference_count + ieee->external_symbol_count;
if (symbol_count != abfd->symcount)
- {
- /* There are gaps in the table -- */
- ieee->symbol_table_full = FALSE;
- }
+ /* There are gaps in the table -- */
+ ieee->symbol_table_full = FALSE;
- *prev_symbols_ptr = (ieee_symbol_type *) NULL;
- *prev_reference_ptr = (ieee_symbol_type *) NULL;
+ *prev_symbols_ptr = NULL;
+ *prev_reference_ptr = NULL;
return TRUE;
}
static bfd_boolean
-ieee_slurp_symbol_table (abfd)
- bfd *abfd;
+ieee_slurp_symbol_table (bfd *abfd)
{
if (! IEEE_DATA (abfd)->read_symbols)
{
extern const bfd_target ieee_vec;
static long
-ieee_canonicalize_symtab (abfd, location)
- bfd *abfd;
- asymbol **location;
+ieee_canonicalize_symtab (bfd *abfd, asymbol **location)
{
ieee_symbol_type *symp;
static bfd dummy_bfd;
if (abfd->symcount)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
+
dummy_bfd.xvec = &ieee_vec;
if (! ieee_slurp_symbol_table (abfd))
return -1;
}
static asection *
-get_section_entry (abfd, ieee, index)
- bfd *abfd;
- ieee_data_type *ieee;
- unsigned int index;
+get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index)
{
if (index >= ieee->section_table_size)
{
amt = c;
amt *= sizeof (asection *);
- n = (asection **) bfd_realloc (ieee->section_table, amt);
+ n = bfd_realloc (ieee->section_table, amt);
if (n == NULL)
return NULL;
}
static void
-ieee_slurp_sections (abfd)
- bfd *abfd;
+ieee_slurp_sections (bfd *abfd)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
file_ptr offset = ieee->w.r.section_part;
if (offset != 0)
{
bfd_byte section_type[3];
+
ieee_seek (ieee, offset);
while (TRUE)
{
{
asection *section;
unsigned int section_index;
+
next_byte (&(ieee->h));
section_index = must_parse_int (&(ieee->h));
section->flags = SEC_ALLOC;
switch (section_type[1])
{
- case 0xD3: /* AS Absolute section attributes. */
+ /* AS Absolute section attributes. */
+ case 0xD3:
next_byte (&(ieee->h));
section_type[2] = this_byte (&(ieee->h));
switch (section_type[2])
}
}
break;
- case 0xC3: /* Named relocatable sections (type C). */
+
+ /* Named relocatable sections (type C). */
+ case 0xC3:
section_type[1] = this_byte (&(ieee->h));
section->flags = SEC_ALLOC;
switch (section_type[1])
/* Skip these fields, which we don't care about. */
{
bfd_vma parent, brother, context;
+
parse_int (&(ieee->h), &parent);
parse_int (&(ieee->h), &brother);
parse_int (&(ieee->h), &context);
unsigned int section_index;
bfd_vma value;
asection *section;
+
next_byte (&(ieee->h));
section_index = must_parse_int (&ieee->h);
section = get_section_entry (abfd, ieee, section_index);
if (section_index > ieee->section_count)
- {
- ieee->section_count = section_index;
- }
+ ieee->section_count = section_index;
+
section->alignment_power =
bfd_log2 (must_parse_int (&ieee->h));
(void) parse_int (&(ieee->h), &value);
out. */
static bfd_boolean
-ieee_slurp_debug (abfd)
- bfd *abfd;
+ieee_slurp_debug (bfd *abfd)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
asection *sec;
/* Archive stuff. */
const bfd_target *
-ieee_archive_p (abfd)
- bfd *abfd;
+ieee_archive_p (bfd *abfd)
{
char *library;
unsigned int i;
ieee_ar_obstack_type *elts = NULL;
bfd_size_type amt = sizeof (ieee_ar_data_type);
- abfd->tdata.ieee_ar_data = (ieee_ar_data_type *) bfd_alloc (abfd, amt);
+ abfd->tdata.ieee_ar_data = bfd_alloc (abfd, amt);
if (!abfd->tdata.ieee_ar_data)
goto error_ret_restore;
ieee = IEEE_AR_DATA (abfd);
/* Ignore the return value here. It doesn't matter if we don't read
the entire buffer. We might have a very small ieee file. */
- bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
+ bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
must_parse_int (&(ieee->h));
alc_elts = 10;
- elts = (ieee_ar_obstack_type *) bfd_malloc (alc_elts * sizeof *elts);
+ elts = bfd_malloc (alc_elts * sizeof *elts);
if (elts == NULL)
goto error_return;
ieee_ar_obstack_type *n;
alc_elts *= 2;
- n = ((ieee_ar_obstack_type *)
- bfd_realloc (elts, alc_elts * sizeof *elts));
+ n = bfd_realloc (elts, alc_elts * sizeof (* elts));
if (n == NULL)
goto error_return;
elts = n;
goto error_return;
/* Again ignore return value of bfd_bread. */
- bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
+ bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
}
amt = ieee->element_count;
amt *= sizeof *ieee->elements;
- ieee->elements = (ieee_ar_obstack_type *) bfd_alloc (abfd, amt);
+ ieee->elements = bfd_alloc (abfd, amt);
if (ieee->elements == NULL)
goto error_return;
goto error_return;
/* Again ignore return value of bfd_bread. */
- bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
+ bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
}
const bfd_target *
-ieee_object_p (abfd)
- bfd *abfd;
+ieee_object_p (bfd *abfd)
{
char *processor;
unsigned int part;
goto fail;
/* Read the first few bytes in to see if it makes sense. Ignore
bfd_bread return value; The file might be very small. */
- bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
+ bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.input_p = buffer;
if (this_byte_and_next (&(ieee->h)) != Module_Beginning)
m68k family. Code for other processors can be added here. */
if ((processor[0] == '6') && (processor[1] == '8'))
{
- if (processor[2] == '3') /* 683xx integrated processors */
+ if (processor[2] == '3') /* 683xx integrated processors. */
{
switch (processor[3])
{
case '0': /* 68302, 68306, 68307 */
case '2': /* 68322, 68328 */
case '5': /* 68356 */
- strcpy (family, "68000"); /* MC68000-based controllers */
+ strcpy (family, "68000"); /* MC68000-based controllers. */
break;
case '3': /* 68330, 68331, 68332, 68333,
strcpy (family, "68332"); /* CPU32 and CPU32+ */
break;
- default: /* Does not exist yet */
+ default: /* Does not exist yet. */
strcpy (family, "68332"); /* Guess it will be CPU32 */
}
}
record. */
amt = ieee->w.r.me_record + 1;
- IEEE_DATA (abfd)->h.first_byte =
- (unsigned char *) bfd_alloc (ieee->h.abfd, amt);
+ IEEE_DATA (abfd)->h.first_byte = bfd_alloc (ieee->h.abfd, amt);
if (!IEEE_DATA (abfd)->h.first_byte)
goto fail;
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
goto fail;
/* FIXME: Check return value. I'm not sure whether it needs to read
the entire buffer or not. */
- bfd_bread ((PTR) (IEEE_DATA (abfd)->h.first_byte),
+ bfd_bread ((void *) (IEEE_DATA (abfd)->h.first_byte),
(bfd_size_type) ieee->w.r.me_record + 1, abfd);
ieee_slurp_sections (abfd);
goto fail;
/* Parse section data to activate file and section flags implied by
- section contents. */
+ section contents. */
if (! ieee_slurp_section_data (abfd))
goto fail;
}
static void
-ieee_get_symbol_info (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
+ieee_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol,
+ symbol_info *ret)
{
bfd_symbol_info (symbol, ret);
if (symbol->name[0] == ' ')
}
static void
-ieee_print_symbol (abfd, afile, symbol, how)
- bfd *abfd;
- PTR afile;
- asymbol *symbol;
- bfd_print_symbol_type how;
+ieee_print_symbol (bfd *abfd,
+ void * afile,
+ asymbol *symbol,
+ bfd_print_symbol_type how)
{
FILE *file = (FILE *) afile;
: symbol->section->name);
if (symbol->name[0] == ' ')
- {
- fprintf (file, "* empty table entry ");
- }
+ fprintf (file, "* empty table entry ");
else
{
- bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
+ bfd_print_symbol_vandf (abfd, (void *) file, symbol);
fprintf (file, " %-5s %04x %02x %s",
section_name,
}
static bfd_boolean
-do_one (ieee, current_map, location_ptr, s, iterations)
- ieee_data_type *ieee;
- ieee_per_section_type *current_map;
- unsigned char *location_ptr;
- asection *s;
- int iterations;
+do_one (ieee_data_type *ieee,
+ ieee_per_section_type *current_map,
+ unsigned char *location_ptr,
+ asection *s,
+ int iterations)
{
switch (this_byte (&(ieee->h)))
{
ieee_reloc_type *r;
bfd_size_type amt = sizeof (ieee_reloc_type);
- r = (ieee_reloc_type *) bfd_alloc (ieee->h.abfd, amt);
+ r = bfd_alloc (ieee->h.abfd, amt);
if (!r)
return FALSE;
default:
{
bfd_vma this_size;
+
if (parse_int (&(ieee->h), &this_size))
{
unsigned int i;
+
for (i = 0; i < this_size; i++)
{
location_ptr[current_map->pc++] = this_byte (&(ieee->h));
}
}
else
- {
- loop = FALSE;
- }
+ loop = FALSE;
}
}
/* Prevent more than the first load-item of an LR record
- from being repeated (MRI convention). */
+ from being repeated (MRI convention). */
if (iterations != 1)
loop = FALSE;
}
/* Read in all the section data and relocation stuff too. */
static bfd_boolean
-ieee_slurp_section_data (abfd)
- bfd *abfd;
+ieee_slurp_section_data (bfd *abfd)
{
bfd_byte *location_ptr = (bfd_byte *) NULL;
ieee_data_type *ieee = IEEE_DATA (abfd);
unsigned int section_number;
-
- ieee_per_section_type *current_map = (ieee_per_section_type *) NULL;
+ ieee_per_section_type *current_map = NULL;
asection *s;
+
/* Seek to the start of the data area. */
if (ieee->read_data)
return TRUE;
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
ieee_per_section_type *per = ieee_per_section (s);
+
if ((s->flags & SEC_DEBUGGING) != 0)
continue;
- per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->size);
+ per->data = bfd_alloc (ieee->h.abfd, s->size);
if (!per->data)
return FALSE;
per->reloc_tail_ptr =
}
static bfd_boolean
-ieee_new_section_hook (abfd, newsect)
- bfd *abfd;
- asection *newsect;
+ieee_new_section_hook (bfd *abfd, asection *newsect)
{
- newsect->used_by_bfd
- = (PTR) bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type));
+ newsect->used_by_bfd = bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type));
if (!newsect->used_by_bfd)
return FALSE;
- ieee_per_section (newsect)->data = (bfd_byte *) NULL;
+ ieee_per_section (newsect)->data = NULL;
ieee_per_section (newsect)->section = newsect;
return TRUE;
}
static long
-ieee_get_reloc_upper_bound (abfd, asect)
- bfd *abfd;
- sec_ptr asect;
+ieee_get_reloc_upper_bound (bfd *abfd, sec_ptr asect)
{
if ((asect->flags & SEC_DEBUGGING) != 0)
return 0;
}
static bfd_boolean
-ieee_get_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- sec_ptr section;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
+ieee_get_section_contents (bfd *abfd,
+ sec_ptr section,
+ void * location,
+ file_ptr offset,
+ bfd_size_type count)
{
ieee_per_section_type *p = ieee_per_section (section);
if ((section->flags & SEC_DEBUGGING) != 0)
return _bfd_generic_get_section_contents (abfd, section, location,
offset, count);
ieee_slurp_section_data (abfd);
- (void) memcpy ((PTR) location, (PTR) (p->data + offset), (unsigned) count);
+ (void) memcpy ((void *) location, (void *) (p->data + offset), (unsigned) count);
return TRUE;
}
static long
-ieee_canonicalize_reloc (abfd, section, relptr, symbols)
- bfd *abfd;
- sec_ptr section;
- arelent **relptr;
- asymbol **symbols;
+ieee_canonicalize_reloc (bfd *abfd,
+ sec_ptr section,
+ arelent **relptr,
+ asymbol **symbols)
{
ieee_reloc_type *src = (ieee_reloc_type *) (section->relocation);
ieee_data_type *ieee = IEEE_DATA (abfd);
*relptr++ = &src->relent;
src = src->next;
}
- *relptr = (arelent *) NULL;
+ *relptr = NULL;
return section->reloc_count;
}
static int
-comp (ap, bp)
- const PTR ap;
- const PTR bp;
+comp (const void * ap, const void * bp)
{
arelent *a = *((arelent **) ap);
arelent *b = *((arelent **) bp);
/* Write the section headers. */
static bfd_boolean
-ieee_write_section_part (abfd)
- bfd *abfd;
+ieee_write_section_part (bfd *abfd)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
asection *s;
+
ieee->w.r.section_part = bfd_tell (abfd);
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
return TRUE;
}
-
static bfd_boolean
-do_with_relocs (abfd, s)
- bfd *abfd;
- asection *s;
+do_with_relocs (bfd *abfd, asection *s)
{
unsigned int number_of_maus_in_address =
bfd_arch_bits_per_address (abfd) / bfd_arch_bits_per_byte (abfd);
/* Output a stream of bytes. */
if (! ieee_write_int (abfd, run))
return FALSE;
- if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd)
+ if (bfd_bwrite ((void *) (stream + current_byte_index), run, abfd)
!= run)
return FALSE;
current_byte_index += run;
/* Output the data stream as the longest sequence of bytes
possible, allowing for the a reasonable packet size and
relocation stuffs. */
-
- if ((PTR) stream == (PTR) NULL)
+ if (stream == NULL)
{
/* Outputting a section without data, fill it up. */
- stream = (unsigned char *) bfd_zalloc (abfd, s->size);
+ stream = bfd_zalloc (abfd, s->size);
if (!stream)
return FALSE;
}
/* Output a stream of bytes. */
if (! ieee_write_int (abfd, run))
return FALSE;
- if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd)
+ if (bfd_bwrite ((void *) (stream + current_byte_index), run, abfd)
!= run)
return FALSE;
current_byte_index += run;
switch (r->howto->size)
{
case 2:
-
ov = bfd_get_signed_32 (abfd,
stream + current_byte_index);
current_byte_index += 4;
ieee_function_either_open_b_enum))
return FALSE;
-/* abort();*/
-
if (r->sym_ptr_ptr != (asymbol **) NULL)
{
if (! ieee_write_expression (abfd, r->addend + ov,
bytes. */
static bfd_boolean
-do_as_repeat (abfd, s)
- bfd *abfd;
- asection *s;
+do_as_repeat (bfd *abfd, asection *s)
{
if (s->size)
{
}
static bfd_boolean
-do_without_relocs (abfd, s)
- bfd *abfd;
- asection *s;
+do_without_relocs (bfd *abfd, asection *s)
{
bfd_byte *stream = ieee_per_section (s)->data;
static int output_buffer;
static bfd_boolean
-ieee_mkobject (abfd)
- bfd *abfd;
+ieee_mkobject (bfd *abfd)
{
bfd_size_type amt;
output_bfd = NULL;
output_buffer = 0;
amt = sizeof (ieee_data_type);
- abfd->tdata.ieee_data = (ieee_data_type *) bfd_zalloc (abfd, amt);
+ abfd->tdata.ieee_data = bfd_zalloc (abfd, amt);
return abfd->tdata.ieee_data != NULL;
}
static void
-fill ()
+fill (void)
{
bfd_size_type amt = input_ptr_end - input_ptr_start;
/* FIXME: Check return value. I'm not sure whether it needs to read
the entire buffer or not. */
- bfd_bread ((PTR) input_ptr_start, amt, input_bfd);
+ bfd_bread ((void *) input_ptr_start, amt, input_bfd);
input_ptr = input_ptr_start;
}
static void
-flush ()
+flush (void)
{
bfd_size_type amt = output_ptr - output_ptr_start;
- if (bfd_bwrite ((PTR) (output_ptr_start), amt, output_bfd) != amt)
+ if (bfd_bwrite ((void *) (output_ptr_start), amt, output_bfd) != amt)
abort ();
output_ptr = output_ptr_start;
output_buffer++;
}
#define THIS() ( *input_ptr )
-#define NEXT() { input_ptr++; if (input_ptr == input_ptr_end) fill(); }
-#define OUT(x) { *output_ptr++ = (x); if(output_ptr == output_ptr_end) flush(); }
+#define NEXT() { input_ptr++; if (input_ptr == input_ptr_end) fill (); }
+#define OUT(x) { *output_ptr++ = (x); if (output_ptr == output_ptr_end) flush (); }
static void
-write_int (value)
- int value;
+write_int (int value)
{
if (value >= 0 && value <= 127)
{
else
{
unsigned int length;
+
/* How many significant bytes ? */
/* FIXME FOR LONGER INTS. */
if (value & 0xff000000)
}
/* Drop the int in the buffer, and copy a null into the gap, which we
- will overwrite later */
+ will overwrite later. */
static void
fill_int (buf)
input_bfd = input;
/* FIXME: Check return value. I'm not sure whether it needs to read
the entire buffer or not. */
- bfd_bread ((PTR) input_ptr_start, (bfd_size_type) IBS, input);
+ bfd_bread ((void *) input_ptr_start, (bfd_size_type) IBS, input);
block ();
}
continue;
/* Sort the reloc records so we can insert them in the correct
- places */
+ places. */
if (s->reloc_count != 0)
{
if (! do_with_relocs (abfd, s))
if (s->size != 0)
{
bfd_size_type size = s->size;
- ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, size));
+ ieee_per_section (s)->data = bfd_alloc (abfd, size);
if (!ieee_per_section (s)->data)
return FALSE;
}
ieee_set_section_contents (abfd, section, location, offset, count)
bfd *abfd;
sec_ptr section;
- const PTR location;
+ const void * location;
file_ptr offset;
bfd_size_type count;
{
if (section->contents == NULL)
{
bfd_size_type size = section->size;
- section->contents = (unsigned char *) bfd_alloc (abfd, size);
+ section->contents = bfd_alloc (abfd, size);
if (section->contents == NULL)
return FALSE;
}
if (!init_for_output (abfd))
return FALSE;
}
- memcpy ((PTR) (ieee_per_section (section)->data + offset),
- (PTR) location,
+ memcpy ((void *) (ieee_per_section (section)->data + offset),
+ (void *) location,
(unsigned int) count);
return TRUE;
}
|| ! ieee_write_id (abfd, p->name)
|| ! ieee_write_2bytes (abfd, ieee_attribute_record_enum)
|| ! ieee_write_int (abfd, (bfd_vma) public_index)
- || ! ieee_write_byte (abfd, 15) /* instruction address */
- || ! ieee_write_byte (abfd, 19) /* static symbol */
- || ! ieee_write_byte (abfd, 1)) /* one of them */
+ || ! ieee_write_byte (abfd, 15) /* Instruction address. */
+ || ! ieee_write_byte (abfd, 19) /* Static symbol. */
+ || ! ieee_write_byte (abfd, 1)) /* One of them. */
return FALSE;
/* Write out the value. */
/* 0xf1, 0xce, 0x21, 00, 50, 0x82, 0x07, 0xc7, 0x09, 0x11, 0x11,
0x19, 0x2c,
*/
- 0xf1, 0xce, 0x21, 00, 52, 0x00, /* exec ok */
+ 0xf1, 0xce, 0x21, 00, 52, 0x00, /* exec ok. */
- 0xf1, 0xce, 0x21, 0, 53, 0x03,/* host unix */
+ 0xf1, 0xce, 0x21, 0, 53, 0x03,/* host unix. */
/* 0xf1, 0xce, 0x21, 0, 54, 2,1,1 tool & version # */
};
return FALSE;
if (abfd->flags & EXEC_P)
{
- if (! ieee_write_byte (abfd, 0x1)) /* Absolute */
+ if (! ieee_write_byte (abfd, 0x1)) /* Absolute. */
return FALSE;
}
else
{
- if (! ieee_write_byte (abfd, 0x2)) /* Relocateable */
+ if (! ieee_write_byte (abfd, 0x2)) /* Relocateable. */
return FALSE;
}
return TRUE;
}
\f
-/* Native-level interface to symbols. */
+/* Native-level interface to symbols. */
/* We read the symbols into a buffer, which is discarded when this
function exits. We read the strings into a buffer large enough to
bfd *abfd;
{
bfd_size_type amt = sizeof (ieee_symbol_type);
- ieee_symbol_type *new = (ieee_symbol_type *) bfd_zalloc (abfd, amt);
+ ieee_symbol_type *new = bfd_zalloc (abfd, amt);
if (!new)
return NULL;
},
/* ieee_close_and_cleanup, ieee_bfd_free_cached_info, ieee_new_section_hook,
- ieee_get_section_contents, ieee_get_section_contents_in_window */
+ ieee_get_section_contents, ieee_get_section_contents_in_window. */
BFD_JUMP_TABLE_GENERIC (ieee),
BFD_JUMP_TABLE_COPY (_bfd_generic),
ieee_construct_extended_name_table, ieee_truncate_arname,
ieee_write_armap, ieee_read_ar_hdr, ieee_openr_next_archived_file,
ieee_get_elt_at_index, ieee_generic_stat_arch_elt,
- ieee_update_armap_timestamp */
+ ieee_update_armap_timestamp. */
BFD_JUMP_TABLE_ARCHIVE (ieee),
/* ieee_get_symtab_upper_bound, ieee_canonicalize_symtab,
ieee_make_empty_symbol, ieee_print_symbol, ieee_get_symbol_info,
ieee_bfd_is_local_label_name, ieee_get_lineno,
ieee_find_nearest_line, ieee_bfd_make_debug_symbol,
- ieee_read_minisymbols, ieee_minisymbol_to_symbol */
+ ieee_read_minisymbols, ieee_minisymbol_to_symbol. */
BFD_JUMP_TABLE_SYMBOLS (ieee),
/* ieee_get_reloc_upper_bound, ieee_canonicalize_reloc,
- ieee_bfd_reloc_type_lookup */
+ ieee_bfd_reloc_type_lookup. */
BFD_JUMP_TABLE_RELOCS (ieee),
- /* ieee_set_arch_mach, ieee_set_section_contents */
+ /* ieee_set_arch_mach, ieee_set_section_contents. */
BFD_JUMP_TABLE_WRITE (ieee),
/* ieee_sizeof_headers, ieee_bfd_get_relocated_section_contents,
_bfd_generic_link_hash_table_free,
ieee_bfd_link_add_symbols, ieee_bfd_final_link,
ieee_bfd_link_split_section, ieee_bfd_gc_sections,
- ieee_bfd_merge_sections */
+ ieee_bfd_merge_sections. */
BFD_JUMP_TABLE_LINK (ieee),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
- (PTR) 0
+ (void *) 0
};