From 64bf6ae67d0699ac530e79beeae898b7eab6ac57 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Wed, 22 Nov 2000 21:25:36 +0000 Subject: [PATCH] Eliminate compiler warnings from IA-64 port. * coff-ia64.c (howto_table): Use EMPTY_HOWTO. (in_reloc_p): Add ATTRIBUTE_UNUSED to unused parameters. * cpu-ia64-opc.c (ins_rsvd, ext_rsvd, ins_const, ext_const): Likewise. (ins_imms_scaled): Initialize sign_bit at function entry. (elf64_ia64_operands): Add missing initializers. * elfxx-ia64.c (elfNN_ia64_reloc, elfNN_ia64_reloc_type_lookup, elfNN_ia64_info_to_howto, elfNN_ia64_fake_sections, elfNN_ia64_add_symbol_hook, elfNN_ia64_is_local_label_name, elfNN_ia64_local_hash_table_init, get_fptr, get_pltoff, elfNN_ia64_adjust_dynamic_symbol): Add ATTRIBUTE_UNUSED for unused parameters. (elfNN_ia64_info_to_howto): Initialize free_relocs, free_contents, and free_extsyms at function entry. (elfNN_add_symbol_hook): Add unsigned cast to bfd_get_gp_size result. (elfNN_ia64_create_dynamic_sections): Delete unused local h. (get_got): Delete unused local srel. (elfNN_ia64_check_relocs): Initialize dynrel_type when declared. (elfNN_ia64_relocate_section): Delete unused local dynindx. --- bfd/ChangeLog | 21 +++++++++++++++++++++ bfd/coff-ia64.c | 6 +++--- bfd/cpu-ia64-opc.c | 40 ++++++++++++++++++++++------------------ bfd/elfxx-ia64.c | 45 ++++++++++++++++++++------------------------- 4 files changed, 66 insertions(+), 46 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8f2c64942fd..e3393ed0163 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,24 @@ +2000-11-22 Jim Wilson + + * coff-ia64.c (howto_table): Use EMPTY_HOWTO. + (in_reloc_p): Add ATTRIBUTE_UNUSED to unused parameters. + * cpu-ia64-opc.c (ins_rsvd, ext_rsvd, ins_const, ext_const): Likewise. + (ins_imms_scaled): Initialize sign_bit at function entry. + (elf64_ia64_operands): Add missing initializers. + * elfxx-ia64.c (elfNN_ia64_reloc, elfNN_ia64_reloc_type_lookup, + elfNN_ia64_info_to_howto, elfNN_ia64_fake_sections, + elfNN_ia64_add_symbol_hook, elfNN_ia64_is_local_label_name, + elfNN_ia64_local_hash_table_init, get_fptr, get_pltoff, + elfNN_ia64_adjust_dynamic_symbol): Add ATTRIBUTE_UNUSED for unused + parameters. + (elfNN_ia64_info_to_howto): Initialize free_relocs, free_contents, + and free_extsyms at function entry. + (elfNN_add_symbol_hook): Add unsigned cast to bfd_get_gp_size result. + (elfNN_ia64_create_dynamic_sections): Delete unused local h. + (get_got): Delete unused local srel. + (elfNN_ia64_check_relocs): Initialize dynrel_type when declared. + (elfNN_ia64_relocate_section): Delete unused local dynindx. + 2000-11-21 Kazu Hirata * coff-a29k.c: Fix formatting. diff --git a/bfd/coff-ia64.c b/bfd/coff-ia64.c index 6054e4c9989..1f2b4458f3d 100644 --- a/bfd/coff-ia64.c +++ b/bfd/coff-ia64.c @@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ static reloc_howto_type howto_table[] = { - {0}, + EMPTY_HOWTO (0), }; #define BADMAG(x) IA64BADMAG(x) @@ -58,8 +58,8 @@ static reloc_howto_type howto_table[] = static boolean in_reloc_p(abfd, howto) - bfd * abfd; - reloc_howto_type *howto; + bfd * abfd ATTRIBUTE_UNUSED; + reloc_howto_type *howto ATTRIBUTE_UNUSED; { return 0; /* We don't do relocs for now... */ } diff --git a/bfd/cpu-ia64-opc.c b/bfd/cpu-ia64-opc.c index 36de3c818e2..84774d228d6 100644 --- a/bfd/cpu-ia64-opc.c +++ b/bfd/cpu-ia64-opc.c @@ -31,25 +31,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0]))) static const char* -ins_rsvd (const struct ia64_operand *self, ia64_insn value, ia64_insn *code) +ins_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED, + ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED) { return "internal error---this shouldn't happen"; } static const char* -ext_rsvd (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep) +ext_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED, + ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED) { return "internal error---this shouldn't happen"; } static const char* -ins_const (const struct ia64_operand *self, ia64_insn value, ia64_insn *code) +ins_const (const struct ia64_operand *self ATTRIBUTE_UNUSED, + ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED) { return 0; } static const char* -ext_const (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep) +ext_const (const struct ia64_operand *self ATTRIBUTE_UNUSED, + ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED) { return 0; } @@ -133,7 +137,7 @@ static const char* ins_imms_scaled (const struct ia64_operand *self, ia64_insn value, ia64_insn *code, int scale) { - BFD_HOST_64_BIT svalue = value, sign_bit; + BFD_HOST_64_BIT svalue = value, sign_bit = 0; ia64_insn new = 0; int i; @@ -413,19 +417,19 @@ ext_inc3 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep) const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] = { /* constants: */ - { CST, ins_const, ext_const, "NIL", {{ 0, }}, 0, "" }, - { CST, ins_const, ext_const, "ar.ccv", {{ 0, }}, 0, "ar.ccv" }, - { CST, ins_const, ext_const, "ar.pfs", {{ 0, }}, 0, "ar.pfs" }, - { CST, ins_const, ext_const, "1", {{ 0, }}, 0, "1" }, - { CST, ins_const, ext_const, "8", {{ 0, }}, 0, "1" }, - { CST, ins_const, ext_const, "16", {{ 0, }}, 0, "16" }, - { CST, ins_const, ext_const, "r0", {{ 0, }}, 0, "r0" }, - { CST, ins_const, ext_const, "ip", {{ 0, }}, 0, "ip" }, - { CST, ins_const, ext_const, "pr", {{ 0, }}, 0, "pr" }, - { CST, ins_const, ext_const, "pr.rot", {{ 0, }}, 0, "pr.rot" }, - { CST, ins_const, ext_const, "psr", {{ 0, }}, 0, "psr" }, - { CST, ins_const, ext_const, "psr.l", {{ 0, }}, 0, "psr.l" }, - { CST, ins_const, ext_const, "psr.um", {{ 0, }}, 0, "psr.um" }, + { CST, ins_const, ext_const, "NIL", {{ 0, 0}}, 0, "" }, + { CST, ins_const, ext_const, "ar.ccv", {{ 0, 0}}, 0, "ar.ccv" }, + { CST, ins_const, ext_const, "ar.pfs", {{ 0, 0}}, 0, "ar.pfs" }, + { CST, ins_const, ext_const, "1", {{ 0, 0}}, 0, "1" }, + { CST, ins_const, ext_const, "8", {{ 0, 0}}, 0, "1" }, + { CST, ins_const, ext_const, "16", {{ 0, 0}}, 0, "16" }, + { CST, ins_const, ext_const, "r0", {{ 0, 0}}, 0, "r0" }, + { CST, ins_const, ext_const, "ip", {{ 0, 0}}, 0, "ip" }, + { CST, ins_const, ext_const, "pr", {{ 0, 0}}, 0, "pr" }, + { CST, ins_const, ext_const, "pr.rot", {{ 0, 0}}, 0, "pr.rot" }, + { CST, ins_const, ext_const, "psr", {{ 0, 0}}, 0, "psr" }, + { CST, ins_const, ext_const, "psr.l", {{ 0, 0}}, 0, "psr.l" }, + { CST, ins_const, ext_const, "psr.um", {{ 0, 0}}, 0, "psr.um" }, /* register operands: */ { REG, ins_reg, ext_reg, "ar", {{ 7, 20}}, 0, /* AR3 */ diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index fc5ef251bcb..5f93287654e 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -283,10 +283,10 @@ static boolean elfNN_ia64_print_private_bfd_data static bfd_reloc_status_type elfNN_ia64_reloc (abfd, reloc, sym, data, input_section, output_bfd, error_message) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; arelent *reloc; - asymbol *sym; - PTR data; + asymbol *sym ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; asection *input_section; bfd *output_bfd; char **error_message; @@ -418,7 +418,7 @@ lookup_howto (rtype) static reloc_howto_type* elfNN_ia64_reloc_type_lookup (abfd, bfd_code) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; bfd_reloc_code_real_type bfd_code; { unsigned int rtype; @@ -513,7 +513,7 @@ elfNN_ia64_reloc_type_lookup (abfd, bfd_code) static void elfNN_ia64_info_to_howto (abfd, bfd_reloc, elf_reloc) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; arelent *bfd_reloc; ElfNN_Internal_Rela *elf_reloc; { @@ -603,12 +603,12 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *internal_relocs; - Elf_Internal_Rela *free_relocs; + Elf_Internal_Rela *free_relocs = NULL; Elf_Internal_Rela *irel, *irelend; bfd_byte *contents; - bfd_byte *free_contents; + bfd_byte *free_contents = NULL; ElfNN_External_Sym *extsyms; - ElfNN_External_Sym *free_extsyms; + ElfNN_External_Sym *free_extsyms = NULL; struct elfNN_ia64_link_hash_table *ia64_info; struct one_fixup *fixups = NULL; boolean changed_contents = false; @@ -636,7 +636,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) link_info->keep_memory)); if (internal_relocs == NULL) goto error_return; - free_relocs = NULL; + if (! link_info->keep_memory) free_relocs = internal_relocs; @@ -656,7 +656,6 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) } /* Get the section contents. */ - free_contents = NULL; if (elf_section_data (sec)->this_hdr.contents != NULL) contents = elf_section_data (sec)->this_hdr.contents; else @@ -672,7 +671,6 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) } /* Read this BFD's symbols. */ - free_extsyms = NULL; if (symtab_hdr->contents != NULL) extsyms = (ElfNN_External_Sym *) symtab_hdr->contents; else @@ -964,7 +962,7 @@ elfNN_ia64_section_flags (flags, hdr) static boolean elfNN_ia64_fake_sections (abfd, hdr, sec) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; ElfNN_Internal_Shdr *hdr; asection *sec; { @@ -1011,14 +1009,14 @@ elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd *abfd; struct bfd_link_info *info; const Elf_Internal_Sym *sym; - const char **namep; - flagword *flagsp; + const char **namep ATTRIBUTE_UNUSED; + flagword *flagsp ATTRIBUTE_UNUSED; asection **secp; bfd_vma *valp; { if (sym->st_shndx == SHN_COMMON && !info->relocateable - && sym->st_size <= bfd_get_gp_size (abfd)) + && sym->st_size <= (unsigned) bfd_get_gp_size (abfd)) { /* Common symbols less than or equal to -G nn bytes are automatically put into .sbss. */ @@ -1164,7 +1162,7 @@ elfNN_ia64_modify_segment_map (abfd) static boolean elfNN_ia64_is_local_label_name (abfd, name) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; const char *name; { return name[0] == '.'; @@ -1203,7 +1201,7 @@ elfNN_ia64_dynamic_symbol_p (h, info) static boolean elfNN_ia64_local_hash_table_init (ht, abfd, new) struct elfNN_ia64_local_hash_table *ht; - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; new_hash_entry_func new; { memset (ht, 0, sizeof(*ht)); @@ -1433,7 +1431,6 @@ elfNN_ia64_create_dynamic_sections (abfd, info) struct bfd_link_info *info; { struct elfNN_ia64_link_hash_table *ia64_info; - struct elf_link_hash_entry *h; asection *s; if (! _bfd_elf_create_dynamic_sections (abfd, info)) @@ -1537,7 +1534,7 @@ get_got (abfd, info, ia64_info) struct bfd_link_info *info; struct elfNN_ia64_link_hash_table *ia64_info; { - asection *got, *srel; + asection *got; bfd *dynobj; got = ia64_info->got_sec; @@ -1570,7 +1567,7 @@ get_got (abfd, info, ia64_info) static asection * get_fptr (abfd, info, ia64_info) bfd *abfd; - struct bfd_link_info *info; + struct bfd_link_info *info ATTRIBUTE_UNUSED; struct elfNN_ia64_link_hash_table *ia64_info; { asection *fptr; @@ -1607,7 +1604,7 @@ get_fptr (abfd, info, ia64_info) static asection * get_pltoff (abfd, info, ia64_info) bfd *abfd; - struct bfd_link_info *info; + struct bfd_link_info *info ATTRIBUTE_UNUSED; struct elfNN_ia64_link_hash_table *ia64_info; { asection *pltoff; @@ -1758,7 +1755,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) struct elfNN_ia64_dyn_sym_info *dyn_i; int need_entry; boolean maybe_dynamic; - int dynrel_type; + int dynrel_type = R_IA64_NONE; if (r_symndx >= symtab_hdr->sh_info) { @@ -2245,7 +2242,7 @@ allocate_dynrel_entries (dyn_i, data) static boolean elfNN_ia64_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; + struct bfd_link_info *info ATTRIBUTE_UNUSED; struct elf_link_hash_entry *h; { /* ??? Undefined symbols with PLT entries should be re-defined @@ -3614,8 +3611,6 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if ((dynamic_symbol_p || info->shared) && (input_section->flags & SEC_ALLOC) != 0) { - long dynindx; - BFD_ASSERT (srel != NULL); /* If we don't need dynamic symbol lookup, install two -- 2.30.2