Hilko Bengen
2025-10-23
Let's take a look at GNU hello
src/hello.csrc/hello.ohelloSimple sources, simple result.
$ hello
Hello, world!
(or so one might think)
Not so fast…
lib/c-ctype.c lib/c-strcasecmp.c lib/c-strncasecmp.c
lib/close-stream.c lib/closeout.c lib/dirname.c lib/basename.c
lib/dirname-lgpl.c lib/basename-lgpl.c lib/stripslash.c lib/exitfail.c
lib/localcharset.c lib/progname.c lib/quotearg.c lib/strnlen1.c
lib/unistd.c lib/wctype-h.c lib/xmalloc.c lib/xalloc-die.c
lib/xstrndup.c
…get compiled into corresponding .o files and linked linked into lib/libhello.a
Result is statically linked with hello.o into hello
executable
gcc -o src/hello.o src/hello.c
cc1 src/hello.c -o /tmp/ccspfdss.s
hello.c and
many *.h header files as part of
pre-processingas -o src/hello.o /tmp/ccspfdss.s
ar cru lib/libhello.a lib/c-ctype.o lib/c-strcasecmp.o lib/c-strncasecmp.o […]
libhello.agcc -o hello src/hello.o ./lib/libhello.a
collect2 -o hello src/hello.o ./lib/libhello.a
ld -o hello src/hello.o ./lib/libhello.a
Assuming no network activity…
fork+execve)LD_PRELOAD to
instrument the build toolchain works – but not for statially linked
toolsstrace works in
general, has high overhead, even if we limit ourselves to a handful of
syscalls.liblzma_la-crc64-fast.o is not created by a
linker binary.crc64_fast.c source
code is overwritten using sed.Slides will be published here:
(https://hillu.github.io/conference-materials/hacklu-2025-build/slides.reveal.html)
Contact me at
Hilko Bengen <bengen@hilluzination.de> @hillu@infosec.exchange