This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/34777] uClibc-0.9.29 compilation error for sh4 arch with gcc-4.x
- From: "kkojima at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jan 2008 00:54:24 -0000
- Subject: [Bug target/34777] uClibc-0.9.29 compilation error for sh4 arch with gcc-4.x
- References: <bug-34777-15616@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from kkojima at gcc dot gnu dot org 2008-01-19 00:54 -------
Created an attachment (id=14973)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14973&action=view)
reduced testcase
I think Richard's comment is the case. Here is a reduced testcase.
The PIC memory access on SH4 makes register pressure on R0 high
and sometimes can't use with asm register statement using R0.
It seems that there is no easy way to fix this issue. Currently,
it's a limitation of asm extensions on this target.
In the above testcase, the error will go away with adding
-fno-schedule-insns option, but the more complex cases like PR 34807
will fail even with that option. You could avoid this problem
completely with isolating PIC accesses and asm statements.
For example, if the above reduced testcase is changed so to use
noinline attribute, that program
static __attribute__ ((__noinline__)) void *
_dl_mmap (void * start, int length, int prot, int flags, int fd,
int offset)
{
register long __sc3 __asm__ ("r3") = 90;
register long __sc4 __asm__ ("r4") = (long) start;
register long __sc5 __asm__ ("r5") = (long) length;
register long __sc6 __asm__ ("r6") = (long) prot;
register long __sc7 __asm__ ("r7") = (long) flags;
register long __sc0 __asm__ ("r0") = (long) fd;
register long __sc1 __asm__ ("r1") = (long) offset;
__asm__ __volatile__ ("trapa %1"
: "=z" (__sc0)
: "i" (0x10 + 6), "0" (__sc0), "r" (__sc4),
"r" (__sc5), "r" (__sc6), "r" (__sc7),
"r" (__sc3), "r" (__sc1)
: "memory" );
}
extern int _dl_pagesize;
void _dl_dprintf(int fd, const char *fmt, ...)
{
static char *buf;
buf = _dl_mmap ((void *) 0, _dl_pagesize, 0x1 | 0x2, 0x02 | 0x20, -1, 0);
}
will never hit this problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34777