aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog31
-rw-r--r--bfd/aoutx.h26
-rw-r--r--bfd/archive.c28
-rw-r--r--bfd/ecoff.c18
-rw-r--r--bfd/libaout.h5
-rw-r--r--bfd/libbfd.c11
6 files changed, 85 insertions, 34 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ef3539b..dc41069 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,34 @@
+Fri Dec 31 16:23:43 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+
+ Minor cleanups suggested by CodeCenter.
+ * aoutx.h, coffgen.c, ecoff.c, ecofflink.c, elf.c, libbfd.c,
+ linker.c, reloc.c, section.c, srec.c: Added /*ARGSUSED*/ as
+ appropriate.
+ * aoutx.h (struct external_exec): Removed unnecessary declaration.
+ (NAME(aout,some_aout_object_p)): Set some tdata pointers to NULL.
+ (adjust_z_magic): Removed useless variable data_vma.
+ (stringtab_init): Initialize hash_zero.
+ (add_to_stringtab): Removed unused fourth argument.
+ (NAME(aout,swap_std_reloc_out)): Removed useless variable
+ r_addend.
+ (aout_link_input_section): Added some casts.
+ * archive.c (get_extended_arelt_filename, do_slurp_coff_armap,
+ bfd_ar_hdr_from_filesystem, bsd_write_armap, coff_write_armap):
+ Minor code rewriting to make it more C like.
+ (do_slurp_bsd_armap): Added some casts.
+ * ecoff.c (ecoff_write_object_contents): Removed useless variable
+ scn_base.
+ (ecoff_write_armap): Added some casts. Use "" rather than "\0".
+ * ecofflink.c (bfd_ecoff_write_debug): Added a cast.
+ * libaout.h (struct internal_exec): Removed unnecessary
+ declaration.
+ * linker.c (_bfd_generic_indirect_link_order): Added a cast.
+ * opncls.c (new_bfd): Removed a cast.
+ * reloc.c (bfd_generic_get_relocated_section_contents): Added
+ some casts.
+ * srec.c (internal_srec_write_object_contents): Removed useless
+ variable bytes_written.
+
Fri Dec 31 11:46:13 1993 David J. Mackenzie (djm@thepub.cygnus.com)
* i386mach3.c (N_TXTADDR): Don't define after all.
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 57eeaa6..8e05efe 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -128,7 +128,6 @@ DESCRIPTION
#include <ansidecl.h>
#include "bfdlink.h"
-struct external_exec;
#include "libaout.h"
#include "libbfd.h"
#include "aout/aout64.h"
@@ -409,6 +408,10 @@ DEFUN(NAME(aout,some_aout_object_p),(abfd, execp, callback_to_real_object_p),
/* The default symbol entry size is that of traditional Unix. */
obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE;
+ obj_aout_external_syms (abfd) = NULL;
+ obj_aout_external_strings (abfd) = NULL;
+ obj_aout_sym_hashes (abfd) = NULL;
+
/* Create the sections. This is raunchy, but bfd_close wants to reclaim
them. */
@@ -737,7 +740,6 @@ adjust_z_magic (abfd, execp)
file_ptr text_end;
CONST struct aout_backend_data *abdp;
int ztih; /* Nonzero if text includes exec header. */
- bfd_vma data_vma;
abdp = aout_backend_info (abfd);
@@ -769,7 +771,6 @@ adjust_z_magic (abfd, execp)
vma = obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size;
obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size);
}
- data_vma = obj_datasec(abfd)->vma;
if (abdp && abdp->zmagic_mapped_contiguous)
{
text_pad = (obj_datasec(abfd)->vma
@@ -1585,6 +1586,7 @@ stringtab_init (tab)
{
tab->strings = 0;
tab->output_order = 0;
+ tab->hash_zero = 0;
tab->end = &tab->output_order;
/* Initial string table length includes size of length field. */
@@ -1628,11 +1630,10 @@ log2 (num)
entry into the string table should be irrelevant -- it just has to
return a valid index. */
static bfd_size_type
-add_to_stringtab (abfd, str, tab, check)
+add_to_stringtab (abfd, str, tab)
bfd *abfd;
CONST char *str;
struct stringtab_data *tab;
- int check;
{
struct stringtab_entry **ep;
register struct stringtab_entry *entry;
@@ -1916,7 +1917,6 @@ DEFUN(NAME(aout,swap_std_reloc_out),(abfd, g, natptr),
unsigned int r_length;
int r_pcrel;
int r_baserel, r_jmptable, r_relative;
- unsigned int r_addend;
asection *output_section = sym->section->output_section;
PUT_WORD(abfd, g->address, natptr->r_address);
@@ -1929,7 +1929,10 @@ DEFUN(NAME(aout,swap_std_reloc_out),(abfd, g, natptr),
r_jmptable = 0;
r_relative = 0;
+#if 0
+ /* For a standard reloc, the addend is in the object file. */
r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
+#endif
/* name was clobbered by aout_write_syms to be symbol index */
@@ -2401,6 +2404,8 @@ DEFUN(NAME(aout,get_symtab_upper_bound),(abfd),
return (bfd_get_symcount (abfd)+1) * (sizeof (aout_symbol_type *));
}
+
+/*ARGSUSED*/
alent *
DEFUN(NAME(aout,get_lineno),(ignore_abfd, ignore_symbol),
bfd *ignore_abfd AND
@@ -2409,6 +2414,7 @@ DEFUN(NAME(aout,get_lineno),(ignore_abfd, ignore_symbol),
return (alent *)NULL;
}
+/*ARGSUSED*/
void
DEFUN(NAME(aout,get_symbol_info),(ignore_abfd, symbol, ret),
bfd *ignore_abfd AND
@@ -2435,6 +2441,7 @@ DEFUN(NAME(aout,get_symbol_info),(ignore_abfd, symbol, ret),
}
}
+/*ARGSUSED*/
void
DEFUN(NAME(aout,print_symbol),(ignore_abfd, afile, symbol, how),
bfd *ignore_abfd AND
@@ -2588,6 +2595,7 @@ DEFUN(NAME(aout,find_nearest_line),(abfd,
}
+/*ARGSUSED*/
int
DEFUN(NAME(aout,sizeof_headers),(abfd, execable),
bfd *abfd AND
@@ -2972,7 +2980,6 @@ aout_link_add_symbols (abfd, info)
else
copy = true;
-
/* We keep a list of the linker hash table entries that correspond
to particular symbols. We could just look them up in the hash
table, but keeping the list is more efficient. Perhaps this
@@ -3718,7 +3725,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
/* Get the section contents. */
input_size = bfd_section_size (input_bfd, input_section);
contents = (bfd_byte *) alloca (input_size);
- if (! bfd_get_section_contents (input_bfd, input_section, contents,
+ if (! bfd_get_section_contents (input_bfd, input_section, (PTR) contents,
(file_ptr) 0, input_size))
return false;
@@ -3747,7 +3754,8 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
/* Write out the section contents. */
if (! bfd_set_section_contents (finfo->output_bfd,
input_section->output_section,
- contents, input_section->output_offset,
+ (PTR) contents,
+ input_section->output_offset,
input_size))
return false;
diff --git a/bfd/archive.c b/bfd/archive.c
index d5c96d4..8cfdb14 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -208,8 +208,8 @@ DESCRIPTION
information, returning that symbol's (internal) index into the
symbol table.
- Supply BFD_NO_MORE_SYMBOLS as the @var{previous} entry to get
- the first one; returns BFD_NO_MORE_SYMBOLS when you're already
+ Supply <<BFD_NO_MORE_SYMBOLS>> as the @var{previous} entry to get
+ the first one; returns <<BFD_NO_MORE_SYMBOLS>> when you've already
got the last one.
A <<carsym>> is a canonical archive symbol. The only
@@ -310,7 +310,8 @@ add_bfd_to_cache (arch_bfd, filepos, new_elt)
else {
struct ar_cache *current = bfd_ardata (arch_bfd)->cache;
- for (; current->next != NULL; current = current->next);
+ while (current->next != NULL)
+ current = current->next;
current->next = new_cache;
}
@@ -672,8 +673,8 @@ DEFUN (do_slurp_bsd_armap, (abfd),
return false;
}
- ardata->symdef_count =
- bfd_h_get_32(abfd, (PTR)raw_armap) / sizeof (struct symdef);
+ ardata->symdef_count = (bfd_h_get_32 (abfd, (bfd_byte *) raw_armap)
+ / sizeof (struct symdef));
if (ardata->symdef_count * sizeof (struct symdef)
> parsed_size - sizeof (*raw_armap)) {
@@ -689,8 +690,10 @@ DEFUN (do_slurp_bsd_armap, (abfd),
for (;counter < ardata->symdef_count; counter++) {
struct symdef *sym = ((struct symdef *) rbase) + counter;
- sym->s.name = bfd_h_get_32(abfd, (PTR)(&(sym->s.string_offset))) + stringbase;
- sym->file_offset = bfd_h_get_32(abfd, (PTR)( &(sym->file_offset)));
+ sym->s.name = (bfd_h_get_32 (abfd, (bfd_byte *) (&sym->s.string_offset))
+ + stringbase);
+ sym->file_offset = bfd_h_get_32 (abfd,
+ (bfd_byte *) (&(sym->file_offset)));
}
ardata->first_file_filepos = bfd_tell (abfd);
@@ -781,7 +784,7 @@ DEFUN (do_slurp_coff_armap, (abfd),
rawptr = raw_armap + i;
carsyms->file_offset = swap((PTR)rawptr);
carsyms->name = stringbase;
- while (*stringbase++) ;
+ stringbase += strlen (stringbase) + 1;
carsyms++;
}
*stringbase = 0;
@@ -1140,9 +1143,8 @@ DEFUN(bfd_ar_hdr_from_filesystem, (abfd,filename),
hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
/* ar headers are space padded, not null padded! */
- temp = (char *) hdr;
- temp1 = temp + sizeof (struct ar_hdr) - 2;
- for (; temp < temp1; *(temp++) = ' ');
+ memset (hdr, ' ', sizeof (struct ar_hdr));
+
strncpy (hdr->ar_fmag, ARFMAG, 2);
/* Goddamned sprintf doesn't permit MAXIMUM field lengths */
@@ -1617,7 +1619,7 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
/* The spec sez this should be a newline. But in order to be
bug-compatible for sun's ar we use a null. */
if (padit)
- bfd_write("\0",1,1,arch);
+ bfd_write("",1,1,arch);
return true;
}
@@ -1766,7 +1768,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
/* The spec sez this should be a newline. But in order to be
bug-compatible for arc960 we use a null. */
if (padit)
- bfd_write("\0",1,1,arch);
+ bfd_write("",1,1,arch);
return true;
}
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 101adbd..511ab59 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -140,6 +140,7 @@ ecoff_mkobject_hook (abfd, filehdr, aouthdr)
/* This is a hook needed by SCO COFF, but we have nothing to do. */
+/*ARGSUSED*/
asection *
ecoff_make_section_hook (abfd, name)
bfd *abfd;
@@ -328,6 +329,7 @@ ecoff_sec_to_styp_flags (name, flags)
/* Get the BFD flags to use for a section. */
+/*ARGSUSED*/
flagword
ecoff_styp_to_sec_flags (abfd, hdr)
bfd *abfd;
@@ -1527,6 +1529,7 @@ ecoff_type_to_string (abfd, aux_ptr, indx, bigendian)
/* Return information about ECOFF symbol SYMBOL in RET. */
+/*ARGSUSED*/
void
ecoff_get_symbol_info (abfd, symbol, ret)
bfd *abfd; /* Ignored. */
@@ -1870,6 +1873,7 @@ ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
and return the name of the source file and the line nearest to the
wanted location. */
+/*ARGSUSED*/
boolean
ecoff_find_nearest_line (abfd,
section,
@@ -2219,6 +2223,7 @@ ecoff_set_arch_mach (abfd, arch, machine)
/* Get the size of the section headers. We do not output the .reginfo
section. */
+/*ARGSUSED*/
int
ecoff_sizeof_headers (abfd, reloc)
bfd *abfd;
@@ -2418,7 +2423,6 @@ ecoff_write_object_contents (abfd)
HDRR * const symhdr = &debug->symbolic_header;
asection *current;
unsigned int count;
- file_ptr scn_base;
file_ptr reloc_base;
file_ptr sym_base;
unsigned long reloc_size;
@@ -2437,10 +2441,6 @@ ecoff_write_object_contents (abfd)
if(abfd->output_has_begun == false)
ecoff_compute_section_file_positions(abfd);
- if (abfd->sections != (asection *) NULL)
- scn_base = abfd->sections->filepos;
- else
- scn_base = 0;
reloc_base = ecoff_data (abfd)->reloc_filepos;
count = 1;
@@ -3125,7 +3125,7 @@ ecoff_write_armap (abfd, elength, map, orl_count, stridx)
return false;
bfd_h_put_32 (abfd, (bfd_vma) hashsize, temp);
- if (bfd_write (temp, 1, 4, abfd) != 4)
+ if (bfd_write ((PTR) temp, 1, 4, abfd) != 4)
return false;
hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
@@ -3174,14 +3174,14 @@ ecoff_write_armap (abfd, elength, map, orl_count, stridx)
(PTR) (hashtable + hash * 8 + 4));
}
- if (bfd_write (hashtable, 1, symdefsize, abfd) != symdefsize)
+ if (bfd_write ((PTR) hashtable, 1, symdefsize, abfd) != symdefsize)
return false;
bfd_release (abfd, hashtable);
/* Now write the strings. */
bfd_h_put_32 (abfd, (bfd_vma) stringsize, temp);
- if (bfd_write (temp, 1, 4, abfd) != 4)
+ if (bfd_write ((PTR) temp, 1, 4, abfd) != 4)
return false;
for (i = 0; i < orl_count; i++)
{
@@ -3196,7 +3196,7 @@ ecoff_write_armap (abfd, elength, map, orl_count, stridx)
bug-compatible for DECstation ar we use a null. */
if (padit)
{
- if (bfd_write ("\0", 1, 1, abfd) != 1)
+ if (bfd_write ("", 1, 1, abfd) != 1)
return false;
}
diff --git a/bfd/libaout.h b/bfd/libaout.h
index 1f89385..330f60e 100644
--- a/bfd/libaout.h
+++ b/bfd/libaout.h
@@ -44,10 +44,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define BYTES_IN_WORD 4
#endif /* ARCH_SIZE==32 */
-/* Declare these types at file level, since they are used in parameter
- lists, which have wierd scope. */
+/* Declare at file level, since it isused in parameter lists, which
+ have weird scope. */
struct external_exec;
-struct internal_exec;
/* Back-end information for various a.out targets. */
struct aout_backend_data
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 10e9a9d..8e20e3e 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -32,6 +32,7 @@ DESCRIPTION
completeness.
*/
+/*ARGSUSED*/
boolean
DEFUN(_bfd_dummy_new_section_hook,(ignore, ignore_newsect),
bfd *ignore AND
@@ -40,6 +41,7 @@ DEFUN(_bfd_dummy_new_section_hook,(ignore, ignore_newsect),
return true;
}
+/*ARGSUSED*/
boolean
DEFUN(bfd_false ,(ignore),
bfd *ignore)
@@ -47,6 +49,7 @@ DEFUN(bfd_false ,(ignore),
return false;
}
+/*ARGSUSED*/
boolean
DEFUN(bfd_true,(ignore),
bfd *ignore)
@@ -54,6 +57,7 @@ DEFUN(bfd_true,(ignore),
return true;
}
+/*ARGSUSED*/
PTR
DEFUN(bfd_nullvoidptr,(ignore),
bfd *ignore)
@@ -61,6 +65,7 @@ DEFUN(bfd_nullvoidptr,(ignore),
return (PTR)NULL;
}
+/*ARGSUSED*/
int
DEFUN(bfd_0,(ignore),
bfd *ignore)
@@ -68,6 +73,7 @@ DEFUN(bfd_0,(ignore),
return 0;
}
+/*ARGSUSED*/
unsigned int
DEFUN(bfd_0u,(ignore),
bfd *ignore)
@@ -75,12 +81,14 @@ DEFUN(bfd_0u,(ignore),
return 0;
}
+/*ARGSUSED*/
void
DEFUN(bfd_void,(ignore),
bfd *ignore)
{
}
+/*ARGSUSED*/
boolean
DEFUN(_bfd_dummy_core_file_matches_executable_p,(ignore_core_bfd, ignore_exec_bfd),
bfd *ignore_core_bfd AND
@@ -92,6 +100,7 @@ DEFUN(_bfd_dummy_core_file_matches_executable_p,(ignore_core_bfd, ignore_exec_bf
/* of course you can't initialize a function to be the same as another, grr */
+/*ARGSUSED*/
char *
DEFUN(_bfd_dummy_core_file_failing_command,(ignore_abfd),
bfd *ignore_abfd)
@@ -99,6 +108,7 @@ DEFUN(_bfd_dummy_core_file_failing_command,(ignore_abfd),
return (char *)NULL;
}
+/*ARGSUSED*/
int
DEFUN(_bfd_dummy_core_file_failing_signal,(ignore_abfd),
bfd *ignore_abfd)
@@ -106,6 +116,7 @@ DEFUN(_bfd_dummy_core_file_failing_signal,(ignore_abfd),
return 0;
}
+/*ARGSUSED*/
bfd_target *
DEFUN(_bfd_dummy_target,(ignore_abfd),
bfd *ignore_abfd)