mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-31 22:51:22 +00:00
Merge pull request #227560 from jackyliu16/loongnix-commit
lib.platforms.loongarch64: init
This commit is contained in:
commit
b2ef7956b6
@ -136,6 +136,7 @@ rec {
|
||||
else if final.isPower then "powerpc"
|
||||
else if final.isRiscV then "riscv"
|
||||
else if final.isS390 then "s390"
|
||||
else if final.isLoongArch64 then "loongarch"
|
||||
else final.parsed.cpu.name;
|
||||
|
||||
qemuArch =
|
||||
|
@ -26,7 +26,7 @@ let
|
||||
|
||||
# Linux
|
||||
"aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux"
|
||||
"armv7l-linux" "i686-linux" "m68k-linux" "microblaze-linux"
|
||||
"armv7l-linux" "i686-linux" "loongarch64-linux" "m68k-linux" "microblaze-linux"
|
||||
"microblazeel-linux" "mipsel-linux" "mips64el-linux" "powerpc64-linux"
|
||||
"powerpc64le-linux" "riscv32-linux" "riscv64-linux" "s390-linux"
|
||||
"s390x-linux" "x86_64-linux"
|
||||
@ -86,6 +86,7 @@ in {
|
||||
m68k = filterDoubles predicates.isM68k;
|
||||
s390 = filterDoubles predicates.isS390;
|
||||
s390x = filterDoubles predicates.isS390x;
|
||||
loongarch64 = filterDoubles predicates.isLoongArch64;
|
||||
js = filterDoubles predicates.isJavaScript;
|
||||
|
||||
bigEndian = filterDoubles predicates.isBigEndian;
|
||||
|
@ -90,6 +90,10 @@ rec {
|
||||
config = "mipsel-unknown-linux-gnu";
|
||||
} // platforms.fuloong2f_n32;
|
||||
|
||||
loongarch64-linux = {
|
||||
config = "loongarch64-unknown-linux-gnu";
|
||||
};
|
||||
|
||||
# can execute on 32bit chip
|
||||
mips-linux-gnu = { config = "mips-unknown-linux-gnu"; } // platforms.gcc_mips32r2_o32;
|
||||
mipsel-linux-gnu = { config = "mipsel-unknown-linux-gnu"; } // platforms.gcc_mips32r2_o32;
|
||||
|
@ -57,6 +57,7 @@ rec {
|
||||
isM68k = { cpu = { family = "m68k"; }; };
|
||||
isS390 = { cpu = { family = "s390"; }; };
|
||||
isS390x = { cpu = { family = "s390"; bits = 64; }; };
|
||||
isLoongArch64 = { cpu = { family = "loongarch"; bits = 64; }; };
|
||||
isJavaScript = { cpu = cpuTypes.javascript; };
|
||||
|
||||
is32bit = { cpu = { bits = 32; }; };
|
||||
|
@ -131,6 +131,8 @@ rec {
|
||||
|
||||
or1k = { bits = 32; significantByte = bigEndian; family = "or1k"; };
|
||||
|
||||
loongarch64 = { bits = 64; significantByte = littleEndian; family = "loongarch"; };
|
||||
|
||||
javascript = { bits = 32; significantByte = littleEndian; family = "javascript"; };
|
||||
};
|
||||
|
||||
|
@ -34,7 +34,7 @@ with lib.systems.doubles; lib.runTests {
|
||||
testredox = mseteq redox [ "x86_64-redox" ];
|
||||
testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */);
|
||||
testillumos = mseteq illumos [ "x86_64-solaris" ];
|
||||
testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mips64el-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" "m68k-linux" "s390-linux" "s390x-linux" "microblaze-linux" "microblazeel-linux" ];
|
||||
testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mips64el-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" "m68k-linux" "s390-linux" "s390x-linux" "microblaze-linux" "microblazeel-linux" "loongarch64-linux" ];
|
||||
testnetbsd = mseteq netbsd [ "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" "i686-netbsd" "m68k-netbsd" "mipsel-netbsd" "powerpc-netbsd" "riscv32-netbsd" "riscv64-netbsd" "x86_64-netbsd" ];
|
||||
testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ];
|
||||
testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ];
|
||||
|
@ -125,6 +125,10 @@ let
|
||||
magicOrExtension = ''\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00'';
|
||||
mask = ''\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'';
|
||||
};
|
||||
loongarch64-linux = {
|
||||
magicOrExtension = ''\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01'';
|
||||
mask = ''\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'';
|
||||
};
|
||||
wasm32-wasi = {
|
||||
magicOrExtension = ''\x00asm'';
|
||||
mask = ''\xff\xff\xff\xff'';
|
||||
|
@ -88,6 +88,7 @@ let
|
||||
else if targetPlatform.isMips then "${sharedLibraryLoader}/lib/ld.so.1"
|
||||
# `ld-linux-riscv{32,64}-<abi>.so.1`
|
||||
else if targetPlatform.isRiscV then "${sharedLibraryLoader}/lib/ld-linux-riscv*.so.1"
|
||||
else if targetPlatform.isLoongArch64 then "${sharedLibraryLoader}/lib/ld-linux-loongarch*.so.1"
|
||||
else if targetPlatform.isDarwin then "/usr/lib/dyld"
|
||||
else if targetPlatform.isFreeBSD then "/libexec/ld-elf.so.1"
|
||||
else if lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1"
|
||||
|
@ -42,6 +42,7 @@ stdenv.mkDerivation rec {
|
||||
platforms = platforms.linux;
|
||||
badPlatforms = [
|
||||
"alpha-linux"
|
||||
"loongarch64-linux"
|
||||
"riscv32-linux"
|
||||
"sparc-linux"
|
||||
"sparc64-linux"
|
||||
|
@ -1,5 +1,5 @@
|
||||
let
|
||||
withGold = platform: platform.parsed.kernel.execFormat.name == "elf" && !platform.isRiscV;
|
||||
withGold = platform: platform.parsed.kernel.execFormat.name == "elf" && !platform.isRiscV && !platform.isLoongArch64;
|
||||
in
|
||||
|
||||
{ stdenv
|
||||
|
@ -24,7 +24,7 @@ in stdenv.mkDerivation rec {
|
||||
|
||||
patches =
|
||||
lib.optional
|
||||
(!isFuse3 && stdenv.isAarch64)
|
||||
(!isFuse3 && (stdenv.isAarch64 || stdenv.hostPlatform.isLoongArch64))
|
||||
(fetchpatch {
|
||||
url = "https://github.com/libfuse/libfuse/commit/914871b20a901e3e1e981c92bc42b1c93b7ab81b.patch";
|
||||
sha256 = "1w4j6f1awjrycycpvmlv0x5v9gprllh4dnbjxl4dyl2jgbkaw6pa";
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ lib, stdenv, fetchurl, pcre, libiconv, perl }:
|
||||
{ lib, stdenv, fetchurl, pcre, libiconv, perl, autoreconfHook }:
|
||||
|
||||
# Note: this package is used for bootstrapping fetchurl, and thus
|
||||
# cannot use fetchpatch! All mutable patches (generated by GitHub or
|
||||
@ -16,8 +16,11 @@ stdenv.mkDerivation {
|
||||
sha256 = "0g42svbc1nq5bamxfj6x7320wli4dlj86padk0hwgbk04hqxl42w";
|
||||
};
|
||||
|
||||
# https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=b50c6442e43d79471a31a2a202d3e50c0557446f
|
||||
patches = lib.optional stdenv.hostPlatform.isLoongArch64 ./sigsegv-loongarch.patch;
|
||||
|
||||
# Perl is needed for testing
|
||||
nativeBuildInputs = [ perl ];
|
||||
nativeBuildInputs = [ perl ] ++ lib.optional stdenv.hostPlatform.isLoongArch64 autoreconfHook;
|
||||
outputs = [ "out" "info" ]; # the man pages are rather small
|
||||
|
||||
buildInputs = [ pcre libiconv ];
|
||||
|
31
pkgs/tools/text/gnugrep/sigsegv-loongarch.patch
Normal file
31
pkgs/tools/text/gnugrep/sigsegv-loongarch.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From b50c6442e43d79471a31a2a202d3e50c0557446f Mon Sep 17 00:00:00 2001
|
||||
From: Sun Haiyong <youbest@sina.com>
|
||||
Date: Sat, 4 Sep 2021 15:06:43 +0200
|
||||
Subject: sigsegv: Improve cross-compilation support for LoongArch CPU.
|
||||
|
||||
* m4/stack-direction.m4 (SV_STACK_DIRECTION): Assume the stack grows
|
||||
down on LoongArch.
|
||||
---
|
||||
m4/stack-direction.m4 | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/m4/stack-direction.m4 b/m4/stack-direction.m4
|
||||
index 9328725..e682be9 100644
|
||||
--- a/m4/stack-direction.m4
|
||||
+++ b/m4/stack-direction.m4
|
||||
@@ -1,4 +1,4 @@
|
||||
-# stack-direction.m4 serial 7
|
||||
+# stack-direction.m4 serial 8
|
||||
dnl Copyright (C) 2002-2021 Free Software Foundation, Inc.
|
||||
dnl This file is free software, distributed under the terms of the GNU
|
||||
dnl General Public License. As a special exception to the GNU General
|
||||
@@ -32,6 +32,7 @@ AC_DEFUN([SV_STACK_DIRECTION],
|
||||
i?86 | x86_64 | \
|
||||
i860 | \
|
||||
ia64 | \
|
||||
+ loongarch* | \
|
||||
m32r | \
|
||||
m68* | \
|
||||
m88k | \
|
||||
--
|
||||
cgit v1.1
|
@ -26321,7 +26321,7 @@ with pkgs;
|
||||
busybox = callPackage ../os-specific/linux/busybox { };
|
||||
busybox-sandbox-shell = callPackage ../os-specific/linux/busybox/sandbox-shell.nix {
|
||||
# musl roadmap has RISC-V support projected for 1.1.20
|
||||
busybox = if !stdenv.hostPlatform.isRiscV && stdenv.hostPlatform.libc != "bionic"
|
||||
busybox = if !stdenv.hostPlatform.isRiscV && !stdenv.hostPlatform.isLoongArch64 && stdenv.hostPlatform.libc != "bionic"
|
||||
then pkgsStatic.busybox
|
||||
else busybox;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user