[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Is libc6 OK on powerpc?



> > and the va_arg argument is used in several places inside, e.g.
> >     gi->custom_id = va_arg(ap, int);
> >     strncpy(gi->info_text, va_arg(ap, char *), max_textsize);
> >     gi->type = va_arg(ap, unsigned long);
> >     gi->deco.width = va_arg(ap, int);
> >     gi->deco.height = va_arg(ap, int);
> >     gi->design[GD_BUTTON_PRESSED].bitmap = va_arg(ap, Bitmap *);
> >     gi->event_mask = va_arg(ap, unsigned long);
> >     gi->callback_info = va_arg(ap, gadget_function);
>
> Somewhere, you left out one of the va_arg calls.  It'll be using a char
> or short argument.  This is illegal C; only promoted types (int,
> pointers, etc) may be given to va_arg.

The Bitmap* or gadget_function argument should be cast to void* I think.

> > So this "undefined reference to __va_arg_type_violation", is it a known
> > problem on the powerpc?  Have others met it?  Or does it mean the code has
> > been written poorly?  There's nothing obviously bad in the code that I can

You must be using illegal types as arguments to va_arg (char, short, float,
perhaps the pointers), that's what's bad.

> > see, but I've never had to deal with powerpc or endian issues before (though
> > I can't see any issues here). It works fine on x86.
>
> It works on x86 because x86 is a mostly unaligned architecture, that's
> all :)

Prepare for more breakage (run time, horrible stack corruption) after it
compiles. Passing pointers to va_lists, using va_list_save = va_list
instead of va_copy, all this makes for a fun debugging project.

Lots of ix86 code using varargs isn't written portably, or even to the
spec.

	Michael



Reply to: