Problems with 4.9.2 M32C target
Patrick Oppenlander
pattyo.lists@gmail.com
Tue Feb 10 22:22:00 GMT 2015
Hi,
I'm having some trouble with the 4.9.2 M32C target.
Problems start when trying to build the cross compiler. The m32cm
multilib fails with:
configure: error: unable to detect exception model
make[2]: *** [configure-target-libgcc] Error 1
Makefile:11635: recipe for target 'configure-target-libgcc' failed
make[2]: Leaving directory
'/home/patrick/src/m16c/toolchain/build/gcc-4.9.2-stage2'
make[1]: *** [all] Error 2
Makefile:849: recipe for target 'all' failed
make[1]: Leaving directory
'/home/patrick/src/m16c/toolchain/build/gcc-4.9.2-stage2'
make: ***
[/home/patrick/src/m16c/toolchain/build/gcc-4.9.2-stage2/.compiled] Error 2
gcc/gcc.mk:114: recipe for target
'/home/patrick/src/m16c/toolchain/build/gcc-4.9.2-stage2/.compiled' failed
make gcc-stage2 596.96s user 37.86s system 87% cpu 12:01.42 total
tee log 0.04s user 0.56s system 0% cpu 12:01.42 total
(full build log attached if anyone is interested)
I haven't investigated that issue and am hoping someone may be able to help.
Given that I'm only interested in the m16c variant of the processor I
disabled the m32cm multilib with a patch (m16c-multilib.patch attached)
to temporarily work around the build issue.
I now had a working compiler which appears to be able to compile normal
code, however there appear to be a few issues with the far memory support.
The following test case demonstrates one issue:
extern char *src;
extern char __far *far_src;
extern char *dest;
extern char __far *far_dest;
void test(void)
{
*dest = *src;
*dest = *far_src;
*far_dest = *src;
*far_dest = *far_src;
}
./m32c-elf-gcc -mcpu=m16c -c -o test.o ~/src/patrick/m32c/bug.c
/tmp/ccUMQwCN.s: Assembler messages:
/tmp/ccUMQwCN.s:18: Error: unrecognized keyword/register name `ste.b
[a1a0],r0l'
/tmp/ccUMQwCN.s:30: Error: Invalid literal `lde.b r0l,[a1a0]'
/tmp/ccUMQwCN.s:41: Error: unrecognized keyword/register name `ste.b
[a1a0],r0l'
/tmp/ccUMQwCN.s:44: Error: Invalid literal `lde.b r0l,[a1a0]'
Looked like gcc was emitting some garbage instructions. In fact, the
ste.b and lde.b are reversed. I spent some time trying to understand the
issue and came up with m32c.patch (attached). The assembly output now
looks ok, however I am not sure about the full side-effects of the patch.
There are now two issues which I have been unable to address:
Issue 1:
char x[1];
void __far *test(void)
{
return x;
}
./m32c-elf-gcc -mcpu=m16c -c -o test.o ~/src/patrick/m32c/bug2.c
/home/patrick/src/patrick/m32c/bug2.c: In function 'test':
/home/patrick/src/patrick/m32c/bug2.c:6:1: error: unrecognizable insn:
}
^
(insn 5 2 6 2 (set (reg:SI 28)
(zero_extend:SI (symbol_ref:HI ("x") <var_decl 0x7f37210fa390
x>))) /home/patrick/src/patrick/m32c/bug2.c:5 -1
(nil))
/home/patrick/src/patrick/m32c/bug2.c:6:1: internal compiler error: in
extract_insn, at recog.c:2202
Issue 2:
char __far x[1];
void __far *test(void)
{
return x;
}
./m32c-elf-gcc -mcpu=m16c -c -o test.o ~/src/patrick/m32c/bug3.c
/home/patrick/src/patrick/m32c/bug3.c: In function 'test':
/home/patrick/src/patrick/m32c/bug3.c:6:1: internal compiler error: in
elimination_costs_in_insn, at reload1.c:3638
Unfortunately I don't know enough about the internals of GCC to make a
sane attempt at addressing either of these.
I started by reading
https://gcc.gnu.org/onlinedocs/gccint/Machine-Desc.html to try to
understand the first issue, but this document is a bit too low-level for
me to digest at this time. I know what RTL *is*, but have no idea about
the details of the operations GCC generates and how it expects the
machine description to interpret them. Is there a high-level
introduction of GCC internals available? I admit laziness on this point
as I haven't had a chance to do much searching.
I haven't done any work towards understanding the second issue at all.
For now, I have a compiler which I think will be useful for the short
term, but I would like to have __far support working in the future as I
have a large lookup table which should really go in flash memory (__far)
on the m16c.
I would appreciate any help towards addressing the above issues.
Thanks,
Patrick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: m32cm-multilib-failure.log.tar.xz
Type: application/x-xz
Size: 61824 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20150210/4776eab1/attachment.xz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: m16c-multilib.patch
Type: text/x-patch
Size: 448 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20150210/4776eab1/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: m32c.patch
Type: text/x-patch
Size: 373 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20150210/4776eab1/attachment-0001.bin>
More information about the Gcc-help
mailing list