-
Notifications
You must be signed in to change notification settings - Fork 407
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
Add RISC-V support. #208
Add RISC-V support. #208
Conversation
Currently only compile-tested on risc64, will report back when runtime tested. Thanks to @sorear for the pointers. |
I've now done some light runtime testing (via the repl for the nix expression language) and all seems good so far. Do you have a stress test I can run? |
No, it does not. The code in master branch relies on GCC built-in primitives if test_atomic_ops passes. |
Issue #208 (bdwgc). * include/private/gcconfig.h [__riscv && LINUX && __riscv_xlen==32] (RISCV32, mach_type_known): Define macro. * include/private/gcconfig.h [__riscv && LINUX && __riscv_xlen==64] (RISCV64, mach_type_known): Define macro. * include/private/gcconfig.h [RISCV32 || RISCV64] (CPP_WORDSZ, MACH_TYPE, ALIGNMENT): Likewise. * include/private/gcconfig.h [(RISCV32 || RISCV64) && LINUX] (OS_TYPE, DATASTART, LINUX_STACKBOTTOM, DYNAMIC_LOADING): Likewise. * include/private/gcconfig.h [(RISCV32 || RISCV64) && LINUX] (__data_start): Declare external variable.
@palmer-dabbelt would you have a chance to test Boehm GC native on Hifive Unleashed? Should take under five minutes of your time (it took 4m30s on a Raspberry pi just now, 2m30s on an Odroid C2 (1.5 GHz A53)).
|
After merging your patch, I found another variant of the patch (https://github.com/AOSC-Dev/aosc-os-abbs/blob/staging/base-libs/gc/autobuild/patches/gc-riscv.patch) created by @Icenowy (the difference is in DATAEND and DYNAMIC_LOADING). |
@ivmai I will verify that DYNAMIC_LOADING works here. How can I determine which DATAEND is correct? |
Ah, I'll do a native build and run the tests when I get my native toolchain bootstrapped. |
I'm sorry, no difference (DYNAMIC_LOADING exists in both patches, DATA is defined to _end by default). |
@ivmai OK, I'll do that, thanks! |
Merged in 4f7f0ee |
(code refactoring of commit 4f7f0ee) Issue #208 (bdwgc). * include/private/gcconfig.h [__riscv && LINUX] (RISCV32, RISCV64): Replace with RISCV. * include/private/gcconfig.h [RISCV] (MACH_TYPE): Change to "RISC-V". * include/private/gcconfig.h [RISCV] (CPP_WORDSZ, ALIGNMENT): Define using __riscv_xlen.
@brucehoult Can you point me to a disk image (which you could generate with QEMU) that has all the stuff you want me to run, and then I can run it on the board? I can't figure out how to use Fedora :) |
@palmer-dabbelt that's exactly why I pinged you .. it's tooooo hard to do with cross compilers and qemu and just busybox (especially given this stuff is just in my copious free time), but I figured you'd have a real GNU userland and toolchain on your board by now :-) It's not exactly urgent,. It would be good to have once people start to have real boards in their hands, but once we have real boards in our hands we can do it easily. I sounds as if Fedora will be there by the end of next month. Did I get the correct impression that one of the *BSDs is done and ready to go? |
Fedora should have native toolchain packages now... :) |
Fedora image is here: https://fedorapeople.org/groups/risc-v/disk-images/ and indeed it is true that we have a native toolchain based on gcc 7.3.1, binutils 2.30 and glibc 2.27. You need to read the readme file in that link to understand how to use it. I am running the test above using the latest version from git (f9c5815). Will report back once it has finished. |
Note these results are on qemu, not on real hardware. I used
I'll see if I can get a stack trace from the failure. |
I just realised we don't have gdb, and we're some way from having it, so no stack trace for a while ... If there's anything else that can be done to diagnose problems (verbose mode?) let me know. |
I've created #212 for the test failure. |
(back-port of commits 4f7f0ee, 3b008f7 from 'master') Issue #208 (bdwgc). * include/private/gcconfig.h [__riscv && LINUX] (RISCV, mach_type_known): Define macro. * include/private/gcconfig.h [RISCV] (MACH_TYPE): Likewise. * include/private/gcconfig.h [RISCV && LINUX] (OS_TYPE, DATASTART, LINUX_STACKBOTTOM, DYNAMIC_LOADING): Likewise. * include/private/gcconfig.h [RISCV && LINUX] (__data_start): Declare external variable. * include/private/gcconfig.h [RISCV] (CPP_WORDSZ, ALIGNMENT): Define using __riscv_xlen.
Requires ivmai/libatomic_ops#32