Skip to content

Commit 7a628a2

Browse files
unlsycnAvimitin
authored andcommitted
[nix] switch to xsfmm llvm
Signed-off-by: unlsycn <[email protected]>
1 parent 2b812d0 commit 7a628a2

File tree

3 files changed

+51
-15
lines changed

3 files changed

+51
-15
lines changed

flake.lock

Lines changed: 29 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
inputs = {
55
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
66
flake-parts.url = "github:hercules-ci/flake-parts";
7+
nixpkgs-for-llvm.url = "github:NixOS/nixpkgs/nixos-unstable-small";
78
mill-ivy-fetcher.url = "github:Avimitin/mill-ivy-fetcher";
89
circt-follow.url = "github:sequencer/zaozi";
910
treefmt-nix.url = "github:numtide/treefmt-nix";

nix/overlay.nix

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
{ self }:
2+
13
final: prev:
24

35
let
4-
llvmForRVV_attrName = "llvmPackages_19";
5-
rv32_pkgs = final.pkgsCross.riscv32-embedded;
6+
llvmForRVV_attrName = "llvmPackages_git";
7+
rv32_pkgs =
8+
self.inputs.nixpkgs-for-llvm.legacyPackages."${final.system}".pkgsCross.riscv32-embedded;
69
rv32_buildPkgs = rv32_pkgs.buildPackages;
710
in
811
rec {
@@ -92,9 +95,24 @@ rec {
9295
newlib = rv32_pkgs.stdenv.cc.libc.overrideAttrs (oldAttrs: {
9396
CFLAGS_FOR_TARGET = "-march=rv32imacf_zvl128b_zve32f -mabi=ilp32f";
9497
});
98+
99+
llvmPackages = rv32_buildPkgs.${llvmForRVV_attrName};
100+
patchedCC =
101+
let
102+
llvmSrc = prev.fetchFromGitHub {
103+
owner = "topperc";
104+
repo = "llvm-project";
105+
rev = "bb123ff9401b517d877de4ed6fd9ea61edf49dbb";
106+
hash = "sha256-6ca5FhSsG5Qik7wi6Vn3OmUmKR/hULSDniu4JLo+5jM=";
107+
};
108+
in
109+
llvmPackages.clang-unwrapped.override {
110+
monorepoSrc = llvmSrc;
111+
libllvm = llvmPackages.libllvm.override { monorepoSrc = llvmSrc; };
112+
};
95113
in
96114
rv32_buildPkgs.wrapCCWith rec {
97-
cc = rv32_buildPkgs.${llvmForRVV_attrName}.clang-unwrapped;
115+
cc = patchedCC;
98116
libc = newlib;
99117
bintools = rv32_pkgs.stdenv.cc.bintools.override {
100118
inherit libc; # we must keep consistency of bintools libc and compiler libc

0 commit comments

Comments
 (0)