RISCV can't build contribs

Bug #2002930 reported by Douglas Katzman
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

Bug Description

The 'cat' command in make-contrib.lisp doesn't work and that's because run-program doesn't work and that seems to be due to broken alien calls for certain call signatures.

I built at this change from last July which must have worked a little bit better:
commit 9d1c91edc2462177d4070a4202480e12ae5ae919 (HEAD)
Author: Stas Boukarev <email address hidden>
Date: Tue Jul 5 16:32:41 2022 +0300
    Workaround a bootstrapping problem on ppc64, riscv.

and observed that many 'run-program' tests failed back then as well (per below). Now that the build depends on run-program, it's much worse off. We should figure out what the support level is because it's only going to deteriorate further if contribs can't be built.

::: UNEXPECTED-FAILURE (RUN-PROGRAM :CAT 1) due to SB-INT:BROKEN-PIPE:
        "Couldn't write to #<SB-SYS:FD-STREAM for "descriptor 6" {526F3393}>:
           Broken pipe"
::: Running (RUN-PROGRAM :CAT 2)
::: UNEXPECTED-FAILURE (RUN-PROGRAM :CAT 2) due to END-OF-FILE:
        "end of file on #<SB-SYS:FD-STREAM for "descriptor 7" {52886E63}>"
::: Running (RUN-PROGRAM :CAT 3)
Unhandled SB-INT:BROKEN-PIPE in thread #<SB-THREAD:THREAD RUNNING {528882D3}>:
  Couldn't write to #<SB-SYS:FD-STREAM for "descriptor 6" {52886BE3}>:
    Broken pipe

// Running run-program.test.sh in COMPILE evaluator mode
foo bar
Unhandled SIMPLE-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING
                                    {514F4003}>:
  The assertion
  (STRING= STRING "foo bar
")
  failed with STRING = "".

Revision history for this message
Stas Boukarev (stassats) wrote :

I didn't actually build it on riscv back then (or ever).

Revision history for this message
Charles (karlosz) wrote :

Somehow I suspect it's not actually broken, because we probably would've gotten a report by the suse folk, and I didn't observe these failures when I build in around February last year. Probably whatever risc-v environment you have is borked?

Revision history for this message
Douglas Katzman (dougk) wrote :

are there different ABIs? I used to use whatever gcc farm machine was an amd64 with user mode qemu for riscv. Now they have SiFive physical hardware. So if anything it should be better/newer.
I added some printing into spawn() - all the strings come through as total garbage.

Revision history for this message
Douglas Katzman (dougk) wrote :

Must be an unreported regression. I went back even further, to

commit 147d56602ee275c3371d7f1a294c4d1594d8d39a (HEAD)
Author: Douglas Katzman <email address hidden>
Date: Thu Feb 24 00:44:51 2022 -0500
    riscv: workaround QEMU user mode emulator issue

which, with absolute certainty, was able to build, though not pass regressions (for me anyway) because as it remarked "the regression suite crashes a ton in user mode emulation."
Nonetheless when built on the SiFive hardware this *does* pass run-program.impure.lisp

Revision history for this message
Douglas Katzman (dougk) wrote :

git bisect says:

e50eda73cf65d593c01221fad6905b076df358be is the first bad commit
commit e50eda73cf65d593c01221fad6905b076df358be
Author: Charles Zhang <email address hidden>
Date: Wed Mar 9 03:20:12 2022 -0800

    riscv: Make SB-CONCURRENCY work again.

Revision history for this message
Moody Liu (moodyhunter) wrote :

Digging it further I found it's actually the 'pty_name' (the 8th) argument of `spawn` being mistakenly set to something else (it's set the address of spawn function itself on my side)
By the C calling convention this should be register A7.

Hope it helps :)

Revision history for this message
Moody Liu (moodyhunter) wrote :

It.... seems that `#define LINKAGE_TEMP_REG reg_NL3` is actually A7?

Revision history for this message
Charles (karlosz) wrote :

Thanks for the tip. It's fixed now.

Changed in sbcl:
status: New → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.