[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BFD compile time warning fixes
From: |
Nick Clifton |
Subject: |
BFD compile time warning fixes |
Date: |
21 Sep 2001 15:22:10 +0100 |
Hi Guys,
I am checking in the following patch to fix most of the remaining
compile time warning messages in the BFD library. Only the
following warnings remain:
bfd/elf32-hppa.c: In function `elf32_hppa_check_relocs':
bfd/elf32-hppa.c:1588: warning: suggest parentheses around && within ||
bfd/elf32-hppa.c: In function `elf32_hppa_relocate_section':
bfd/elf32-hppa.c:3936: warning: suggest parentheses around && within ||
and:
bfd/trad-core.c: In function `trad_unix_core_file_p':
bfd/trad-core.c:222: warning: cast from pointer to integer of different size
(when compiling with --enable-64-bit-bfd)
Cheers
Nick
bfd
2001-09-21 Nick Clifton <address@hidden>
* 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.
include/opcodes
2001-09-21 Nick Clifton <address@hidden>
* ti.h (GET_SCNHDR_PAGE): Fix compiel time warning.
Index: bfd/coff-mcore.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-mcore.c,v
retrieving revision 1.22
diff -p -r1.22 coff-mcore.c
*** coff-mcore.c 2001/09/20 23:30:34 1.22
--- coff-mcore.c 2001/09/21 14:20:17
*************** Boston, MA 02111-1307, USA. */
*** 39,47 ****
final_link routine once. */
extern boolean mcore_bfd_coff_final_link
PARAMS ((bfd *, struct bfd_link_info *));
!
static struct bfd_link_hash_table * coff_mcore_link_hash_table_create
PARAMS ((bfd *));
static bfd_reloc_status_type mcore_coff_unsupported_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static boolean coff_mcore_relocate_section
--- 39,48 ----
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
*************** static reloc_howto_type * coff
*** 55,61 ****
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
--- 56,61 ----
*************** mcore_hash_table;
*** 220,225 ****
--- 220,226 ----
#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 *
*************** coff_mcore_link_hash_table_create (abfd)
*** 247,252 ****
--- 248,254 ----
return & ret->root.root;
}
+ #endif
/* Add an entry to the base file. */
Index: bfd/coff-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-ppc.c,v
retrieving revision 1.13
diff -p -r1.13 coff-ppc.c
*** coff-ppc.c 2001/09/20 23:30:34 1.13
--- coff-ppc.c 2001/09/21 14:20:17
*************** ppc_coff_reloc_type_lookup (abfd, code)
*** 2176,2185 ****
#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
--- 2176,2181 ----
*************** static void ppc_coff_swap_sym_in_hook PA
*** 2189,2196 ****
--- 2185,2194 ----
#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;}
*************** static void ppc_coff_swap_sym_in_hook PA
*** 2218,2223 ****
--- 2216,2223 ----
#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
*************** static void ppc_coff_swap_sym_in_hook PA
*** 2231,2236 ****
--- 2231,2237 ----
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)
*************** ppc_coff_swap_sym_in_hook (abfd, ext1, i
*** 2272,2277 ****
--- 2273,2279 ----
return;
}
+ #endif
#endif
#ifndef COFF_IMAGE_WITH_PE
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.62
diff -p -r1.62 coffcode.h
*** coffcode.h 2001/09/20 23:30:34 1.62
--- coffcode.h 2001/09/21 14:20:18
*************** coff_set_custom_section_alignment (abfd,
*** 1438,1444 ****
return;
if (alignment_table[i].default_alignment_max != COFF_ALIGNMENT_FIELD_EMPTY
! && default_alignment > alignment_table[i].default_alignment_max)
return;
section->alignment_power = alignment_table[i].alignment_power;
--- 1438,1447 ----
return;
if (alignment_table[i].default_alignment_max != COFF_ALIGNMENT_FIELD_EMPTY
! #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;
Index: bfd/elf32-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mips.c,v
retrieving revision 1.114
diff -p -r1.114 elf32-mips.c
*** elf32-mips.c 2001/09/20 23:30:35 1.114
--- elf32-mips.c 2001/09/21 14:20:21
*************** static bfd *reldyn_sorting_bfd;
*** 323,329 ****
#else
#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
(ABI_64_P (elf_hash_table (info)->dynobj) \
! ? (abort (), false)
\
: bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val))
#endif
--- 323,329 ----
#else
#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
(ABI_64_P (elf_hash_table (info)->dynobj) \
! ? (boolean) (abort (), false) \
: bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val))
#endif
*************** mips_elf_obtain_contents (howto, relocat
*** 6562,6568 ****
bfd_byte *location = contents + relocation->r_offset;
/* Obtain the bytes. */
! x = bfd_get (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)
--- 6562,6568 ----
bfd_byte *location = contents + relocation->r_offset;
/* Obtain the bytes. */
! 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)
*************** _bfd_mips_elf_relocate_section (output_b
*** 6981,6987 ****
--- 6981,6991 ----
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;
*************** _bfd_mips_elf_relocate_section (output_b
*** 7103,7109 ****
--- 7107,7117 ----
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;
Index: bfd/elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.42
diff -p -r1.42 elf64-alpha.c
*** elf64-alpha.c 2001/09/20 23:30:36 1.42
--- elf64-alpha.c 2001/09/21 14:20:22
*************** elf64_alpha_relax_with_lituse (info, sym
*** 1020,1026 ****
{
if (ELF64_R_TYPE (urel->r_info) != R_ALPHA_LITUSE)
break;
! if (urel->r_addend >= 0 && urel->r_addend <= 3)
flags |= 1 << urel->r_addend;
}
--- 1020,1026 ----
{
if (ELF64_R_TYPE (urel->r_info) != R_ALPHA_LITUSE)
break;
! if (urel->r_addend <= 3)
flags |= 1 << urel->r_addend;
}
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.24
diff -p -r1.24 elfxx-ia64.c
*** elfxx-ia64.c 2001/09/20 23:30:36 1.24
--- elfxx-ia64.c 2001/09/21 14:20:23
*************** elfNN_ia64_size_dynamic_sections (output
*** 2772,2781 ****
}
static bfd_reloc_status_type
! elfNN_ia64_install_value (abfd, hit_addr, val, r_type)
bfd *abfd;
bfd_byte *hit_addr;
! bfd_vma val;
unsigned int r_type;
{
const struct ia64_operand *op;
--- 2772,2781 ----
}
static bfd_reloc_status_type
! elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
bfd *abfd;
bfd_byte *hit_addr;
! bfd_vma v;
unsigned int r_type;
{
const struct ia64_operand *op;
*************** elfNN_ia64_install_value (abfd, hit_addr
*** 2784,2789 ****
--- 2784,2794 ----
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)
*************** elfNN_ia64_install_value (abfd, hit_addr
*** 2945,2951 ****
insn = (dword >> shift) & 0x1ffffffffffLL;
op = elf64_ia64_operands + opnd;
! err = (*op->insert) (op, val, &insn);
if (err)
return bfd_reloc_overflow;
--- 2950,2956 ----
insn = (dword >> shift) & 0x1ffffffffffLL;
op = elf64_ia64_operands + opnd;
! err = (*op->insert) (op, val, (ia64_insn *)& insn);
if (err)
return bfd_reloc_overflow;
Index: bfd/libbfd.c
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.c,v
retrieving revision 1.19
diff -p -r1.19 libbfd.c
*** libbfd.c 2001/09/20 23:30:37 1.19
--- libbfd.c 2001/09/21 14:20:23
*************** bfd_bwrite (ptr, size, abfd)
*** 581,588 ****
if (nwrote != size)
{
#ifdef ENOSPC
! if (nwrote >= 0)
! errno = ENOSPC;
#endif
bfd_set_error (bfd_error_system_call);
}
--- 581,587 ----
if (nwrote != size)
{
#ifdef ENOSPC
! errno = ENOSPC;
#endif
bfd_set_error (bfd_error_system_call);
}
*************** DESCRIPTION
*** 869,882 ****
. BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
.
.#define bfd_get(bits, abfd, ptr) \
! . ((bits) == 8 ? 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) == 16 ? bfd_put_16 (abfd, val, ptr) \
. : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
. : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
--- 868,881 ----
. BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
.
.#define bfd_get(bits, 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) == 16 ? bfd_put_16 (abfd, val, ptr) \
. : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
. : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
Index: include/coff/ti.h
===================================================================
RCS file: /cvs/src/src/include/coff/ti.h,v
retrieving revision 1.10
diff -p -r1.10 ti.h
*** ti.h 2001/09/18 10:01:08 1.10
--- ti.h 2001/09/21 14:20:24
*************** struct external_scnhdr {
*** 219,225 ****
#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))
/* on output, make sure that the "reserved" field is zero */
#define PUT_SCNHDR_PAGE(ABFD, VAL, PTR) \
(COFF2_P (ABFD) \
--- 219,225 ----
#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) : (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) \
- BFD compile time warning fixes,
Nick Clifton <=