This is the mail archive of the gcc@gcc.gnu.org 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]
Other format: [Raw text]

Build problem: sparc64 host, avr target


I've been told by the Debian people (who have helped to find 64-bit
portability issues some time ago), that the avr target fails to build
on a sparc64 machine.  The problem is with invalid assembler output
from the newly built cross-compiler, when compiling libgcc2.c.

The RTL is wrong - there is (reg/f:HI 3 r3) instead of r28 (Y pointer
register, which is used as a frame pointer), and of course this results
in incorrect assembler output (like "movw r8,r3" where an even register
number is required for a HImode value, and HARD_REGNO_MODE_OK should
guarantee this).  All other Debian architectures build fine (see
http://buildd.debian.org/build.php?pkg=gcc-avr for details), only
build on sparc fails.

Examples of wrong output (-mrtl --save-temps added to xgcc options):

/* prologue end (size=22) */
/*****************
(insn 4 155 6 (set (mem:QI (plus:HI (reg/f:HI 3 r3)
                (const_int 9 [0x9])) [8 u S1 A8])
        (reg:QI 18 r18)) 9 {*movqi} (nil)
    (nil))
*****************/
	std Y+9,r18

In this case, the RTL is wrong, but the asm output happens to be correct
by accident - simply because out_movhi_mr_r doesn't do enough checking,
so no one would notice this if we didn't also have the following...

/*****************
(insn 161 42 44 (set (reg:HI 8 r8)
        (reg/f:HI 3 r3)) 12 {*movhi} (nil)
    (nil))
*****************/
	movw r8,r3

There should be r28 instead of r3.  If you reverse the order of bits in
a 32-bit value, bit 3 becomes bit 28.  The problem is specific to sparc,
a few other big endian (I think some 64-bit too) architectures are fine.

The other two pointer registers (X=r26, Z=r30) appear correctly in the
RTL and assembler output, only the frame pointer is causing trouble.

Could someone with access to a 64-bit sparc box help me to debug it?
First build and install binutils 2.13 with "./configure --target=avr",
then build GCC 3.2 with "./configure --target=avr --enable-languages=c
and see where it fails.

Thanks,
Marek


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