From 8aba7ae9fa5f3d563500d2f76ecde16b02981b17 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 11 Jan 2021 23:38:43 +0000 Subject: [PATCH] compel: Fix missing loff_t in Alpine musl defines 'loff_t' in fcntl.h as 'off_t'. This patch resolves the following error when running the compel tests on Alpine Linux: gcc -O2 -g -Wall -Werror -c -Wstrict-prototypes -fno-stack-protector -nostdlib -fomit-frame-pointer -ffreestanding -fpie -I ../../../compel/include/uapi -o parasite.o parasite.c In file included from ../../../compel/include/uapi/compel/plugins/std/syscall.h:8, from ../../../compel/include/uapi/compel/plugins/std.h:5, from parasite.c:3: ../../../compel/include/uapi/compel/plugins/std/syscall-64.h:19:66: error: unknown type name 'loff_t'; did you mean 'off_t'? 19 | extern long sys_pread (unsigned int fd, char *buf, size_t count, loff_t pos) ; | ^~~~~~ | off_t ../../../compel/include/uapi/compel/plugins/std/syscall-64.h:96:46: error: unknown type name 'loff_t'; did you mean 'off_t'? 96 | extern long sys_fallocate (int fd, int mode, loff_t offset, loff_t len) ; | ^~~~~~ | off_t ../../../compel/include/uapi/compel/plugins/std/syscall-64.h:96:61: error: unknown type name 'loff_t'; did you mean 'off_t'? 96 | extern long sys_fallocate (int fd, int mode, loff_t offset, loff_t len) ; | ^~~~~~ | off_t make[1]: *** [Makefile:32: parasite.o] Error 1 Signed-off-by: Radostin Stoyanov --- compel/arch/x86/plugins/std/syscalls/Makefile.syscalls | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compel/arch/x86/plugins/std/syscalls/Makefile.syscalls b/compel/arch/x86/plugins/std/syscalls/Makefile.syscalls index 4ba4b56c8..62c25f3e0 100644 --- a/compel/arch/x86/plugins/std/syscalls/Makefile.syscalls +++ b/compel/arch/x86/plugins/std/syscalls/Makefile.syscalls @@ -39,6 +39,10 @@ $(sys-proto): $(sys-def) $(sys-proto-types) $(Q) echo "/* Autogenerated, don't edit */" > $$@ $(Q) echo "#ifndef ASM_SYSCALL_PROTO_H_$(1)__" >> $$@ $(Q) echo "#define ASM_SYSCALL_PROTO_H_$(1)__" >> $$@ + $(Q) echo "/* musl defines loff_t as off_t */" >> $$@ + $(Q) echo '#ifndef loff_t' >> $$@ + $(Q) echo '#define loff_t off_t' >> $$@ + $(Q) echo '#endif' >> $$@ $(Q) echo '#include ' >> $$@ $(Q) echo '#include ' >> $$@ ifeq ($(1),32) @@ -71,6 +75,10 @@ $(sys-codes-generic): $(PLUGIN_ARCH_DIR)/std/syscalls/syscall_32.tbl $(sys-proto $(Q) echo "/* Autogenerated, don't edit */" > $@ $(Q) echo "#ifndef __ASM_CR_SYSCALL_CODES_H__" >> $@ $(Q) echo "#define __ASM_CR_SYSCALL_CODES_H__" >> $@ + $(Q) echo "/* musl defines loff_t as off_t */" >> $@ + $(Q) echo '#ifndef loff_t' >> $@ + $(Q) echo '#define loff_t off_t' >> $@ + $(Q) echo '#endif' >> $@ $(Q) echo '#include ' >> $@ $(Q) cat $< | awk '/^__NR/{NR32=$$1; \ sub("^__NR", "__NR32", NR32); \