problem compiling ia64-gen.c with current tree

James E Wilson wilson@specifix.com
Fri Oct 14 19:08:00 GMT 2005


On Fri, 2005-10-14 at 05:39, Doug Evans wrote:
> gcc -DHAVE_CONFIG_H -I. -I/home/dje/gnu/src/opcodes -I. -D_GNU_SOURCE -I. -I/home/dje/gnu/src/opcodes -I../bfd -I/home/dje/gnu/src/opcodes/../include -I/home/dje/gnu/src/opcodes/../bfd  -I/home/dje/gnu/src/opcodes/../intl -I../intl   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c /home/dje/gnu/src/opcodes/ia64-gen.c
> /home/dje/gnu/src/opcodes/ia64-gen.c: In function `print_main_table':
> /home/dje/gnu/src/opcodes/ia64-gen.c:2704: warning: long unsigned int format, different type arg (arg 3)
> /home/dje/gnu/src/opcodes/ia64-gen.c:2706: warning: long unsigned int format, different type arg (arg 3)

ia64-gen.c requires the 64-bit (BFD64) definition of fprintf_vma from
bfd/bfd-in2.h.  We could perhaps just copy the 32-bit host version of
that into the ia64-gen.c file and rename it.  It is only 4 lines of
code, and will work for both 32-bit and 64-bit hosts.

An alternative is to require --enable-64-bit-bfd in order to build it. 
This is what is done in the bfd directory, where the ia64 files are in
BFD64_BACKENDS, and are only built if BFD64 is defined.  This would
require more hackery than the above, as there is currently no
distinction between 32-bit and 64-bit targets in the opcodes directory.

How about the attached patch?
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com
-------------- next part --------------
2005-10-14  James E Wilson  <wilson@specifix.com>

	* ia64-gen.c (_opcode_int64_low, _opcode_int64_high,
	opcode_fprintf_vma): New.
	(print_main_table): New opcode_fprintf_vma instead of fprintf_vma.

Index: ia64-gen.c
===================================================================
RCS file: /cvs/src/src/opcodes/ia64-gen.c,v
retrieving revision 1.16
diff -p -p -r1.16 ia64-gen.c
*** ia64-gen.c	7 Jul 2005 19:27:50 -0000	1.16
--- ia64-gen.c	14 Oct 2005 19:03:55 -0000
***************
*** 54,59 ****
--- 54,68 ----
  #include <libintl.h>
  #define _(String) gettext (String)
  
+ /* This is a copy of fprintf_vma from bfd/bfd-in2.h.  We have to use this
+    always, because we might be compiled without BFD64 defined, if configured
+    for a 32-bit target and --enable-targets=all is used.  This will work for
+    both 32-bit and 64-bit hosts.  */
+ #define _opcode_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
+ #define _opcode_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
+ #define opcode_fprintf_vma(s,x) \
+   fprintf ((s), "%08lx%08lx", _opcode_int64_high (x), _opcode_int64_low (x))
+ 
  const char * program_name = NULL;
  int debug = 0;
  
*************** print_main_table (void)
*** 2701,2709 ****
  	      ptr->name->num,
  	      ptr->opcode->type,
  	      ptr->opcode->num_outputs);
!       fprintf_vma (stdout, ptr->opcode->opcode);
        printf ("ull, 0x");
!       fprintf_vma (stdout, ptr->opcode->mask);
        printf ("ull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n",
  	      ptr->opcode->operands[0],
  	      ptr->opcode->operands[1],
--- 2710,2718 ----
  	      ptr->name->num,
  	      ptr->opcode->type,
  	      ptr->opcode->num_outputs);
!       opcode_fprintf_vma (stdout, ptr->opcode->opcode);
        printf ("ull, 0x");
!       opcode_fprintf_vma (stdout, ptr->opcode->mask);
        printf ("ull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n",
  	      ptr->opcode->operands[0],
  	      ptr->opcode->operands[1],


More information about the Binutils mailing list