Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add linux/riscv64 support #92

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mengzhuo
Copy link

No description provided.

@jaromil jaromil force-pushed the main branch 3 times, most recently from b9a6fba to afe4f6a Compare January 6, 2025 15:03
@jaromil
Copy link
Member

jaromil commented Jan 7, 2025

Hi! simply copying a new Makefile target doesn't grants portability per se. Have you tried it on RISC-V? Let us know!

@mengzhuo
Copy link
Author

mengzhuo commented Jan 7, 2025

Hi! simply copying a new Makefile target doesn't grants portability per se. Have you tried it on RISC-V? Let us know!

Yes, I've tried on Bananpi-F3, which runs perfectly.

mzh@bpi-f3-2:~/cjit$ uname -a
Linux bpi-f3-2 6.6.36 #2.0.4.2 SMP PREEMPT Thu Dec  5 15:02:13 UTC 2024 riscv64 riscv64 riscv64 GNU/Linux
mzh@bpi-f3-2:~/cjit$ cat hello.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
  fprintf(stderr,"Hello, World!\n");
  exit(0);
}
mzh@bpi-f3-2:~/cjit$ ./cjit hello.c
CJIT v0.15.4 by Dyne.org
Hello, World!

@jaromil
Copy link
Member

jaromil commented Jan 7, 2025

awesome! do you mind also running make check and sharing here the output? I will add a CI build to release riscv binaries too.

@mengzhuo
Copy link
Author

mengzhuo commented Jan 8, 2025

Sure

mzh@bpi-f3-2:~/cjit$ make check
cli.bats
 ✓ Hello World!
 ✓ Pass pre-processor defines
 ✓ Compile to object and execute
 ✓ Compile to custom object and execute
 ✓ Compile and link to executable and run
 ✓ Execute multiple files
 ✓ Pass arguments to executed source

7 tests, 0 failures

linux.bats
 ✓ Log ldso.conf.d output and libc.so resolution
CJIT v0.15.4 (c) 2024-2025 Dyne.org foundation
Build system: GNU/Linux
Target platform: risc-v code generator
Target system: GNU/Linux
ELF interpreter: /lib/ld-linux-riscv64-lp64d.so.1
Library paths (7)
+ /home/mzh/cjit
+ /usr/lib/riscv64-linux-gnu/fakechroot
+ /usr/lib/riscv64-linux-gnu/libfakeroot
+ /usr/local/lib
+ /usr/local/lib/riscv64-linux-gnu
+ /lib/riscv64-linux-gnu
+ /usr/lib/riscv64-linux-gnu
Libraries (1)
+ c
Lib files (1)
+ /lib/riscv64-linux-gnu/libc.so.6
 ✓ Linker resolution of libm simple gnu ld script
 ✓ Linker resolution of openssl
 ✓ Linker missing library
 ✓ Linker resolution of ncurses (ldscript+symlinks)

5 tests, 0 failures

windows.bats
 ✓ Timeb.h inclusion for clock() in Windows
 ✓ BOM source file UTF8
 ✓ BOM source file UTF16 big endian
 ✓ BOM source file UTF16 little endian

4 tests, 0 failures



muntar.bats
 ✓ muntar list contents
 ✓ muntar extract contents
             i,j,k,x,y,o,N;
         main(){float z[1760],a
      #define R(t,x,y) f=x;x-=t*y\
   ;y+=t*f;f=(3-x*x-y*y)/2;x*=f;y*=f;
   =0,e=1,c=1,d=0,f,g,h,G,H,A,t,D;char
 b[1760];for(;;){memset(b,32,1760);g=0,
h=1;memset(z,0,7040);for(j=0;j<90;j++){
G=0,H=1;for(i=0;i<314;i++){A=h+2,D=1/(G*
A*a+g*e+5);t=G*A        *e-g*a;x=40+30*D
*(H*A*d-t*c);y=          12+15*D*(H*A*c+
t*d);o=x+80*y;N          =8*((g*a-G*h*e)
*d-G*h*a-g*e-H*h        *c);if(22>y&&y>
 0&&x>0&&80>x&&D>z[o]){z[o]=D;b[o]=(N>0
  ?N:0)[".,-~:;=!*#$@"];}R(.02,H,G);}R(
  .07,h,g);}for(k=0;1761>k;k++)putchar
   (k%80?b[k]:10);R(.04,e,a);R(.02,d,
     c);usleep(15000);printf('\n'+(
        " donut.c! \x1b[23A"));}}
          /*no math lib needed
             .@a1k0n 2021.*/
 ✓ tinf decompress gzip
 ✓ muntargz extract contents
             i,j,k,x,y,o,N;
         main(){float z[1760],a
      #define R(t,x,y) f=x;x-=t*y\
   ;y+=t*f;f=(3-x*x-y*y)/2;x*=f;y*=f;
   =0,e=1,c=1,d=0,f,g,h,G,H,A,t,D;char
 b[1760];for(;;){memset(b,32,1760);g=0,
h=1;memset(z,0,7040);for(j=0;j<90;j++){
G=0,H=1;for(i=0;i<314;i++){A=h+2,D=1/(G*
A*a+g*e+5);t=G*A        *e-g*a;x=40+30*D
*(H*A*d-t*c);y=          12+15*D*(H*A*c+
t*d);o=x+80*y;N          =8*((g*a-G*h*e)
*d-G*h*a-g*e-H*h        *c);if(22>y&&y>
 0&&x>0&&80>x&&D>z[o]){z[o]=D;b[o]=(N>0
  ?N:0)[".,-~:;=!*#$@"];}R(.02,H,G);}R(
  .07,h,g);}for(k=0;1761>k;k++)putchar
   (k%80?b[k]:10);R(.04,e,a);R(.02,d,
     c);usleep(15000);printf('\n'+(
        " donut.c! \x1b[23A"));}}
          /*no math lib needed
             .@a1k0n 2021.*/

4 tests, 0 failures

dmon.bats
 ✓ DMON monitoring of filesystem

1 test, 0 failures

@jaromil jaromil force-pushed the main branch 2 times, most recently from 6c7c6fc to 64fe3ce Compare January 16, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants