Commit fc82d7db authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Paul E. McKenney
Browse files

tools/nolibc: add libc-test binary



This can be used to easily compare the behavior of nolibc to the system
libc.

Signed-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 2df07fc5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
/initramfs/
/libc-test
/nolibc-test
/run.out
/sysroot/
+6 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ help:
	@echo "  help         this help"
	@echo "  sysroot      create the nolibc sysroot here (uses \$$ARCH)"
	@echo "  nolibc-test  build the executable (uses \$$CC and \$$CROSS_COMPILE)"
	@echo "  libc-test    build an executable using the compiler's default libc instead"
	@echo "  run-user     runs the executable under QEMU (uses \$$ARCH, \$$TEST)"
	@echo "  initramfs    prepare the initramfs with nolibc-test"
	@echo "  defconfig    create a fresh new default config (uses \$$ARCH)"
@@ -128,6 +129,9 @@ nolibc-test: nolibc-test.c sysroot/$(ARCH)/include
	$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
	  -nostdlib -static -Isysroot/$(ARCH)/include $< -lgcc

libc-test: nolibc-test.c
	$(QUIET_CC)$(CC) -o $@ $<

# qemu user-land test
run-user: nolibc-test
	$(Q)qemu-$(QEMU_ARCH) ./nolibc-test > "$(CURDIR)/run.out" || :
@@ -159,6 +163,8 @@ clean:
	$(Q)rm -rf sysroot
	$(call QUIET_CLEAN, nolibc-test)
	$(Q)rm -f nolibc-test
	$(call QUIET_CLEAN, libc-test)
	$(Q)rm -f libc-test
	$(call QUIET_CLEAN, initramfs)
	$(Q)rm -rf initramfs
	$(call QUIET_CLEAN, run.out)