summaryrefslogtreecommitdiff
path: root/lib/systems
diff options
context:
space:
mode:
authoraleksana <me@aleksana.moe>2025-05-01 23:47:02 +0800
committeraleksana <me@aleksana.moe>2025-05-22 19:59:54 +0800
commit54e53047bfc87dc62779c979198e1025f360fc8b (patch)
tree4dfb2fe1c16da266ef0bcb429982efc854885014 /lib/systems
parentcc-wrapper: add -m{,no-}strict-align and -mcmodel parameter (diff)
downloadnixpkgs-54e53047bfc87dc62779c979198e1025f360fc8b.tar.gz
lib.systems.examples: separate loongarch64 for desktop and embedded variants
Diffstat (limited to 'lib/systems')
-rw-r--r--lib/systems/examples.nix10
-rw-r--r--lib/systems/platforms.nix15
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix
index 7378b3bc5ecb..bfb7a73d547e 100644
--- a/lib/systems/examples.nix
+++ b/lib/systems/examples.nix
@@ -170,9 +170,17 @@ rec {
libc = "newlib";
};
- loongarch64-linux = {
+ # https://github.com/loongson/la-softdev-convention/blob/master/la-softdev-convention.adoc#10-operating-system-package-build-requirements
+ loongarch64-linux = lib.recursiveUpdate platforms.loongarch64-multiplatform {
config = "loongarch64-unknown-linux-gnu";
};
+ loongarch64-linux-embedded = lib.recursiveUpdate platforms.loongarch64-multiplatform {
+ config = "loongarch64-unknown-linux-gnu";
+ gcc = {
+ arch = "loongarch64";
+ strict-align = true;
+ };
+ };
mmix = {
config = "mmix-unknown-mmixware";
diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix
index 2df6f5d731cf..8e3f3621698b 100644
--- a/lib/systems/platforms.nix
+++ b/lib/systems/platforms.nix
@@ -572,6 +572,19 @@ rec {
};
};
+ loongarch64-multiplatform = {
+ gcc = {
+ # https://github.com/loongson/la-softdev-convention/blob/master/la-softdev-convention.adoc#10-operating-system-package-build-requirements
+ arch = "la64v1.0";
+ strict-align = false;
+ # Avoid text sections of large apps exceeding default code model
+ # Will be default behavior in LLVM 21 and hopefully GCC16
+ # https://github.com/loongson-community/discussions/issues/43
+ # https://github.com/llvm/llvm-project/pull/132173
+ cmodel = "medium";
+ };
+ };
+
# This function takes a minimally-valid "platform" and returns an
# attrset containing zero or more additional attrs which should be
# included in the platform in order to further elaborate it.
@@ -607,6 +620,8 @@ rec {
else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then
powernv
+ else if platform.isLoongArch64 then
+ loongarch64-multiplatform
else
{ };
}