~ruther/guix-local

c69230c81f9657fd6338c1cd625139a1c1d1c39f — Efraim Flashner 2 years ago 3c1f25f
gnu: Add support for x86_64-linux-gnux32.

* gnu/packages/bootstrap.scm (glibc-dynamic-linker): Add entry for
x86_64-linux-gnux32.
* gnu/packages/gcc.scm (gcc-configure-flags-for-triplet): Add
configure-flag for x86_64-linux-gnux32.
* guix/platforms/x86.scm (x86_64-linux-gnux32): New variable.
* guix/utils.scm (gnu-triplet->nix-system): Force x86_64-linux-gnux32 to
output a different nix-system than x86_64-linux-gnu.

Change-Id: I519fea2f8357e4b9895ede05fe8a5e373e9b034a
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
4 files changed, 21 insertions(+), 3 deletions(-)

M gnu/packages/bootstrap.scm
M gnu/packages/gcc.scm
M guix/platforms/x86.scm
M guix/utils.scm
M gnu/packages/bootstrap.scm => gnu/packages/bootstrap.scm +4 -1
@@ 1,7 1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015, 2018, 2019 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2017, 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017, 2020, 2024 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018, 2020, 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2019 Carl Dong <contact@carldong.me>
;;; Copyright © 2019 Léo Le Bouter <lle-bout@zaclys.net>


@@ 323,6 323,9 @@ or false to signal an error."
     ((string=? system "powerpc64-linux") "/lib/ld64.so.1")
     ((string=? system "alpha-linux") "/lib/ld-linux.so.2")

     ;; TODO: Differentiate between x86_64-linux-gnu and x86_64-linux-gnux32.
     ((string=? system "x86_64-linux-gnux32") "/lib/ld-linux-x32.so.2")

     ;; XXX: This one is used bare-bones, without a libc, so add a case
     ;; here just so we can keep going.
     ((string=? system "arm-eabi") "no-ld.so")

M gnu/packages/gcc.scm => gnu/packages/gcc.scm +4 -1
@@ 3,7 3,7 @@
;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2015, 2023 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2015-2018, 2020-2023 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2015-2018, 2020-2024 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016 Carlos Sánchez de La Lama <csanchezdll@gmail.com>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2020, 2022 Marius Bakke <marius@gnu.org>


@@ 75,6 75,9 @@ where the OS part is overloaded to denote a specific ABI---into GCC
           "--with-mode=thumb"
           "--with-fpu=neon"))

        ((string-match "x86_64-linux-gnux32" target)
         '("--with-abi=mx32"))

        ((and (string-suffix? "-gnu" target)
              (not (string-contains target "-linux")))
         ;; Cross-compilation of libcilkrts in GCC 5.5.0 to GNU/Hurd fails

M guix/platforms/x86.scm => guix/platforms/x86.scm +10 -0
@@ 1,5 1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
;;; Copyright © 2023, 2024 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;


@@ 21,6 22,7 @@
  #:use-module (guix records)
  #:export (i686-linux
            x86_64-linux
            x86_64-linux-x32
            i686-mingw
            x86_64-mingw
            i586-gnu))


@@ 41,6 43,14 @@
   (rust-target "x86_64-unknown-linux-gnu")
   (glibc-dynamic-linker "/lib/ld-linux-x86-64.so.2")))

(define x86_64-linux-x32
  (platform
   (target "x86_64-linux-gnux32")
   (system #f)
   (linux-architecture "x86_64")
   (rust-target "x86_64-unknown-linux-gnux32")
   (glibc-dynamic-linker "/lib/ld-linux-x32.so.2")))

(define i686-mingw
  (platform
   (target "i686-w64-mingw32")

M guix/utils.scm => guix/utils.scm +3 -1
@@ 7,7 7,7 @@
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2018, 2020 Marius Bakke <marius@gnu.org>
;;; Copyright © 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2020, 2021, 2024 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>


@@ 634,6 634,8 @@ returned by `config.guess'."
                       (else triplet))))
    (cond ((string-match "^arm[^-]*-([^-]+-)?linux-gnueabihf" triplet)
           "armhf-linux")
          ;; Otherwise it will show up as x86_64-linux... which isn't wrong.
          ((string-match "x86_64-linux-gnux32" triplet) "x86_64-linux-gnux32")
          ((string-match "^([^-]+)-([^-]+-)?linux-gnu.*" triplet)
           =>
           (lambda (m)