From 1e738b87c87fe468ba6dd11f8e94e937d0ee665f Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 21 Sep 2001 14:25:09 +0000 Subject: [PATCH] Fix compile time warnings --- bfd/ChangeLog | 11 +++++++++++ bfd/bfd-in2.h | 4 ++-- bfd/coff-mcore.c | 6 ++++-- bfd/coff-ppc.c | 10 ++++++---- bfd/coffcode.h | 5 ++++- bfd/elf32-mips.c | 12 ++++++++++-- bfd/elf64-alpha.c | 2 +- bfd/elfxx-ia64.c | 11 ++++++++--- bfd/libbfd.c | 7 +++---- include/coff/ChangeLog | 4 ++++ include/coff/ti.h | 2 +- 11 files changed, 54 insertions(+), 20 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 62c5f96e812..4d69e0fb982 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,14 @@ +2001-09-21 Nick Clifton + + * elfxx-ia64.c: Fix compile time warning messages. + * bfd/coff-mcore.c: Fix compile time warning messages. + * bfd/coff-ppc.c: Fix compile time warning messages. + * bfd/coffcode.h: Fix compile time warning messages. + * bfd/elf32-mips.c: Fix compile time warning messages. + * bfd/elf64-alpha.c: Fix compile time warning messages. + * bfd/libbfd.c: Fix compile time warning messages. + * bfd/bfd-in2.h: Regenerate. + 2001-09-21 Alan Modra * Makefile.am: Run "make dep-am". diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 0b5584de092..3f906c6c82b 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -883,11 +883,11 @@ bfd_make_readable PARAMS ((bfd *abfd)); BFD_SEND(abfd, bfd_getx_signed_64, (ptr)) #define bfd_get(bits, abfd, ptr) \ - ((bits) == 8 ? bfd_get_8 (abfd, ptr) \ + ( (bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ - : (abort (), (bfd_vma) - 1)) + : (abort (), (bfd_vma) -1)) #define bfd_put(bits, abfd, val, ptr) \ ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c index 323bc455163..9603e029a61 100644 --- a/bfd/coff-mcore.c +++ b/bfd/coff-mcore.c @@ -39,9 +39,10 @@ Boston, MA 02111-1307, USA. */ final_link routine once. */ extern boolean mcore_bfd_coff_final_link PARAMS ((bfd *, struct bfd_link_info *)); - +#if 0 static struct bfd_link_hash_table * coff_mcore_link_hash_table_create PARAMS ((bfd *)); +#endif static bfd_reloc_status_type mcore_coff_unsupported_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static boolean coff_mcore_relocate_section @@ -55,7 +56,6 @@ static reloc_howto_type * coff_mcore_rtype_to_howto static void mcore_emit_base_file_entry PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_vma)); static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *)); -static struct bfd_link_hash_table * coff_mcore_link_hash_table_create PARAMS ((bfd *)); /* The NT loader points the toc register to &toc + 32768, in order to use the complete range of a 16-bit displacement. We have to adjust @@ -220,6 +220,7 @@ mcore_hash_table; #define coff_mcore_hash_table(info) \ ((mcore_hash_table *) ((info)->hash)) +#if 0 /* Create an MCore coff linker hash table. */ static struct bfd_link_hash_table * @@ -247,6 +248,7 @@ coff_mcore_link_hash_table_create (abfd) return & ret->root.root; } +#endif /* Add an entry to the base file. */ diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index 7dd4aadd258..f2bdfe57a90 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -2176,10 +2176,6 @@ ppc_coff_reloc_type_lookup (abfd, code) #define RTYPE2HOWTO(cache_ptr, dst) ppc_coff_rtype2howto (cache_ptr, dst) -#ifndef COFF_IMAGE_WITH_PE -static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR)); -#endif - /* We use the special COFF backend linker, with our own special touch. */ #define coff_bfd_reloc_type_lookup ppc_coff_reloc_type_lookup @@ -2189,8 +2185,10 @@ static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR)); #ifndef COFF_IMAGE_WITH_PE /* FIXME: This no longer works. */ +#if 0 #define coff_swap_sym_in_hook ppc_coff_swap_sym_in_hook #endif +#endif #define SELECT_RELOC(internal, howto) {internal.r_type=howto->type;} @@ -2218,6 +2216,8 @@ static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR)); #include "coffcode.h" #ifndef COFF_IMAGE_WITH_PE +/* FIXME: This no longer works. */ +#if 0 /* FIXME: What we're trying to do here is allocate a toc section (early), and attach it to the last bfd to be processed. This avoids the problem of having a toc @@ -2231,6 +2231,7 @@ static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR)); 3. Doing it on a "swap in" hook depends on when the "swap in" is called, and how often, etc. It's not clear to me that there isn't a hole here. */ +static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR)); static void ppc_coff_swap_sym_in_hook (abfd, ext1, in1) @@ -2273,6 +2274,7 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, in1) return; } #endif +#endif #ifndef COFF_IMAGE_WITH_PE diff --git a/bfd/coffcode.h b/bfd/coffcode.h index dff083963ad..7c0f3e12776 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1438,7 +1438,10 @@ coff_set_custom_section_alignment (abfd, section, alignment_table, table_size) return; if (alignment_table[i].default_alignment_max != COFF_ALIGNMENT_FIELD_EMPTY - && default_alignment > alignment_table[i].default_alignment_max) +#if COFF_DEFAULT_SECTION_ALIGNMENT_POWER != 0 + && default_alignment > alignment_table[i].default_alignment_max +#endif + ) return; section->alignment_power = alignment_table[i].alignment_power; diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 3a4feb915f1..bba115f8d2d 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -323,7 +323,7 @@ static bfd *reldyn_sorting_bfd; #else #define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? (abort (), false) \ + ? (boolean) (abort (), false) \ : bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val)) #endif @@ -6562,7 +6562,7 @@ mips_elf_obtain_contents (howto, relocation, input_bfd, contents) bfd_byte *location = contents + relocation->r_offset; /* Obtain the bytes. */ - x = bfd_get (8 * bfd_get_reloc_size (howto), input_bfd, location); + x = bfd_get (((bfd_vma)(8 * bfd_get_reloc_size (howto))), input_bfd, location); if ((ELF32_R_TYPE (relocation->r_info) == R_MIPS16_26 || ELF32_R_TYPE (relocation->r_info) == R_MIPS16_GPREL) @@ -6981,7 +6981,11 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_vma high_bits; if (addend & ((bfd_vma) 1 << 31)) +#ifdef BFD64 sign_bits = ((bfd_vma) 1 << 32) - 1; +#else + sign_bits = -1; +#endif else sign_bits = 0; @@ -7103,7 +7107,11 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_vma high_bits; if (value & ((bfd_vma) 1 << 31)) +#ifdef BFD64 sign_bits = ((bfd_vma) 1 << 32) - 1; +#else + sign_bits = -1; +#endif else sign_bits = 0; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 4642baccceb..7d9206efaad 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -1020,7 +1020,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend) { if (ELF64_R_TYPE (urel->r_info) != R_ALPHA_LITUSE) break; - if (urel->r_addend >= 0 && urel->r_addend <= 3) + if (urel->r_addend <= 3) flags |= 1 << urel->r_addend; } diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 0747b8767b8..ef18ec32ed1 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -2772,10 +2772,10 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) } static bfd_reloc_status_type -elfNN_ia64_install_value (abfd, hit_addr, val, r_type) +elfNN_ia64_install_value (abfd, hit_addr, v, r_type) bfd *abfd; bfd_byte *hit_addr; - bfd_vma val; + bfd_vma v; unsigned int r_type; { const struct ia64_operand *op; @@ -2784,6 +2784,11 @@ elfNN_ia64_install_value (abfd, hit_addr, val, r_type) enum ia64_opnd opnd; const char *err; size_t size = 8; +#ifdef BFD_HOST_U_64_BIT + BFD_HOST_U_64_BIT val = (BFD_HOST_U_64_BIT) v; +#else + bfd_vma val = v; +#endif opnd = IA64_OPND_NIL; switch (r_type) @@ -2945,7 +2950,7 @@ elfNN_ia64_install_value (abfd, hit_addr, val, r_type) insn = (dword >> shift) & 0x1ffffffffffLL; op = elf64_ia64_operands + opnd; - err = (*op->insert) (op, val, &insn); + err = (*op->insert) (op, val, (ia64_insn *)& insn); if (err) return bfd_reloc_overflow; diff --git a/bfd/libbfd.c b/bfd/libbfd.c index f7320cc4e2f..5aa51aee272 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -581,8 +581,7 @@ bfd_bwrite (ptr, size, abfd) if (nwrote != size) { #ifdef ENOSPC - if (nwrote >= 0) - errno = ENOSPC; + errno = ENOSPC; #endif bfd_set_error (bfd_error_system_call); } @@ -869,14 +868,14 @@ DESCRIPTION . BFD_SEND(abfd, bfd_getx_signed_64, (ptr)) . .#define bfd_get(bits, abfd, ptr) \ -. ((bits) == 8 ? bfd_get_8 (abfd, ptr) \ +. ( (bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ . : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ . : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ . : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ . : (abort (), (bfd_vma) - 1)) . .#define bfd_put(bits, abfd, val, ptr) \ -. ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ +. ( (bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ . : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ . : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ . : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog index b95d7b5c581..5cc0aac314f 100644 --- a/include/coff/ChangeLog +++ b/include/coff/ChangeLog @@ -1,3 +1,7 @@ +2001-09-21 Nick Clifton + + * ti.h (GET_SCNHDR_PAGE): Fix compile time warning. + 2001-09-18 Alan Modra * external.h (GET_LINENO_LNNO): Use H_GET_32/16. diff --git a/include/coff/ti.h b/include/coff/ti.h index 5c58d8936fa..7f45a56e572 100644 --- a/include/coff/ti.h +++ b/include/coff/ti.h @@ -219,7 +219,7 @@ struct external_scnhdr { #define PUT_SCNHDR_FLAGS(ABFD, VAL, PTR) \ (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, (PTR) -4)) #define GET_SCNHDR_PAGE(ABFD, PTR) \ - (COFF2_P (ABFD) ? H_GET_16 (ABFD, PTR) : H_GET_8 (ABFD, (PTR) -7)) + (COFF2_P (ABFD) ? H_GET_16 (ABFD, PTR) : (unsigned) H_GET_8 (ABFD, (PTR) -7)) /* on output, make sure that the "reserved" field is zero */ #define PUT_SCNHDR_PAGE(ABFD, VAL, PTR) \ (COFF2_P (ABFD) \ -- 2.30.2