problem compiling ia64-gen.c with current tree

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

problem compiling ia64-gen.c with current tree

Doug Evans-2
fyi,

host=i686-pc-gnu-linux, tree configured with
../src/configure --target=m32r-elf --prefix=/mumble \
  --enable-maintainer-mode \
  --enable-targets=all \
  --enable-cgen-maint

-->

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)
make[3]: *** [ia64-gen.o] Error 1
make[3]: Leaving directory `/play/gnu/b-m32r-src/opcodes'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/play/gnu/b-m32r-src/opcodes'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/play/gnu/b-m32r-src/opcodes'
make: *** [all-opcodes] Error 2


fprintf_vma is used to print an ia64_insn which is a long long.

      fprintf_vma (stdout, ptr->opcode->opcode);
      printf ("ull, 0x");
      fprintf_vma (stdout, ptr->opcode->mask);

--> [from .i]

      fprintf (stdout, "%08lx", ptr->opcode->opcode);
      printf ("ull, 0x");
      fprintf (stdout, "%08lx", ptr->opcode->mask);
Reply | Threaded
Open this post in threaded view
|

Re: problem compiling ia64-gen.c with current tree

Nick Clifton
Hi Doug,

> /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)

Does this patch work for you ?

Cheers
   Nick



Index: opcodes/ia64-gen.c
===================================================================
RCS file: /cvs/src/src/opcodes/ia64-gen.c,v
retrieving revision 1.16
diff -c -3 -p -r1.16 ia64-gen.c
*** opcodes/ia64-gen.c 7 Jul 2005 19:27:50 -0000 1.16
--- opcodes/ia64-gen.c 14 Oct 2005 13:44:46 -0000
*************** 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],
--- 2701,2709 ----
       ptr->name->num,
       ptr->opcode->type,
       ptr->opcode->num_outputs);
!       fprintf (stdout, "%016ux", ptr->opcode->opcode);
        printf ("ull, 0x");
!       fprintf (stdout, "%016ux", ptr->opcode->mask);
        printf ("ull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n",
       ptr->opcode->operands[0],
       ptr->opcode->operands[1],
Reply | Threaded
Open this post in threaded view
|

Re: problem compiling ia64-gen.c with current tree

Doug Evans-2
I don't see how this can work.  The data is long long and I'm using a 32
bit system.

Question: To what extent has binutils gone Standard C?
Can we use inttypes.h here?  I don't care what; for grin's sake cast to
uintmax_t and use PRIxMAX?

Nick Clifton wrote:

> Hi Doug,
>
>> /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)
>
>
> Does this patch work for you ?
>
> Cheers
>   Nick
>
>
>------------------------------------------------------------------------
>
>Index: opcodes/ia64-gen.c
>===================================================================
>RCS file: /cvs/src/src/opcodes/ia64-gen.c,v
>retrieving revision 1.16
>diff -c -3 -p -r1.16 ia64-gen.c
>*** opcodes/ia64-gen.c 7 Jul 2005 19:27:50 -0000 1.16
>--- opcodes/ia64-gen.c 14 Oct 2005 13:44:46 -0000
>*************** 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],
>--- 2701,2709 ----
>        ptr->name->num,
>        ptr->opcode->type,
>        ptr->opcode->num_outputs);
>!       fprintf (stdout, "%016ux", ptr->opcode->opcode);
>        printf ("ull, 0x");
>!       fprintf (stdout, "%016ux", ptr->opcode->mask);
>        printf ("ull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n",
>        ptr->opcode->operands[0],
>        ptr->opcode->operands[1],
>  
>

Reply | Threaded
Open this post in threaded view
|

Re: problem compiling ia64-gen.c with current tree

Andreas Schwab
Doug Evans <[hidden email]> writes:

> Question: To what extent has binutils gone Standard C?
> Can we use inttypes.h here?  I don't care what; for grin's sake cast to
> uintmax_t and use PRIxMAX?

Binutils source is written in C89/C90, which does not have inttypes.h, but
you can autoconf it.  Note that there is great variance in support for
features of inttypes.h on pre-C99 hosts.

Andreas.

--
Andreas Schwab, SuSE Labs, [hidden email]
SuSE Linux Products GmbH, Maxfeldstra?e 5, 90409 N?rnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Reply | Threaded
Open this post in threaded view
|

Re: problem compiling ia64-gen.c with current tree

Jim Wilson-6
In reply to this post by Doug Evans-2
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

patch.32-bit.ia64-gen (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: problem compiling ia64-gen.c with current tree

Jim Wilson-6
On Fri, 2005-10-14 at 12:08, James E Wilson wrote:
> How about the attached patch?

I never got around to checking this in.  It is checked in now.  I tested
it on an x86_64-linux system, building two trees one with gcc and one
with "gcc -m32", verified that I could reproduce the problem, and
verified that the patch results in no difference to the output
ia64-asmtab.c file.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com