itszor / gcc-6502-bits

Build tools, tiny C library, etc. for gcc-6502 port.
61 stars 17 forks source link

vfprintf.c in tiny C Library fails to compile #6

Closed elminster closed 7 years ago

elminster commented 7 years ago

On stage 2 the build fails with

***************************
* Building tiny C library *
***************************

.: compile: exit.c
.: compile: abort.c
.: compile: stdfiles.c
.: compile: semi65x/fputc.c
.: compile: fputs.c
.: compile: putchar.c
.: compile: puts.c
.: compile: vfprintf.c
vfprintf.c: In function 'print_udec':
vfprintf.c:36:1: internal compiler error: Max. number of generated reload insns per insn is achieved (90)

 }
  ^
0x83865b lra_constraints(bool)
    ../../gcc-src/gcc/lra-constraints.c:4831
0x81e34b lra(_IO_FILE*)
    ../../gcc-src/gcc/lra.c:2335
0x7b70f7 do_reload
    ../../gcc-src/gcc/ira.c:5417
0x7b75df execute
    ../../gcc-src/gcc/ira.c:5588

I have done a fresh install of Ubuntu 17 on x86_64 and installed cc65 as both packages and afrom source.

$ gcc --version
gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406

I have also tried an ARM build on Raspberry Pi from source and that fails with the same error.

pi@raspberrypi ~/code/code/gcc-6502-bits $ gcc --version
gcc (Debian 4.6.3-14+rpi1) 4.6.3
itszor commented 7 years ago

Hmm... not sure why that might be. There's an experimental branch in the gcc-6502 repo proper that you could try though, something like:

$ cd gcc-src $ git checkout m65x-gcc6-virt

then retry the build. Let me know how you get on if you try it!

elminster commented 7 years ago

Ah ha. Yes that seems to have done something, using the expr branch it has now compiled on X86_64 Ubuntu.

2972888 May 2 16:37 6502-cpp
2960400 May 2 16:37 6502-gcc
2386616 May 1 01:33 6502-gcc-6.0.0
2960400 May 2 16:37 6502-gcc-6.1.1
108056  May 2 16:37 6502-gcc-ar
108032  May 2 16:37 6502-gcc-nm
108040  May 2 16:37 6502-gcc-ranlib
1844632 May 2 16:37 6502-gcov
1880848 May 2 16:37 6502-gcov-tool

Will see if it now compiles on ARM. And also running some tests to see if I can cross compile anything. Hopefully I can and issue can be closed.

elminster commented 7 years ago

Looks okay


    === gcc Summary ===

 of expected passes     63374
 of unexpected failures 2159
 of unexpected successes    2
 of expected failures       101
 of unresolved testcases    1115
 of unsupported tests       2783

$ 6502-gcc helloworld.c -O2 -o helloworld
$ ../gcc-6502-bits/semi65x/semi65x -l 0x200 ./helloworld
Hello World
$ 

Using 6502-gcc -mmach=bbcmaster -mcpu=65C02 -O2 helloworld.c -o hello2

and a lot of head scratching I managed to get

Hello World

to display on a real BBC Master. For some odd reason it is not displaying on Beebem.

So I guess the issue can be closed with the caveat it is fixed using experimental code. Thanks.

elminster commented 7 years ago

Took a while to compile but fix means it now also builds on Raspberry Pi's ARM as well.