liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit a7e7146887a7f036763d48e49bb93fe7ca59d2d3
parent d66f5901a2f26219c23bbeee1c495a19256dba3a
Author: Daniel Barlow <dan@telent.net>
Date:   Sun, 18 Jun 2023 23:02:08 +0100

preinit: disable nolibc

- it stopped working with 22.11->23.05
- linking statically against musl is about 17k, so
  this is costing us 11k or so

Diffstat:
Mpkgs/preinit/default.nix | 5+++--
Mpkgs/preinit/preinit.c | 3++-
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/pkgs/preinit/default.nix b/pkgs/preinit/default.nix @@ -13,12 +13,13 @@ stdenv.mkDerivation { name = "preinit"; src = ./.; - # NIX_DEBUG=2; +# NIX_DEBUG=2; hardeningDisable = [ "all" ]; - CFLAGS = "-Os -nostartfiles -nostdlib -fno-stack-protector -fpic -fPIC -I ./ -I ${kernel}/tools/include/nolibc"; + CFLAGS = "-Os -static -DPREINIT_USE_LIBC -fno-stack-protector -fpic -fPIC -I ./ -I ${kernel}/tools/include/nolibc"; postBuild = '' $STRIP --remove-section=.note --remove-section=.comment preinit + ls -l preinit ''; makeFlags = ["preinit"]; diff --git a/pkgs/preinit/preinit.c b/pkgs/preinit/preinit.c @@ -1,6 +1,7 @@ -#ifdef USE_LIBC +#ifdef PREINIT_USE_LIBC #include <string.h> #include <unistd.h> +#include <fcntl.h> #include <sys/mount.h> #include <sys/wait.h> #include <string.h>