Diet libc

Is a Linux specific libc implementation optmized for small size

Prerequisites:

Installing

# Get diet libc sources
cd /opt || cat >&2
cvs -d :pserver:cvs@cvs.fefe.de:/cvs -z9 co dietlibc

cd dietlibc || cat >&2

# Patch if needed

make
make install-bin install-headers

This goes directly into /opt/diet.

Notes:

  • Since mid 2018 patch for extra no-pic, see below.
  • 20190119: befor make install run:
make bin-x86_64/libm.a bin-x86_64/libpthread.a bin-x86_64/libcrypt.a bin-x86_64/dnsd

Instructions

If you want to compile with diet:

PATH=/opt/diet/bin:$PATH

Update

cd /opt/dietlibc || cat >&2

cvs update

# Patch if needed

make clean
make
make install-bin install-headers

Patches

Since mid 2018:

patch <<'EOF'
--- Makefile   11 Dec 2018 15:16:38 -0000  1.220
+++ Makefile   19 Jan 2019 10:25:07 -0000
@@ -595,7 +595,7 @@
 # WANT_SSP
 # This facepalm brought to you by: Ubuntu!
 $(PICODIR)/stackgap.o: EXTRACFLAGS:=-fno-stack-protector
-$(OBJDIR)/stackgap.o: EXTRACFLAGS:=-fno-stack-protector -fno-pie -DNDEBUG
+$(OBJDIR)/stackgap.o: EXTRACFLAGS:=-fno-stack-protector -fpie -DNDEBUG
 $(OBJDIR)/stackgap-pie.o: EXTRACFLAGS:=-fno-stack-protector -Dstackgap=stackgap_pie -fpie

 $(OBJDIR)/stackgap-g.o: EXTRACFLAGS:=-fno-stack-protector -fno-pie
EOF