# CC kernel/fork.o
gcc -Wp,-MMD,kernel/.fork.o.d -nostdinc -I./arch/um/include -I./arch/um/include/generated -I./include -I./arch/um/include/uapi -I./arch/um/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -m64 -I./arch/x86/um -I./arch/x86/include -I./arch/x86/include/uapi -I./arch/x86/include/generated -I./arch/x86/include/generated/uapi -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -funsigned-char -std=gnu11 -mcmodel=large -fno-builtin -m64 -D__arch_um__ -I./arch/um/include/shared -I./arch/x86/um/shared -I./arch/um/include/shared/skas -Dvmap=kernel_vmap -Dlongjmp=kernel_longjmp -Dsetjmp=kernel_setjmp -Din6addr_loopback=kernel_in6addr_loopback -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask -Dmktime=kernel_mktime -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O0 -mno-sse -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -mno-avx -mno-avx2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fno-stack-protector -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -ftrivial-auto-var-init=zero -fno-stack-clash-protection -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g -DKBUILD_MODFILE='"kernel/fork"' -DKBUILD_BASENAME='"fork"' -DKBUILD_MODNAME='"fork"' -D__KBUILD_MODNAME=kmod_fork -c -o kernel/fork.o kernel/fork.c
In file included from ./include/linux/mm_inline.h:10,
from kernel/fork.c:46:
./include/linux/swapops.h: In function 'set_pmd_migration_entry':
./include/linux/swapops.h:531:1: error: no return statement in function returning non-void [-Werror=return-type]
531 | }
| ^
In file included from kernel/fork.c:52:
./include/linux/hugetlb.h: In function 'hugetlb_follow_page_mask':
./include/linux/hugetlb.h:305:1: error: no return statement in function returning non-void [-Werror=return-type]
305 | }
| ^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:252: kernel/fork.o] Error 1
make[1]: *** [scripts/Makefile.build:497: kernel] Error 2
make: *** [Makefile:2035: .] Error 2
確認すると、getsがこのコメントで定義されていることがlinux-6.4.12/include/linux/hugetlb.h
わかります。hugetlb_follow_page_mask
BUILD_BUG();
/* should never be compiled in if !CONFIG_HUGETLB_PAGE*/
CONFIG_HUGETLB_PAGE
Linuxカーネルコードベースでこれが制御されている場所が見つかりません。何らかの理由でCC_OPTIMIZE_FOR_PERFORMANCE
ORを取り除き、代わりにORをCC_OPTIMIZE_FOR_SIZE
導入しようとすると、HugeTLBのサポートは中断されますか?-O0
-O2
-Os