forked from dan/liminix
1
0
Fork 0

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
This commit is contained in:
Daniel Barlow 2023-06-18 23:02:08 +01:00
parent d66f5901a2
commit a7e7146887
2 changed files with 5 additions and 3 deletions

View File

@ -13,12 +13,13 @@ stdenv.mkDerivation {
name = "preinit"; name = "preinit";
src = ./.; src = ./.;
# NIX_DEBUG=2; # NIX_DEBUG=2;
hardeningDisable = [ "all" ]; 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 = '' postBuild = ''
$STRIP --remove-section=.note --remove-section=.comment preinit $STRIP --remove-section=.note --remove-section=.comment preinit
ls -l preinit
''; '';
makeFlags = ["preinit"]; makeFlags = ["preinit"];

View File

@ -1,6 +1,7 @@
#ifdef USE_LIBC #ifdef PREINIT_USE_LIBC
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h>
#include <sys/mount.h> #include <sys/mount.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <string.h> #include <string.h>