bebbo / libnix

libnix (v4): a C link library for AmigaOS/m68k
14 stars 9 forks source link

Check for 68881 does not work anmore with toolchain from 26Jan24 #76

Closed githubaf closed 1 month ago

githubaf commented 4 months ago

We had a check for the presence of 68020 and also for 68881.

An alert was displayed with address "68020" if project was build for 68020 or above but only an 68000 is present. That still works.

We had a second check for 68881. If project was build for FPU but no FPU is present an alert "68881" was shown. That does no longer work.

githubaf commented 4 months ago

For 68060 the last toolchain that created the executable with the FPU check was from 15Dec23. Starting with 16Dec23 the FPU check code is no longer in the executable.

The other cpu variants still had the FPU check code up to 23Jan24 according to my tests.

bebbo commented 4 months ago

You have to specify -m68881 or -mhard-float.

Since there are 68060 versions without FPU, specifying -m68060 is not sufficient.

githubaf commented 4 months ago

Hm, OK. I will experiment more and report.

githubaf commented 4 months ago

I tried to following test with the toolchain from Feb, 6th: cat test.c

#include <stdio.h>
#include <math.h>

float circumference( int radius)
{
   return 2*M_PI*radius;
}

int main(void)
{
   int i;
   for(i=1;i<11;i++)
   {
      printf("radius %d, circumference=%f\n",i,circumference(i));
   }
   return 0;
}
m68k-amigaos-gcc -noixemul -Wall --pedantic  -m68020 -m68881 -O2  test.c -o test -lm

vamos test   # plain 68000 and of course no FPU

12:25:33.367    doslist:WARNING:  t:ENV does not exist
12:25:33.373    machine:  ERROR:  ----- ERROR in CPU Run #1 -----
12:25:33.373    machine:  ERROR:  Run: 'test': Initial PC=002360, SP=0068d0
12:25:33.373    machine:  ERROR:  PC=00000404  SR=-----    USP=000068b4 ISP=000006f8 MSP=00000780
12:25:33.373    machine:  ERROR:  D0=00000001  D1=0000abfc  D2=0000000a  D3=ffffffff  D4=ffffffb1  D5=ffffff84  D6=00000000  D7=00000000
12:25:33.373    machine:  ERROR:  A0=000046b8  A1=0002cc9c  A2=000024b8  A3=0000471c  A4=00000000  A5=000068bc  A6=0000133c  A7=000006f8
12:25:33.373    machine:  ERROR:  SP-32=000000 SP-28=000000 SP-24=000000 SP-20=000000 SP-16=000000 SP-12=000000 SP-08=000000 SP-04=000000
12:25:33.373    machine:  ERROR:  SP+00=7000000 SP+04=247c002c SP+08=000000 SP+12=000000 SP+16=000000 SP+20=000000 SP+24=000000 SP+28=000000
12:25:33.373    machine:  ERROR:  InvalidCPUStateError: Invalid CPU State: pc=00247c: m68k Exception: sr=0700
12:25:33.373       main:  ERROR:  vamos failed!
12:25:33.373     libmgr:WARNING:  can't expunge: 'dos.library' with open count 1
12:25:33.373     libmgr:WARNING:  shutdown: can't expunge 1 vamos libs/devs!
bebbo commented 1 month ago

please test

githubaf commented 1 month ago

Yes, now it is working again. Thank you very much!

githubaf commented 1 month ago

Arg, seems I was to fast :-(

CPU and FPU check work for the 68020 executable. Seems also to be correct now with the 68040 executable. *68060 executable still have that that issue. Seems the CPU/FPU check is missing. I used my tiny example from above: https://github.com/bebbo/libnix/issues/76#issuecomment-1952263481

m68k-amigaos-gcc -noixemul -Wall --pedantic  -m68060 -m68881 -O2  test.c -o test -lm
developer@cn-vm-afritsch:~/Desktop/bebbo$ vamos -C00 -m1024 test   # plain 68000 and of course no FPU
21:20:37.007    doslist:WARNING:  t:ENV does not exist
21:20:37.016    machine:  ERROR:  ----- ERROR in CPU Run #1 -----
21:20:37.016    machine:  ERROR:  Run: 'test': Initial PC=002360, SP=0074b4
21:20:37.016    machine:  ERROR:  PC=00000404  SR=-----    USP=00007498 ISP=000006fa MSP=00000780
21:20:37.016    machine:  ERROR:  D0=00000000  D1=0000ba98  D2=00000001  D3=ffffffff  D4=ffffffb1  D5=ffffff84  D6=00000000  D7=00000000
21:20:37.016    machine:  ERROR:  A0=00005294  A1=0002db38  A2=000024b0  A3=000052f0  A4=00000000  A5=000074a0  A6=0000133c  A7=000006fa
21:20:37.016    machine:  ERROR:  SP-32=000000 SP-28=000000 SP-24=000000 SP-20=000000 SP-16=000000 SP-12=000000 SP-08=000000 SP-04=000000
21:20:37.016    machine:  ERROR:  SP+00=7000000 SP+04=24740000 SP+08=000000 SP+12=000000 SP+16=000000 SP+20=000000 SP+24=000000 SP+28=000000
21:20:37.016    machine:  ERROR:  InvalidCPUStateError: Invalid CPU State: pc=002474: m68k Exception: sr=0700
21:20:37.016       main:  ERROR:  vamos failed!
21:20:37.016     libmgr:WARNING:  can't expunge: 'dos.library' with open count 1
21:20:37.016     libmgr:WARNING:  can't expunge: 'mathieeedoubbas.library' with open count 1
21:20:37.016     libmgr:WARNING:  can't expunge: 'utility.library' with open count 1
21:20:37.016     libmgr:WARNING:  shutdown: can't expunge 3 vamos libs/devs!
bebbo commented 1 month ago

please test, lib search path was bogus

githubaf commented 1 month ago

Now it seem to work in all my configurations. (Toolchain from 11. May24) Thank you very much!