This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: GDB multi-build failure in lm32-opc.c file
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: Pierre Muller <muller at ics dot u-strasbg dot fr>
- Cc: binutils at sourceware dot org
- Date: Sat, 14 Feb 2009 14:16:18 +0000
- Subject: Re: GDB multi-build failure in lm32-opc.c file
- References: <20090214144637.hzlq5bf0m8kso00s@webmail.u-strasbg.fr>
Pierre Muller wrote:
> lm32-opc.o
> cc1: warnings being treated as errors
> In function ?memset?,
> inlined from ?lm32_cgen_init_opcode_table? at
> ../../src/opcodes/lm32-opc.c:847:
> /usr/include/bits/string3.h:82: error: call to ?__warn_memset_zero_len?
> declared with attribute warning: memset used with constant zero length
> parameter; this could be due to transposed parameters
> make[3]: *** [lm32-opc.lo] Error 1
>
> Seems to suggest that CGEN_INSN type is
> still opaque and thus of unknown size...
Nah, otherwise you'd get an error about trying to use an incomplete
definition; sizeof() wouldn't just return zero. So looking at that line in
lm32-opc.c,
837 void
838 lm32_cgen_init_opcode_table (CGEN_CPU_DESC cd)
839 {
840 int i;
841 int num_macros = (sizeof (lm32_cgen_macro_insn_table) /
842 sizeof (lm32_cgen_macro_insn_table[0]));
843 const CGEN_IBASE *ib = & lm32_cgen_macro_insn_table[0];
844 const CGEN_OPCODE *oc = & lm32_cgen_macro_insn_opcode_table[0];
845 CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
846
847 memset (insns, 0, num_macros * sizeof (CGEN_INSN));
it must be the case that num_macros is zero. And indeed:
742 static const CGEN_IBASE lm32_cgen_macro_insn_table[] =
743 {
744 };
I would guess something went wrong when it got autogenerated, or conceivably
it's supposed to be empty but the warning on zero-size memset is new? LM32 is
a very recent port, only added in December. As a workaround, you could
probably add a single dummy entry just to get it to compile, as long as you
don't try debugging any LM32 executables you should be ok. Something as
simple as an empty default initialiser:
742 static const CGEN_IBASE lm32_cgen_macro_insn_table[] =
743 {
{ }
744 };
ought to do the trick.
cheers,
DaveK