This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[RFA] Fix libbfd.a compilation for mingw64.
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'Binutils'" <binutils at sourceware dot org>
- Date: Fri, 14 Jan 2011 16:22:29 +0100
- Subject: [RFA] Fix libbfd.a compilation for mingw64.
mingw64 has this nasty feature that sizeof(long) == 4,
while sizeof (void *) == 8.
This leads to some failures when trying to compile
libbfd.a for mingw64 with --enable-targets=all option.
The change in elf32-rx.c is related to the
missing bfd_stdint.h inclusion, which also forbids successful
compilation of libbfd.a library.
Could someone please review this patch?
I just tested that it did not create
any new failure for gdb testsuite
on a x86_64 linux machine
configured with --enable-targets=all,
but I have no knowledge about Binutils testsuite ...
Pierre Muller
GDB pascal language maintainer
2011-01-14 Pierre Muller <muller@ics.u-strasbg.fr>
Fix compilation for mingw64.
* coffcode.h (coff_slurp_symbol_table): Add intptr_t intermediate
typecast to avoid warning.
* elf32-rx.c: Add "bfd_stdint.h" include required for int32_t type
usage.
* elfxx-ia64.c (elfNN_ia64_relax_br): Use intptr_t typeacast instead
of long for pointer to avoid warning.
(elfNN_ia64_relax_brl): Idem.
(elfNN_ia64_install_value): Idem.
* vms-alpha.c (_bfd_vms_slurp_etir): Idem.
Index: src/bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.171
diff -u -p -r1.171 coffcode.h
--- src/bfd/coffcode.h 4 Nov 2010 16:03:22 -0000 1.171
+++ src/bfd/coffcode.h 14 Jan 2011 14:52:18 -0000
@@ -4852,7 +4852,7 @@ coff_slurp_symbol_table (bfd * abfd)
to the symbol instead of the index. FIXME: This
should use a union. */
src->u.syment.n_value =
- (long) (native_symbols + src->u.syment.n_value);
+ (long) (intptr_t) (native_symbols + src->u.syment.n_value);
dst->symbol.value = src->u.syment.n_value;
src->fix_value = 1;
break;
Index: src/bfd/elf32-rx.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-rx.c,v
retrieving revision 1.7
diff -u -p -r1.7 elf32-rx.c
--- src/bfd/elf32-rx.c 5 Jan 2011 22:04:08 -0000 1.7
+++ src/bfd/elf32-rx.c 14 Jan 2011 14:52:19 -0000
@@ -20,6 +20,7 @@
#include "sysdep.h"
#include "bfd.h"
+#include "bfd_stdint.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/rx.h"
Index: src/bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.229
diff -u -p -r1.229 elfxx-ia64.c
--- src/bfd/elfxx-ia64.c 8 Nov 2010 02:48:56 -0000 1.229
+++ src/bfd/elfxx-ia64.c 14 Jan 2011 14:52:19 -0000
@@ -636,7 +636,7 @@ elfNN_ia64_relax_br (bfd_byte *contents,
bfd_byte *hit_addr;
hit_addr = (bfd_byte *) (contents + off);
- br_slot = (long) hit_addr & 0x3;
+ br_slot = (intptr_t) hit_addr & 0x3;
hit_addr -= br_slot;
t0 = bfd_getl64 (hit_addr + 0);
t1 = bfd_getl64 (hit_addr + 8);
@@ -738,7 +738,7 @@ elfNN_ia64_relax_brl (bfd_byte *contents
bfd_vma t0, t1, i0, i1, i2;
hit_addr = (bfd_byte *) (contents + off);
- hit_addr -= (long) hit_addr & 0x3;
+ hit_addr -= (intptr_t) hit_addr & 0x3;
t0 = bfd_getl64 (hit_addr);
t1 = bfd_getl64 (hit_addr + 8);
@@ -3874,7 +3874,7 @@ elfNN_ia64_install_value (bfd_byte *hit_
switch (opnd)
{
case IA64_OPND_IMMU64:
- hit_addr -= (long) hit_addr & 0x3;
+ hit_addr -= (intptr_t) hit_addr & 0x3;
t0 = bfd_getl64 (hit_addr);
t1 = bfd_getl64 (hit_addr + 8);
@@ -3903,7 +3903,7 @@ elfNN_ia64_install_value (bfd_byte *hit_
break;
case IA64_OPND_TGT64:
- hit_addr -= (long) hit_addr & 0x3;
+ hit_addr -= (intptr_t) hit_addr & 0x3;
t0 = bfd_getl64 (hit_addr);
t1 = bfd_getl64 (hit_addr + 8);
@@ -3928,7 +3928,7 @@ elfNN_ia64_install_value (bfd_byte *hit_
break;
default:
- switch ((long) hit_addr & 0x3)
+ switch ((intptr_t) hit_addr & 0x3)
{
case 0: shift = 5; break;
case 1: shift = 14; hit_addr += 3; break;
Index: src/bfd/vms-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-alpha.c,v
retrieving revision 1.38
diff -u -p -r1.38 vms-alpha.c
--- src/bfd/vms-alpha.c 13 Dec 2010 01:06:16 -0000 1.38
+++ src/bfd/vms-alpha.c 14 Jan 2011 14:52:20 -0000
@@ -1709,7 +1709,7 @@ _bfd_vms_slurp_etir (bfd *abfd, struct b
#if VMS_DEBUG
_bfd_vms_debug (4, "etir: %s(%d)\n",
_bfd_vms_etir_name (cmd), cmd);
- _bfd_hexdump (8, ptr, cmd_length - 4, (long) ptr);
+ _bfd_hexdump (8, ptr, cmd_length - 4, (intptr_t) ptr);
#endif
switch (cmd)