intel / intel/ethernet-linux-ixgbevf
Unable to compile with LLVM toolchain due to multiple C errors
- Dominant language
- C
- Stars
- 14
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
When building using the LLVM (16) toochain under Debian bookworm (VyOS), compilation fails with multiple
```make
In file included from ./include/linux/tcp.h:20:
./include/net/inet_connection_sock.h:226:3: error: initializing 'int' with an expression of incompatible type 'void'
pr_debug("reset_xmit_timer: sk=%p %d when=0x%lx, caller=%p\n",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/printk.h:579:2: note: expanded from macro 'pr_debug'
dynamic_pr_debug(fmt, ##__VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dynamic_debug.h:269:2: note: expanded from macro 'dynamic_pr_debug'
_dynamic_func_call(fmt, __dynamic_pr_debug, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dynamic_debug.h:250:2: note: expanded from macro '_dynamic_func_call'
_dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
./include/linux/dynamic_debug.h:222:2: note: expanded from macro '__dynamic_func_call_cls'
DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dynamic_debug.h:173:3: note: expanded from macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
_DPRINTK_KEY_INIT \
^~~~~~~~~~~~~~~~~
./include/linux/dynamic_debug.h:190:47:In file included from /vyos/packages/linux-kernel/ixgbevf-4.18.9/src/ixgbe_mbx.c:4note: :
```
type errors along with
```make
In file included from /vyos/packages/linux-kernel/ixgbevf-4.18.9/src/kcompat.h./include/linux/dynamic_debug.h::26269:
:In file included from 2./include/linux/ipv6.h:: 95:
In file included from note: ./include/linux/tcp.h:expanded from macro 'dynamic_pr_debug'20:
./include/net/inet_connection_sock.h:356:2: error: _dynamic_func_call(fmt, __dynamic_pr_debug, \expected expression
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spin_lock_init(&icsk->icsk_accept_queue.fastopenq.lock);./include/linux/dynamic_debug.h
:250 ^:
2: ./include/linux/spinlock.h:note: 344:expanded from macro '_dynamic_func_call'13:
note: expanded from macro 'spin_lock_init'
*(_lock) = __SPIN_LOCK_UNLOCKED(_lock); \
^
_dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/vyos/packages/linux-kernel/ixgbevf-4.18.9/src/kcompat_gcc.h
:61:21:note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)note:
expanded from macro '__SPIN_LOCK_UNLOCKED'
./include/linux/dynamic_debug.h:222: /* (spinlock_t) */ __SPIN_LOCK_INITIALIZER(lockname)2
: ^
note: expanded from macro '__dynamic_func_call_cls'./include/linux/spinlock_types.h:
38:2: note: expanded from macro '__SPIN_LOCK_INITIALIZER'
DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { { .rlock = ___SPIN_LOCK_INITIALIZER(lockname) } }
^
./include/linux/dynamic_debug.h:173:3: note: expanded from macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
_DPRINTK_KEY_INIT \
^~~~~~~~~~~~~~~~~
./include/linux/dynamic_debug.h:190:47: note: expanded from macro '_DPRINTK_KEY_INIT'
#define _DPRINTK_KEY_INIT .key.dd_key_false = (STATIC_KEY_FALSE_INIT)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /vyos/packages/linux-kernel/ixgbevf-4.18.9/src/ixgbevf_ethtool.c:15:
In file included from /vyos/packages/linux-kernel/ixgbevf-4.18.9/src/ixgbevf.h:24:
In file included from /vyos/packages/linux-kernel/ixgbevf-4.18.9/src/kcompat.h:26:
In file included from ./include/linux/ipv6.h:95:
In file included from ./include/linux/tcp.h:20:
```
Use of the LLVM toolchain is growing in adoption outside of Android and will more so now that kCFI is on by default in recent versions.
Building with kCFI and LTO_CLANG_FULL using https://github.com/vyos/vyos-build/blob/current/packages/linux-kernel/build-intel-ixgbevf.sh via
```shell
# Get kernel sources
gpg2 --locate-keys torvalds@kernel.org gregkh@kernel.org
curl -OL https://www.kernel.org/pub/linux/kernel/v6.x/linux-${KERNEL_VER}.tar.xz
curl -OL https://www.kernel.org/pub/linux/kernel/v6.x/linux-${KERNEL_VER}.tar.sign
xz -cd linux-${KERNEL_VER}.tar.xz | gpg2 --verify linux-${KERNEL_VER}.tar.sign -
# LLVM setup
sudo apt -y install llvm-16 clang-16 lld-16 clang-tools-16
export LLVM=-16
cp arch/x86/configs/vyos_defconfig_clang arch/x86/configs/vyos_defconfig
# Unpack Kernel source
tar xf linux-${KERNEL_VER}.tar.xz
ln -s linux-${KERNEL_VER} linux
# ... Build Kernel
./build-kernel.sh
# Build Intel drivers
./build-intel-ixgbe.sh && \
./build-intel-ixgbevf.sh
```
from inside the VyOS build-container in https://github.com/vyos/vyos-build/blob/current/docker
Contributor guide
Research direction
Reproduce the LLVM 16 build using build-intel-ixgbevf.sh and the reported VyOS kernel configuration. Start with src/kcompat.h and the referenced include/linux/dynamic_debug.h, spinlock.h, and net/inet_connection_sock.h diagnostics. Done means the ixgbevf driver compiles with the LLVM toolchain, kCFI, and LTO_CLANG_FULL without these C errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- networking, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100