On Thu, Mar 22, 2001 at 12:51:02AM +1100, Drew Parsons wrote: > gcc main.o init.o events.o tools.o screens.o game.o editor.o files.o > cartoons.o libgame/libgame.a -lSDL_image -lSDL_mixer -L/usr/lib -lSDL > -lpthread -lm -o ../mirrormagic > libgame/libgame.a(gadgets.o): In function HandleGadgetTags': > gadgets.o(.text+0x9f8): undefined reference to __va_arg_type_violation' > gadgets.o(.text+0x9f8): relocation truncated to fit: R_PPC_REL24 > __va_arg_type_violation > collect2: ld returned 1 exit status > make[2]: *** [../mirrormagic] Error 1
> The code in question is declared as: > > static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) > > 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. > 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 > 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 :) -- Daniel Jacobowitz Debian GNU/Linux Developer Monta Vista Software Debian Security Team "I am croutons!"