From 5f9ca9603825b26fca8625e98e34e75aa599f26f Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Thu, 15 Oct 1992 09:44:59 +0000 Subject: [PATCH] * aout-adobe.c, aoutf1.h, aoutx.h, bout.c coff-m68k.c, coff-z8k.c, coffcode.h, elf.c, libaout.h, libbfd.h, srec.c: Lint. --- bfd/ChangeLog | 3 +++ bfd/aoutf1.h | 1 - bfd/aoutx.h | 1 - bfd/bout.c | 20 +++++--------------- bfd/coff-m68k.c | 21 ++++++++++----------- bfd/coff-z8k.c | 15 ++++++++------- bfd/coffcode.h | 1 - bfd/elf.c | 7 ------- bfd/srec.c | 23 +++++++++++------------ 9 files changed, 37 insertions(+), 55 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e69851e..33b1f2a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -5,6 +5,9 @@ Thu Oct 15 01:32:22 1992 John Gilmore (gnu@cygnus.com) sco-core.c: Lint: Second argument of bfd_seek is always file_ptr. Third argument is SEEK_SET or SEEK_CUR. Result is always 0 or -1. + * aout-adobe.c, aoutf1.h, aoutx.h, bout.c coff-m68k.c, coff-z8k.c, + coffcode.h, elf.c, libaout.h, libbfd.h, srec.c: Lint. + Fri Oct 9 03:46:37 1992 John Gilmore (gnu@cygnus.com) * configure.host: New file, contains mapping of host configs diff --git a/bfd/aoutf1.h b/bfd/aoutf1.h index da933cd..11da04c 100644 --- a/bfd/aoutf1.h +++ b/bfd/aoutf1.h @@ -141,7 +141,6 @@ DEFUN(NAME(aout,sunos4_write_object_contents), (abfd), bfd *abfd) { - bfd_size_type data_pad = 0; struct external_exec exec_bytes; struct internal_exec *execp = exec_hdr (abfd); diff --git a/bfd/aoutx.h b/bfd/aoutx.h index b009384..a874757 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -827,7 +827,6 @@ DEFUN (NAME (aout,adjust_sizes_and_vmas), (abfd, text_size, text_end), break; case n_magic: { - CONST struct aout_backend_data *abdp; file_ptr pos = adata(abfd).exec_bytes_size; bfd_vma vma = 0; int pad; diff --git a/bfd/bout.c b/bfd/bout.c index 020ca13..8ab69c2 100644 --- a/bfd/bout.c +++ b/bfd/bout.c @@ -888,6 +888,7 @@ DEFUN(get_value,(reloc, seclet), { bfd_vma value; asymbol *symbol = *(reloc->sym_ptr_ptr); + /* A symbol holds a pointer to a section, and an offset from the base of the section. To relocate, we find where the section will live in the output and add that in */ @@ -904,8 +905,7 @@ DEFUN(get_value,(reloc, seclet), symbol->section->output_offset + symbol->section->output_section->vma; } - - + /* Add the value contained in the relocation */ value += (short)((reloc->addend) & 0xffff); @@ -962,7 +962,6 @@ DEFUN(abs32code,(input_section, symbols, r, shrink), if (-1<<23 < (long)gap && (long)gap < 1<<23 ) { - /* Change the reloc type from 32bitcode possible 24, to 24bit possible 32 */ @@ -973,8 +972,6 @@ DEFUN(abs32code,(input_section, symbols, r, shrink), /* This will be four bytes smaller in the long run */ shrink += 4 ; perform_slip(symbols, 4, input_section, r->address-shrink +4); - - } return shrink; } @@ -986,20 +983,17 @@ DEFUN(aligncode,(input_section, symbols, r, shrink), arelent *r AND unsigned int shrink) { - bfd_vma value = get_value(r,0); - bfd_vma dot = input_section->output_section->vma + input_section->output_offset + r->address; bfd_vma gap; bfd_vma old_end; bfd_vma new_end; - int shrink_delta; -int size = r->howto->size; + int shrink_delta; + int size = r->howto->size; + /* Reduce the size of the alignment so that it's still aligned but smaller - the current size is already the same size as or bigger than the alignment required. */ - - /* calculate the first byte following the padding before we optimize */ old_end = ((dot + size ) & ~size) + size+1; /* work out where the new end will be - remember that we're smaller @@ -1013,7 +1007,6 @@ int size = r->howto->size; if (shrink_delta) { - /* Change the reloc so that it knows how far to align to */ r->howto = howto_done_align_table + (r->howto - howto_align_table); @@ -1022,9 +1015,6 @@ int size = r->howto->size; r->addend = old_end ; /* This will be N bytes smaller in the long run, adjust all the symbols */ - - - perform_slip(symbols, shrink_delta, input_section, r->address - shrink ); shrink += shrink_delta; } diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c index 891e7a3..f357fea 100644 --- a/bfd/coff-m68k.c +++ b/bfd/coff-m68k.c @@ -44,22 +44,21 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define BADMAG(x) M68KBADMAG(x) #define M68 1 /* Customize coffcode.h */ +void m68k_rtype2howto(internal, relocentry) -arelent *internal; -int relocentry; + arelent *internal; + int relocentry; { switch (relocentry) { - case R_RELBYTE: (internal)->howto = ( m68kcoff_howto_table + 0);break; - case R_RELWORD: (internal)->howto = ( m68kcoff_howto_table + 1);break; - case R_RELLONG: (internal)->howto = ( m68kcoff_howto_table + 2);break; - case R_PCRBYTE: (internal)->howto = ( m68kcoff_howto_table + 3);break; - case R_PCRWORD: (internal)->howto = ( m68kcoff_howto_table + 4);break; - case R_PCRLONG: (internal)->howto = ( m68kcoff_howto_table + 5);break; - case R_RELLONG_NEG: (internal)->howto = ( m68kcoff_howto_table + 6);break; + case R_RELBYTE: internal->howto = m68kcoff_howto_table + 0; break; + case R_RELWORD: internal->howto = m68kcoff_howto_table + 1; break; + case R_RELLONG: internal->howto = m68kcoff_howto_table + 2; break; + case R_PCRBYTE: internal->howto = m68kcoff_howto_table + 3; break; + case R_PCRWORD: internal->howto = m68kcoff_howto_table + 4; break; + case R_PCRLONG: internal->howto = m68kcoff_howto_table + 5; break; + case R_RELLONG_NEG: internal->howto = m68kcoff_howto_table + 6; break; } - - } #define RTYPE2HOWTO(internal, relocentry) m68k_rtype2howto(internal, (relocentry)->r_type) diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c index e4968aa..864b51e 100644 --- a/bfd/coff-z8k.c +++ b/bfd/coff-z8k.c @@ -151,14 +151,15 @@ static void DEFUN(reloc_processing,(relent,reloc, symbols, abfd, section) , } static bfd_vma get_value(); -static + +static void extra_case(in_abfd, seclet, reloc, data, src_ptr, dst_ptr) -bfd *in_abfd; -bfd_seclet_type *seclet; -arelent *reloc; -bfd_byte *data; -unsigned int *src_ptr; -unsigned int *dst_ptr; + bfd *in_abfd; + bfd_seclet_type *seclet; + arelent *reloc; + bfd_byte *data; + unsigned int *src_ptr; + unsigned int *dst_ptr; { switch (reloc->howto->type) { diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 6b311f9..1fef148 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -2315,7 +2315,6 @@ coff_add_missing_symbols (abfd) asymbol **sympp2; unsigned int i; int need_text = 1, need_data = 1, need_bss = 1, need_file = 1; - coff_data_type *cdata = coff_data (abfd); for (i = 0; i < nsyms; i++) { diff --git a/bfd/elf.c b/bfd/elf.c index 7f3a430..8dc971d 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -476,7 +476,6 @@ DEFUN(bfd_section_from_shdr, (abfd, shindex), { asection *target_sect; - unsigned int idx; bfd_section_from_shdr (abfd, hdr->sh_link); /* symbol table */ bfd_section_from_shdr (abfd, hdr->sh_info); /* target */ @@ -1047,7 +1046,6 @@ DEFUN (elf_object_p, (abfd), bfd *abfd) Elf_Internal_Shdr *i_shdrp; /* Section header table, internal form */ int shindex; char *shstrtab; /* Internal copy of section header stringtab */ - Elf_Off offset; /* Temp place to stash file offsets */ /* Read in the ELF header in external format. */ @@ -1910,7 +1908,6 @@ DEFUN (elf_slurp_symbol_table, (abfd, symptrs), Elf_Internal_Shdr *hdr = i_shdrp + elf_onesymtab (abfd); int symcount; /* Number of external ELF symbols */ int i; - char *strtab; /* Buffer for raw ELF string table section */ asymbol *sym; /* Pointer to current bfd symbol */ asymbol *symbase; /* Buffer for generated bfd symbols */ Elf_Internal_Sym i_sym; @@ -2206,7 +2203,6 @@ DEFUN(elf_slurp_reloca_table,(abfd, asect, symbols), RELOC_PROCESSING(cache_ptr, &dst, symbols, abfd, asect); #else Elf_Internal_Rela dst; - asymbol *ptr; Elf_External_Rela *src; cache_ptr = reloc_cache + idx; @@ -2227,7 +2223,6 @@ DEFUN(elf_slurp_reloca_table,(abfd, asect, symbols), /* ELF_R_SYM(dst.r_info) is the symbol table offset... */ cache_ptr->sym_ptr_ptr = symbols + ELF_R_SYM(dst.r_info); cache_ptr->addend = dst.r_addend; - /* ptr = *(cache_ptr->sym_ptr_ptr); */ /* Fill in the cache_ptr->howto field from dst.r_type */ elf_info_to_howto(abfd, cache_ptr, &dst); @@ -2269,8 +2264,6 @@ DEFUN (elf_get_symtab, (abfd, alocation), bfd *abfd AND asymbol **alocation) { - unsigned int symcount; - asymbol **vec; if (!elf_slurp_symbol_table (abfd, alocation)) return (0); diff --git a/bfd/srec.c b/bfd/srec.c index 6f3081a..fd63066 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -76,20 +76,20 @@ DESCRIPTION #include "sysdep.h" #include "libbfd.h" -static char digs[] = "0123456789ABCDEF"; +/* Macros for converting between hex and binary */ -/* Horrible ascii dependent macros for converting between hex and - binary */ +static const char digs[] = "0123456789ABCDEF"; + +static char hex_value[1 + (unsigned char)~0]; -#define CHARS_IN_SET 256 -static char hex_value[CHARS_IN_SET]; #define NOT_HEX 20 -#define NIBBLE(x) hex_value[x] +#define NIBBLE(x) hex_value[(unsigned char)(x)] #define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1])) -#define TOHEX(d,x, ch) \ -d[1] = digs[(x) & 0xf]; \ -d[0] = digs[((x)>>4)&0xf]; ch += (x & 0xff); -#define ISHEX(x) (hex_value[x] != NOT_HEX) +#define TOHEX(d, x, ch) \ + d[1] = digs[(x) & 0xf]; \ + d[0] = digs[((x)>>4)&0xf]; \ + ch += ((x) & 0xff); +#define ISHEX(x) (hex_value[(unsigned char)(x)] != NOT_HEX) @@ -104,7 +104,7 @@ DEFUN_VOID(srec_init) inited = true; - for (i = 0; i < CHARS_IN_SET; i++) + for (i = 0; i < sizeof (hex_value); i++) { hex_value[i] = NOT_HEX; } @@ -429,7 +429,6 @@ void DEFUN(srec_write_record,(abfd, type, address, data, end), { TOHEX(dst, *src, check_sum); dst+=2; - } /* Fill in the length */ -- 2.7.4