mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Allow empty vendor string in GNU target triplets.
NetBSD and pkgsrc have been using an empty vendor string since the mid-'90s, such as x86_64--netbsd. pkgsrc has been carrying around a workaround just the guile build for a long time. (Before that, NetBSD omitted the vendor altogether, so if x86_64 existed then it might have been `x86_64-netbsd', but that caused more problems.) This change makes Guile accept an empty vendor string so workarounds are no longer necessary. * module/system/base/target.scm (validate-target): Allow empty vendor string in GNU target triplets. * test-suite/tests/cross-compilation.test ("cross-compilation"): Add tests for "x86_64--netbsd". Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
158da6966b
commit
e4e8afd6c8
2 changed files with 11 additions and 2 deletions
|
@ -53,7 +53,14 @@
|
|||
(if (or (not (string? target))
|
||||
(let ((parts (string-split target #\-)))
|
||||
(or (< (length parts) 3)
|
||||
(or-map string-null? parts))))
|
||||
(let ((cpu (list-ref parts 0))
|
||||
(os (list-ref parts 2)))
|
||||
(or (string-null? cpu)
|
||||
;; vendor (parts[1]) may be empty
|
||||
(string-null? os)
|
||||
;; optional components (ABI) should be nonempty if
|
||||
;; specified
|
||||
(or-map string-null? (list-tail parts 3)))))))
|
||||
(error "invalid target" target)))
|
||||
|
||||
(define (with-target target thunk)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;;; Cross compilation -*- mode: scheme; coding: utf-8; -*-
|
||||
;;;;
|
||||
;;;; Copyright (C) 2010-2014, 2020 Free Software Foundation, Inc.
|
||||
;;;; Copyright (C) 2010-2014, 2020, 2022 Free Software Foundation, Inc.
|
||||
;;;;
|
||||
;;;; This library is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -67,11 +67,13 @@
|
|||
(test-triplet "i586" "pc" "gnu0.3")
|
||||
(test-triplet "x86_64" "unknown" "linux-gnu")
|
||||
(test-triplet "x86_64" "unknown" "kfreebsd-gnu")
|
||||
(test-triplet "x86_64" "" "netbsd") ;NetBSD/pkgsrc with empty vendor
|
||||
|
||||
(test-target "i586-pc-gnu0.3" (endianness little) 4)
|
||||
(test-target "x86_64-pc-linux-gnu" (endianness little) 8)
|
||||
(test-target "powerpc-unknown-linux-gnu" (endianness big) 4)
|
||||
(test-target "sparc64-unknown-freebsd8.2" (endianness big) 8)
|
||||
(test-target "x86_64--netbsd" (endianness little) 8)
|
||||
|
||||
(test-target "mips64el-unknown-linux-gnu" ; n32 or o32 ABI
|
||||
(endianness little) 4)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue