Conditonal variable to enable nolibc build. Link: https://github.com/axboe/liburing/issues/443 Signed-off-by: Ammar Faizi <ammar.faizi@xxxxxxxxxxxxxxxxxxxxx> --- configure | 7 +++++++ src/Makefile | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 92f51bd..6bdcead 100755 --- a/configure +++ b/configure @@ -358,6 +358,13 @@ print_config "has_memfd_create" "$has_memfd_create" ############################################################################# +if test "$LIBURING_NOLIBC" = "y" -o "$LIBURING_NOLIBC" = "yes" -o "$LIBURING_NOLIBC" = "1"; then + output_sym "LIBURING_NOLIBC" + LIBURING_NOLIBC="yes" +else + LIBURING_NOLIBC="no" +fi +print_config "LIBURING_NOLIBC" "$LIBURING_NOLIBC" if test "$__kernel_rwf_t" = "yes"; then output_sym "CONFIG_HAVE_KERNEL_RWF_T" diff --git a/src/Makefile b/src/Makefile index 5e46a9d..bc42675 100644 --- a/src/Makefile +++ b/src/Makefile @@ -32,11 +32,22 @@ endif all: $(all_targets) -liburing_srcs := setup.c queue.c syscall.c register.c +liburing_srcs := setup.c queue.c register.c + +ifeq ($(LIBURING_NOLIBC),y) + liburing_srcs += nolibc.c + override CFLAGS += -nostdlib -nolibc -nodefaultlibs -ffreestanding -fno-stack-protector -fpic + override CPPFLAGS += -nostdlib -nolibc -nodefaultlibs -ffreestanding -fno-stack-protector -fpic + override LINK_FLAGS += -nostdlib -nolibc -nodefaultlibs -fpic +else + liburing_srcs += syscall.c +endif liburing_objs := $(patsubst %.c,%.ol,$(liburing_srcs)) liburing_sobjs := $(patsubst %.c,%.os,$(liburing_srcs)) +$(liburing_srcs): syscall.h lib.h + $(liburing_objs) $(liburing_sobjs): include/liburing/io_uring.h %.os: %.c -- 2.30.2