[BUG]: riscv64 binutils assembly: Invalid architecture
Describe the bug
with Assembly Source #1:
infiniteLoop:
j main
main:
j infiniteLoop
RISC-V (64) binutils 2.38.0 produces:
Could not execute the program
Executable not found
Compiler returned: 0
Compiler stderr
Invalid architecture for linking and execution
Compiler did not produce an executable
Steps to reproduce
see above
Expected behavior
program executes
Reproduction link
https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:assembly,selection:(endColumn:1,endLineNumber:5,positionColumn:1,positionLineNumber:5,selectionStartColumn:1,selectionStartLineNumber:5,startColumn:1,startLineNumber:5),source:'infiniteLoop:%0A++++j+main%0Amain:%0A++++j+infiniteLoop%0A'),l:'5',n:'0',o:'Assembly+source+%231',t:'0')),k:100,l:'4',m:46.787148594377506,n:'0',o:'',s:0,t:'0'),(g:!((h:executor,i:(argsPanelShown:'1',compilationPanelShown:'0',compiler:gnuasriscv64g1320,compilerName:'',compilerOutShown:'0',execArgs:'',execStdin:'',fontScale:14,fontUsePx:'0',j:1,lang:assembly,libs:!(),options:'',overrides:!(),runtimeTools:!(),source:1,stdinPanelShown:'1',wrap:'1'),l:'5',n:'0',o:'Executor+RISC-V+binutils+2.38.0+(Assembly,+Editor+%231)',t:'0')),header:(),l:'4',m:53.21285140562249,n:'0',o:'',s:0,t:'0')),l:'3',n:'0',o:'',t:'0')),version:4
Screenshots
Operating System
No response
Browser version
No response
The cross compiler can produce binaries, but we have not configured it to produce executables (even if this code were correct). And there's little incentive to spend time on this, because we don't have any RiscV hardware either way. So I think the error message is pretty clear.
the rv-linux toolchain can link to a binary, but of course we can't execute it.
It seems we do have a config issue as some rv target are wrongly enable for execution:
that's probably my fault, I'll have a look.
Note that the intel asm checkbox is also wrong, obviously.
the rv-linux toolchain can link to a binary, but of course we can't execute it. It seems we do have a config issue as some rv target are wrongly enable for execution
execution pane and checkbox was enabled for all compilers as part of https://github.com/compiler-explorer/compiler-explorer/issues/6379 - there was no other way to do it
The cross compiler can produce binaries, but we have not configured it to produce executables (even if this code were correct). And there's little incentive to spend time on this, because we don't have any RiscV hardware either way. So I think the error message is pretty clear.
what's the procedure for acquiring riscv hardware? what prevents the use of qemu-riscv64?
The cross compiler can produce binaries, but we have not configured it to produce executables (even if this code were correct). And there's little incentive to spend time on this, because we don't have any RiscV hardware either way. So I think the error message is pretty clear.
what's the procedure for acquiring riscv hardware? what prevents the use of qemu-riscv64?
It seems that in https://github.com/compiler-explorer/compiler-explorer/pull/6700, in lib/base-compiler.ts, the logic of executing compiled binaries was changed, it forces compiled binaries to have the same target triple with host machine.
I'm running a local-hosted instance of CE, after upgrading to recent commits, my local built execution wrappers for RISC-V binaries also became unable to execute. I have to make a few walk arounds to change the logic mentioned above, to support compilers which is set as supportsExecute. Actually, I just changed the two else branches to make another check that !this.compiler.supportsExecute, and it works.
I think implementing a huge CE server on a RISC-V local machine might have some difficulties in practice. So, I think if you really need to make RISC-V binaries executable insides CE, try to host a local instance and add your custom execution wrappers might do the job.
i now have a milk-v megrez, which is riscv64 hardware that runs linux with quite roomy disk and memory. if i can acquire it, i think the project could too if executing risc-v code was really desired :-)
we don't have any RiscV hardware either way
@partouf If someone can provide an accessible RISC-V machine outside of AWS, would it be feasible to integrate it with godbolt.org to provide RISC-V execution support? What criteria would such an external RISC-V machine need to meet?