Bug 1955659 - Feature: allow compilation of kvdo using clang with clang compiled kernels
Summary: Feature: allow compilation of kvdo using clang with clang compiled kernels
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: kmod-kvdo
Version: 9.0
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: beta
: ---
Assignee: vdo-internal
QA Contact: vdo-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-30 15:27 UTC by Nikolay Kichukov
Modified: 2021-04-30 15:28 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)

Description Nikolay Kichukov 2021-04-30 15:27:08 UTC
Description of problem:
Allow kvdo to be compiled with clang and against clang compiled kernels. Ref:
https://www.kernel.org/doc/html/latest/kbuild/llvm.html


Version-Release number of selected component (if applicable): kvdo, unstable branch, ie - latest.


How reproducible:
Compile kernel 5.10.27 with clang and they try to compile kvdo kernel module.


Steps to Reproduce:
1. Compile your kernel 5.10.27 with clang
2. compile kvdo for clang:
make V=1 LLVM=1 -j1 -C /usr/src/linux M=/var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999


Actual results:
make: Entering directory '/usr/src/linux-5.10.27-gentoo'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (                \
echo >&2;                                                       \
echo >&2 "  ERROR: Kernel configuration is invalid.";           \
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";      \
echo >&2 ;                                                      \
/bin/false)
make -f ./scripts/Makefile.build obj=/var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999 \
single-build= \
need-builtin=1 need-modorder=1
make -f ./scripts/Makefile.build obj=/var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999/uds \
 \
need-builtin=1 \
need-modorder=1
  clang -Wp,-MMD,/var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999/uds/.buffer.o.d -nostdinc -isystem /usr/lib/llvm/11/bin/../../../../lib/clang/11.1.0/include -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Qunused-arguments -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 -std=gnu89 -no-integrated-as -Werror=unknown-warning-option -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -mno-80387 -mstack-alignment=8 -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mretpoline-external-thunk -fno-delete-null-pointer-checks -Wno-frame-address -Wno-address-of-packed-member -O2 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-format-invalid-specifier -Wno-gnu -mno-global-merge -Wno-unused-const-variable -fomit-frame-pointer -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -fno-strict-overflow -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -Wno-initializer-overrides -Wno-format -Wno-sign-compare -Wno-format-zero-length -Wno-pointer-to-enum-cast -Wno-tautological-constant-out-of-range-compare -fno-builtin-memset -Wframe-larger-than=400 -Wno-declaration-after-statement -DUDS_VERSION=\"8.1.0.231\" -I/var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999/uds  -DMODULE  -DKBUILD_BASENAME='"buffer"' -DKBUILD_MODNAME='"uds"' -c -o /var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999/uds/buffer.o /var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999/uds/buffer.c
In file included from /var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999/uds/buffer.c:26:
In file included from /var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999/uds/memoryAlloc.h:28:
/var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999/uds/cpu.h:60:4: error: argument to '__builtin_prefetch' must be a constant integer
                        __builtin_prefetch(address, for_write);
                        ^                           ~~~~~~~~~
1 error generated.
make[2]: *** [scripts/Makefile.build:279: /var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999/uds/buffer.o] Error 1
make[1]: *** [scripts/Makefile.build:496: /var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999/uds] Error 2
make: *** [Makefile:1810: /var/tmp/portage/sys-block/kvdo-9999/work/kvdo-9999] Error 2
make: Leaving directory '/usr/src/linux-5.10.27-gentoo'



Expected results:
Compile cleanly.


Additional info:
amd64 arch
clang 11.1.0
llvm 11.1.0
clang compiled kernel: 5.10.27


Note You need to log in before you can comment on or make changes to this bug.