This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Building a sparc-sun-solaris2.6 hosted gcc cross compiler for powerpc-wrs-vxworks5.4


Has anyone successfully built gcc to cross compile from sparc-sun-solaris2.6
to powerpc-wrs-vxworks5.4?

I am using binutils-2.10 and gcc-2.95.2.

I've managed to get the compiler to build and it works fine.  At least I
thought it did.  I have recently discovered that the variable arguments
support doesn't work.  I built and ran the following code:

#include "vxWorks.h"
#include "stdarg.h"
#include "stdio.h"

int vargFunc(int arg1, ...)
	int anInt = arg1, count = 1;
	va_list ap;

	va_start(ap, arg1);
	while((anInt != 0) && (count < 10))
		printf("int %d: %d\n", count, anInt);
		anInt = va_arg(ap, int);

int testvarg()
	printf("%d %d %d %d", (int)1, (int)2, (int)3, (int)4);
	vargFunc(1, (int)2, (int)3, (int)4, (int)5, (int)0);

I first built it using the WindRiver supplied compiler (ccppc) and it
produced the expected output.  When built with my newly built compiler the
printf statement in the vargFunc function printed seemingly random numbers
for the variable arguments (the count argument was printed correctly).  I
looked at the code generated by the pre-processor of both compilers and it
was identical.  The va_start and va_arg macros were expanded in to
complicated __builtin_* statements.  I even built and ran the pre-processed
code with (not surprisingly) the same results.  It seems that the
__builtin_* statements aren't generating the correct code in the new
compiler when they do in the old compiler.  The printf statement in the
testvarg function printed the expected results when built with either
compiler.  In all cases the code was linked with the WindRiver supplied
libPPC604gnuvx.a which was presumably built with the WindRiver supplied
compiler.  Suggesting that the new and the old compiler use the same
argument passing calling convention.

Has anyone else experienced this problem.  Does anyone have any idea how to
fix it or even where in the source code I should look.  I have the source
for both the old and the new.  Can I simply copy the old code for these
__builtin_* functions and rebuild?

All help greatly appreciated,

Stuart Lovett.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]