bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-mes] mes target selection - currently hardcoded


From: Danny Milosavljevic
Subject: [bug-mes] mes target selection - currently hardcoded
Date: Mon, 4 Feb 2019 13:01:23 +0100

Hi,

currently, a lot of the configure script parts in mes assume that 32 bit x86 is
the target/testing architecture.

It would be better if we mandated specifying the architecture instead of
assuming a default.  That would make it easier for the user to see what's
getting selected and why.

If we wanted to, we could also autodetect it as follows (but I would prefer
if we didn't):

At least in GuixSD it is the case that if one adds the coreutils to the
environment then the "uname" executable will return "armv7l" for arm.

Example:

$ guix environment -s armhf-linux --ad-hoc binutils coreutils
[env]$ uname -m
armv7l

However, guile inside the environment will not (when using the system
call) give you the same value.

scheme@(guile-user)> (uname)
$1 = #("Linux" "dayas" "4.20.0-gnu" "#1 SMP 1" "x86_64")

That's understandable because even after we emulate ARM for the executables,
the Linux kernel is still the same as before and indeed runs on x86_64.

Since we want to target non-Guix platforms it's probably not a good idea
to rely on the above.

For reference, a list of unpushed patches to mes to make it use ARM follow:

diff --git a/build-aux/test.sh b/build-aux/test.sh
index 55a4fed..d60f578 100755
--- a/build-aux/test.sh
+++ b/build-aux/test.sh
@@ -30,8 +30,9 @@ if [ ! "$mesc_p" ]; then
     MES=${MES-guile}
     mesc_p=1
     mes_p=1
-    mes_arch=x86-mes
+    mes_arch=arm-mes
     program_prefix=$mes_arch-
     CC="./pre-inst-env mescc"
+    echo MES='"'${MES}'"' CC='"'$CC'"' sh ${srcdest}build-aux/test-cc.sh $1
     sh ${srcdest}build-aux/test-cc.sh $1
 fi
diff --git a/module/mescc.scm b/module/mescc.scm
index 6767062..f581f7d 100644
--- a/module/mescc.scm
+++ b/module/mescc.scm
@@ -79,7 +79,7 @@
          (usage? (and (not help?) (null? files)))
          (version? (option-ref options 'version #f)))
     (cond ((option-ref options 'dumpmachine #f)
-           (display "x86-mes")
+           (display "armv4-mes")
            (exit 0))
           (version? (format #t "mescc (GNU Mes) ~a\n" %version) (exit 0))
           (else
diff --git a/module/mescc/mescc.scm b/module/mescc/mescc.scm
index 875530d..99d4489 100644
--- a/module/mescc/mescc.scm
+++ b/module/mescc/mescc.scm
@@ -26,6 +26,7 @@
 
   #:use-module (mescc i386 info)
   #:use-module (mescc x86_64 info)
+  #:use-module (mescc armv4 info)
   #:use-module (mescc preprocess)
   #:use-module (mescc compile)
   #:use-module (mescc M1)
@@ -88,8 +89,8 @@
          (includes (cons dir includes))
          (prefix (option-ref options 'prefix ""))
          (machine (option-ref options 'machine "32"))
-         (info (if (equal? machine "32") (x86-info)  (x86_64-info)))
-         (arch (if (equal? machine "32") "__i386__=1" "__x86_64__=1"))
+         (info (if (equal? machine "32") (armv4-info)  (x86_64-info)))
+         (arch (if (equal? machine "32") "__arm__=1" "__x86_64__=1"))
          (defines (cons arch defines)))
     (with-input-from-file file-name
       (cut c99-input->info info #:prefix prefix #:defines defines #:includes 
includes))))
@@ -97,7 +98,7 @@
 (define (E->info options file-name)
   (let* ((ast (with-input-from-file file-name read))
          (machine (option-ref options 'machine "32"))
-         (info (if (equal? machine "32") (x86-info)  (x86_64-info))))
+         (info (if (equal? machine "32") (armv4-info)  (x86_64-info))))
     (c99-ast->info info ast)))
 
 (define (mescc:assemble options)
@@ -177,9 +178,9 @@
                         ((equal? machine "64") "2")
                         (else "1")))
          (m1-macros (cond
-                     ((equal? machine "32") "x86.M1")
+                     ((equal? machine "32") "arm.M1")
                      ((equal? machine "64") "x86_64.M1")
-                     (else "x86.M1")))
+                     (else "arm.M1")))
          (verbose? (option-ref options 'verbose #f))
          (M1 (or (getenv "M1") "M1"))
          (command `(,M1
@@ -232,9 +233,9 @@
          (blood-elf (or (getenv "BLOOD_ELF") "blood-elf"))
          (machine (option-ref options 'machine "32"))
          (m1-macros (cond
-                     ((equal? machine "32") "x86.M1")
+                     ((equal? machine "32") "arm.M1")
                      ((equal? machine "64") "x86_64.M1")
-                     (else "x86.M1")))
+                     (else "arm.M1")))
          (command `(,blood-elf
                       "-f" ,(arch-find options m1-macros)
                       ,@(append-map (cut list "-f" <>) M1-files)
@@ -252,6 +253,7 @@
          (old-suffix (last parts))
          (program-prefix (cond ((string-prefix? "x86-mes-" old-suffix) 
".x86-mes-")
                                ((string-prefix? "x86_64-mes-" old-suffix) 
".x86_64-mes-")
+                               ((string-prefix? "arm-mes-" old-suffix) 
".arm-mes-")
                                (else "."))))
     (if (string-null? suffix)
         (if (string-null? program-prefix) (string-join base ".")
@@ -266,7 +268,7 @@
          (srcdir-lib (string-append srcdest "lib"))
          (machine (option-ref options 'machine "32"))
          (arch (cond
-                ((equal? machine "32") "x86-mes")
+                ((equal? machine "32") "arm-mes")
                 ((equal? machine "64") "x86_64-mes")
                 (else "x86-mes")))
          (path (cons* srcdir-lib

Attachment: pgpGATr_Ir63A.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]