This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

i686 -> powerpc gcc 2.95.3 trouble



Hi folks,

I'm having some trouble with a gcc 2.95.3 cross 
compiler I built for powerpc (405GP "walnut" in 
this case)

The problem I'm having:

I have a user app with a function defined like so:
(I had a proper prototype, and a fucntion that
actually tried to do something, but I took most of
it out in the process of eliminating as much as possible 
while still having the problem appear.)

	long find_unused_blocksx()
	{
		printf("hello!\n"); fflush(stdout);
		return 0;
	}

Later, that function is called:

	long totalsize;

	[...]

	unused_blocks = find_unused_blocksx((void *) NULL,
		666, 777, totalsize); 


Somewhere During the call ("hello" never comes out), I get
"Illegal Instruction" 

If I remove the "totalsize" parameter and call the function this 
way:
	unused_blocks = find_unused_blocksx((void *) NULL, 666, 777); 

It works fine, which makes me think it's something about the actual
function call that's messed up.

If I create a simple C program with the function above
it seems to work, it seems only in the context of this
larger program that it breaks.

My compiler options are like:

/usr/local/powerpc-linux/bin/gcc -Wa,-m405 -g -DLINUX -DOS_MODEL=LINUX -I../include -c y.tab.c

I get the same results without the -Wa,-m405

I have another "working gcc" that I didn't build, which will produce 
usable code, which is why I think something is wrong with my compiler.  
However, my "broken gcc" will successfully build a usable linux kernel 
(the latest powerpc port from penguinppc.org's bitkeeper tree) while 
this "working gcc" won't build this kernel.  (that's the reason I made 
my gcc at all.)

Using the -S optino, I get assembly code for the region of the
offending function call that looks like this:

Working code from the "working gcc" (claims to be gcc 2.95.2):

	mr 10,4
	mr 3,9
	mr 4,10
	bl __fixdfsi
	stw 3,152(31)
.stabn 68,0,1640,.LM898-diskinfo
.LM898:
	li 3,0
	li 4,666
	li 5,777
	lwz 6,152(31)
	bl find_unused_blocksx
	mr 0,3
	stw 0,148(31)

Broken code from my "broken gcc":

	fmul 12,0,13
	fctiwz 0,12
	stfd 0,160(31)
	lwz 0,164(31)
	stw 0,144(31)
.stabn 68,0,1640,.LM898-diskinfo
.LM898:
	li 3,0
	li 4,666
	li 5,777
	lwz 6,144(31)
	crxor 6,6,6
	bl find_unused_blocksx
	mr 0,3
	stw 0,140(31)

I build my gcc cross compiler with redhat 7.2 native gcc, 
which is 2.96.

I got my glibc headers for the cross compiler 
out of this rpm from ftp.yellowdoglinux.com
glibc-devel-2.2.5-0.19a.ppc.rpm

Used this stuff to build my gcc, from ftp.gnu.org:

binutils-2.12.90.0.4.tar.bz2
gcc-2.95.3.tar.gz
glibc-2.2.5-0.19a.ppc.rpm
glibc-2.2.5.tar.gz
glibc-linuxthreads-2.2.5.tar.gz

Any ideas what I might be doing wrong, 
or what I might try?

Thanks,

-- steve


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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