Skip to contentSkip to conversation

Bug in CONFIG_CC_HAS_INT128 (5.5 regression)

DISCUSSION George Spelvin 1 participant 1 message Mar 9, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

Here's an interesting bug I just ran into, a bug in commit c12d3362a74b ("int128: move __uint128_t compiler test to Kconfig")

My x86-64 kernel build is lacking CC_HAS_INT128 and therefore
CONFIG_ARCH_SUPPORTS_INT128, even through it supports
__int128 just fine.

The reason is that the actuall call which tests for compiler support is
execve("/usr/bin/gcc", ["gcc", "-Werror", "-D__SIZEOF_INT128__=0", "-S", "-x", "c", "/dev/null", "-o", "/dev/null"], 0x5818d390 /* 122 vars */) = 0

and it doesn't detect the redefined symbol.

$ gcc -Werror -D__SIZEOF_INT128__=0 -S -x c /dev/null -o /dev/null
$ echo $?
0

But on my machine, gcc defaults to the 32-bit compiler. The kernel is compiled with -m64, and with that on the command line, things fail as expected:

$ gcc -m64 -Werror -D__SIZEOF_INT128__=0 -S -x c /dev/null -o /dev/null
<command-line>: error: "__SIZEOF_INT128__" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
$

I haven't figured out how to fix this, but hopefully someone more familiar with the innards of Kconfig can.