+Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+
+ Changes to let BFD return an error indication from
+ get_symtab_upper_bound, bfd_canonicalize_symtab,
+ bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
+ return long instead of unsigned int, and use -1 to indicate an
+ error. Along the way, rename get_symtab_upper_bound to
+ bfd_get_symtab_upper_bound.
+ * bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
+ errors.
+ (bfd_canonicalize_reloc): Likewise.
+ * syms.c (bfd_get_symtab_upper_bound): Renamed from
+ get_symtab_upper_bound.
+ * targets.c (bfd_target): Renamed _get_symtab_upper_bound to
+ _bfd_get_symtab_upper_bound, and changed it and
+ _bfd_canonicalize_symtab and _get_reloc_upper_bound and
+ _bfd_canonicalize_reloc to all return long.
+ * aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
+ (NAME(aout,canonicalize_reloc)): Likewise.
+ (NAME(aout,get_reloc_upper_bound)): Likewise.
+ (NAME(aout,get_symtab_upper_bound)): Likewise.
+ * bout.c (b_out_canonicalize_reloc): Likewise.
+ (b_out_get_reloc_upper_bound): Likewise.
+ * coffcode.h (coff_canonicalize_reloc): Likewise.
+ * coffgen.c (coff_get_symtab_upper_bound): Likewise.
+ (coff_get_symtab): Likewise.
+ (coff_get_reloc_upper_bound): Likewise.
+ * ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
+ (ecoff_get_symtab): Likewise.
+ (ecoff_canonicalize_reloc): Likewise.
+ * elfcode.h (elf_get_symtab_upper_bound): Likewise.
+ (elf_get_reloc_upper_bound): Likewise.
+ (elf_canonicalize_reloc): Likewise.
+ (elf_get_symtab): Likewise.
+ * hp300hpux.c (MY(get_symtab)): Likewise.
+ (MY(get_symtab_upper_bound)): Likewise.
+ (MY(canonicalize_reloc)): Likewise.
+ * i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
+ * ieee.c (ieee_slurp_external_symbols): Change return type to
+ boolean. Check for errors from get_symbol.
+ (ieee_slurp_symbol_table): Change return type to boolean. Check
+ for errors from ieee_slurp_external_symbols.
+ (ieee_get_symtab_upper_bound): Return long, and -1 on errors.
+ (ieee_get_symtab): Likewise.
+ (ieee_get_reloc_upper_bound): Likewise.
+ (ieee_canonicalize_reloc): Likewise.
+ * mipsbsd.c (MY(canonicalize_reloc)): Likewise.
+ * nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
+ (nlm_get_symtab): Likewise.
+ (nlm_get_reloc_upper_bound): Likewise.
+ (nlm_canonicalize_reloc): Likewise.
+ * oasys.c (oasys_get_symtab_upper_bound): Likewise.
+ (oasys_get_symtab): Likewise.
+ (oasys_get_reloc_upper_bound): Likewise.
+ (oasys_canonicalize_reloc): Likewise.
+ * som.c (som_get_symtab_upper_bound): Likewise.
+ (som_get_symtab): Likewise.
+ (som_get_reloc_upper_bound): Likewise.
+ (som_canonicalize_reloc): Likewise.
+ * srec.c (srec_get_symtab_upper_bound): Likewise.
+ (srec_get_symtab): Likewise.
+ (srec_get_reloc_upper_bound): Define as bfd_0l.
+ (srec_canonicalize_reloc): Likewise.
+ * tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
+ (tekhex_get_symtab_upper_bound): Likewise.
+ (tekhex_get_reloc_upper_bound): Define as bfd_0l.
+ (tekhex_canonicalize_reloc): Likewise.
+ * libaout.h (NAME(aout,get_symtab_upper_bound)): Change
+ declaration to return long.
+ (NAME(aout,get_symtab)): Likewise.
+ (NAME(aout,canonicalize_reloc)): Likewise.
+ (NAME(aout,get_reloc_upper_bound)): Likewise.
+ * libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
+ (coff_get_symtab): Likewise.
+ (coff_get_reloc_upper_bound): Likewise.
+ * libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
+ (ecoff_get_symtab): Likewise.
+ (ecoff_canonicalize_reloc): Likewise.
+ * libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
+ (bfd_elf32_get_symtab): Likewise.
+ (bfd_elf32_get_reloc_upper_bound): Likewise.
+ (bfd_elf32_canonicalize_reloc): Likewise.
+ (bfd_elf64_get_symtab_upper_bound): Likewise.
+ (bfd_elf64_get_symtab): Likewise.
+ (bfd_elf64_get_reloc_upper_bound): Likewise.
+ (bfd_elf64_canonicalize_reloc): Likewise.
+ * libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
+ (nlmNAME(get_symtab)): Likewise.
+ (nlmNAME(get_reloc_upper_bound)): Likewise.
+ (nlmNAME(canonicalize_reloc)): Likewise.
+ * archive.c (compute_and_write_armap): Use error_return and
+ no_memory_return labels rather than freeing information in various
+ places. Change storage, symcount and src_count to long. Check
+ errors from bfd_get_symtab_upper_bound and
+ bfd_canonicalize_symtab.
+ * bout.c (b_out_relax_section): Change reloc_size to long. Check
+ for errors from bfd_get_reloc_upper_bound and
+ bfd_canonicalize_reloc.
+ (b_out_get_relocated_section_contents): Likewise.
+ * coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
+ Likewise.
+ * elf32-mips.c: Likewise.
+ * elf32-hppa.c (hppa_elf_stub_finish): Likewise.
+ (hppa_look_for_stubs_in_section): Check for errors from
+ bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
+ bfd_canonicalize_reloc.
+ * ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
+ from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
+ * linker.c (generic_link_read_symbols): Likewise.
+ (_bfd_generic_final_link): Check for errors from
+ bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
+ * reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
+ * reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
+ (bfd_coff_reloc16_get_relocated_section_contents): Likewise.
+ * libbfd.c (bfd_0l): New function.
+ * libbfd-in.h (bfd_0l): Declare.
+ * aix386-core.c: Change get_symtab_upper_bound, get_symtab,
+ get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
+ than bfd_0u.
+ * cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
+ * irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
+ * bfd-in2.h: Rebuilt.
+ * libbfd.h: Rebuilt.
+ * libcoff.h: Rebuilt.
+
+ * nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
+ temp and name.
+
Wed Mar 30 08:33:04 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
* hosts/dpx2.h: Define POSIX_UTIME.
#define aix386_get_section_contents bfd_generic_get_section_contents
#define aix386_new_section_hook (PROTO (boolean, (*), \
(bfd *, sec_ptr))) bfd_true
-#define aix386_get_symtab_upper_bound bfd_0u
-#define aix386_get_symtab (PROTO (unsigned int, (*), \
- (bfd *, struct symbol_cache_entry **))) bfd_0u
-#define aix386_get_reloc_upper_bound (PROTO (unsigned int, (*), \
- (bfd *, sec_ptr))) bfd_0u
-#define aix386_canonicalize_reloc (PROTO (unsigned int, (*), \
- (bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
+#define aix386_get_symtab_upper_bound bfd_0l
+#define aix386_get_symtab (PROTO (long, (*), \
+ (bfd *, struct symbol_cache_entry **))) bfd_0l
+#define aix386_get_reloc_upper_bound (PROTO (long, (*), \
+ (bfd *, sec_ptr))) bfd_0l
+#define aix386_canonicalize_reloc (PROTO (long, (*), \
+ (bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
#define aix386_make_empty_symbol (PROTO ( \
struct symbol_cache_entry *, (*), (bfd *))) bfd_false
#define aix386_print_symbol (PROTO (void, (*), \
}
\f
-unsigned int
+long
NAME(aout,get_symtab) (abfd, location)
bfd *abfd;
asymbol **location;
unsigned int counter = 0;
aout_symbol_type *symbase;
- if (!NAME(aout,slurp_symbol_table)(abfd)) return 0;
+ if (!NAME(aout,slurp_symbol_table)(abfd))
+ return -1;
for (symbase = obj_aout_symbols(abfd); counter++ < bfd_get_symcount (abfd);)
*(location++) = (asymbol *)( symbase++);
}
/* This is stupid. This function should be a boolean predicate */
-unsigned int
+long
NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
unsigned int count;
if (!(tblptr || NAME(aout,slurp_reloc_table)(abfd, section, symbols)))
- return 0;
+ return -1;
if (section->flags & SEC_CONSTRUCTOR) {
arelent_chain *chain = section->constructor_chain;
return section->reloc_count;
}
-unsigned int
+long
NAME(aout,get_reloc_upper_bound) (abfd, asect)
bfd *abfd;
sec_ptr asect;
if (bfd_get_format (abfd) != bfd_object) {
bfd_set_error (bfd_error_invalid_operation);
- return 0;
+ return -1;
}
if (asect->flags & SEC_CONSTRUCTOR) {
return (sizeof (arelent *) * (asect->reloc_count+1));
dynrel_count = ((*aout_backend_info (abfd)->read_dynamic_relocs)
(abfd, &dynrels));
if (dynrel_count == (bfd_size_type) -1)
- return 0;
+ return -1;
}
if (asect == obj_datasec (abfd))
+ dynrel_count + 1));
bfd_set_error (bfd_error_invalid_operation);
- return 0;
+ return -1;
}
\f
-unsigned int
+long
NAME(aout,get_symtab_upper_bound) (abfd)
bfd *abfd;
{
- if (!NAME(aout,slurp_symbol_table)(abfd)) return 0;
+ if (!NAME(aout,slurp_symbol_table)(abfd))
+ return -1;
return (bfd_get_symcount (abfd)+1) * (sizeof (aout_symbol_type *));
}
bfd *arch;
unsigned int elength;
{
- char *first_name;
+ char *first_name = NULL;
bfd *current;
file_ptr elt_no = 0;
- struct orl *map;
+ struct orl *map = NULL;
int orl_max = 1024; /* fine initial default */
int orl_count = 0;
int stridx = 0; /* string index */
asymbol **syms = NULL;
- unsigned int syms_max = 0;
+ long syms_max = 0;
boolean ret;
/* Dunno if this is the best place for this info... */
map = (struct orl *) malloc (orl_max * sizeof (struct orl));
if (map == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ goto no_memory_return;
/* We put the symbol names on the arch obstack, and then discard
them when done. */
first_name = bfd_alloc (arch, 1);
if (first_name == NULL)
- {
- free (map);
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ goto no_memory_return;
/* Drop all the files called __.SYMDEF, we're going to make our
own */
if ((bfd_check_format (current, bfd_object) == true)
&& ((bfd_get_file_flags (current) & HAS_SYMS)))
{
- unsigned int storage;
- unsigned int symcount;
- unsigned int src_count;
+ long storage;
+ long symcount;
+ long src_count;
+
+ storage = bfd_get_symtab_upper_bound (current);
+ if (storage < 0)
+ goto error_return;
- storage = get_symtab_upper_bound (current);
if (storage != 0)
{
if (storage > syms_max)
if (syms_max > 0)
free (syms);
syms_max = storage;
- syms = (asymbol **) malloc (syms_max);
+ syms = (asymbol **) malloc ((size_t) syms_max);
if (syms == NULL)
- {
- free (map);
- bfd_release (arch, first_name);
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ goto no_memory_return;
}
symcount = bfd_canonicalize_symtab (current, syms);
+ if (symcount < 0)
+ goto error_return;
/* Now map over all the symbols, picking out the ones we want */
for (src_count = 0; src_count < symcount; src_count++)
realloc ((PTR) map,
orl_max * sizeof (struct orl)));
if (new_map == (struct orl *) NULL)
- {
- free_and_quit:
- free (syms);
- free (map);
- bfd_release (arch, first_name);
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ goto no_memory_return;
map = new_map;
}
bfd_alloc (arch,
sizeof (char *)));
if (map[orl_count].name == NULL)
- goto free_and_quit;
+ goto no_memory_return;
*(map[orl_count].name) = bfd_alloc (arch, namelen + 1);
if (*(map[orl_count].name) == NULL)
- goto free_and_quit;
+ goto no_memory_return;
strcpy (*(map[orl_count].name), syms[src_count]->name);
(map[orl_count]).pos = (file_ptr) current;
(map[orl_count]).namidx = stridx;
if (syms_max > 0)
free (syms);
- free (map);
- bfd_release (arch, first_name);
+ if (map != NULL)
+ free (map);
+ if (first_name != NULL)
+ bfd_release (arch, first_name);
return ret;
+
+ no_memory_return:
+ bfd_set_error (bfd_error_no_memory);
+
+ error_return:
+ if (syms_max > 0)
+ free (syms);
+ if (map != NULL)
+ free (map);
+ if (first_name != NULL)
+ bfd_release (arch, first_name);
+
+ return false;
}
boolean
PTR udata;
} asymbol;
-#define get_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _get_symtab_upper_bound, (abfd))
+#define bfd_get_symtab_upper_bound(abfd) \
+ BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
boolean
bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym));
struct sgi_core_struct *sgi_core_data;
struct lynx_core_struct *lynx_core_data;
struct osf_core_struct *osf_core_data;
+ struct cisco_core_struct *cisco_core_data;
PTR any;
} tdata;
void
bfd_perror PARAMS ((CONST char *message));
-unsigned int
+long
bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
-unsigned int
+long
bfd_canonicalize_reloc
PARAMS ((bfd *abfd,
asection *sec,
BFD_SEND (abfd, _bfd_get_relocated_section_contents, \
(abfd, link_info, link_order, data, relocateable, symbols))
-#define bfd_relax_section(abfd, section, link_info, symbols) \
- BFD_SEND (abfd, _bfd_relax_section, \
- (abfd, section, link_info, symbols))
+#define bfd_relax_section(abfd, section, link_info, again) \
+ BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
#define bfd_link_hash_table_create(abfd) \
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
bfd *, sec_ptr));
boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
- unsigned int (*_get_symtab_upper_bound) PARAMS ((bfd *));
- unsigned int (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
- struct symbol_cache_entry **));
- unsigned int (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
- unsigned int (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
- struct symbol_cache_entry **));
+ long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
+ long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
+ struct symbol_cache_entry **));
+ long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
+ long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
+ struct symbol_cache_entry **));
struct symbol_cache_entry *
(*_bfd_make_empty_symbol) PARAMS ((bfd *));
void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
struct symbol_cache_entry **));
boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
- struct bfd_link_info *, struct symbol_cache_entry **));
+ struct bfd_link_info *, boolean *again));
/* See documentation on reloc types. */
CONST struct reloc_howto_struct *
. struct sgi_core_struct *sgi_core_data;
. struct lynx_core_struct *lynx_core_data;
. struct osf_core_struct *osf_core_data;
+. struct cisco_core_struct *cisco_core_data;
. PTR any;
. } tdata;
.
bfd_get_reloc_upper_bound
SYNOPSIS
- unsigned int bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
+ long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
DESCRIPTION
Return the number of bytes required to store the
relocation information associated with section @var{sect}
- attached to bfd @var{abfd}.
+ attached to bfd @var{abfd}. If an error occurs, return -1.
*/
-unsigned int
+long
bfd_get_reloc_upper_bound (abfd, asect)
bfd *abfd;
sec_ptr asect;
{
if (abfd->format != bfd_object) {
bfd_set_error (bfd_error_invalid_operation);
- return 0;
+ return -1;
}
return BFD_SEND (abfd, _get_reloc_upper_bound, (abfd, asect));
bfd_canonicalize_reloc
SYNOPSIS
- unsigned int bfd_canonicalize_reloc
+ long bfd_canonicalize_reloc
(bfd *abfd,
asection *sec,
arelent **loc,
information attached to @var{sec} into the internal canonical
form. Place the table into memory at @var{loc}, which has
been preallocated, usually by a call to
- <<bfd_get_reloc_upper_bound>>.
+ <<bfd_get_reloc_upper_bound>>. Returns the number of relocs, or
+ -1 on error.
The @var{syms} table is also needed for horrible internal magic
reasons.
*/
-unsigned int
+long
bfd_canonicalize_reloc (abfd, asect, location, symbols)
bfd *abfd;
sec_ptr asect;
{
if (abfd->format != bfd_object) {
bfd_set_error (bfd_error_invalid_operation);
- return 0;
+ return -1;
}
return BFD_SEND (abfd, _bfd_canonicalize_reloc,
(abfd, asect, location, symbols));
return value;
}
+/*
+FUNCTION
+ bfd_copy_private_bfd_data
+
+SYNOPSIS
+ boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
+
+DESCRIPTION
+ Copy private BFD information from the BFD @var{ibfd} to the
+ the BFD @var{obfd}. Return <<true>> on success, <<false>> on error.
+ Possible error returns are:
+
+ o <<bfd_error_no_memory>> -
+ Not enough memory exists to create private data for @var{obfd}.
+
+.#define bfd_copy_private_bfd_data(ibfd, obfd) \
+. BFD_SEND (ibfd, _bfd_copy_private_bfd_data, \
+. (ibfd, obfd))
+
+*/
+
/*
FUNCTION
stuff
. BFD_SEND (abfd, _bfd_get_relocated_section_contents, \
. (abfd, link_info, link_order, data, relocateable, symbols))
.
-.#define bfd_relax_section(abfd, section, link_info, symbols) \
-. BFD_SEND (abfd, _bfd_relax_section, \
-. (abfd, section, link_info, symbols))
+.#define bfd_relax_section(abfd, section, link_info, again) \
+. BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
.
.#define bfd_link_hash_table_create(abfd) \
. BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
}
/* This is stupid. This function should be a boolean predicate */
-static unsigned int
+static long
b_out_canonicalize_reloc (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
arelent *tblptr = section->relocation;
unsigned int count = 0;
- if (!(tblptr || b_out_slurp_reloc_table (abfd, section, symbols))) return 0;
+ if (!(tblptr || b_out_slurp_reloc_table (abfd, section, symbols)))
+ return -1;
tblptr = section->relocation;
- if (!tblptr) return 0;
+ if (!tblptr)
+ return -1;
for (; count++ < section->reloc_count;)
*relptr++ = tblptr++;
return section->reloc_count;
}
-static unsigned int
+static long
b_out_get_reloc_upper_bound (abfd, asect)
bfd *abfd;
sec_ptr asect;
{
if (bfd_get_format (abfd) != bfd_object) {
bfd_set_error (bfd_error_invalid_operation);
- return 0;
+ return -1;
}
if (asect == obj_datasec (abfd))
return 0;
bfd_set_error (bfd_error_invalid_operation);
- return 0;
+ return -1;
}
\f
static boolean
asection *input_section = i;
int shrink = 0 ;
arelent **reloc_vector = NULL;
- bfd_size_type reloc_size = bfd_get_reloc_upper_bound(input_bfd,
- input_section);
+ long reloc_size = bfd_get_reloc_upper_bound(input_bfd,
+ input_section);
+
+ if (reloc_size < 0)
+ return false;
/* We only run this relaxation once. It might work to run it
multiple times, but it hasn't been tested. */
if (reloc_size)
{
+ long reloc_count;
+
reloc_vector = (arelent **) malloc (reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
{
}
/* Get the relocs and think about them */
- if (bfd_canonicalize_reloc(input_bfd, input_section, reloc_vector,
- _bfd_generic_link_get_symbols (input_bfd)))
+ reloc_count =
+ bfd_canonicalize_reloc (input_bfd, input_section, reloc_vector,
+ _bfd_generic_link_get_symbols (input_bfd));
+ if (reloc_count < 0)
+ goto error_return;
+ if (reloc_count > 0)
{
arelent **parent;
for (parent = reloc_vector; *parent; parent++)
/* Get enough memory to hold the stuff */
bfd *input_bfd = link_order->u.indirect.section->owner;
asection *input_section = link_order->u.indirect.section;
- bfd_size_type reloc_size = bfd_get_reloc_upper_bound(input_bfd,
- input_section);
+ long reloc_size = bfd_get_reloc_upper_bound(input_bfd,
+ input_section);
arelent **reloc_vector = NULL;
+ long reloc_count;
+
+ if (reloc_size < 0)
+ goto error_return;
/* If producing relocateable output, don't bother to relax. */
if (relocateable)
0,
input_section->_raw_size));
- if (bfd_canonicalize_reloc(input_bfd,
- input_section,
- reloc_vector,
- symbols) )
+ reloc_count = bfd_canonicalize_reloc (input_bfd,
+ input_section,
+ reloc_vector,
+ symbols);
+ if (reloc_count < 0)
+ goto error_return;
+ if (reloc_count > 0)
{
arelent **parent = reloc_vector;
arelent *reloc ;
/* OK, we believe you. You're a core file. */
- abfd->tdata.cisco_core_data = (struct cisco_core_struct *)
- bfd_zmalloc (abfd, sizeof (struct cisco_core_struct));
+ abfd->tdata.cisco_core_data =
+ ((struct cisco_core_struct *)
+ bfd_zmalloc (sizeof (struct cisco_core_struct)));
if (abfd->tdata.cisco_core_data == NULL)
{
bfd_set_error (bfd_error_no_memory);
free (asect);
asect = nextsect;
}
- free (abfd->tdata);
+ free (abfd->tdata.cisco_core_data);
return NULL;
}
}
#define cisco_get_section_contents bfd_generic_get_section_contents
#define cisco_new_section_hook (boolean (*) PARAMS \
((bfd *, sec_ptr))) bfd_true
-#define cisco_get_symtab_upper_bound bfd_0u
-#define cisco_get_symtab (unsigned int (*) PARAMS \
- ((bfd *, struct symbol_cache_entry **))) bfd_0u
-#define cisco_get_reloc_upper_bound (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr))) bfd_0u
-#define cisco_canonicalize_reloc (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
+#define cisco_get_symtab_upper_bound bfd_0l
+#define cisco_get_symtab (long (*) PARAMS \
+ ((bfd *, struct symbol_cache_entry **))) bfd_0l
+#define cisco_get_reloc_upper_bound (long (*) PARAMS \
+ ((bfd *, sec_ptr))) bfd_0l
+#define cisco_canonicalize_reloc (long (*) PARAMS \
+ ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
#define cisco_make_empty_symbol (struct symbol_cache_entry * \
(*) PARAMS ((bfd *))) bfd_false
#define cisco_print_symbol (void (*) PARAMS \
#define cisco_bfd_copy_private_bfd_data \
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
#define cisco_bfd_is_local_label \
- ((boolean (*) PARAMS ((bfd *, asection *))) bfd_false)
+ ((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
bfd_target cisco_core_vec =
{
{
bfd *input_bfd = link_order->u.indirect.section->owner;
asection *input_section = link_order->u.indirect.section;
- size_t reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
+ long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
arelent **reloc_vector = NULL;
+ long reloc_count;
bfd *output_bfd = relocateable ? abfd : (bfd *) NULL;
bfd_vma gp;
boolean gp_undefined;
bfd_vma stack[RELOC_STACKSIZE];
int tos = 0;
+ if (reloc_size < 0)
+ goto error_return;
reloc_vector = (arelent **) malloc (reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
{
input_section->_cooked_size = input_section->_raw_size;
input_section->reloc_done = true;
- if (bfd_canonicalize_reloc (input_bfd, input_section, reloc_vector,
- symbols)
- == 0)
+ reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,
+ reloc_vector, symbols);
+ if (reloc_count < 0)
+ goto error_return;
+ if (reloc_count == 0)
goto successful_return;
/* Get the GP value for the output BFD. */
/* This is stupid. This function should be a boolean predicate. */
-static unsigned int
+static long
coff_canonicalize_reloc (abfd, section, relptr, symbols)
bfd * abfd;
sec_ptr section;
}
else
{
- coff_slurp_reloc_table (abfd, section, symbols);
-
+ if (! coff_slurp_reloc_table (abfd, section, symbols))
+ return -1;
tblptr = section->relocation;
if (!tblptr)
- return 0;
+ return -1;
for (; count++ < section->reloc_count;)
*relptr++ = tblptr++;
/* Get the upper bound of a COFF symbol table. */
-unsigned int
+long
coff_get_symtab_upper_bound(abfd)
bfd *abfd;
{
if (!bfd_coff_slurp_symbol_table(abfd))
- return 0;
+ return -1;
return (bfd_get_symcount(abfd) + 1) * (sizeof(coff_symbol_type *));
}
/* Canonicalize a COFF symbol table. */
-unsigned int
+long
coff_get_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
coff_symbol_type *symbase;
coff_symbol_type **location = (coff_symbol_type **) (alocation);
if (!bfd_coff_slurp_symbol_table(abfd))
- return 0;
+ return -1;
symbase = obj_symbols(abfd);
while (counter < bfd_get_symcount(abfd))
return (internal);
} /* coff_get_normalized_symtab() */
-unsigned int
+long
coff_get_reloc_upper_bound (abfd, asect)
bfd *abfd;
sec_ptr asect;
{
if (bfd_get_format(abfd) != bfd_object) {
bfd_set_error (bfd_error_invalid_operation);
- return 0;
+ return -1;
}
return (asect->reloc_count + 1) * sizeof(arelent *);
}
/* Return the amount of space needed for the canonical symbols. */
-unsigned int
+long
ecoff_get_symtab_upper_bound (abfd)
bfd *abfd;
{
- if (ecoff_slurp_symbolic_info (abfd) == false
- || bfd_get_symcount (abfd) == 0)
+ if (! ecoff_slurp_symbolic_info (abfd))
+ return -1;
+
+ if (bfd_get_symcount (abfd) == 0)
return 0;
return (bfd_get_symcount (abfd) + 1) * (sizeof (ecoff_symbol_type *));
/* Get the canonical symbols. */
-unsigned int
+long
ecoff_get_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
ecoff_symbol_type *symbase;
ecoff_symbol_type **location = (ecoff_symbol_type **) alocation;
- if (ecoff_slurp_symbol_table (abfd) == false
- || bfd_get_symcount (abfd) == 0)
+ if (ecoff_slurp_symbol_table (abfd) == false)
+ return -1;
+ if (bfd_get_symcount (abfd) == 0)
return 0;
symbase = ecoff_data (abfd)->canonical_symbols;
/* Get a canonical list of relocs. */
-unsigned int
+long
ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
bfd *abfd;
asection *section;
arelent *tblptr;
if (ecoff_slurp_reloc_table (abfd, section, symbols) == false)
- return 0;
+ return -1;
tblptr = section->relocation;
if (tblptr == (arelent *) NULL)
- return 0;
+ return -1;
for (count = 0; count < section->reloc_count; count++)
*relptr++ = tblptr++;
asymbol **symbols;
asymbol **sym_ptr;
asymbol **sym_end;
+ long symsize;
+ long symcount;
PTR external_fdr;
memset ((PTR) &fdr, 0, sizeof fdr);
fdr.isymBase = output_symhdr->isymMax;
/* Get the local symbols from the input BFD. */
- symbols = (asymbol **) bfd_alloc (output_bfd,
- get_symtab_upper_bound (input_bfd));
+ symsize = bfd_get_symtab_upper_bound (input_bfd);
+ if (symsize < 0)
+ return false;
+ symbols = (asymbol **) bfd_alloc (output_bfd, symsize);
if (symbols == (asymbol **) NULL)
{
bfd_set_error (bfd_error_no_memory);
return false;
}
- sym_end = symbols + bfd_canonicalize_symtab (input_bfd, symbols);
+ symcount = bfd_canonicalize_symtab (input_bfd, symbols);
+ if (symcount < 0)
+ return false;
+ sym_end = symbols + symcount;
/* Handle the local symbols. Any external symbols are handled
separately. */
bfd *stub_bfd = stub_list->this_bfd;
asection *stub_sec = bfd_get_section_by_name (stub_bfd,
".hppa_linker_stubs");
- bfd_size_type reloc_size;
+ long reloc_size;
arelent **reloc_vector;
+ long reloc_count;
/* Some sanity checking. */
BFD_ASSERT (stub_sec == stub_list->stub_sec);
/* Make space to hold the relocations for the stub section. */
reloc_size = bfd_get_reloc_upper_bound (stub_bfd, stub_sec);
+ if (reloc_size < 0)
+ {
+ /* FIXME: Should return an error. */
+ abort ();
+ }
reloc_vector = (arelent **) malloc (reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
{
}
/* If we have relocations, do them. */
- if (bfd_canonicalize_reloc (stub_bfd, stub_sec, reloc_vector,
- output_bfd->outsymbols))
+ reloc_count = bfd_canonicalize_reloc (stub_bfd, stub_sec,
+ reloc_vector,
+ output_bfd->outsymbols);
+ if (reloc_count < 0)
+ {
+ /* FIXME: Should return an error. */
+ abort ();
+ }
+ if (reloc_count > 0)
{
arelent **parent;
for (parent = reloc_vector; *parent != NULL; parent++)
location. */
if (bfd_get_outsymbols (abfd) == NULL)
{
- size_t symsize;
+ long symsize;
+ long symcount;
- symsize = get_symtab_upper_bound (abfd);
+ symsize = bfd_get_symtab_upper_bound (abfd);
+ if (symsize < 0)
+ goto error_return;
abfd->outsymbols = (asymbol **) bfd_alloc (abfd, symsize);
- if (!abfd->outsymbols)
+ if (!abfd->outsymbols && symsize != 0)
{
bfd_set_error (bfd_error_no_memory);
goto error_return;
}
- abfd->symcount = bfd_canonicalize_symtab (abfd, abfd->outsymbols);
+ symcount = bfd_canonicalize_symtab (abfd, abfd->outsymbols);
+ if (symcount < 0)
+ goto error_return;
+ abfd->symcount = symcount;
}
/* Now get the relocations. */
- bfd_canonicalize_reloc (abfd, asec, reloc_vector,
- bfd_get_outsymbols (abfd));
+ if (bfd_canonicalize_reloc (abfd, asec, reloc_vector,
+ bfd_get_outsymbols (abfd)) < 0)
+ goto error_return;
/* Examine each relocation entry in this section. */
for (i = 0; i < asec->reloc_count; i++)
{
asection *input_section;
bfd *input_bfd;
- bfd_size_type relsize;
+ long relsize;
arelent **relocs;
- bfd_size_type reloc_count;
+ long reloc_count;
input_section = p->u.indirect.section;
input_bfd = input_section->owner;
relsize = bfd_get_reloc_upper_bound (input_bfd,
input_section);
+ if (relsize < 0)
+ return false;
relocs = (arelent **) malloc (relsize);
if (!relocs && relsize != 0)
{
bfd_canonicalize_reloc (input_bfd, input_section,
relocs,
bfd_get_outsymbols (input_bfd));
+ if (reloc_count < 0)
+ return false;
BFD_ASSERT (reloc_count == input_section->reloc_count);
o->reloc_count += reloc_count;
free (relocs);
the vector allocated based on this size. However, the ELF symbol table
always has a dummy entry as symbol #0, so it ends up even. */
-unsigned int
+long
elf_get_symtab_upper_bound (abfd)
bfd *abfd;
{
- unsigned int symcount;
- unsigned int symtab_size = 0;
-
+ long symcount;
+ long symtab_size;
Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->symtab_hdr;
+
symcount = hdr->sh_size / sizeof (Elf_External_Sym);
symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *));
attached to bfd <<abfd>>
*/
-unsigned int
+long
elf_get_reloc_upper_bound (abfd, asect)
bfd *abfd;
sec_ptr asect;
return true;
}
-unsigned int
+long
elf_canonicalize_reloc (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
/* snarfed from coffcode.h */
if (use_rela_p)
- elf_slurp_reloca_table (abfd, section, symbols);
+ {
+ if (! elf_slurp_reloca_table (abfd, section, symbols))
+ return -1;
+ }
else
- elf_slurp_reloc_table (abfd, section, symbols);
+ {
+ if (! elf_slurp_reloc_table (abfd, section, symbols))
+ return -1;
+ }
tblptr = section->relocation;
if (!tblptr)
- return 0;
+ return -1;
for (; count++ < section->reloc_count;)
*relptr++ = tblptr++;
return section->reloc_count;
}
-unsigned int
+long
elf_get_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
{
-
if (!elf_slurp_symbol_table (abfd, alocation))
- return 0;
- else
- return bfd_get_symcount (abfd);
+ return -1;
+
+ return bfd_get_symcount (abfd);
}
asymbol *
/* call aout_32 versions if the input file was generated by gcc */
/************************************************************************/
-unsigned int aout_32_get_symtab PARAMS ((bfd * abfd, asymbol ** location));
-unsigned int aout_32_get_symtab_upper_bound PARAMS ((bfd * abfd));
+long aout_32_get_symtab PARAMS ((bfd * abfd, asymbol ** location));
+long aout_32_get_symtab_upper_bound PARAMS ((bfd * abfd));
-unsigned int aout_32_canonicalize_reloc PARAMS ((bfd * abfd, sec_ptr section,
- arelent ** relptr,
- asymbol ** symbols));
+long aout_32_canonicalize_reloc PARAMS ((bfd * abfd, sec_ptr section,
+ arelent ** relptr,
+ asymbol ** symbols));
-unsigned int
+long
MY (get_symtab) (abfd, location)
bfd *abfd;
asymbol **location;
return aout_32_get_symtab (abfd, location);
if (!MY (slurp_symbol_table) (abfd))
- return 0;
+ return -1;
for (symbase = obj_aout_symbols (abfd); counter++ < bfd_get_symcount (abfd);)
*(location++) = (asymbol *) (symbase++);
return bfd_get_symcount (abfd);
}
-unsigned int
+long
MY (get_symtab_upper_bound) (abfd)
bfd *abfd;
{
if (obj_aout_subformat (abfd) == gnu_encap_format)
return aout_32_get_symtab_upper_bound (abfd);
if (!MY (slurp_symbol_table) (abfd))
- return 0;
+ return -1;
return (bfd_get_symcount (abfd) + 1) * (sizeof (aout_symbol_type *));
}
-unsigned int
+long
MY (canonicalize_reloc) (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
return aout_32_canonicalize_reloc (abfd, section, relptr, symbols);
if (!(tblptr || MY (slurp_reloc_table) (abfd, section, symbols)))
- return 0;
+ return -1;
if (section->flags & SEC_CONSTRUCTOR)
{
{
tblptr = section->relocation;
if (!tblptr)
- return 0;
+ return -1;
for (count = 0; count++ < section->reloc_count;)
{
val = bfd_read ((void *) &u, 1, sizeof u, abfd);
if (val != sizeof u)
{
- bfd_error = wrong_format;
+ bfd_set_error (bfd_error_wrong_format);
return NULL;
}
struct stat statbuf;
if (stream == NULL || fstat (fileno (stream), &statbuf) < 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return NULL;
}
if (NBPG * (UPAGES + u.u_dsize + u.u_ssize) > statbuf.st_size)
{
- bfd_error = file_truncated;
+ bfd_set_error (bfd_error_file_truncated);
return NULL;
}
if (clicksz * (UPAGES + u.u_dsize + u.u_ssize) < statbuf.st_size)
{
/* The file is too big. Maybe it's not a core file
or we otherwise have bad values for u_dsize and u_ssize). */
- bfd_error = wrong_format;
+ bfd_set_error (bfd_error_wrong_format);
return NULL;
}
}
bfd_zalloc (abfd, sizeof (struct hppabsd_core_struct));
if (!coredata)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
bfd_generic_get_section_contents
#define hppabsd_core_new_section_hook (boolean (*) PARAMS \
((bfd *, sec_ptr))) bfd_true
-#define hppabsd_core_get_symtab_upper_bound bfd_0u
-#define hppabsd_core_get_symtab (unsigned int (*) PARAMS \
- ((bfd *, struct symbol_cache_entry **))) bfd_0u
-#define hppabsd_core_get_reloc_upper_bound (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr))) bfd_0u
-#define hppabsd_core_canonicalize_reloc (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
+#define hppabsd_core_get_symtab_upper_bound bfd_0l
+#define hppabsd_core_get_symtab (long (*) PARAMS \
+ ((bfd *, struct symbol_cache_entry **))) bfd_0l
+#define hppabsd_core_get_reloc_upper_bound (long (*) PARAMS \
+ ((bfd *, sec_ptr))) bfd_0l
+#define hppabsd_core_canonicalize_reloc (long (*) PARAMS \
+ ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
#define hppabsd_core_print_symbol (void (*) PARAMS \
((bfd *, PTR, struct symbol_cache_entry *, \
bfd_print_symbol_type))) bfd_false
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define hppabsd_core_bfd_final_link \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+#define hppabsd_core_bfd_copy_private_section_data \
+ ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_false)
+#define hppabsd_core_bfd_copy_private_bfd_data \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
+#define hppabsd_core_bfd_is_local_label \
+ ((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
/* If somebody calls any byte-swapping routines, shoot them. */
static void
bfd *abfd;
{
asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
- new->the_bfd = abfd;
+ if (new)
+ new->the_bfd = abfd;
return new;
}
#define hpux_core_close_and_cleanup bfd_generic_close_and_cleanup
#define hpux_core_set_section_contents (boolean (*) PARAMS \
((bfd *abfd, asection *section, PTR data, file_ptr offset, \
- bfd_size_type count))) bfd_false
+ bfd_size_type count))) bfd_generic_set_section_contents
#define hpux_core_get_section_contents bfd_generic_get_section_contents
#define hpux_core_new_section_hook (boolean (*) PARAMS \
((bfd *, sec_ptr))) bfd_true
-#define hpux_core_get_symtab_upper_bound bfd_0u
-#define hpux_core_get_symtab (unsigned int (*) PARAMS \
- ((bfd *, struct symbol_cache_entry **))) bfd_0u
-#define hpux_core_get_reloc_upper_bound (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr))) bfd_0u
-#define hpux_core_canonicalize_reloc (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
+#define hpux_core_get_symtab_upper_bound bfd_0l
+#define hpux_core_get_symtab (long (*) PARAMS \
+ ((bfd *, struct symbol_cache_entry **))) bfd_0l
+#define hpux_core_get_reloc_upper_bound (long (*) PARAMS \
+ ((bfd *, sec_ptr))) bfd_0l
+#define hpux_core_canonicalize_reloc (long (*) PARAMS \
+ ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
#define hpux_core_print_symbol (void (*) PARAMS \
((bfd *, PTR, struct symbol_cache_entry *, \
bfd_print_symbol_type))) bfd_false
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define hpux_core_bfd_final_link \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+#define hpux_core_bfd_copy_private_section_data \
+ ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_false)
+#define hpux_core_bfd_copy_private_bfd_data \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
+#define hpux_core_bfd_is_local_label \
+ ((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
/* If somebody calls any byte-swapping routines, shoot them. */
void
{
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
}
-#define NO_GET ((bfd_vma (*) PARAMS (( bfd_byte *))) swap_abort )
+#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
-#define NO_SIGNED_GET ((bfd_signed_vma (*) PARAMS ((bfd_byte *))) swap_abort )
+#define NO_SIGNED_GET \
+ ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
bfd_target hpux_core_vec =
{
}
/* This is stupid. This function should be a boolean predicate */
-unsigned int
-NAME (lynx, canonicalize_reloc) (abfd, section, relptr, symbols)
+long
+NAME(lynx,canonicalize_reloc) (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
arelent **relptr;
unsigned int count;
if (!(tblptr || NAME (lynx, slurp_reloc_table) (abfd, section, symbols)))
- return 0;
+ return -1;
if (section->flags & SEC_CONSTRUCTOR)
{
{
tblptr = section->relocation;
if (!tblptr)
- return 0;
+ return -1;
for (count = 0; count++ < section->reloc_count;)
{
return last_symbol;
}
-static void
+static boolean
ieee_slurp_external_symbols (abfd)
bfd *abfd;
{
symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
&prev_symbols_ptr,
&ieee->external_symbol_max_index, 'D');
-
+ if (symbol == NULL)
+ return false;
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id (&(ieee->h));
symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
&prev_symbols_ptr,
&ieee->external_symbol_max_index, 'D');
-
+ if (symbol == NULL)
+ return false;
BFD_ASSERT (symbol->index >= ieee->external_symbol_min_index);
symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
&prev_reference_ptr,
&ieee->external_reference_max_index, 'X');
-
+ if (symbol == NULL)
+ return false;
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id (&(ieee->h));
*prev_symbols_ptr = (ieee_symbol_type *) NULL;
*prev_reference_ptr = (ieee_symbol_type *) NULL;
+
+ return true;
}
-static void
+static boolean
ieee_slurp_symbol_table (abfd)
bfd *abfd;
{
if (IEEE_DATA (abfd)->read_symbols == false)
{
- ieee_slurp_external_symbols (abfd);
+ if (! ieee_slurp_external_symbols (abfd))
+ return false;
IEEE_DATA (abfd)->read_symbols = true;
}
+ return true;
}
-unsigned int
+long
ieee_get_symtab_upper_bound (abfd)
bfd *abfd;
{
- ieee_slurp_symbol_table (abfd);
+ if (! ieee_slurp_symbol_table (abfd))
+ return -1;
return (abfd->symcount != 0) ?
(abfd->symcount + 1) * (sizeof (ieee_symbol_type *)) : 0;
extern bfd_target ieee_vec;
-unsigned int
+long
ieee_get_symtab (abfd, location)
bfd *abfd;
asymbol **location;
{
ieee_data_type *ieee = IEEE_DATA (abfd);
dummy_bfd.xvec = &ieee_vec;
- ieee_slurp_symbol_table (abfd);
+ if (! ieee_slurp_symbol_table (abfd))
+ return -1;
if (ieee->symbol_table_full == false)
{
return true;
}
-unsigned int
+long
ieee_get_reloc_upper_bound (abfd, asect)
bfd *abfd;
sec_ptr asect;
{
- ieee_slurp_section_data (abfd);
+ if (! ieee_slurp_section_data (abfd))
+ return -1;
return (asect->reloc_count + 1) * sizeof (arelent *);
}
return true;
}
-unsigned int
+long
ieee_canonicalize_reloc (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ieee_bfd_final_link _bfd_generic_final_link
+#define ieee_bfd_copy_private_section_data \
+ ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
+#define ieee_bfd_copy_private_bfd_data \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+#define ieee_bfd_is_local_label bfd_generic_is_local_label
/*SUPPRESS 460 */
bfd_target ieee_vec =
bfd *abfd;
{
asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
- new->the_bfd = abfd;
+ if (new)
+ new->the_bfd = abfd;
return new;
}
#define irix_core_close_and_cleanup bfd_generic_close_and_cleanup
#define irix_core_set_section_contents (boolean (*) PARAMS \
((bfd *abfd, asection *section, PTR data, file_ptr offset, \
- bfd_size_type count))) bfd_false
+ bfd_size_type count))) bfd_generic_set_section_contents
#define irix_core_get_section_contents bfd_generic_get_section_contents
#define irix_core_new_section_hook (boolean (*) PARAMS \
((bfd *, sec_ptr))) bfd_true
-#define irix_core_get_symtab_upper_bound bfd_0u
-#define irix_core_get_symtab (unsigned int (*) PARAMS \
- ((bfd *, struct symbol_cache_entry **))) bfd_0u
-#define irix_core_get_reloc_upper_bound (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr))) bfd_0u
-#define irix_core_canonicalize_reloc (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
+#define irix_core_get_symtab_upper_bound bfd_0l
+#define irix_core_get_symtab (long (*) PARAMS \
+ ((bfd *, struct symbol_cache_entry **))) bfd_0l
+#define irix_core_get_reloc_upper_bound (long (*) PARAMS \
+ ((bfd *, sec_ptr))) bfd_0l
+#define irix_core_canonicalize_reloc (long (*) PARAMS \
+ ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
#define irix_core_print_symbol (void (*) PARAMS \
((bfd *, PTR, struct symbol_cache_entry *, \
bfd_print_symbol_type))) bfd_false
#define irix_core_bfd_final_link \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+#define irix_core_bfd_copy_private_section_data \
+ ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_false)
+#define irix_core_bfd_copy_private_bfd_data \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
+#define irix_core_bfd_is_local_label \
+ ((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
+
/* If somebody calls any byte-swapping routines, shoot them. */
void
swap_abort()
{
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
}
-#define NO_GET ((bfd_vma (*) PARAMS (( bfd_byte *))) swap_abort )
+#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
-#define NO_SIGNED_GET ((bfd_signed_vma (*) PARAMS ((bfd_byte *))) swap_abort )
+#define NO_SIGNED_GET \
+ ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
bfd_target irix_core_vec =
{
#define BYTES_IN_WORD 4
#endif /* ARCH_SIZE==32 */
-/* Declare at file level, since it isused in parameter lists, which
- have weird scope. */
+/* Declare at file level, since used in parameter lists, which have
+ weird scope. */
struct external_exec;
+struct external_nlist;
/* Back-end information for various a.out targets. */
struct aout_backend_data
to the size of the text section in the file for alignment purposes but
does *not* get counted in the length of the text section. */
unsigned char exec_header_not_counted;
+
+ /* A callback function to read in the dynamic symbols of an object
+ which is dynamically linked. This returns the number of symbols
+ read (or -1 on error) and sets *SYMS to a buffer holding an array
+ of external_nlist structures and *STRS and *STRSIZE to the
+ associated string table. (This interface works for SunOS, but
+ can be changed if some other interface is better for some other
+ shared library implementation). */
+ bfd_size_type (*read_dynamic_symbols) PARAMS ((bfd *,
+ struct external_nlist **syms,
+ char **strs,
+ bfd_size_type *strsize));
+
+ /* A callback function to read in the dynamic relocs of an object
+ which is dynamically linked. This returns the number of relocs
+ read (or -1 on error) and sets *RELOCS to a buffer holding an
+ array of external reloc structures (the type depends upon the
+ type of object file). */
+ bfd_size_type (*read_dynamic_relocs) PARAMS ((bfd *, PTR *relocs));
};
#define aout_backend_info(abfd) \
((CONST struct aout_backend_data *)((abfd)->xvec->backend_data))
M_HPUX = (0x20c % 256)/* HP 200/300 HPUX binary */
};
-#define N_DYNAMIC(exec) ((exec).a_info & 0x8000000)
+#define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)
#ifndef N_MAGIC
# define N_MAGIC(exec) ((exec).a_info & 0xffff)
| (((flags) & 0xff) << 24))
#endif
+#ifndef N_SET_DYNAMIC
+# define N_SET_DYNAMIC(exec, dynamic) \
+((exec).a_info = (dynamic) ? ((exec).a_info | 0x80000000) : \
+((exec).a_info & 0x7fffffff))
+#endif
+
#ifndef N_SET_MAGIC
# define N_SET_MAGIC(exec, magic) \
((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
bfd_size_type external_sym_count;
char *external_strings;
struct aout_link_hash_entry **sym_hashes;
+
+ /* A pointer for shared library information. */
+ PTR dynamic_info;
};
struct aout_data_struct {
#define obj_aout_external_sym_count(bfd) (adata(bfd).external_sym_count)
#define obj_aout_external_strings(bfd) (adata(bfd).external_strings)
#define obj_aout_sym_hashes(bfd) (adata(bfd).sym_hashes)
+#define obj_aout_dynamic_info(bfd) (adata(bfd).dynamic_info)
/* We take the address of the first element of an asymbol to ensure that the
macro is only ever applied to an asymbol */
void
NAME(aout,reclaim_symbol_table) PARAMS ((bfd *abfd));
-unsigned int
+long
NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *abfd));
-unsigned int
+long
NAME(aout,get_symtab) PARAMS ((bfd *abfd, asymbol **location));
boolean
NAME(aout,slurp_reloc_table) PARAMS ((bfd *abfd, sec_ptr asect,
asymbol **symbols));
-unsigned int
+long
NAME(aout,canonicalize_reloc) PARAMS ((bfd *abfd, sec_ptr section,
arelent **relptr, asymbol **symbols));
-unsigned int
+long
NAME(aout,get_reloc_upper_bound) PARAMS ((bfd *abfd, sec_ptr asect));
void
#define NO_WRITE_HEADER_KLUDGE 0
#endif
+#ifndef aout_32_bfd_copy_private_section_data
+#define aout_32_bfd_copy_private_section_data \
+ ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
+#endif
+#ifndef aout_32_bfd_copy_private_bfd_data
+#define aout_32_bfd_copy_private_bfd_data \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+#endif
+#ifndef aout_32_bfd_is_local_label
+#define aout_32_bfd_is_local_label bfd_generic_is_local_label
+#endif
+
#ifndef WRITE_HEADERS
#define WRITE_HEADERS(abfd, execp) \
{ \
PTR bfd_nullvoidptr PARAMS ((bfd *ignore));
int bfd_0 PARAMS ((bfd *ignore));
unsigned int bfd_0u PARAMS ((bfd *ignore));
+long bfd_0l PARAMS ((bfd *ignore));
void bfd_void PARAMS ((bfd *ignore));
bfd * _bfd_new_bfd_contained_in PARAMS ((bfd *));
extern boolean _bfd_generic_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
+/* Generic add symbol routine. This version is used by targets for
+ which the linker must collect constructors and destructors by name,
+ as the collect2 program does. */
+extern boolean _bfd_generic_link_add_symbols_collect
+ PARAMS ((bfd *, struct bfd_link_info *));
+
/* Generic archive add symbol routine. */
extern boolean _bfd_generic_link_add_archive_symbols
PARAMS ((bfd *, struct bfd_link_info *,
return 0;
}
+/*ARGUSED*/
+long
+bfd_0l (ignore)
+ bfd *ignore;
+{
+ return 0;
+}
+
/*ARGSUSED*/
void
bfd_void (ignore)
PTR bfd_nullvoidptr PARAMS ((bfd *ignore));
int bfd_0 PARAMS ((bfd *ignore));
unsigned int bfd_0u PARAMS ((bfd *ignore));
+long bfd_0l PARAMS ((bfd *ignore));
void bfd_void PARAMS ((bfd *ignore));
bfd * _bfd_new_bfd_contained_in PARAMS ((bfd *));
PARAMS ((bfd *abfd,
asection *section,
struct bfd_link_info *,
- asymbol **symbols));
+ boolean *));
bfd_byte *
/* BFD COFF object file private structure.
- Copyright (C) 1990-1991 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
#define obj_relocbase(bfd) (coff_data(bfd)->relocbase)
#define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments)
+#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
#if CFILE_STUFF
/* Functions in coffgen.c. */
extern bfd_target *coff_object_p PARAMS ((bfd *));
extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
-extern unsigned int coff_get_symtab_upper_bound PARAMS ((bfd *));
-extern unsigned int coff_get_symtab PARAMS ((bfd *, asymbol **));
-extern void coff_count_linenumbers PARAMS ((bfd *));
+extern long coff_get_symtab_upper_bound PARAMS ((bfd *));
+extern long coff_get_symtab PARAMS ((bfd *, asymbol **));
+extern int coff_count_linenumbers PARAMS ((bfd *));
extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
-extern void coff_renumber_symbols PARAMS ((bfd *));
+extern boolean coff_renumber_symbols PARAMS ((bfd *));
extern void coff_mangle_symbols PARAMS ((bfd *));
extern void coff_write_symbols PARAMS ((bfd *));
-extern void coff_write_linenumbers PARAMS ((bfd *));
+extern boolean coff_write_linenumbers PARAMS ((bfd *));
extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *));
-extern unsigned int coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
+extern long coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
extern asymbol *coff_make_empty_symbol PARAMS ((bfd *));
extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *,
bfd_print_symbol_type how));
-extern asymbol *coff_make_debug_symbol PARAMS ((bfd *, PTR, unsigned long));
+extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *,
+ symbol_info *ret));
+extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR,
+ unsigned long));
extern boolean coff_find_nearest_line PARAMS ((bfd *,
asection *,
asymbol **,
CONST char **functionname_ptr,
unsigned int *line_ptr));
extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc));
-extern boolean bfd_coff_reloc16_relax_section PARAMS ((bfd *,
- asection *,
- asymbol **));
+extern boolean bfd_coff_reloc16_relax_section
+ PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
- PARAMS ((bfd *, struct bfd_seclet *, bfd_byte *, boolean relocateable));
+ PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
+ bfd_byte *, boolean relocateable, asymbol **));
extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *,
- struct bfd_seclet *));
+ struct bfd_link_info *,
+ asection *));
+extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip,
+ asection *input_section,
+ bfd_vma val));
/* And more taken from the source .. */
/* BFD COFF object file private structure.
- Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
/* Functions in coffgen.c. */
extern bfd_target *coff_object_p PARAMS ((bfd *));
extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
-extern unsigned int coff_get_symtab_upper_bound PARAMS ((bfd *));
-extern unsigned int coff_get_symtab PARAMS ((bfd *, asymbol **));
+extern long coff_get_symtab_upper_bound PARAMS ((bfd *));
+extern long coff_get_symtab PARAMS ((bfd *, asymbol **));
extern int coff_count_linenumbers PARAMS ((bfd *));
extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
-extern void coff_renumber_symbols PARAMS ((bfd *));
+extern boolean coff_renumber_symbols PARAMS ((bfd *));
extern void coff_mangle_symbols PARAMS ((bfd *));
extern void coff_write_symbols PARAMS ((bfd *));
-extern void coff_write_linenumbers PARAMS ((bfd *));
+extern boolean coff_write_linenumbers PARAMS ((bfd *));
extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *));
-extern unsigned int coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
+extern long coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
extern asymbol *coff_make_empty_symbol PARAMS ((bfd *));
extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *,
bfd_print_symbol_type how));
CONST char **functionname_ptr,
unsigned int *line_ptr));
extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc));
-extern boolean bfd_coff_reloc16_relax_section PARAMS ((bfd *,
- asection *,
- struct bfd_link_info *,
- asymbol **));
+extern boolean bfd_coff_reloc16_relax_section
+ PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
bfd_byte *, boolean relocateable, asymbol **));
extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *,
struct bfd_link_info *,
asection *));
-extern void bfd_perform_slip PARAMS ((asymbol **s, unsigned int slip,
+extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip,
asection *input_section,
- bfd_vma value));
+ bfd_vma val));
/* And more taken from the source .. */
-typedef struct coff_ptr_struct
+typedef struct coff_ptr_struct
{
/* Remembers the offset from the first symbol in the file for
/* Have the line numbers been relocated yet ? */
boolean done_lineno;
} coff_symbol_type;
-typedef struct
+typedef struct
{
void (*_bfd_coff_swap_aux_in) PARAMS ((
bfd *abfd,
unsigned int *src_ptr,
unsigned int *dst_ptr));
int (*_bfd_coff_reloc16_estimate) PARAMS ((
+ bfd *abfd,
asection *input_section,
- asymbol **symbols,
arelent *r,
unsigned int shrink,
struct bfd_link_info *link_info));
((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
-#define bfd_coff_reloc16_estimate(abfd, section, symbols, reloc, shrink, link_info)\
+#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
- (section, symbols, reloc, shrink, link_info))
-
+ (abfd, section, reloc, shrink, link_info))
+
/* Generic ECOFF BFD backend vectors. */
extern asymbol *ecoff_make_empty_symbol PARAMS ((bfd *abfd));
-extern unsigned int ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
-extern unsigned int ecoff_get_symtab PARAMS ((bfd *abfd,
- asymbol **alocation));
+extern long ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
+extern long ecoff_get_symtab PARAMS ((bfd *abfd, asymbol **alocation));
extern void ecoff_get_symbol_info PARAMS ((bfd *abfd,
asymbol *symbol,
symbol_info *ret));
extern void ecoff_print_symbol PARAMS ((bfd *abfd, PTR filep,
asymbol *symbol,
bfd_print_symbol_type how));
-extern unsigned int ecoff_canonicalize_reloc PARAMS ((bfd *abfd,
- asection *section,
- arelent **relptr,
- asymbol **symbols));
+extern long ecoff_canonicalize_reloc PARAMS ((bfd *abfd,
+ asection *section,
+ arelent **relptr,
+ asymbol **symbols));
extern boolean ecoff_find_nearest_line PARAMS ((bfd *abfd,
asection *section,
asymbol **symbols,
file_ptr,
bfd_size_type));
-extern unsigned int bfd_elf32_get_symtab_upper_bound PARAMS ((bfd *));
-extern unsigned int bfd_elf32_get_symtab PARAMS ((bfd *, asymbol **));
-extern unsigned int bfd_elf32_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
-extern unsigned int bfd_elf32_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
- arelent **,
- asymbol **));
+extern long bfd_elf32_get_symtab_upper_bound PARAMS ((bfd *));
+extern long bfd_elf32_get_symtab PARAMS ((bfd *, asymbol **));
+extern long bfd_elf32_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
+extern long bfd_elf32_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
+ arelent **, asymbol **));
extern asymbol *bfd_elf32_make_empty_symbol PARAMS ((bfd *));
extern void bfd_elf32_print_symbol PARAMS ((bfd *, PTR, asymbol *,
bfd_print_symbol_type));
file_ptr,
bfd_size_type));
-extern unsigned int bfd_elf64_get_symtab_upper_bound PARAMS ((bfd *));
-extern unsigned int bfd_elf64_get_symtab PARAMS ((bfd *, asymbol **));
-extern unsigned int bfd_elf64_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
-extern unsigned int bfd_elf64_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
- arelent **,
- asymbol **));
+extern long bfd_elf64_get_symtab_upper_bound PARAMS ((bfd *));
+extern long bfd_elf64_get_symtab PARAMS ((bfd *, asymbol **));
+extern long bfd_elf64_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
+extern long bfd_elf64_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
+ arelent **, asymbol **));
extern asymbol *bfd_elf64_make_empty_symbol PARAMS ((bfd *));
extern void bfd_elf64_print_symbol PARAMS ((bfd *, PTR, asymbol *,
bfd_print_symbol_type));
extern void nlmNAME(get_symbol_info)
PARAMS ((bfd *, asymbol *, symbol_info *));
-extern unsigned int nlmNAME(get_symtab_upper_bound)
+extern long nlmNAME(get_symtab_upper_bound)
PARAMS ((bfd *));
-extern unsigned int nlmNAME(get_symtab)
+extern long nlmNAME(get_symtab)
PARAMS ((bfd *, asymbol **));
extern asymbol *nlmNAME(make_empty_symbol)
PARAMS ((bfd *));
extern void nlmNAME(print_symbol)
PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
-extern unsigned int nlmNAME(get_reloc_upper_bound)
+extern long nlmNAME(get_reloc_upper_bound)
PARAMS ((bfd *, asection *));
-extern unsigned int nlmNAME(canonicalize_reloc)
+extern long nlmNAME(canonicalize_reloc)
PARAMS ((bfd *, asection *, arelent **, asymbol **));
extern bfd_target *nlmNAME(object_p)
PARAMS ((bfd *));
/* Caches for data read from object file. */
arelent * nlm_reloc_fixups;
asection ** nlm_reloc_fixup_secs;
+ /* Backend specific information. This should probably be a pointer,
+ but that would require yet another entry point to initialize the
+ structure. */
+ union
+ {
+ struct /* Alpha backend information. */
+ {
+ bfd_vma gp; /* GP value. */
+ bfd_vma lita_address; /* .lita section address. */
+ bfd_size_type lita_size; /* .lita section size. */
+ }
+ alpha_backend_data;
+ }
+ backend_data;
};
#define nlm_tdata(bfd) ((bfd) -> tdata.nlm_obj_data)
#define nlm_relocation_fixups(bfd) (nlm_tdata(bfd) -> nlm_reloc_fixups)
#define nlm_relocation_fixup_secs(bfd) (nlm_tdata(bfd)->nlm_reloc_fixup_secs)
+#define nlm_alpha_backend_data(bfd) \
+ (&nlm_tdata (bfd)->backend_data.alpha_backend_data)
+
/* This is used when writing out the external relocs. */
struct reloc_and_sec
enum bfd_architecture arch;
/* Machine. */
long mach;
+ /* Some NLM formats do not use the uninitialized data section, so
+ all uninitialized data must be put into the regular data section
+ instead. */
+ boolean no_uninitialized_data;
/* Some NLM formats have a prefix on the file. If this function is
not NULL, it will be called by nlm_object_p. It should return
true if this file could match this format, and it should leave
boolean (*nlm_write_external) PARAMS ((bfd *, bfd_size_type,
asymbol *,
struct reloc_and_sec *));
+ boolean (*nlm_write_export) PARAMS ((bfd *, asymbol *, bfd_vma));
};
#define nlm_backend(bfd) \
((struct nlm_backend_data *)((bfd) -> xvec -> backend_data))
#define nlm_signature(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> signature : "")
+ (nlm_backend(bfd) -> signature)
#define nlm_fixed_header_size(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> fixed_header_size : 0)
+ (nlm_backend(bfd) -> fixed_header_size)
#define nlm_optional_prefix_size(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> optional_prefix_size : 0)
+ (nlm_backend(bfd) -> optional_prefix_size)
#define nlm_architecture(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> arch : bfd_arch_unknown)
+ (nlm_backend(bfd) -> arch)
#define nlm_machine(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> mach : 0)
+ (nlm_backend(bfd) -> mach)
+#define nlm_no_uninitialized_data(bfd) \
+ (nlm_backend(bfd) -> no_uninitialized_data)
#define nlm_backend_object_p_func(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_backend_object_p : 0)
+ (nlm_backend(bfd) -> nlm_backend_object_p)
#define nlm_write_prefix_func(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_write_prefix : 0)
+ (nlm_backend(bfd) -> nlm_write_prefix)
#define nlm_read_reloc_func(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_read_reloc : 0)
+ (nlm_backend(bfd) -> nlm_read_reloc)
#define nlm_mangle_relocs_func(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_mangle_relocs : 0)
+ (nlm_backend(bfd) -> nlm_mangle_relocs)
#define nlm_read_import_func(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_read_import : 0)
+ (nlm_backend(bfd) -> nlm_read_import)
#define nlm_write_import_func(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_write_import : 0)
+ (nlm_backend(bfd) -> nlm_write_import)
#define nlm_set_public_section_func(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_set_public_section : 0)
+ (nlm_backend(bfd) -> nlm_set_public_section)
#define nlm_get_public_offset_func(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_get_public_offset : 0)
+ (nlm_backend(bfd) -> nlm_get_public_offset)
#define nlm_swap_fixed_header_in_func(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_swap_fhdr_in : 0)
+ (nlm_backend(bfd) -> nlm_swap_fhdr_in)
#define nlm_swap_fixed_header_out_func(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_swap_fhdr_out : 0)
+ (nlm_backend(bfd) -> nlm_swap_fhdr_out)
#define nlm_write_external_func(bfd) \
- (nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_write_external : 0)
+ (nlm_backend(bfd) -> nlm_write_external)
+#define nlm_write_export_func(bfd) \
+ (nlm_backend(bfd) -> nlm_write_export)
/* The NLM code, data, and uninitialized sections have no names defined
in the NLM, but bfd wants to give them names, so use the traditional
#define MY_write_object_contents MY(write_object_contents)
static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
-#define MY_reloc_howto_type_lookup MY(reloc_howto_type_lookup)
-#define MY_canonicalize_reloc MY(canonicalize_reloc)
+/* We can't use MY(x) here because it leads to a recursive call to CAT
+ when expanded inside JUMP_TABLE. */
+#define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup
+#define MY_canonicalize_reloc mipsbsd_canonicalize_reloc
+
+#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
+#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define MY_bfd_final_link _bfd_generic_final_link
#define MY_backend_data &MY(backend_data)
#define MY_BFD_TARGET
* 0x10000 and continue normally. This will compensate for the sign extension
* when the low bits are added at run time.
*/
-bfd_reloc_status_type
-mips_fix_hi16_s (abfd,reloc_entry,symbol,data,input_section,output_bfd)
+static bfd_reloc_status_type
+mips_fix_hi16_s PARAMS ((bfd *, arelent *, asymbol *, PTR,
+ asection *, bfd *, char **));
+
+static bfd_reloc_status_type
+mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
bfd *abfd;
arelent *reloc_entry;
- struct symbol_cache_entry *symbol;
+ asymbol *symbol;
PTR data;
asection *input_section;
bfd *output_bfd;
+ char **error_message;
{
bfd_vma relocation;
}
static reloc_howto_type mips_howto_table_ext[] = {
- {MIPS_RELOC_32, 0, 2, 32, false, 0, true, true, 0,
+ {MIPS_RELOC_32, 0, 2, 32, false, 0, complain_overflow_bitfield, 0,
"32", false, 0, 0xffffffff, false},
- {MIPS_RELOC_JMP, 2, 2, 26, false, 0, false, true, 0,
+ {MIPS_RELOC_JMP, 2, 2, 26, false, 0, complain_overflow_bitfield, 0,
"MIPS_JMP", false, 0, 0x03ffffff, false},
- {MIPS_RELOC_WDISP16, 2, 1, 16, true, 0, false, true, 0,
+ {MIPS_RELOC_WDISP16, 2, 1, 16, true, 0, complain_overflow_signed, 0,
"WDISP16", false, 0, 0x0000ffff, false},
- {MIPS_RELOC_HI16, 16, 1, 16, false, 0, false, true, 0,
+ {MIPS_RELOC_HI16, 16, 1, 16, false, 0, complain_overflow_bitfield, 0,
"HI16", false, 0, 0x0000ffff, false},
- {MIPS_RELOC_HI16_S, 16, 1, 16, false, 0, false, true, mips_fix_hi16_s,
- "HI16_S", false, 0, 0x0000ffff, false},
- {MIPS_RELOC_LO16, 0, 1, 16, false, 0, false, true, 0,
+ {MIPS_RELOC_HI16_S, 16, 1, 16, false, 0, complain_overflow_bitfield,
+ mips_fix_hi16_s,
+ "HI16_S", false, 0, 0x0000ffff, false},
+ {MIPS_RELOC_LO16, 0, 1, 16, false, 0, complain_overflow_dont, 0,
"LO16", false, 0, 0x0000ffff, false},
};
-static reloc_howto_type *
+static const reloc_howto_type *
MY(reloc_howto_type_lookup) (abfd, code)
bfd *abfd;
bfd_reloc_code_real_type code;
* This is just like the standard aoutx.h version but we need to do our
* own mapping of external reloc type values to howto entries.
*/
-unsigned int
+long
MY(canonicalize_reloc)(abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
}
if (!NAME(aout,slurp_reloc_table)(abfd, section, symbols))
- return 0;
+ return -1;
tblptr = section->relocation;
if (!tblptr)
- return 0;
+ return -1;
/* fix up howto entries */
for (count = 0; count++ < section->reloc_count;)
bfd_target aout_mips_little_vec =
{
- "aout-mips-little", /* name */
+ "a.out-mips-little", /* name */
bfd_target_aout_flavour,
false, /* target byte order (little) */
false, /* target headers byte order (little) */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
+ HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
MY_symbol_leading_char,
' ', /* ar_pad_char */
15, /* ar_max_namelen */
1, /* minimum alignment */
- _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */
- _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
bfd_generic_archive_p, MY_core_file_p},
{bfd_false, MY_mkobject, /* bfd_set_format */
_bfd_generic_mkarchive, bfd_false},
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
-
- MY_core_file_failing_command,
- MY_core_file_failing_signal,
- MY_core_file_matches_executable_p,
- MY_slurp_armap,
- MY_slurp_extended_name_table,
- MY_truncate_arname,
- MY_write_armap,
- MY_close_and_cleanup,
- MY_set_section_contents,
- MY_get_section_contents,
- MY_new_section_hook,
- MY_get_symtab_upper_bound,
- MY_get_symtab,
- MY_get_reloc_upper_bound,
- MY_canonicalize_reloc,
- MY_make_empty_symbol,
- MY_print_symbol,
- MY_get_lineno,
- MY_set_arch_mach,
- MY_openr_next_archived_file,
- MY_find_nearest_line,
- MY_generic_stat_arch_elt,
- MY_sizeof_headers,
- MY_bfd_debug_info_start,
- MY_bfd_debug_info_end,
- MY_bfd_debug_info_accumulate,
- bfd_generic_get_relocated_section_contents,
- bfd_generic_relax_section,
- bfd_generic_seclet_link,
- MY_reloc_howto_type_lookup,
- MY_make_debug_symbol,
+ JUMP_TABLE (MY),
(PTR) MY_backend_data,
};
bfd_target aout_mips_big_vec =
{
- "aout-mips-big", /* name */
+ "a.out-mips-big", /* name */
bfd_target_aout_flavour,
true, /* target byte order (big) */
true, /* target headers byte order (big) */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
+ HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
MY_symbol_leading_char,
' ', /* ar_pad_char */
15, /* ar_max_namelen */
1, /* minimum alignment */
- _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
- _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
+ bfd_getb64, bfd_getb_signed_64, bfd_putb64,
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
+ bfd_getb64, bfd_getb_signed_64, bfd_putb64,
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
bfd_generic_archive_p, MY_core_file_p},
{bfd_false, MY_mkobject, /* bfd_set_format */
_bfd_generic_mkarchive, bfd_false},
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
-
- MY_core_file_failing_command,
- MY_core_file_failing_signal,
- MY_core_file_matches_executable_p,
- MY_slurp_armap,
- MY_slurp_extended_name_table,
- MY_truncate_arname,
- MY_write_armap,
- MY_close_and_cleanup,
- MY_set_section_contents,
- MY_get_section_contents,
- MY_new_section_hook,
- MY_get_symtab_upper_bound,
- MY_get_symtab,
- MY_get_reloc_upper_bound,
- MY_canonicalize_reloc,
- MY_make_empty_symbol,
- MY_print_symbol,
- MY_get_lineno,
- MY_set_arch_mach,
- MY_openr_next_archived_file,
- MY_find_nearest_line,
- MY_generic_stat_arch_elt,
- MY_sizeof_headers,
- MY_bfd_debug_info_start,
- MY_bfd_debug_info_end,
- MY_bfd_debug_info_accumulate,
- bfd_generic_get_relocated_section_contents,
- bfd_generic_relax_section,
- bfd_generic_seclet_link,
- MY_reloc_howto_type_lookup,
- MY_make_debug_symbol,
+ JUMP_TABLE (MY),
(PTR) MY_backend_data,
};
asection **secp;
arelent *rel;
{
- bfd_byte temp[4];
bfd_vma val, addend;
- const char *name;
int index;
unsigned int type;
struct nlm32_sparc_reloc_ext tmp_reloc;
#endif
bfd_target *
-DEFUN (nlm_object_p, (abfd), bfd * abfd)
+nlm_object_p (abfd)
+ bfd *abfd;
{
struct nlm_obj_tdata *preserved_tdata = nlm_tdata (abfd);
boolean (*backend_object_p) PARAMS ((bfd *));
backend_object_p = nlm_backend_object_p_func (abfd);
if (backend_object_p)
{
- if (! (*backend_object_p) (abfd))
+ if (!(*backend_object_p) (abfd))
goto got_wrong_format_error;
}
if (!nlm_swap_variable_header_in (abfd)
|| !nlm_swap_auxiliary_headers_in (abfd)
|| !add_bfd_section (abfd, NLM_CODE_NAME,
- i_fxdhdrp -> codeImageOffset,
- i_fxdhdrp -> codeImageSize,
- (SEC_CODE | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_RELOC))
+ i_fxdhdrp->codeImageOffset,
+ i_fxdhdrp->codeImageSize,
+ (SEC_CODE | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_RELOC))
|| !add_bfd_section (abfd, NLM_INITIALIZED_DATA_NAME,
- i_fxdhdrp -> dataImageOffset,
- i_fxdhdrp -> dataImageSize,
- (SEC_DATA | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_RELOC))
+ i_fxdhdrp->dataImageOffset,
+ i_fxdhdrp->dataImageSize,
+ (SEC_DATA | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_RELOC))
|| !add_bfd_section (abfd, NLM_UNINITIALIZED_DATA_NAME,
(file_ptr) 0,
- i_fxdhdrp -> uninitializedDataSize,
+ i_fxdhdrp->uninitializedDataSize,
SEC_ALLOC))
goto got_wrong_format_error;
if (x_fxdhdr != NULL)
free (x_fxdhdr);
- return (abfd -> xvec);
+ return (abfd->xvec);
- got_wrong_format_error:
+got_wrong_format_error:
bfd_set_error (bfd_error_wrong_format);
- got_no_match:
+got_no_match:
nlm_tdata (abfd) = preserved_tdata;
if (x_fxdhdr != NULL)
free (x_fxdhdr);
/* Add a section to the bfd. */
static boolean
-DEFUN (add_bfd_section, (abfd, name, offset, size, flags),
- bfd *abfd AND
- char *name AND
- file_ptr offset AND
- bfd_size_type size AND
- flagword flags)
+add_bfd_section (abfd, name, offset, size, flags)
+ bfd *abfd;
+ char *name;
+ file_ptr offset;
+ bfd_size_type size;
+ flagword flags;
{
asection *newsect;
{
return (false);
}
- newsect -> vma = 0; /* NLM's are relocatable. */
- newsect -> _raw_size = size;
- newsect -> filepos = offset;
- newsect -> flags = flags;
- newsect -> alignment_power = bfd_log2 (0); /* FIXME */
+ newsect->vma = 0; /* NLM's are relocatable. */
+ newsect->_raw_size = size;
+ newsect->filepos = offset;
+ newsect->flags = flags;
+ newsect->alignment_power = bfd_log2 (0); /* FIXME */
return (true);
}
exist in the NLM, and must exist in the order they are read here. */
static boolean
-DEFUN (nlm_swap_variable_header_in, (abfd),
- bfd * abfd)
+nlm_swap_variable_header_in (abfd)
+ bfd *abfd;
{
- unsigned char temp [NLM_TARGET_LONG_SIZE];
+ unsigned char temp[NLM_TARGET_LONG_SIZE];
/* Read the description length and text members. */
- if (bfd_read ((PTR) &nlm_variable_header (abfd) -> descriptionLength,
- sizeof (nlm_variable_header (abfd) -> descriptionLength),
+ if (bfd_read ((PTR) & nlm_variable_header (abfd)->descriptionLength,
+ sizeof (nlm_variable_header (abfd)->descriptionLength),
1, abfd) !=
- sizeof (nlm_variable_header (abfd) -> descriptionLength))
+ sizeof (nlm_variable_header (abfd)->descriptionLength))
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- if (bfd_read ((PTR) nlm_variable_header (abfd) -> descriptionText,
- nlm_variable_header (abfd) -> descriptionLength + 1,
+ if (bfd_read ((PTR) nlm_variable_header (abfd)->descriptionText,
+ nlm_variable_header (abfd)->descriptionLength + 1,
1, abfd) !=
- nlm_variable_header (abfd) -> descriptionLength + 1)
+ nlm_variable_header (abfd)->descriptionLength + 1)
{
bfd_set_error (bfd_error_system_call);
return (false);
bfd_set_error (bfd_error_system_call);
return (false);
}
- nlm_variable_header (abfd) -> stackSize = get_word (abfd, (bfd_byte *) temp);
+ nlm_variable_header (abfd)->stackSize = get_word (abfd, (bfd_byte *) temp);
/* Read and convert the reserved field. */
bfd_set_error (bfd_error_system_call);
return (false);
}
- nlm_variable_header (abfd) -> reserved = get_word (abfd, (bfd_byte *) temp);
+ nlm_variable_header (abfd)->reserved = get_word (abfd, (bfd_byte *) temp);
/* Read the oldThreadName field. This field is a fixed length string. */
- if (bfd_read ((PTR) nlm_variable_header (abfd) -> oldThreadName,
- sizeof (nlm_variable_header (abfd) -> oldThreadName),
+ if (bfd_read ((PTR) nlm_variable_header (abfd)->oldThreadName,
+ sizeof (nlm_variable_header (abfd)->oldThreadName),
1, abfd) !=
- sizeof (nlm_variable_header (abfd) -> oldThreadName))
+ sizeof (nlm_variable_header (abfd)->oldThreadName))
{
bfd_set_error (bfd_error_system_call);
return (false);
/* Read the screen name length and text members. */
- if (bfd_read ((PTR) &nlm_variable_header (abfd) -> screenNameLength,
- sizeof (nlm_variable_header (abfd) -> screenNameLength),
+ if (bfd_read ((PTR) & nlm_variable_header (abfd)->screenNameLength,
+ sizeof (nlm_variable_header (abfd)->screenNameLength),
1, abfd) !=
- sizeof (nlm_variable_header (abfd) -> screenNameLength))
+ sizeof (nlm_variable_header (abfd)->screenNameLength))
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- if (bfd_read ((PTR) nlm_variable_header (abfd) -> screenName,
- nlm_variable_header (abfd) -> screenNameLength + 1,
+ if (bfd_read ((PTR) nlm_variable_header (abfd)->screenName,
+ nlm_variable_header (abfd)->screenNameLength + 1,
1, abfd) !=
- nlm_variable_header (abfd) -> screenNameLength + 1)
+ nlm_variable_header (abfd)->screenNameLength + 1)
{
bfd_set_error (bfd_error_system_call);
return (false);
/* Read the thread name length and text members. */
- if (bfd_read ((PTR) &nlm_variable_header (abfd) -> threadNameLength,
- sizeof (nlm_variable_header (abfd) -> threadNameLength),
+ if (bfd_read ((PTR) & nlm_variable_header (abfd)->threadNameLength,
+ sizeof (nlm_variable_header (abfd)->threadNameLength),
1, abfd) !=
- sizeof (nlm_variable_header (abfd) -> threadNameLength))
+ sizeof (nlm_variable_header (abfd)->threadNameLength))
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- if (bfd_read ((PTR) nlm_variable_header (abfd) -> threadName,
- nlm_variable_header (abfd) -> threadNameLength + 1,
+ if (bfd_read ((PTR) nlm_variable_header (abfd)->threadName,
+ nlm_variable_header (abfd)->threadNameLength + 1,
1, abfd) !=
- nlm_variable_header (abfd) -> threadNameLength + 1)
+ nlm_variable_header (abfd)->threadNameLength + 1)
{
bfd_set_error (bfd_error_system_call);
return (false);
exist in the NLM, and must exist in this order. */
static boolean
-DEFUN (nlm_swap_variable_header_out, (abfd),
- bfd * abfd)
+nlm_swap_variable_header_out (abfd)
+ bfd *abfd;
{
- unsigned char temp [NLM_TARGET_LONG_SIZE];
+ unsigned char temp[NLM_TARGET_LONG_SIZE];
/* Write the description length and text members. */
- if (bfd_write ((PTR) &nlm_variable_header (abfd) -> descriptionLength,
- sizeof (nlm_variable_header (abfd) -> descriptionLength),
+ if (bfd_write ((PTR) & nlm_variable_header (abfd)->descriptionLength,
+ sizeof (nlm_variable_header (abfd)->descriptionLength),
1, abfd) !=
- sizeof (nlm_variable_header (abfd) -> descriptionLength))
+ sizeof (nlm_variable_header (abfd)->descriptionLength))
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- if (bfd_write ((PTR) nlm_variable_header (abfd) -> descriptionText,
- nlm_variable_header (abfd) -> descriptionLength + 1,
+ if (bfd_write ((PTR) nlm_variable_header (abfd)->descriptionText,
+ nlm_variable_header (abfd)->descriptionLength + 1,
1, abfd) !=
- nlm_variable_header (abfd) -> descriptionLength + 1)
+ nlm_variable_header (abfd)->descriptionLength + 1)
{
bfd_set_error (bfd_error_system_call);
return (false);
/* Convert and write the stackSize field. */
- put_word (abfd, (bfd_vma) nlm_variable_header (abfd) -> stackSize,
+ put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->stackSize,
(bfd_byte *) temp);
if (bfd_write ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp))
{
/* Convert and write the reserved field. */
- put_word (abfd, (bfd_vma) nlm_variable_header (abfd) -> reserved,
+ put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->reserved,
(bfd_byte *) temp);
if (bfd_write ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp))
{
/* Write the oldThreadName field. This field is a fixed length string. */
- if (bfd_write ((PTR) nlm_variable_header (abfd) -> oldThreadName,
- sizeof (nlm_variable_header (abfd) -> oldThreadName),
+ if (bfd_write ((PTR) nlm_variable_header (abfd)->oldThreadName,
+ sizeof (nlm_variable_header (abfd)->oldThreadName),
1, abfd) !=
- sizeof (nlm_variable_header (abfd) -> oldThreadName))
+ sizeof (nlm_variable_header (abfd)->oldThreadName))
{
bfd_set_error (bfd_error_system_call);
return (false);
/* Write the screen name length and text members. */
- if (bfd_write ((PTR) &nlm_variable_header (abfd) -> screenNameLength,
- sizeof (nlm_variable_header (abfd) -> screenNameLength),
+ if (bfd_write ((PTR) & nlm_variable_header (abfd)->screenNameLength,
+ sizeof (nlm_variable_header (abfd)->screenNameLength),
1, abfd) !=
- sizeof (nlm_variable_header (abfd) -> screenNameLength))
+ sizeof (nlm_variable_header (abfd)->screenNameLength))
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- if (bfd_write ((PTR) nlm_variable_header (abfd) -> screenName,
- nlm_variable_header (abfd) -> screenNameLength + 1,
+ if (bfd_write ((PTR) nlm_variable_header (abfd)->screenName,
+ nlm_variable_header (abfd)->screenNameLength + 1,
1, abfd) !=
- nlm_variable_header (abfd) -> screenNameLength + 1)
+ nlm_variable_header (abfd)->screenNameLength + 1)
{
bfd_set_error (bfd_error_system_call);
return (false);
/* Write the thread name length and text members. */
- if (bfd_write ((PTR) &nlm_variable_header (abfd) -> threadNameLength,
- sizeof (nlm_variable_header (abfd) -> threadNameLength),
+ if (bfd_write ((PTR) & nlm_variable_header (abfd)->threadNameLength,
+ sizeof (nlm_variable_header (abfd)->threadNameLength),
1, abfd) !=
- sizeof (nlm_variable_header (abfd) -> threadNameLength))
+ sizeof (nlm_variable_header (abfd)->threadNameLength))
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- if (bfd_write ((PTR) nlm_variable_header (abfd) -> threadName,
- nlm_variable_header (abfd) -> threadNameLength + 1,
+ if (bfd_write ((PTR) nlm_variable_header (abfd)->threadName,
+ nlm_variable_header (abfd)->threadNameLength + 1,
1, abfd) !=
- nlm_variable_header (abfd) -> threadNameLength + 1)
+ nlm_variable_header (abfd)->threadNameLength + 1)
{
bfd_set_error (bfd_error_system_call);
return (false);
recognize it. */
static boolean
-DEFUN (nlm_swap_auxiliary_headers_in, (abfd),
- bfd * abfd)
+nlm_swap_auxiliary_headers_in (abfd)
+ bfd *abfd;
{
- char tempstr [16];
+ char tempstr[16];
long position;
for (;;)
if (strncmp (tempstr, "VeRsIoN#", 8) == 0)
{
Nlm_External_Version_Header thdr;
- if (bfd_read ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
+ if (bfd_read ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- memcpy (nlm_version_header (abfd) -> stamp, thdr.stamp,
+ memcpy (nlm_version_header (abfd)->stamp, thdr.stamp,
sizeof (thdr.stamp));
- nlm_version_header (abfd) -> majorVersion =
+ nlm_version_header (abfd)->majorVersion =
get_word (abfd, (bfd_byte *) thdr.majorVersion);
- nlm_version_header (abfd) -> minorVersion =
+ nlm_version_header (abfd)->minorVersion =
get_word (abfd, (bfd_byte *) thdr.minorVersion);
- nlm_version_header (abfd) -> revision =
+ nlm_version_header (abfd)->revision =
get_word (abfd, (bfd_byte *) thdr.revision);
- nlm_version_header (abfd) -> year =
+ nlm_version_header (abfd)->year =
get_word (abfd, (bfd_byte *) thdr.year);
- nlm_version_header (abfd) -> month =
+ nlm_version_header (abfd)->month =
get_word (abfd, (bfd_byte *) thdr.month);
- nlm_version_header (abfd) -> day =
+ nlm_version_header (abfd)->day =
get_word (abfd, (bfd_byte *) thdr.day);
}
else if (strncmp (tempstr, "MeSsAgEs", 8) == 0)
{
Nlm_External_Extended_Header thdr;
- if (bfd_read ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
+ if (bfd_read ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- memcpy (nlm_extended_header (abfd) -> stamp, thdr.stamp,
+ memcpy (nlm_extended_header (abfd)->stamp, thdr.stamp,
sizeof (thdr.stamp));
- nlm_extended_header (abfd) -> languageID =
+ nlm_extended_header (abfd)->languageID =
get_word (abfd, (bfd_byte *) thdr.languageID);
- nlm_extended_header (abfd) -> messageFileOffset =
+ nlm_extended_header (abfd)->messageFileOffset =
get_word (abfd, (bfd_byte *) thdr.messageFileOffset);
- nlm_extended_header (abfd) -> messageFileLength =
+ nlm_extended_header (abfd)->messageFileLength =
get_word (abfd, (bfd_byte *) thdr.messageFileLength);
- nlm_extended_header (abfd) -> messageCount =
+ nlm_extended_header (abfd)->messageCount =
get_word (abfd, (bfd_byte *) thdr.messageCount);
- nlm_extended_header (abfd) -> helpFileOffset =
+ nlm_extended_header (abfd)->helpFileOffset =
get_word (abfd, (bfd_byte *) thdr.helpFileOffset);
- nlm_extended_header (abfd) -> helpFileLength =
+ nlm_extended_header (abfd)->helpFileLength =
get_word (abfd, (bfd_byte *) thdr.helpFileLength);
- nlm_extended_header (abfd) -> RPCDataOffset =
+ nlm_extended_header (abfd)->RPCDataOffset =
get_word (abfd, (bfd_byte *) thdr.RPCDataOffset);
- nlm_extended_header (abfd) -> RPCDataLength =
+ nlm_extended_header (abfd)->RPCDataLength =
get_word (abfd, (bfd_byte *) thdr.RPCDataLength);
- nlm_extended_header (abfd) -> sharedCodeOffset =
+ nlm_extended_header (abfd)->sharedCodeOffset =
get_word (abfd, (bfd_byte *) thdr.sharedCodeOffset);
- nlm_extended_header (abfd) -> sharedCodeLength =
+ nlm_extended_header (abfd)->sharedCodeLength =
get_word (abfd, (bfd_byte *) thdr.sharedCodeLength);
- nlm_extended_header (abfd) -> sharedDataOffset =
+ nlm_extended_header (abfd)->sharedDataOffset =
get_word (abfd, (bfd_byte *) thdr.sharedDataOffset);
- nlm_extended_header (abfd) -> sharedDataLength =
+ nlm_extended_header (abfd)->sharedDataLength =
get_word (abfd, (bfd_byte *) thdr.sharedDataLength);
- nlm_extended_header (abfd) -> sharedRelocationFixupOffset =
+ nlm_extended_header (abfd)->sharedRelocationFixupOffset =
get_word (abfd, (bfd_byte *) thdr.sharedRelocationFixupOffset);
- nlm_extended_header (abfd) -> sharedRelocationFixupCount =
+ nlm_extended_header (abfd)->sharedRelocationFixupCount =
get_word (abfd, (bfd_byte *) thdr.sharedRelocationFixupCount);
- nlm_extended_header (abfd) -> sharedExternalReferenceOffset =
+ nlm_extended_header (abfd)->sharedExternalReferenceOffset =
get_word (abfd, (bfd_byte *) thdr.sharedExternalReferenceOffset);
- nlm_extended_header (abfd) -> sharedExternalReferenceCount =
+ nlm_extended_header (abfd)->sharedExternalReferenceCount =
get_word (abfd, (bfd_byte *) thdr.sharedExternalReferenceCount);
- nlm_extended_header (abfd) -> sharedPublicsOffset =
+ nlm_extended_header (abfd)->sharedPublicsOffset =
get_word (abfd, (bfd_byte *) thdr.sharedPublicsOffset);
- nlm_extended_header (abfd) -> sharedPublicsCount =
+ nlm_extended_header (abfd)->sharedPublicsCount =
get_word (abfd, (bfd_byte *) thdr.sharedPublicsCount);
- nlm_extended_header (abfd) -> sharedDebugRecordOffset =
+ nlm_extended_header (abfd)->sharedDebugRecordOffset =
get_word (abfd, (bfd_byte *) thdr.sharedDebugRecordOffset);
- nlm_extended_header (abfd) -> sharedDebugRecordCount =
+ nlm_extended_header (abfd)->sharedDebugRecordCount =
get_word (abfd, (bfd_byte *) thdr.sharedDebugRecordCount);
- nlm_extended_header (abfd) -> SharedInitializationOffset =
+ nlm_extended_header (abfd)->SharedInitializationOffset =
get_word (abfd, (bfd_byte *) thdr.sharedInitializationOffset);
- nlm_extended_header (abfd) -> SharedExitProcedureOffset =
+ nlm_extended_header (abfd)->SharedExitProcedureOffset =
get_word (abfd, (bfd_byte *) thdr.SharedExitProcedureOffset);
- nlm_extended_header (abfd) -> productID =
+ nlm_extended_header (abfd)->productID =
get_word (abfd, (bfd_byte *) thdr.productID);
- nlm_extended_header (abfd) -> reserved0 =
+ nlm_extended_header (abfd)->reserved0 =
get_word (abfd, (bfd_byte *) thdr.reserved0);
- nlm_extended_header (abfd) -> reserved1 =
+ nlm_extended_header (abfd)->reserved1 =
get_word (abfd, (bfd_byte *) thdr.reserved1);
- nlm_extended_header (abfd) -> reserved2 =
+ nlm_extended_header (abfd)->reserved2 =
get_word (abfd, (bfd_byte *) thdr.reserved2);
- nlm_extended_header (abfd) -> reserved3 =
+ nlm_extended_header (abfd)->reserved3 =
get_word (abfd, (bfd_byte *) thdr.reserved3);
- nlm_extended_header (abfd) -> reserved4 =
+ nlm_extended_header (abfd)->reserved4 =
get_word (abfd, (bfd_byte *) thdr.reserved4);
- nlm_extended_header (abfd) -> reserved5 =
+ nlm_extended_header (abfd)->reserved5 =
get_word (abfd, (bfd_byte *) thdr.reserved5);
}
else if (strncmp (tempstr, "CuStHeAd", 8) == 0)
{
Nlm_External_Custom_Header thdr;
- if (bfd_read ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
+ if (bfd_read ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- memcpy (nlm_custom_header (abfd) -> stamp, thdr.stamp,
+ memcpy (nlm_custom_header (abfd)->stamp, thdr.stamp,
sizeof (thdr.stamp));
- nlm_custom_header (abfd) -> dataLength =
+ nlm_custom_header (abfd)->dataLength =
get_word (abfd, (bfd_byte *) thdr.dataLength);
- nlm_custom_header (abfd) -> debugRecOffset =
+ nlm_custom_header (abfd)->debugRecOffset =
get_word (abfd, (bfd_byte *) thdr.debugRecOffset);
- nlm_custom_header (abfd) -> debugRecLength =
+ nlm_custom_header (abfd)->debugRecLength =
get_word (abfd, (bfd_byte *) thdr.debugRecLength);
}
else if (strncmp (tempstr, "CoPyRiGhT=", 10) == 0)
bfd_set_error (bfd_error_system_call);
return (false);
}
- if (bfd_read ((PTR) &(nlm_copyright_header (abfd)
- ->copyrightMessageLength),
+ if (bfd_read ((PTR) & (nlm_copyright_header (abfd)
+ ->copyrightMessageLength),
1, 1, abfd) != 1)
{
bfd_set_error (bfd_error_system_call);
return (false);
}
/* The copyright message is a variable length string. */
- if (bfd_read ((PTR) nlm_copyright_header (abfd) -> copyrightMessage,
- nlm_copyright_header (abfd) -> copyrightMessageLength + 1,
+ if (bfd_read ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
+ nlm_copyright_header (abfd)->copyrightMessageLength + 1,
1, abfd) !=
- nlm_copyright_header (abfd) -> copyrightMessageLength + 1)
+ nlm_copyright_header (abfd)->copyrightMessageLength + 1)
{
bfd_set_error (bfd_error_system_call);
return (false);
Nlm_External_Version_Header thdr;
memcpy (thdr.stamp, "VeRsIoN#", 8);
- put_word (abfd, (bfd_vma) nlm_version_header (abfd) -> majorVersion,
+ put_word (abfd, (bfd_vma) nlm_version_header (abfd)->majorVersion,
(bfd_byte *) thdr.majorVersion);
- put_word (abfd, (bfd_vma) nlm_version_header (abfd) -> minorVersion,
+ put_word (abfd, (bfd_vma) nlm_version_header (abfd)->minorVersion,
(bfd_byte *) thdr.minorVersion);
- put_word (abfd, (bfd_vma) nlm_version_header (abfd) -> revision,
+ put_word (abfd, (bfd_vma) nlm_version_header (abfd)->revision,
(bfd_byte *) thdr.revision);
- put_word (abfd, (bfd_vma) nlm_version_header (abfd) -> year,
+ put_word (abfd, (bfd_vma) nlm_version_header (abfd)->year,
(bfd_byte *) thdr.year);
- put_word (abfd, (bfd_vma) nlm_version_header (abfd) -> month,
+ put_word (abfd, (bfd_vma) nlm_version_header (abfd)->month,
(bfd_byte *) thdr.month);
- put_word (abfd, (bfd_vma) nlm_version_header (abfd) -> day,
+ put_word (abfd, (bfd_vma) nlm_version_header (abfd)->day,
(bfd_byte *) thdr.day);
- if (bfd_write ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
- {
- bfd_set_error (bfd_error_system_call);
- return false;
- }
+ if (bfd_write ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
+ {
+ bfd_set_error (bfd_error_system_call);
+ return false;
+ }
}
/* Write out the extended header if there is one. */
memcpy (thdr.stamp, "MeSsAgEs", 8);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> languageID,
+ (bfd_vma) nlm_extended_header (abfd)->languageID,
(bfd_byte *) thdr.languageID);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> messageFileOffset,
+ (bfd_vma) nlm_extended_header (abfd)->messageFileOffset,
(bfd_byte *) thdr.messageFileOffset);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> messageFileLength,
+ (bfd_vma) nlm_extended_header (abfd)->messageFileLength,
(bfd_byte *) thdr.messageFileLength);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> messageCount,
+ (bfd_vma) nlm_extended_header (abfd)->messageCount,
(bfd_byte *) thdr.messageCount);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> helpFileOffset,
+ (bfd_vma) nlm_extended_header (abfd)->helpFileOffset,
(bfd_byte *) thdr.helpFileOffset);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> helpFileLength,
+ (bfd_vma) nlm_extended_header (abfd)->helpFileLength,
(bfd_byte *) thdr.helpFileLength);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> RPCDataOffset,
+ (bfd_vma) nlm_extended_header (abfd)->RPCDataOffset,
(bfd_byte *) thdr.RPCDataOffset);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> RPCDataLength,
+ (bfd_vma) nlm_extended_header (abfd)->RPCDataLength,
(bfd_byte *) thdr.RPCDataLength);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedCodeOffset,
+ (bfd_vma) nlm_extended_header (abfd)->sharedCodeOffset,
(bfd_byte *) thdr.sharedCodeOffset);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedCodeLength,
+ (bfd_vma) nlm_extended_header (abfd)->sharedCodeLength,
(bfd_byte *) thdr.sharedCodeLength);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedDataOffset,
+ (bfd_vma) nlm_extended_header (abfd)->sharedDataOffset,
(bfd_byte *) thdr.sharedDataOffset);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedDataLength,
+ (bfd_vma) nlm_extended_header (abfd)->sharedDataLength,
(bfd_byte *) thdr.sharedDataLength);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedRelocationFixupOffset,
+ (bfd_vma) nlm_extended_header (abfd)->sharedRelocationFixupOffset,
(bfd_byte *) thdr.sharedRelocationFixupOffset);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedRelocationFixupCount,
+ (bfd_vma) nlm_extended_header (abfd)->sharedRelocationFixupCount,
(bfd_byte *) thdr.sharedRelocationFixupCount);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedExternalReferenceOffset,
+ (bfd_vma) nlm_extended_header (abfd)->sharedExternalReferenceOffset,
(bfd_byte *) thdr.sharedExternalReferenceOffset);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedExternalReferenceCount,
+ (bfd_vma) nlm_extended_header (abfd)->sharedExternalReferenceCount,
(bfd_byte *) thdr.sharedExternalReferenceCount);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedPublicsOffset,
+ (bfd_vma) nlm_extended_header (abfd)->sharedPublicsOffset,
(bfd_byte *) thdr.sharedPublicsOffset);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedPublicsCount,
+ (bfd_vma) nlm_extended_header (abfd)->sharedPublicsCount,
(bfd_byte *) thdr.sharedPublicsCount);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedDebugRecordOffset,
+ (bfd_vma) nlm_extended_header (abfd)->sharedDebugRecordOffset,
(bfd_byte *) thdr.sharedDebugRecordOffset);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> sharedDebugRecordCount,
+ (bfd_vma) nlm_extended_header (abfd)->sharedDebugRecordCount,
(bfd_byte *) thdr.sharedDebugRecordCount);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> SharedInitializationOffset,
+ (bfd_vma) nlm_extended_header (abfd)->SharedInitializationOffset,
(bfd_byte *) thdr.sharedInitializationOffset);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> SharedExitProcedureOffset,
+ (bfd_vma) nlm_extended_header (abfd)->SharedExitProcedureOffset,
(bfd_byte *) thdr.SharedExitProcedureOffset);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> productID,
+ (bfd_vma) nlm_extended_header (abfd)->productID,
(bfd_byte *) thdr.productID);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> reserved0,
+ (bfd_vma) nlm_extended_header (abfd)->reserved0,
(bfd_byte *) thdr.reserved0);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> reserved1,
+ (bfd_vma) nlm_extended_header (abfd)->reserved1,
(bfd_byte *) thdr.reserved1);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> reserved2,
+ (bfd_vma) nlm_extended_header (abfd)->reserved2,
(bfd_byte *) thdr.reserved2);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> reserved3,
+ (bfd_vma) nlm_extended_header (abfd)->reserved3,
(bfd_byte *) thdr.reserved3);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> reserved4,
+ (bfd_vma) nlm_extended_header (abfd)->reserved4,
(bfd_byte *) thdr.reserved4);
put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd) -> reserved5,
+ (bfd_vma) nlm_extended_header (abfd)->reserved5,
(bfd_byte *) thdr.reserved5);
- if (bfd_write ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
- {
- bfd_set_error (bfd_error_system_call);
- return false;
- }
+ if (bfd_write ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
+ {
+ bfd_set_error (bfd_error_system_call);
+ return false;
+ }
}
/* Write out the custom header if there is one. */
/* Right now we assume the custom header is always the suggested
format for alternate debugging records. */
- BFD_ASSERT (nlm_custom_header (abfd) -> dataLength == 8);
+ BFD_ASSERT (nlm_custom_header (abfd)->dataLength == 8);
memcpy (thdr.stamp, "CuStHeAd", 8);
- put_word (abfd, (bfd_vma) nlm_custom_header (abfd) -> dataLength,
+ put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->dataLength,
(bfd_byte *) thdr.dataLength);
- put_word (abfd, (bfd_vma) nlm_custom_header (abfd) -> debugRecOffset,
+ put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->debugRecOffset,
(bfd_byte *) thdr.debugRecOffset);
- put_word (abfd, (bfd_vma) nlm_custom_header (abfd) -> debugRecLength,
+ put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->debugRecLength,
(bfd_byte *) thdr.debugRecLength);
- if (bfd_write ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
- {
- bfd_set_error (bfd_error_system_call);
- return false;
- }
+ if (bfd_write ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
+ {
+ bfd_set_error (bfd_error_system_call);
+ return false;
+ }
}
/* Write out the copyright header if there is one. */
return false;
}
/* The copyright message is a variable length string. */
- if (bfd_write ((PTR) nlm_copyright_header (abfd) -> copyrightMessage,
- nlm_copyright_header (abfd) -> copyrightMessageLength + 1,
+ if (bfd_write ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
+ nlm_copyright_header (abfd)->copyrightMessageLength + 1,
1, abfd) !=
- nlm_copyright_header (abfd) -> copyrightMessageLength + 1)
+ nlm_copyright_header (abfd)->copyrightMessageLength + 1)
{
bfd_set_error (bfd_error_system_call);
return false;
the count plus 1, since we will NULL terminate the vector allocated based
on this size. */
-unsigned int
-DEFUN (nlm_get_symtab_upper_bound, (abfd), bfd * abfd)
+long
+nlm_get_symtab_upper_bound (abfd)
+ bfd *abfd;
{
Nlm_Internal_Fixed_Header *i_fxdhdrp; /* Nlm file header, internal form */
- unsigned int symcount;
- unsigned int symtab_size = 0;
+ long symcount;
+ long symtab_size = 0;
i_fxdhdrp = nlm_fixed_header (abfd);
- symcount = (i_fxdhdrp -> numberOfPublics
- + i_fxdhdrp -> numberOfDebugRecords
- + i_fxdhdrp -> numberOfExternalReferences);
+ symcount = (i_fxdhdrp->numberOfPublics
+ + i_fxdhdrp->numberOfDebugRecords
+ + i_fxdhdrp->numberOfExternalReferences);
symtab_size = (symcount + 1) * (sizeof (asymbol));
return (symtab_size);
}
/* Note that bfd_get_symcount is guaranteed to be zero if slurping the
symbol table fails. */
-unsigned int
+long
nlm_get_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
bfd_size_type counter = 0;
if (nlm_slurp_symbol_table (abfd) == false)
- return 0;
+ return -1;
symbase = nlm_get_symbols (abfd);
while (counter < bfd_get_symcount (abfd))
{
asymbol *
nlm_make_empty_symbol (abfd)
- bfd * abfd;
+ bfd *abfd;
{
nlm_symbol_type *new;
void
nlm_get_symbol_info (ignore_abfd, symbol, ret)
- bfd * ignore_abfd;
- asymbol * symbol;
- symbol_info * ret;
+ bfd *ignore_abfd;
+ asymbol *symbol;
+ symbol_info *ret;
{
bfd_symbol_info (symbol, ret);
}
case bfd_print_symbol_name:
case bfd_print_symbol_more:
if (symbol->name)
- fprintf (file,"%s", symbol->name);
+ fprintf (file, "%s", symbol->name);
break;
case bfd_print_symbol_all:
bfd_print_symbol_vandf ((PTR) file, symbol);
fprintf (file, " %-5s", symbol->section->name);
if (symbol->name)
- fprintf (file," %s", symbol->name);
+ fprintf (file, " %s", symbol->name);
break;
}
}
bfd *abfd;
{
Nlm_Internal_Fixed_Header *i_fxdhdrp; /* Nlm file header, internal form */
- bfd_size_type totsymcount; /* Number of NLM symbols */
- bfd_size_type symcount; /* Counter of NLM symbols */
- nlm_symbol_type *sym; /* Pointer to current bfd symbol */
- unsigned char symlength; /* Symbol length read into here */
- unsigned char symtype; /* Type of debugging symbol */
+ bfd_size_type totsymcount; /* Number of NLM symbols */
+ bfd_size_type symcount; /* Counter of NLM symbols */
+ nlm_symbol_type *sym; /* Pointer to current bfd symbol */
+ unsigned char symlength; /* Symbol length read into here */
+ unsigned char symtype; /* Type of debugging symbol */
bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Symbol offsets read into here */
boolean (*read_import_func) PARAMS ((bfd *, nlm_symbol_type *));
boolean (*set_public_section_func) PARAMS ((bfd *, nlm_symbol_type *));
use all the NLM symbols, so there will be no space left over at the end.
When we have all the symbols, we build the caller's pointer vector. */
- abfd -> symcount = 0;
+ abfd->symcount = 0;
i_fxdhdrp = nlm_fixed_header (abfd);
- totsymcount = (i_fxdhdrp -> numberOfPublics
- + i_fxdhdrp -> numberOfDebugRecords
- + i_fxdhdrp -> numberOfExternalReferences);
+ totsymcount = (i_fxdhdrp->numberOfPublics
+ + i_fxdhdrp->numberOfDebugRecords
+ + i_fxdhdrp->numberOfExternalReferences);
if (totsymcount == 0)
{
return (true);
}
- if (bfd_seek (abfd, i_fxdhdrp -> publicsOffset, SEEK_SET) == -1)
+ if (bfd_seek (abfd, i_fxdhdrp->publicsOffset, SEEK_SET) == -1)
{
bfd_set_error (bfd_error_system_call);
return (false);
were read. */
set_public_section_func = nlm_set_public_section_func (abfd);
- symcount = i_fxdhdrp -> numberOfPublics;
- while (abfd -> symcount < symcount)
+ symcount = i_fxdhdrp->numberOfPublics;
+ while (abfd->symcount < symcount)
{
- if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd)
+ if (bfd_read ((PTR) & symlength, sizeof (symlength), 1, abfd)
!= sizeof (symlength))
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- sym -> symbol.the_bfd = abfd;
- sym -> symbol.name = bfd_alloc (abfd, symlength + 1);
- if (!sym -> symbol.name)
+ sym->symbol.the_bfd = abfd;
+ sym->symbol.name = bfd_alloc (abfd, symlength + 1);
+ if (!sym->symbol.name)
{
bfd_set_error (bfd_error_no_memory);
return false;
}
- if (bfd_read ((PTR) sym -> symbol.name, symlength, 1, abfd)
+ if (bfd_read ((PTR) sym->symbol.name, symlength, 1, abfd)
!= symlength)
{
bfd_set_error (bfd_error_system_call);
return (false);
}
/* Cast away const. */
- ((char *) (sym -> symbol.name))[symlength] = '\0';
+ ((char *) (sym->symbol.name))[symlength] = '\0';
if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp))
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- sym -> symbol.flags = BSF_GLOBAL | BSF_EXPORT;
- sym -> symbol.value = get_word (abfd, temp);
+ sym->symbol.flags = BSF_GLOBAL | BSF_EXPORT;
+ sym->symbol.value = get_word (abfd, temp);
if (set_public_section_func)
{
/* Most backends can use the code below, but unfortunately
}
else
{
- if (sym -> symbol.value & NLM_HIBIT)
+ if (sym->symbol.value & NLM_HIBIT)
{
- sym -> symbol.value &= ~NLM_HIBIT;
- sym -> symbol.flags |= BSF_FUNCTION;
- sym -> symbol.section =
+ sym->symbol.value &= ~NLM_HIBIT;
+ sym->symbol.flags |= BSF_FUNCTION;
+ sym->symbol.section =
bfd_get_section_by_name (abfd, NLM_CODE_NAME);
}
else
{
- sym -> symbol.section =
+ sym->symbol.section =
bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
}
}
- sym -> rcnt = 0;
- abfd -> symcount++;
+ sym->rcnt = 0;
+ abfd->symcount++;
sym++;
}
/* Read the debugging records. */
- if (i_fxdhdrp -> numberOfDebugRecords > 0)
+ if (i_fxdhdrp->numberOfDebugRecords > 0)
{
- if (bfd_seek (abfd, i_fxdhdrp -> debugInfoOffset, SEEK_SET) == -1)
+ if (bfd_seek (abfd, i_fxdhdrp->debugInfoOffset, SEEK_SET) == -1)
{
bfd_set_error (bfd_error_system_call);
return (false);
}
- symcount += i_fxdhdrp -> numberOfDebugRecords;
- while (abfd -> symcount < symcount)
+ symcount += i_fxdhdrp->numberOfDebugRecords;
+ while (abfd->symcount < symcount)
{
- if ((bfd_read ((PTR) &symtype, sizeof (symtype), 1, abfd)
+ if ((bfd_read ((PTR) & symtype, sizeof (symtype), 1, abfd)
!= sizeof (symtype))
- || bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)
- || (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd)
+ || bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)
+ || (bfd_read ((PTR) & symlength, sizeof (symlength), 1, abfd)
!= sizeof (symlength)))
{
bfd_set_error (bfd_error_system_call);
return false;
}
- sym -> symbol.the_bfd = abfd;
- sym -> symbol.name = bfd_alloc (abfd, symlength + 1);
- if (!sym -> symbol.name)
+ sym->symbol.the_bfd = abfd;
+ sym->symbol.name = bfd_alloc (abfd, symlength + 1);
+ if (!sym->symbol.name)
{
bfd_set_error (bfd_error_no_memory);
return false;
}
- if (bfd_read ((PTR) sym -> symbol.name, symlength, 1, abfd)
+ if (bfd_read ((PTR) sym->symbol.name, symlength, 1, abfd)
!= symlength)
{
bfd_set_error (bfd_error_system_call);
return (false);
}
/* Cast away const. */
- ((char *) (sym -> symbol.name))[symlength] = '\0';
- sym -> symbol.flags = BSF_LOCAL;
- sym -> symbol.value = get_word (abfd, temp);
+ ((char *) (sym->symbol.name))[symlength] = '\0';
+ sym->symbol.flags = BSF_LOCAL;
+ sym->symbol.value = get_word (abfd, temp);
if (symtype == 0)
{
- sym -> symbol.section =
+ sym->symbol.section =
bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
}
else if (symtype == 1)
{
- sym -> symbol.flags |= BSF_FUNCTION;
- sym -> symbol.section =
+ sym->symbol.flags |= BSF_FUNCTION;
+ sym->symbol.section =
bfd_get_section_by_name (abfd, NLM_CODE_NAME);
}
else
{
- sym -> symbol.section = &bfd_abs_section;
+ sym->symbol.section = &bfd_abs_section;
}
- sym -> rcnt = 0;
- abfd -> symcount++;
+ sym->rcnt = 0;
+ abfd->symcount++;
sym++;
}
}
read_import_func = nlm_read_import_func (abfd);
if (read_import_func != NULL)
{
- if (bfd_seek (abfd, i_fxdhdrp -> externalReferencesOffset, SEEK_SET)
+ if (bfd_seek (abfd, i_fxdhdrp->externalReferencesOffset, SEEK_SET)
== -1)
{
bfd_set_error (bfd_error_system_call);
return (false);
}
-
- symcount += i_fxdhdrp -> numberOfExternalReferences;
- while (abfd -> symcount < symcount)
+
+ symcount += i_fxdhdrp->numberOfExternalReferences;
+ while (abfd->symcount < symcount)
{
if ((*read_import_func) (abfd, sym) == false)
return false;
since it does not attempt to distinguish them based on the section.
That will be handled when they are actually read. */
-unsigned int
+long
nlm_get_reloc_upper_bound (abfd, sec)
bfd *abfd;
asection *sec;
/* If we don't know how to read relocs, just return 0. */
if (nlm_read_reloc_func (abfd) == NULL)
- return 0;
+ return -1;
/* Make sure we have either the code or the data section. */
if ((bfd_get_section_flags (abfd, sec) & (SEC_CODE | SEC_DATA)) == 0)
return 0;
if (syms == NULL)
{
if (nlm_slurp_symbol_table (abfd) == false)
- return 0;
+ return -1;
syms = nlm_get_symbols (abfd);
}
/* Get the relocs themselves. */
-unsigned int
+long
nlm_canonicalize_reloc (abfd, sec, relptr, symbols)
bfd *abfd;
asection *sec;
if (rels == NULL)
{
if (nlm_slurp_reloc_fixups (abfd) == false)
- return 0;
+ return -1;
rels = nlm_relocation_fixups (abfd);
if (rels == NULL)
- return 0;
+ return -1;
}
secs = nlm_relocation_fixup_secs (abfd);
*relptr = NULL;
- return ret;
+ return ret;
}
\f
/* Compute the section file positions for an NLM file. All variable
bss_sec = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME);
if (bss_sec == NULL)
{
- if (! add_bfd_section (abfd, NLM_UNINITIALIZED_DATA_NAME,
- (file_ptr) 0, (bfd_size_type) 0,
- SEC_ALLOC))
+ if (!add_bfd_section (abfd, NLM_UNINITIALIZED_DATA_NAME,
+ (file_ptr) 0, (bfd_size_type) 0,
+ SEC_ALLOC))
return false;
bss_sec = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME);
}
/* The variable header. */
sofar += (sizeof (nlm_variable_header (abfd)->descriptionLength)
- + nlm_variable_header (abfd) -> descriptionLength + 1
- + NLM_TARGET_LONG_SIZE /* stackSize */
- + NLM_TARGET_LONG_SIZE /* reserved */
- + sizeof (nlm_variable_header (abfd) -> oldThreadName)
- + sizeof (nlm_variable_header (abfd) -> screenNameLength)
- + nlm_variable_header (abfd) -> screenNameLength + 1
- + sizeof (nlm_variable_header (abfd) -> threadNameLength)
- + nlm_variable_header (abfd) -> threadNameLength + 1);
+ + nlm_variable_header (abfd)->descriptionLength + 1
+ + NLM_TARGET_LONG_SIZE /* stackSize */
+ + NLM_TARGET_LONG_SIZE /* reserved */
+ + sizeof (nlm_variable_header (abfd)->oldThreadName)
+ + sizeof (nlm_variable_header (abfd)->screenNameLength)
+ + nlm_variable_header (abfd)->screenNameLength + 1
+ + sizeof (nlm_variable_header (abfd)->threadNameLength)
+ + nlm_variable_header (abfd)->threadNameLength + 1);
/* The auxiliary headers. */
if (find_nonzero ((PTR) nlm_version_header (abfd),
if (find_nonzero ((PTR) nlm_copyright_header (abfd),
sizeof (Nlm_Internal_Copyright_Header)))
sofar += (sizeof (Nlm_External_Copyright_Header)
- + nlm_copyright_header (abfd) -> copyrightMessageLength + 1);
+ + nlm_copyright_header (abfd)->copyrightMessageLength + 1);
/* Compute the section file positions in two passes. First get the
sizes of the text and data sections, and then set the file
same alignment restrictions that apply to the sections in memory;
this may not be necessary. */
text = 0;
- text_low = (bfd_vma) -1;
+ text_low = (bfd_vma) - 1;
text_align = 0;
data = 0;
- data_low = (bfd_vma) -1;
+ data_low = (bfd_vma) - 1;
data_align = 0;
bss = 0;
other_align = 0;
sym = *sym_ptr_ptr;
- if (! bfd_is_com_section (bfd_get_section (sym)))
+ if (!bfd_is_com_section (bfd_get_section (sym)))
continue;
/* Put the common symbol in the .bss section, and increase
mangle_relocs_func = nlm_mangle_relocs_func (abfd);
if (mangle_relocs_func != NULL)
{
- if (! (*mangle_relocs_func) (abfd, section, location,
- (bfd_vma) offset, count))
+ if (!(*mangle_relocs_func) (abfd, section, location,
+ (bfd_vma) offset, count))
return false;
}
}
/* Write out the variable length headers. */
if (bfd_seek (abfd,
- nlm_optional_prefix_size (abfd) + nlm_fixed_header_size (abfd),
+ nlm_optional_prefix_size (abfd) + nlm_fixed_header_size (abfd),
SEEK_SET) != 0)
{
bfd_set_error (bfd_error_system_call);
if (sec->reloc_count == 0)
continue;
- /* We can only represent relocs within a code or data
+ /* We can only represent relocs within a code or data
section. We ignore them for a debugging section. */
if ((bfd_get_section_flags (abfd, sec) & (SEC_CODE | SEC_DATA)) == 0)
continue;
if (sym_ptr_ptr != (asymbol **) NULL)
{
bfd_vma (*get_public_offset_func) PARAMS ((bfd *, asymbol *));
- boolean (*write_export_func) PARAMS ((bfd*, asymbol *, bfd_vma));
+ boolean (*write_export_func) PARAMS ((bfd *, asymbol *, bfd_vma));
asymbol **sym_end;
bfd_set_error (bfd_error_system_call);
goto error_return;
}
-
+
put_word (abfd, offset, temp);
if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp))
{
bfd_set_error (bfd_error_system_call);
goto error_return;
}
- }
+ }
}
nlm_fixed_header (abfd)->numberOfPublics = c;
information. This can not be handled by fiddling with the
symbol table, because exported symbols appear in both the
exported symbol list and the debugging information. */
- if (nlm_fixed_header (abfd)->debugInfoOffset == (file_ptr) -1)
+ if (nlm_fixed_header (abfd)->debugInfoOffset == (file_ptr) - 1)
{
nlm_fixed_header (abfd)->debugInfoOffset = 0;
nlm_fixed_header (abfd)->numberOfDebugRecords = 0;
bfd_set_error (bfd_error_system_call);
goto error_return;
}
- }
+ }
nlm_fixed_header (abfd)->numberOfDebugRecords = c;
}
}
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto error_return;
-
+
write_prefix_func = nlm_write_prefix_func (abfd);
if (write_prefix_func)
{
free (fixed_header);
return true;
- error_return:
+error_return:
if (fixed_header != NULL)
free (fixed_header);
return false;
return true;
}
-static unsigned int
+static long
oasys_get_symtab_upper_bound (abfd)
bfd *CONST abfd;
{
- oasys_slurp_symbol_table (abfd);
+ if (! oasys_slurp_symbol_table (abfd))
+ return -1;
return (abfd->symcount + 1) * (sizeof (oasys_symbol_type *));
}
extern bfd_target oasys_vec;
-unsigned int
+long
oasys_get_symtab (abfd, location)
bfd *abfd;
asymbol **location;
unsigned int counter;
if (oasys_slurp_symbol_table (abfd) == false)
{
- return 0;
+ return -1;
}
symbase = OASYS_DATA (abfd)->symbols;
for (counter = 0; counter < abfd->symcount; counter++)
}
-static unsigned int
+static long
oasys_get_reloc_upper_bound (abfd, asect)
bfd *abfd;
sec_ptr asect;
{
- oasys_slurp_section_data (abfd);
+ if (! oasys_slurp_section_data (abfd))
+ return -1;
return (asect->reloc_count + 1) * sizeof (arelent *);
}
}
-unsigned int
+long
oasys_canonicalize_reloc (ignore_abfd, section, relptr, symbols)
bfd *ignore_abfd;
sec_ptr section;
#define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define oasys_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define oasys_bfd_final_link _bfd_generic_final_link
+#define oasys_bfd_copy_private_section_data \
+ ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
+#define oasys_bfd_copy_private_bfd_data \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+#define oasys_bfd_is_local_label bfd_generic_is_local_label
/*SUPPRESS 460 */
bfd_target oasys_vec =
secname = bfd_alloc (abfd, 40);
if (!secname)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
sprintf (secname, ".data%d", dseccnt++);
#define osf_core_get_section_contents bfd_generic_get_section_contents
#define osf_core_new_section_hook (boolean (*) PARAMS \
((bfd *, sec_ptr))) bfd_true
-#define osf_core_get_symtab_upper_bound bfd_0u
-#define osf_core_get_symtab (unsigned int (*) PARAMS \
- ((bfd *, struct symbol_cache_entry **))) bfd_0u
-#define osf_core_get_reloc_upper_bound (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr))) bfd_0u
-#define osf_core_canonicalize_reloc (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
+#define osf_core_get_symtab_upper_bound bfd_0l
+#define osf_core_get_symtab (long (*) PARAMS \
+ ((bfd *, struct symbol_cache_entry **))) bfd_0l
+#define osf_core_get_reloc_upper_bound (long (*) PARAMS \
+ ((bfd *, sec_ptr))) bfd_0l
+#define osf_core_canonicalize_reloc (long (*) PARAMS \
+ ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
#define osf_core_print_symbol (void (*) PARAMS \
((bfd *, PTR, struct symbol_cache_entry *, \
bfd_print_symbol_type))) bfd_false
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define osf_core_bfd_final_link \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+#define osf_core_bfd_copy_private_section_data \
+ ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_false)
+#define osf_core_bfd_copy_private_bfd_data \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
+#define osf_core_bfd_is_local_label \
+ ((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
/* If somebody calls any byte-swapping routines, shoot them. */
static void
|| u.pt_rev != _BCS_PTRACE_REV)
{
/* Too small to be a core file */
- bfd_error = wrong_format;
+ bfd_set_error (bfd_error_wrong_format);
return 0;
}
bfd_zalloc (abfd, sizeof (struct trad_core_struct));
if (rawptr == NULL) {
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return 0;
}
/* Create the sections. This is raunchy, but bfd_close wants to free
them separately. */
- core_stacksec(abfd) = (asection *) zalloc (sizeof (asection));
+ core_stacksec(abfd) = (asection *) bfd_zmalloc (sizeof (asection));
if (core_stacksec (abfd) == NULL) {
loser:
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
free ((void *)rawptr);
return 0;
}
#define ptrace_unix_close_and_cleanup bfd_generic_close_and_cleanup
#define ptrace_unix_set_section_contents (boolean (*) PARAMS \
((bfd *abfd, asection *section, PTR data, file_ptr offset, \
- bfd_size_type count))) bfd_false
+ bfd_size_type count))) bfd_generic_set_section_contents
#define ptrace_unix_get_section_contents bfd_generic_get_section_contents
#define ptrace_unix_new_section_hook (boolean (*) PARAMS \
((bfd *, sec_ptr))) bfd_true
-#define ptrace_unix_get_symtab_upper_bound bfd_0u
-#define ptrace_unix_get_symtab (unsigned int (*) PARAMS \
- ((bfd *, struct symbol_cache_entry **))) bfd_0u
-#define ptrace_unix_get_reloc_upper_bound (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr))) bfd_0u
-#define ptrace_unix_canonicalize_reloc (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
+#define ptrace_unix_get_symtab_upper_bound bfd_0l
+#define ptrace_unix_get_symtab (long (*) PARAMS \
+ ((bfd *, struct symbol_cache_entry **))) bfd_0l
+#define ptrace_unix_get_reloc_upper_bound (long (*) PARAMS \
+ ((bfd *, sec_ptr))) bfd_0l
+#define ptrace_unix_canonicalize_reloc (long (*) PARAMS \
+ ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
#define ptrace_unix_make_empty_symbol (struct symbol_cache_entry * \
(*) PARAMS ((bfd *))) bfd_false
#define ptrace_unix_print_symbol (void (*) PARAMS \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define ptrace_unix_bfd_final_link \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+#define ptrace_unix_bfd_copy_private_section_data \
+ ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_false)
+#define ptrace_unix_bfd_copy_private_bfd_data \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
+#define ptrace_unix_bfd_is_local_label \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
/* If somebody calls any byte-swapping routines, shoot them. */
void
{
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
}
-#define NO_GET ((bfd_vma (*) PARAMS (( bfd_byte *))) swap_abort )
+#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
-#define NO_SIGNED_GET ((bfd_signed_vma (*) PARAMS ((bfd_byte *))) swap_abort )
+#define NO_SIGNED_GET \
+ ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
bfd_target ptrace_core_vec =
{
CODE_FRAGMENT
.
-.typedef enum bfd_reloc_status
+.typedef enum bfd_reloc_status
.{
. {* No errors detected *}
. bfd_reloc_ok,
. bfd_reloc_status_type;
.
.
-.typedef struct reloc_cache_entry
+.typedef struct reloc_cache_entry
.{
. {* A pointer into the canonical table of pointers *}
. struct symbol_cache_entry **sym_ptr_ptr;
. bfd_size_type address;
.
. {* addend for relocation value *}
-. bfd_vma addend;
+. bfd_vma addend;
.
. {* Pointer to how to perform the required relocation *}
. const struct reloc_howto_struct *howto;
|RELOCATION RECORDS FOR [.text]:
-|offset type value
+|offset type value
|00000006 32 _foo
|
|00000000 4e56 fffc ; linkw fp,#-4
|RELOCATION RECORDS FOR [.text]:
-|offset type value
+|offset type value
|00000002 HVRT16 _foo+0x12340000
|00000006 LVRT16 _foo+0x12340000
|
sparc the parts are created in odd sized lumps. The designers of
the a.out format chose to not use the data within the section
for storing part of the offset; all the offset is kept within
- the reloc. Anything in the data should be ignored.
+ the reloc. Anything in the data should be ignored.
| save %sp,-112,%sp
| sethi %hi(_foo+0x12345678),%g2
|RELOCATION RECORDS FOR [.text]:
-|offset type value
+|offset type value
|00000004 HI22 _foo+0x12345678
|00000008 LO10 _foo+0x12345678
|
would normally have a relocation instruction set and turn
relocations into pointers to the correct structure on input -
but it would be possible to create each howto field on demand.
-
+
*/
/*
*/
/*
-SUBSUBSECTION
+SUBSUBSECTION
<<reloc_howto_type>>
The <<reloc_howto_type>> is a structure which contains all the
CODE_FRAGMENT
.struct symbol_cache_entry; {* Forward declaration *}
.
-.typedef struct reloc_howto_struct
-.{
+.typedef struct reloc_howto_struct
+.{
. {* The type field has mainly a documetary use - the back end can
. do what it wants with it, though normally the back end's
. external idea of what a reloc number is stored
. called rather than the normal function. This allows really
. strange relocation methods to be accomodated (e.g., i960 callj
. instructions). *}
-. bfd_reloc_status_type (*special_function)
+. bfd_reloc_status_type (*special_function)
. PARAMS ((bfd *abfd,
. arelent *reloc_entry,
. struct symbol_cache_entry *symbol,
. PTR data,
-. asection *input_section,
+. asection *input_section,
. bfd *output_bfd,
. char **error_message));
.
. into the instruction. In most cases src_mask == dst_mask,
. except in the above special case, where dst_mask would be
. 0x000000ff, and src_mask would be 0x00000000. *}
-. bfd_vma dst_mask;
+. bfd_vma dst_mask;
.
. {* When some formats create PC relative instructions, they leave
. the value of the pc of the place being relocated in the offset
. relocation = symbol->value; \
. } \
. } \
-.}
+.}
*/
bfd_get_reloc_size (howto)
const reloc_howto_type *howto;
{
- switch (howto->size) {
- case 0: return 1;
- case 1: return 2;
- case 2: return 4;
- case 3: return 0;
- case 4: return 8;
- case -2: return 4;
- default: abort ();
- }
+ switch (howto->size)
+ {
+ case 0: return 1;
+ case 1: return 2;
+ case 2: return 4;
+ case 3: return 0;
+ case 4: return 8;
+ case -2: return 4;
+ default: abort ();
+ }
}
/*
/*
-FUNCTION
+FUNCTION
bfd_perform_relocation
SYNOPSIS
{
bfd_vma relocation;
bfd_reloc_status_type flag = bfd_reloc_ok;
- bfd_size_type addr = reloc_entry->address ;
+ bfd_size_type addr = reloc_entry->address;
bfd_vma output_base = 0;
const reloc_howto_type *howto = reloc_entry->howto;
asection *reloc_target_output_section;
asymbol *symbol;
symbol = *(reloc_entry->sym_ptr_ptr);
- if ((symbol->section == &bfd_abs_section)
- && output_bfd != (bfd *)NULL)
+ if ((symbol->section == &bfd_abs_section)
+ && output_bfd != (bfd *) NULL)
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
reloc_target_output_section = symbol->section->output_section;
/* Convert input-section-relative symbol value to absolute. */
- if (output_bfd && howto->partial_inplace==false)
+ if (output_bfd && howto->partial_inplace == false)
output_base = 0;
else
output_base = reloc_target_output_section->vma;
actually does. I don't want to change it, because it seems
far too likely that something will break. */
- relocation -=
+ relocation -=
input_section->output_section->vma + input_section->output_offset;
if (howto->pcrel_offset == true)
relocation -= reloc_entry->address;
}
- if (output_bfd!= (bfd *)NULL)
+ if (output_bfd != (bfd *) NULL)
{
- if ( howto->partial_inplace == false)
+ if (howto->partial_inplace == false)
{
/* This is a partial relocation, and we want to apply the relocation
to the reloc entry rather than the raw data. Modify the reloc
inplace to reflect what we now know. */
reloc_entry->addend = relocation;
- reloc_entry->address += input_section->output_offset;
+ reloc_entry->address += input_section->output_offset;
return flag;
}
else
{
/* This is a partial relocation, but inplace, so modify the
- reloc record a bit.
+ reloc record a bit.
If we've relocated with a symbol with a section, change
into a ref to the section belonging to the symbol. */
}
}
}
- else
+ else
{
reloc_entry->addend = 0;
}
{
/* Assumes two's complement. */
bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
- bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
+ bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
/* The above right shift is incorrect for a signed value.
Fix it up by forcing on the upper bits. */
if (howto->rightshift > howto->bitpos
&& (bfd_signed_vma) relocation < 0)
- check |= ((bfd_vma) -1
- &~ ((bfd_vma) -1
+ check |= ((bfd_vma) - 1
+ & ~((bfd_vma) - 1
>> (howto->rightshift - howto->bitpos)));
if ((bfd_signed_vma) check > reloc_signed_max
|| (bfd_signed_vma) check < reloc_signed_min)
overflow if howto->bitsize is the number of bits in
bfd_vma. */
bfd_vma reloc_unsigned_max =
- (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
+ (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
if ((bfd_vma) check > reloc_unsigned_max)
flag = bfd_reloc_overflow;
bfd_vma. */
bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
- if (((bfd_vma) check &~ reloc_bits) != 0
- && ((bfd_vma) check &~ reloc_bits) != (-1 &~ reloc_bits))
+ if (((bfd_vma) check & ~reloc_bits) != 0
+ && ((bfd_vma) check & ~reloc_bits) != (-1 & ~reloc_bits))
{
/* The above right shift is incorrect for a signed
value. See if turning on the upper bits fixes the
if (howto->rightshift > howto->bitpos
&& (bfd_signed_vma) relocation < 0)
{
- check |= ((bfd_vma) -1
- &~ ((bfd_vma) -1
+ check |= ((bfd_vma) - 1
+ & ~((bfd_vma) - 1
>> (howto->rightshift - howto->bitpos)));
- if (((bfd_vma) check &~ reloc_bits) != (-1 &~ reloc_bits))
+ if (((bfd_vma) check & ~reloc_bits) != (-1 & ~reloc_bits))
flag = bfd_reloc_overflow;
}
else
abort ();
}
}
-
- /*
+
+ /*
Either we are relocating all the way, or we don't want to apply
the relocation to the reloc entry (probably because there isn't
any room in the output format to describe addends to relocs)
relocation >>= (bfd_vma) howto->rightshift;
/* Shift everything up to where it's going to be used */
-
+
relocation <<= (bfd_vma) howto->bitpos;
/* Wait for the day when all have the mask in them */
A part 1
B part 2
R result
-
+
Do this:
i i i i i o o o o o from bfd_get<size>
and S S S S S to get the size offset we want
+ r r r r r r r r r r to get the final value to place
and D D D D D to chop to right size
-----------------------
- A A A A A
+ A A A A A
And this:
... i i i i i o o o o o from bfd_get<size>
and N N N N N get instruction
-----------------------
... B B B B B
-
- And then:
- B B B B B
- or A A A A A
+
+ And then:
+ B B B B B
+ or A A A A A
-----------------------
R R R R R R R R R R put into bfd_put<size>
*/
#define DOIT(x) \
x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask))
- switch (howto->size)
- {
- case 0:
- {
- char x = bfd_get_8(abfd, (char *)data + addr);
- DOIT(x);
- bfd_put_8(abfd,x, (unsigned char *) data + addr);
- }
- break;
-
- case 1:
- if (relocation)
- {
- short x = bfd_get_16(abfd, (bfd_byte *)data + addr);
- DOIT(x);
- bfd_put_16(abfd, x, (unsigned char *)data + addr);
- }
- break;
- case 2:
- if (relocation)
- {
- long x = bfd_get_32 (abfd, (bfd_byte *) data + addr);
- DOIT (x);
- bfd_put_32 (abfd, x, (bfd_byte *)data + addr);
- }
- break;
- case -2:
- {
- long x = bfd_get_32(abfd, (bfd_byte *) data + addr);
- relocation = -relocation;
- DOIT(x);
- bfd_put_32(abfd,x, (bfd_byte *)data + addr);
- }
- break;
-
- case 3:
- /* Do nothing */
- break;
-
- case 4:
+ switch (howto->size)
+ {
+ case 0:
+ {
+ char x = bfd_get_8 (abfd, (char *) data + addr);
+ DOIT (x);
+ bfd_put_8 (abfd, x, (unsigned char *) data + addr);
+ }
+ break;
+
+ case 1:
+ if (relocation)
+ {
+ short x = bfd_get_16 (abfd, (bfd_byte *) data + addr);
+ DOIT (x);
+ bfd_put_16 (abfd, x, (unsigned char *) data + addr);
+ }
+ break;
+ case 2:
+ if (relocation)
+ {
+ long x = bfd_get_32 (abfd, (bfd_byte *) data + addr);
+ DOIT (x);
+ bfd_put_32 (abfd, x, (bfd_byte *) data + addr);
+ }
+ break;
+ case -2:
+ {
+ long x = bfd_get_32 (abfd, (bfd_byte *) data + addr);
+ relocation = -relocation;
+ DOIT (x);
+ bfd_put_32 (abfd, x, (bfd_byte *) data + addr);
+ }
+ break;
+
+ case 3:
+ /* Do nothing */
+ break;
+
+ case 4:
#ifdef BFD64
- if (relocation)
- {
- bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + addr);
- DOIT (x);
- bfd_put_64 (abfd, x, (bfd_byte *) data + addr);
- }
+ if (relocation)
+ {
+ bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + addr);
+ DOIT (x);
+ bfd_put_64 (abfd, x, (bfd_byte *) data + addr);
+ }
#else
- abort ();
+ abort ();
#endif
- break;
- default:
- return bfd_reloc_other;
- }
+ break;
+ default:
+ return bfd_reloc_other;
+ }
return flag;
}
bfd_reloc_status_type
_bfd_final_link_relocate (howto, input_bfd, input_section, contents, address,
- value, addend)
+ value, addend)
const reloc_howto_type *howto;
bfd *input_bfd;
asection *input_section;
if (howto->pcrel_offset)
relocation -= address;
}
-
+
return _bfd_relocate_contents (howto, input_bfd, relocation,
contents + address);
}
/* If the size is negative, negate RELOCATION. This isn't very
general. */
if (howto->size < 0)
- relocation = - relocation;
+ relocation = -relocation;
/* Get the value we are going to relocate. */
size = bfd_get_reloc_size (howto);
signed_check = check;
else
signed_check = (check
- | ((bfd_vma) -1
- &~ ((bfd_vma) -1 >> howto->rightshift)));
+ | ((bfd_vma) - 1
+ & ~((bfd_vma) - 1 >> howto->rightshift)));
}
/* Get the value from the object file. */
signed_add needs no adjustment to become negative in that
case. */
signed_add = add;
- if ((add & (((~ howto->src_mask) >> 1) & howto->src_mask)) != 0)
- signed_add -= (((~ howto->src_mask) >> 1) & howto->src_mask) << 1;
+ if ((add & (((~howto->src_mask) >> 1) & howto->src_mask)) != 0)
+ signed_add -= (((~howto->src_mask) >> 1) & howto->src_mask) << 1;
/* Add the value from the object file, shifted so that it is a
straight number. */
signed_check += add >> howto->bitpos;
else
signed_check += ((add >> howto->bitpos)
- | ((bfd_vma) -1
- &~ ((bfd_vma) -1 >> howto->bitpos)));
+ | ((bfd_vma) - 1
+ & ~((bfd_vma) - 1 >> howto->bitpos)));
}
switch (howto->complain_on_overflow)
{
/* Assumes two's complement. */
bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
- bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
+ bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
if (signed_check > reloc_signed_max
|| signed_check < reloc_signed_min)
overflow if howto->bitsize is the number of bits in
bfd_vma. */
bfd_vma reloc_unsigned_max =
- (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
+ (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
if (check > reloc_unsigned_max)
overflow = true;
bfd_vma. */
bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
- if ((check &~ reloc_bits) != 0
- && (((bfd_vma) signed_check &~ reloc_bits)
- != (-1 &~ reloc_bits)))
+ if ((check & ~reloc_bits) != 0
+ && (((bfd_vma) signed_check & ~reloc_bits)
+ != (-1 & ~reloc_bits)))
overflow = true;
}
break;
relocation <<= (bfd_vma) howto->bitpos;
/* Add RELOCATION to the right bits of X. */
- x = ((x &~ howto->dst_mask)
+ x = ((x & ~howto->dst_mask)
| (((x & howto->src_mask) + relocation) & howto->dst_mask));
/* Put the relocated value back in the object file. */
howto manager, , typedef arelent, Relocations
SECTION
- The howto manager
+ The howto manager
When an application wants to create a relocation, but doesn't
know what the target machine might call it, it can find out by
CODE_FRAGMENT
.
-.typedef enum bfd_reloc_code_real
+.typedef enum bfd_reloc_code_real
.{
. {* Basic absolute relocations *}
. BFD_RELOC_64,
. BFD_RELOC_32,
-. BFD_RELOC_16,
+. BFD_RELOC_16,
. BFD_RELOC_14,
. BFD_RELOC_8,
.
const struct reloc_howto_struct *
-DEFUN(bfd_reloc_type_lookup,(abfd, code),
- bfd *abfd AND
- bfd_reloc_code_real_type code)
+bfd_reloc_type_lookup (abfd, code)
+ bfd *abfd;
+ bfd_reloc_code_real_type code;
{
return BFD_SEND (abfd, reloc_type_lookup, (abfd, code));
}
static reloc_howto_type bfd_howto_32 =
- HOWTO(0, 00,2,32,false,0,complain_overflow_bitfield,0,"VRT32", false,0xffffffff,0xffffffff,true);
+HOWTO (0, 00, 2, 32, false, 0, complain_overflow_bitfield, 0, "VRT32", false, 0xffffffff, 0xffffffff, true);
/*
SYNOPSIS
const struct reloc_howto_struct *bfd_default_reloc_type_lookup
- (bfd *abfd AND
- bfd_reloc_code_real_type code);
+ (bfd *abfd, bfd_reloc_code_real_type code);
DESCRIPTION
Provides a default relocation lookup routine for any architecture.
*/
const struct reloc_howto_struct *
-DEFUN(bfd_default_reloc_type_lookup, (abfd, code),
- bfd *abfd AND
- bfd_reloc_code_real_type code)
+bfd_default_reloc_type_lookup (abfd, code)
+ bfd *abfd;
+ bfd_reloc_code_real_type code;
{
- switch (code)
+ switch (code)
{
case BFD_RELOC_CTOR:
/* The type of reloc used in a ctor, which will be as wide as the
address - so either a 64, 32, or 16 bitter. */
- switch (bfd_get_arch_info (abfd)->bits_per_address) {
- case 64:
- BFD_FAIL();
- case 32:
- return &bfd_howto_32;
- case 16:
- BFD_FAIL();
- default:
- BFD_FAIL();
- }
+ switch (bfd_get_arch_info (abfd)->bits_per_address)
+ {
+ case 64:
+ BFD_FAIL ();
+ case 32:
+ return &bfd_howto_32;
+ case 16:
+ BFD_FAIL ();
+ default:
+ BFD_FAIL ();
+ }
default:
- BFD_FAIL();
+ BFD_FAIL ();
}
- return (const struct reloc_howto_struct *)NULL;
+ return (const struct reloc_howto_struct *) NULL;
}
(bfd *abfd,
asection *section,
struct bfd_link_info *,
- asymbol **symbols);
+ boolean *);
DESCRIPTION
Provides default handling for relaxing for back ends which
/*ARGSUSED*/
boolean
-bfd_generic_relax_section (abfd, section, link_info, symbols)
+bfd_generic_relax_section (abfd, section, link_info, again)
bfd *abfd;
asection *section;
struct bfd_link_info *link_info;
- asymbol **symbols;
+ boolean *again;
{
- return false;
+ *again = false;
+ return true;
}
-
+
/*
INTERNAL_FUNCTION
bfd_generic_get_relocated_section_contents
bfd *input_bfd = link_order->u.indirect.section->owner;
asection *input_section = link_order->u.indirect.section;
- size_t reloc_size = bfd_get_reloc_upper_bound(input_bfd, input_section);
+ long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
arelent **reloc_vector = NULL;
+ long reloc_count;
+
+ if (reloc_size < 0)
+ goto error_return;
reloc_vector = (arelent **) malloc (reloc_size);
- if (reloc_vector == NULL)
+ if (reloc_vector == NULL && reloc_size != 0)
{
bfd_set_error (bfd_error_no_memory);
goto error_return;
}
-
+
/* read in the section */
- if (!bfd_get_section_contents(input_bfd,
- input_section,
- (PTR) data,
- 0,
- input_section->_raw_size))
+ if (!bfd_get_section_contents (input_bfd,
+ input_section,
+ (PTR) data,
+ 0,
+ input_section->_raw_size))
goto error_return;
/* We're not relaxing the section, so just copy the size info */
input_section->_cooked_size = input_section->_raw_size;
input_section->reloc_done = true;
- if (!bfd_canonicalize_reloc (input_bfd,
- input_section,
- reloc_vector,
- symbols))
+ reloc_count = bfd_canonicalize_reloc (input_bfd,
+ input_section,
+ reloc_vector,
+ symbols);
+ if (reloc_count < 0)
goto error_return;
- {
- arelent **parent;
- for (parent = reloc_vector; * parent != (arelent *)NULL;
- parent++)
- {
- char *error_message = (char *) NULL;
- bfd_reloc_status_type r=
- bfd_perform_relocation(input_bfd,
- *parent,
- (PTR) data,
- input_section,
- relocateable ? abfd : (bfd *) NULL,
- &error_message);
-
- if (relocateable)
+ if (reloc_count > 0)
+ {
+ arelent **parent;
+ for (parent = reloc_vector; *parent != (arelent *) NULL;
+ parent++)
{
- asection *os = input_section->output_section;
+ char *error_message = (char *) NULL;
+ bfd_reloc_status_type r =
+ bfd_perform_relocation (input_bfd,
+ *parent,
+ (PTR) data,
+ input_section,
+ relocateable ? abfd : (bfd *) NULL,
+ &error_message);
+
+ if (relocateable)
+ {
+ asection *os = input_section->output_section;
- /* A partial link, so keep the relocs */
- os->orelocation[os->reloc_count] = *parent;
- os->reloc_count++;
- }
+ /* A partial link, so keep the relocs */
+ os->orelocation[os->reloc_count] = *parent;
+ os->reloc_count++;
+ }
- if (r != bfd_reloc_ok)
- {
- switch (r)
- {
- case bfd_reloc_undefined:
- if (! ((*link_info->callbacks->undefined_symbol)
- (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
- input_bfd, input_section, (*parent)->address)))
- goto error_return;
- break;
- case bfd_reloc_dangerous:
- BFD_ASSERT (error_message != (char *) NULL);
- if (! ((*link_info->callbacks->reloc_dangerous)
- (link_info, error_message, input_bfd, input_section,
- (*parent)->address)))
- goto error_return;
- break;
- case bfd_reloc_overflow:
- if (! ((*link_info->callbacks->reloc_overflow)
- (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
- (*parent)->howto->name, (*parent)->addend,
- input_bfd, input_section, (*parent)->address)))
- goto error_return;
- break;
- case bfd_reloc_outofrange:
- default:
- abort();
- break;
- }
+ if (r != bfd_reloc_ok)
+ {
+ switch (r)
+ {
+ case bfd_reloc_undefined:
+ if (!((*link_info->callbacks->undefined_symbol)
+ (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
+ input_bfd, input_section, (*parent)->address)))
+ goto error_return;
+ break;
+ case bfd_reloc_dangerous:
+ BFD_ASSERT (error_message != (char *) NULL);
+ if (!((*link_info->callbacks->reloc_dangerous)
+ (link_info, error_message, input_bfd, input_section,
+ (*parent)->address)))
+ goto error_return;
+ break;
+ case bfd_reloc_overflow:
+ if (!((*link_info->callbacks->reloc_overflow)
+ (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
+ (*parent)->howto->name, (*parent)->addend,
+ input_bfd, input_section, (*parent)->address)))
+ goto error_return;
+ break;
+ case bfd_reloc_outofrange:
+ default:
+ abort ();
+ break;
+ }
- }
- }
- }
+ }
+ }
+ }
if (reloc_vector != NULL)
free (reloc_vector);
return data;
- error_return:
+error_return:
if (reloc_vector != NULL)
free (reloc_vector);
return NULL;
static boolean som_write_object_contents PARAMS ((bfd *));
static boolean som_slurp_string_table PARAMS ((bfd *));
static unsigned int som_slurp_symbol_table PARAMS ((bfd *));
-static unsigned int som_get_symtab_upper_bound PARAMS ((bfd *));
-static unsigned int som_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
- arelent **, asymbol **));
-static unsigned int som_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
+static long som_get_symtab_upper_bound PARAMS ((bfd *));
+static long som_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
+ arelent **, asymbol **));
+static long som_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
static unsigned int som_set_reloc_info PARAMS ((unsigned char *, unsigned int,
arelent *, asection *,
asymbol **, boolean));
static boolean som_slurp_reloc_table PARAMS ((bfd *, asection *,
asymbol **, boolean));
-static unsigned int som_get_symtab PARAMS ((bfd *, asymbol **));
+static long som_get_symtab PARAMS ((bfd *, asymbol **));
static asymbol * som_make_empty_symbol PARAMS ((bfd *));
static void som_print_symbol PARAMS ((bfd *, PTR,
asymbol *, bfd_print_symbol_type));
/* Return the amount of data (in bytes) required to hold the symbol
table for this object. */
-static unsigned int
+static long
som_get_symtab_upper_bound (abfd)
bfd *abfd;
{
if (!som_slurp_symbol_table (abfd))
- return 0;
+ return -1;
return (bfd_get_symcount (abfd) + 1) * (sizeof (asymbol *));
}
/* Canonicalize a SOM symbol table. Return the number of entries
in the symbol table. */
-static unsigned int
+static long
som_get_symtab (abfd, location)
bfd *abfd;
asymbol **location;
som_symbol_type *symbase;
if (!som_slurp_symbol_table (abfd))
- return 0;
+ return -1;
i = bfd_get_symcount (abfd);
symbase = obj_som_symtab (abfd);
/* Return the number of bytes required to store the relocation
information associated with the given section. */
-static unsigned int
+static long
som_get_reloc_upper_bound (abfd, asect)
bfd *abfd;
sec_ptr asect;
and parse it to determine how many relocations exist. */
if (asect->flags & SEC_RELOC)
{
- if (som_slurp_reloc_table (abfd, asect, NULL, true))
- return (asect->reloc_count + 1) * sizeof (arelent);
+ if (! som_slurp_reloc_table (abfd, asect, NULL, true))
+ return false;
+ return (asect->reloc_count + 1) * sizeof (arelent);
}
- /* Either there are no relocations or an error occurred while
- reading and parsing the relocation stream. */
+ /* There are no relocations. */
return 0;
}
/* Convert relocations from SOM (external) form into BFD internal
form. Return the number of relocations. */
-static unsigned int
+static long
som_canonicalize_reloc (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
int count;
if (som_slurp_reloc_table (abfd, section, symbols, false) == false)
- return 0;
+ return -1;
count = section->reloc_count;
tblptr = section->relocation;
if (tblptr == (arelent *) NULL)
- return 0;
+ return -1;
while (count--)
*relptr++ = tblptr++;
return new;
}
-static unsigned int
+static long
srec_get_symtab_upper_bound (abfd)
bfd *abfd;
{
/* Read in all the info */
- srec_get_section_contents (abfd, abfd->sections, 0, 0, 0);
+ if (! srec_get_section_contents (abfd, abfd->sections, 0, 0, 0))
+ return -1;
return (bfd_get_symcount (abfd) + 1) * (sizeof (asymbol *));
}
-static unsigned int
+static long
srec_get_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
#define FOO PROTO
#define srec_new_section_hook (FOO(boolean, (*), (bfd *, asection *)))bfd_true
-#define srec_get_reloc_upper_bound (FOO(unsigned int, (*),(bfd*, asection *)))bfd_false
-#define srec_canonicalize_reloc (FOO(unsigned int, (*),(bfd*,asection *, arelent **, asymbol **))) bfd_0
+#define srec_get_reloc_upper_bound (FOO(long, (*),(bfd*, asection *)))bfd_0l
+#define srec_canonicalize_reloc (FOO(long, (*),(bfd*,asection *, arelent **, asymbol **))) bfd_0l
#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define srec_bfd_final_link _bfd_generic_final_link
+#define srec_bfd_copy_private_section_data \
+ ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
+#define srec_bfd_copy_private_bfd_data \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+#define srec_bfd_is_local_label bfd_generic_is_local_label
+
bfd_target srec_vec =
{
"srec", /* name */
Symbols and relocations.
-. unsigned int (*_get_symtab_upper_bound) PARAMS ((bfd *));
-. unsigned int (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
-. struct symbol_cache_entry **));
-. unsigned int (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
-. unsigned int (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
-. struct symbol_cache_entry **));
+. long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
+. long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
+. struct symbol_cache_entry **));
+. long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
+. long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
+. struct symbol_cache_entry **));
. struct symbol_cache_entry *
. (*_bfd_make_empty_symbol) PARAMS ((bfd *));
. void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
if (!sname || !d)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
if (!n)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
abort(); /* FIXME */
}
memcpy (n, sym, len + 1);
if (!new)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
abort(); /* FIXME */
}
new->symbol.the_bfd = abfd;
new->symbol.name = bfd_alloc (abfd, len + 1);
if (!new->symbol.name)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
abort(); /* FIXME */
}
memcpy ((char *) (new->symbol.name), sym, len + 1);
}
-unsigned int
+long
tekhex_get_symtab (abfd, table)
bfd *abfd;
asymbol **table;
return bfd_get_symcount (abfd);
}
-unsigned int
+long
tekhex_get_symtab_upper_bound (abfd)
bfd *abfd;
{
if (!tdata)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
abfd->tdata.tekhex_data = tdata;
break;
case 'C':
case 'U':
- bfd_error = wrong_format;
+ bfd_set_error (bfd_error_wrong_format);
return false;
}
if (!new)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
new->symbol.the_bfd = abfd;
#define FOO PROTO
#define tekhex_new_section_hook (FOO(boolean, (*), (bfd *, asection *)))bfd_true
-#define tekhex_get_reloc_upper_bound (FOO(unsigned int, (*),(bfd*, asection *)))bfd_false
-#define tekhex_canonicalize_reloc (FOO(unsigned int, (*),(bfd*,asection *, arelent **, asymbol **))) bfd_0
+#define tekhex_get_reloc_upper_bound (FOO(long, (*),(bfd*, asection *)))bfd_0l
+#define tekhex_canonicalize_reloc (FOO(long, (*),(bfd*,asection *, arelent **, asymbol **))) bfd_0l
#define tekhex_openr_next_archived_file (FOO(bfd *, (*), (bfd*,bfd*))) bfd_nullvoidptr
#define tekhex_find_nearest_line (FOO(boolean, (*),(bfd*,asection*,asymbol**,bfd_vma, CONST char**, CONST char**, unsigned int *))) bfd_false
#define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define tekhex_bfd_final_link _bfd_generic_final_link
+#define tekhex_bfd_copy_private_section_data \
+ ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
+#define tekhex_bfd_copy_private_bfd_data \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+#define tekhex_bfd_is_local_label bfd_generic_is_local_label
bfd_target tekhex_vec =
{
/* Allocate both the upage and the struct core_data at once, so
a single free() will free them both. */
rawptr = (struct trad_core_struct *)
- bfd_zmalloc (abfd, sizeof (struct trad_core_struct));
+ bfd_zmalloc (sizeof (struct trad_core_struct));
if (rawptr == NULL) {
bfd_set_error (bfd_error_no_memory);
return 0;
#define trad_unix_get_section_contents bfd_generic_get_section_contents
#define trad_unix_new_section_hook (boolean (*) PARAMS \
((bfd *, sec_ptr))) bfd_true
-#define trad_unix_get_symtab_upper_bound bfd_0u
-#define trad_unix_get_symtab (unsigned int (*) PARAMS \
- ((bfd *, struct symbol_cache_entry **))) bfd_0u
-#define trad_unix_get_reloc_upper_bound (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr))) bfd_0u
-#define trad_unix_canonicalize_reloc (unsigned int (*) PARAMS \
- ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
+#define trad_unix_get_symtab_upper_bound bfd_0l
+#define trad_unix_get_symtab (long (*) PARAMS \
+ ((bfd *, struct symbol_cache_entry **))) bfd_0l
+#define trad_unix_get_reloc_upper_bound (long (*) PARAMS \
+ ((bfd *, sec_ptr))) bfd_0l
+#define trad_unix_canonicalize_reloc (long (*) PARAMS \
+ ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
#define trad_unix_make_empty_symbol (struct symbol_cache_entry * \
(*) PARAMS ((bfd *))) bfd_false
#define trad_unix_print_symbol (void (*) PARAMS \