itszor / gcc-6502

A port of GCC to the 6502 processor family.
GNU General Public License v2.0
97 stars 17 forks source link

Compilation fails #1

Closed iss000 closed 10 years ago

iss000 commented 10 years ago

I followed step by step instructions, but compilation failed: make[3]: Leaving directory /root/work/repos/public/gcc-6502-bits/gcc-build/6502/libgcc' /root/work/repos/public/gcc-6502-bits/gcc-build/./gcc/xgcc -B/root/work/repos/public/gcc-6502-bits/gcc-build/./gcc/ -B/root/work/repos/public/gcc-6502-bits/prefix/6502/bin/ -B/root/work/repos/public/gcc-6502-bits/prefix/6502/lib/ -isystem /root/work/repos/public/gcc-6502-bits/prefix/6502/include -isystem /root/work/repos/public/gcc-6502-bits/prefix/6502/sys-include -g -O2 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -I. -I. -I../.././gcc -I../../../gcc-6502/libgcc -I../../../gcc-6502/libgcc/. -I../../../gcc-6502/libgcc/../gcc -I../../../gcc-6502/libgcc/../include -DHAVE_CC_TLS -DUSE_EMUTLS -o _fixunssfsi.o -MT _fixunssfsi.o -MD -MP -MF _fixunssfsi.dep -DL_fixunssfsi -c ../../../gcc-6502/libgcc/libgcc2.c /tmp/ccWyFLg4.s(82): Error: Range error (-128 not in [0..255]) make[2]: *** [_fixunssfsi.o] Error 1 make[2]: Leaving directory/root/work/repos/public/gcc-6502-bits/gcc-build/6502/libgcc' make[1]: * [all-target-libgcc] Error 2 make[1]: Leaving directory `/root/work/repos/public/gcc-6502-bits/gcc-build' make: * [all] Error 2

itszor commented 10 years ago

On Thu, May 01, 2014 at 10:07:45AM -0700, iss000 wrote:

I followed step by step instructions, but compilation failed: make[3]: Leaving directory `/root/work/repos/public/gcc-6502-bits/gcc-build/6502/libgcc' /root/work/repos/public/gcc-6502-bits/gcc-build/./gcc/xgcc -B/root/work/repos/public/gcc-6502-bits/gcc-build/./gcc/ -B/root/work/repos/public/gcc-6502-bits/prefix/6502/bin/ -B/root/work/repos/public/gcc-6502-bits/prefix/6502/lib/ -isystem /root/work/repos/public/gcc-6502-bits/prefix/6502/include -isystem /root/work/repos/public/gcc-6502-bits/prefix/6502/sys-include -g -O2 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -I. -I. -I../.././gcc -I../../../gcc-6502/libgcc -I../../../gcc-6502/libgcc/. -I../../../gcc-6502/libgcc/../gcc -I../../../gcc-6502/libgcc/../include -DHAVE_CC_TLS -DUSE_EMUTLS -o _fixunssfsi.o -MT _fixunssfsi.o -MD -MP -MF _fixunssfsi.dep -DL_fixunssfsi -c ../../../gcc-6502/libgcc/libgcc2.c /tmp/ccWyFLg4.s(82): Error: Range error (-128 not in [0..255])

Can you send me preprocessed source please? Isolate the command that fails (you did that already), add -save-temps and send me the resulting libgcc2.i (and libgcc2.s for good measure)?

My first guess is that this is caused by a different ca65 version to the one I'm using...

Thanks,

Julian

iss000 commented 10 years ago

Hi Julian, Thanks for response. Yes, the problem is in the ca65. I'm using the last version build from the git repository. Please, send me or just point me to the version you use. My email: iss (at) dir.bg I checked the problem and here is the first failed function (in libgcc2.c) and the preprocessed file:

error here: sbc #-$80

UWtype
__fixunssfSI (SFtype a)
{
  if (a >= - (SFtype) Wtype_MIN)
    return (Wtype) (a + Wtype_MIN) - Wtype_MIN;
  return (Wtype) a;
}

