diff mbox series

[bug#68202,2/5] gnu: Add target-x32?.

Message ID fdba6969380b5c73d30556110ed2deaaf1bc0761.1704179455.git.efraim@flashner.co.il
State New
Headers show
Series Add support for x86_64-linux-gnux32 | expand

Commit Message

Efraim Flashner Jan. 2, 2024, 7:27 a.m. UTC
* guix/utils.scm (target-x32?): New procedure.

Change-Id: Ia16c7edce64de01d5ccb126c7bd9a6736f327b5f
---
 guix/utils.scm | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Simon Tournier Jan. 8, 2024, 9:20 a.m. UTC | #1
Hi,

On Tue, 2 Jan 2024 at 08:29, Efraim Flashner <efraim@flashner.co.il> wrote:

> +(define* (target-x32? #:optional (target (or (%current-target-system)
> +                                             (%current-system))))
> +  "Is the architecture of TARGET a variant of Intel/AMD's 64-bit
> +architecture (x86_64) using 32-bit data types?"
> +  (and (target-x86-64? target)
> +       (string-suffix? "gnux32" target)))
> +
>  (define* (target-x86? #:optional (target (or (%current-target-system)
>                                               (%current-system))))
>    (or (target-x86-32? target) (target-x86-64? target)))

Why not add it to target-x86-32? ?

Cheers,
simon
Efraim Flashner Jan. 8, 2024, 10:05 a.m. UTC | #2
On Mon, Jan 08, 2024 at 10:20:36AM +0100, Simon Tournier wrote:
> Hi,
> 
> On Tue, 2 Jan 2024 at 08:29, Efraim Flashner <efraim@flashner.co.il> wrote:
> 
> > +(define* (target-x32? #:optional (target (or (%current-target-system)
> > +                                             (%current-system))))
> > +  "Is the architecture of TARGET a variant of Intel/AMD's 64-bit
> > +architecture (x86_64) using 32-bit data types?"
> > +  (and (target-x86-64? target)
> > +       (string-suffix? "gnux32" target)))
> > +
> >  (define* (target-x86? #:optional (target (or (%current-target-system)
> >                                               (%current-system))))
> >    (or (target-x86-32? target) (target-x86-64? target)))
> 
> Why not add it to target-x86-32? ?

It won't run on 32-bit only systems.

The preprocessor macro test is __x86_64__ and __ILP32__

I wasn't exactly sure where to put it, but ld.so --help gave the output
with the glibc-hwcaps optimization paths exactly like x86_64-linux and
pretty much every other piece of software which needed adjusting for it
stressed that it was x86_64.

There's a #debian-x32 channel on libera.chat, they might have some
suggestions about tagging it as 32-bit or 64-bit.  As-is it's currently
labeled as 64-bit.
diff mbox series

Patch

diff --git a/guix/utils.scm b/guix/utils.scm
index f4bf965e9a..e4e9d922e7 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -97,6 +97,7 @@  (define-module (guix utils)
             target-x86-32?
             target-x86-64?
             target-x86?
+            target-x32?
             target-arm32?
             target-aarch64?
             target-arm?
@@ -712,6 +713,13 @@  (define* (target-x86-64? #:optional (target (or (%current-target-system)
 architecture (x86_64)?"
   (string-prefix? "x86_64-" target))
 
+(define* (target-x32? #:optional (target (or (%current-target-system)
+                                             (%current-system))))
+  "Is the architecture of TARGET a variant of Intel/AMD's 64-bit
+architecture (x86_64) using 32-bit data types?"
+  (and (target-x86-64? target)
+       (string-suffix? "gnux32" target)))
+
 (define* (target-x86? #:optional (target (or (%current-target-system)
                                              (%current-system))))
   (or (target-x86-32? target) (target-x86-64? target)))