From cbd2cbd2944bd71b80d6387d4b31b61708107cd0 Mon Sep 17 00:00:00 2001 From: jackyliu16 <18922251299@163.com> Date: Sat, 22 Apr 2023 15:05:37 +0800 Subject: [PATCH] lib.platform.loongnix: FIX gold linker not support Debug: - BC configure-gold failure as a reason that gold linker haven't support loongarch architecture and i have check gold is not supporot it in every version. - According to `lib/systems/default.nix::linker`, the default choice of linker is `bdf` and shouldn't calling fo gold. - But according to `pkgs/development/tools/misc/binutils/default.nix` if the platform kernels execFormat was `elf` and platform wasn't RISCV then binusil will using gold as linker, which is different with prev. Action: 1. since i haven't well understood the overall project structure, and the platform(loongarch64) seems haven't any kind of connection with kernel *(i haven't ideas about how to description it's kernel or os? )*, just adding another negation to avoid to using `gold` linker when architecture is `loongarch64`. 2. adding a kind of document to helping latecommer to easy seem this situation. With-Bug: checking sysdep dirs... configure: error: The loongarch64 is not supported. error: builder for '/nix/store/qli5cbddq11gmjqwr4h5myj2iwjbbfqk-glibc-loongarch64-unknown-linux-gnu-2.35-224.drv' failed with exit code 1 log: https://fars.ee/wBwd Others: Sorry, but seems that i haven't enough time to finish this... very appreciated about @k900:0upti.me help when i was confused. --- lib/systems/default.nix | 1 + pkgs/development/tools/misc/binutils/default.nix | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/systems/default.nix b/lib/systems/default.nix index d39094728345572..cb5805ef91b8e0f 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -66,6 +66,7 @@ rec { # "bfd" and "gold" both come from GNU binutils. The existence of Gold # is why we use the more obscure "bfd" and not "binutils" for this # choice. + # Note: The gold is been default using when kernel.execFormat = elf in `development/tools/misc/binutils/default.nix` else "bfd"; extensions = rec { sharedLibrary = diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index 10a0281b075cbad..0db491f225c1964 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -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