.feature at_in_identifiers
.feature dollar_in_identifiers
.autoimport +
.p02
.importzp _sp0, _sp1, _fp0, _fp1
.importzp _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7
.importzp _s0, _s1, _s2, _s3, _s4, _s5, _s6, _s7
.importzp _tmp0, _tmp1
.segment "CODE"
.export __fixunssfqi
__fixunssfqi:
; frame size 0, pretend size 0, outgoing size 0
lda _s4
pha
lda _s3
pha
lda _s2
pha
lda _s1
pha
lda _s0
pha
lda _r0
sta _s3
lda _r1
sta _s2
lda _r2
sta _s1
lda _r3
sta _s0
lda #$86
sta _s4
lda #$00
sta _r4
sta _r5
sta _r6
lda _s4
sta _r7
jsr __gesf2
lda _r0
cmp #$00
bne L@8
lda _s3
sta _r0
lda _s2
sta _r1
lda _s1
sta _r2
lda _s0
sta _r3
jsr __fixsfsi
pla
sta _s0
pla
sta _s1
pla
sta _s2
pla
sta _s3
pla
sta _s4
rts
L@8:
lda _s3
sta _r0
lda _s2
sta _r1
lda _s1
sta _r2
lda _s0
sta _r3
lda #$00
sta _r4
sta _r5
sta _r6
lda _s4
sta _r7
jsr __subsf3
jsr __fixsfsi
lda _r0
sec
sbc #-$80
sta _r0
pla
sta _s0
pla
sta _s1
pla
sta _s2
pla
sta _s3
pla
sta _s4
rts
itszor commented 10 years ago

This should now be fixed. Please try again!

Thanks

iss000 commented 10 years ago

Thanks! Compilation works now. Unfortunately my results after 'check.sh' (i.e. dejagnu tests (dejagnu is last git version)) are far from yours:

=== gcc Summary === of expected passes 40843 of unexpected failures 14775 of unexpected successes 1 of expected failures 103 of unresolved testcases 13369 of unsupported tests 2340

Please, what version of cc65 are you used before last patch?

itszor commented 10 years ago

On Fri, May 09, 2014 at 12:39:34PM -0700, iss000 wrote:

Thanks! Compilation works now. Unfortunately my results after 'check.sh' (i.e. dejagnu tests (dejagnu is last git version)) are far from yours:

Have you built the semi65x binary?

Julian

iss000 commented 10 years ago

Yes, I follow everything step-by-step as in your guide. semi65x is successful built and working. Here are my log files after "check.sh" (~ 2MB zipped): http://mail.dir.bg/~iss/testresults-2014-05-09-1.zip.

itszor commented 10 years ago

Strange. My ca65 and ld65 identify as:

$ ca65 --version
ca65 V2.14 - Git 9056e41
$ ld65 --version
ld65 V2.14 - Git 9056e41

I compiled this version from github, i.e. https://github.com/cc65/cc65.

iss000 commented 10 years ago

Great! I updated cc65 and everything now is fine (even it's better than your results :D) === gcc Summary ===

of expected passes 62312 of unexpected failures 4130 of unexpected successes 1 of expected failures 104 of unresolved testcases 2544 of unsupported tests 2340

Many thanks for support. I'm interesting in support of Oric/Atmos 8 bit computers and I added to 'mmach' their support. Do you think that it's good idea to include the particular crt0.S files for c64/bbcb/... from cc65?

itszor commented 10 years ago

On Sat, May 10, 2014 at 05:41:01PM -0700, iss000 wrote:

Great! I updated cc65 and everything now is fine (even it's better than your results :D) === gcc Summary ===

of expected passes 62312 of unexpected failures 4130 of unexpected successes 1 of expected failures 104 of unresolved testcases 2544 of unsupported tests 2340

Many thanks for support. I'm interesting in support of Oric/Atmos 8 bit computers and I added to 'mmach' their support. Do you think that it's good idea to include the particular crt0.S files for c64/bbcb/... from cc65?

Excellent! It might be possible to support cc65's crt0, etc. files, but I haven't really looked into that (I've just been concentrating on making things work at all so far!). The rest of cc65's libraries won't be directly compatible (at least the assembler bits), because I'm using a different calling convention for GCC.

The existing mmach bits aren't really done (I need to add machine-specific support to libtinyc -- enough to get off the ground at least, and there's a couple of GCC tweaks needed for that maybe too), but maybe I'll work on that next. There are still lots of code generation bugs in GCC, but it might be nice to try code on real hardware!

Julian

iss000 commented 10 years ago

Many thanks again for your great work and support! I'll follow your work and will be happy to help (somehow...). Ivan