Skip to content

Commit

Permalink
nix: Don't exclude libc for some platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
nspin committed Aug 8, 2023
1 parent 3603d30 commit 8801f7a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 41 deletions.
6 changes: 0 additions & 6 deletions hacking/nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,10 @@ let
};
riscv64 = {
none = mkLeaf (guard "riscv64-none-elf");
noneWithLibc = mkLeaf (guard "riscv64-none-elf" // {
this.noneWithLibc = true;
});
linux = mkLeaf (guard "riscv64-unknown-linux-gnu");
};
riscv32 = {
none = mkLeaf (guard "riscv32-none-elf");
noneWithLibc = mkLeaf (guard "riscv32-none-elf" // {
this.noneWithLibc = true;
});
linux = mkLeaf (guard "riscv32-unknown-linux-gnu");
};
x86_64 = {
Expand Down
8 changes: 0 additions & 8 deletions hacking/nix/overlay/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ assert !(super ? scopeName);
})
;

stdenv =
if super.stdenv.hostPlatform.isNone && !(super.stdenv.hostPlatform.this.noneWithLibc or false)
then
# Use toolchain without newlib. This is equivalent to crossLibcStdenv.
super.overrideCC super.stdenv super.crossLibcStdenv.cc
else
super.stdenv;

# Add Python packages needed by the seL4 ecosystem
pythonPackagesExtensions = super.pythonPackagesExtensions ++ [
(callPackage ./python-overrides.nix {})
Expand Down
19 changes: 1 addition & 18 deletions hacking/nix/scope/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ superCallPackage ../rust-utils {} self //
riscv64 = "riscv64imac-unknown-none-elf"; # gc?
riscv32 = "riscv32imac-unknown-none-elf"; # gc?
x86_64 = "x86_64-unknown-none";
ia32 = "i686-unknown-linux-gnu";
ia32 = "i686-unknown-linux-gnu"; # HACK
}."${seL4Arch}";

mkBuiltinRustTargetInfo = name: {
Expand Down Expand Up @@ -249,21 +249,4 @@ superCallPackage ../rust-utils {} self //
];
});

### stdenv

stdenvWithLibc =
let
bintools = stdenv.cc.bintools.override {
libc = libcCross;
noLibc = false;
};
in
stdenv.override {
cc = stdenv.cc.override {
libc = libcCross;
noLibc = false;
inherit bintools;
};
};

})
5 changes: 1 addition & 4 deletions hacking/nix/scope/world/instances/c.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
, crates
, mkTask
, defaultRustTargetInfo
, stdenvWithLibc

, mkInstance
}:

let
libcDir = "${stdenvWithLibc.cc.libc}/${hostPlatform.config}";
libcDir = "${stdenv.cc.libc}/${hostPlatform.config}";

in
mkInstance {
rootTask = mkTask rec {
stdenv = stdenvWithLibc;

rootCrate = crates.tests-root-task-c;

release = false;
Expand Down
11 changes: 6 additions & 5 deletions hacking/nix/top-level/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ in {
];

sel4testInstances = (map (x: x.this.sel4test) [
pkgs.host.aarch64.linux
pkgs.host.aarch32.linux
pkgs.host.riscv64.noneWithLibc
pkgs.host.riscv32.noneWithLibc
pkgs.host.aarch64.none
pkgs.host.aarch32.none
pkgs.host.riscv64.none
pkgs.host.riscv32.none
# TODO figure out why none doesn't work
pkgs.host.x86_64.linux
pkgs.host.ia32.linux
]);

prerequisites = aggregate "prerequisites" [
pkgs.host.riscv64.noneWithLibc.gccMultiStdenvGeneric
pkgs.host.riscv64.none.gccMultiStdenvGeneric
pkgs.build.this.qemuForSeL4
pkgs.build.this.cargoManifestGenrationUtils.rustfmtWithTOMLSupport
pkgs.build.this.capdl-tool
Expand Down

0 comments on commit 8801f7a

Please sign in to comment.