unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#46059] [PATCH] Enable riscv-elf targets
@ 2021-01-23 22:00 Ekaitz Zarraga
  2021-01-23 23:24 ` [bug#46059] More info about other targets Ekaitz Zarraga
  0 siblings, 1 reply; 3+ messages in thread
From: Ekaitz Zarraga @ 2021-01-23 22:00 UTC (permalink / raw)
  To: 46059

Hi,

I've been struggling to make a RISC-V cross compiler. This `manifest.scm`
file failed to create because there was no available dynamic linker for
the targets which, in the end, don't need any dynamic linker:

manifest.scm:

``` scm

(use-modules (gnu packages cross-base)
             (gnu packages embedded)
             (gnu packages man))

(packages->manifest
  `(,@(let* ((triplet "riscv32-unknown-elf")
             (binutils (cross-binutils triplet)))
        (list
          binutils
          (cross-gcc triplet
                     #:xbinutils binutils
                     #:libc #f)))
    ,man-db))
```

I realized there were some targets missing (and there are more!) in the
bootstrap.scm file, so I think adding them is harmless and lets us
make cross compilers that are not available otherwise.

I'd like to add riscv32-linux too, but that involves setting the correct
path and I don't know it.

Hope this patch is helpful.


From 58785556b7448cfe32916d3842bce398b360c2de Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <ekaitz@elenq.tech>
Date: Sat, 23 Jan 2021 22:50:44 +0100
Subject: [PATCH] gnu: glibc-dynamic-linker: Add riscv*-elf targets

    * gnu/packages/bootstrap.scm: (glibc-dynamic-linker): Set
    riscv64-*-elf targets to "no-ld"
---
 gnu/packages/bootstrap.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index c39e60ec8b..8566d11284 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -302,6 +302,8 @@ or false to signal an error."
         ((string=? system "i686-mingw") "no-ld.so")
         ((string=? system "x86_64-mingw") "no-ld.so")
         ((string=? system "vc4-elf") "no-ld.so")
+        ((string=? system "riscv32-elf") "no-ld.so")
+        ((string=? system "riscv64-elf") "no-ld.so")

         (else (error "dynamic linker name not known for this system"
                      system))))
--
2.29.2






^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#46059] More info about other targets
  2021-01-23 22:00 [bug#46059] [PATCH] Enable riscv-elf targets Ekaitz Zarraga
@ 2021-01-23 23:24 ` Ekaitz Zarraga
  2021-01-24 17:09   ` Ekaitz Zarraga
  0 siblings, 1 reply; 3+ messages in thread
From: Ekaitz Zarraga @ 2021-01-23 23:24 UTC (permalink / raw)
  To: 46059@debbugs.gnu.org

This issue from RISC-V GNU Toolchain has more information
related with the issue described:

https://github.com/riscv/riscv-gnu-toolchain/pull/136




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#46059] More info about other targets
  2021-01-23 23:24 ` [bug#46059] More info about other targets Ekaitz Zarraga
@ 2021-01-24 17:09   ` Ekaitz Zarraga
  0 siblings, 0 replies; 3+ messages in thread
From: Ekaitz Zarraga @ 2021-01-24 17:09 UTC (permalink / raw)
  To: 46059@debbugs.gnu.org

For more information on the dynamic linker names I didn't know:

lp32, ilp32f and ilp32d are the ABI.

i -> integer
l -> long
p -> pointer
f -> float
d -> double

The chars in the beginning indicate what kind of data is sent to 32 bit registers.

The suffix says which ones are sent to floating point registers.

So in ilp32 floating point numbers are sent to integer registers, while in ilp32d double precision numbers are sent to floating point registers.

Not every ABI is compatible with every single RISC-V configuration. RV32I for instance, doesn't support floating point numbers (they are supported in the F extension) so it doesn't provide floating point registers meaning that it's not able to use any ABI that has a `d` or an `f` as suffix.

But RISC-V configurations with floating point modules can actually run the simplest ABI if they want so we probably need to add many entries here :)

Does this make sense?




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-24 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-23 22:00 [bug#46059] [PATCH] Enable riscv-elf targets Ekaitz Zarraga
2021-01-23 23:24 ` [bug#46059] More info about other targets Ekaitz Zarraga
2021-01-24 17:09   ` Ekaitz Zarraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).