Created attachment 257989 [details] kernel config Hi, While usual kernel update from 4.9.34 to 4.12.5 it fails with the error: ------------------------------------------------------------- /tmp/cc3rZjPi.s: Assembler messages: /tmp/cc3rZjPi.s:32: Error: instruction `andn' isn't supported in 16-bit mode. /tmp/cc3rZjPi.s:40: Error: instruction `shlx' isn't supported in 16-bit mode. make[1]: *** [scripts/Makefile.build:302: arch/x86/boot/cpucheck.o] Error 1 make: *** [arch/x86/Makefile:281: bzImage] Error 2 make: *** Waiting for unfinished jobs.... ------------------------------------------------------------ There's neither boot image in /boot, nor modules in /lib/modules installed. I've never seen errors like that before, and have no idea how to fix or debug this issue... My compiling options: KCFLAGS="-O2 -march=native -fno-stack-protector -fomit-frame-pointer" KCPPFLAGS=$KCFLAGS KCXXFLAGS=$KCFLAGS make -j4 && make modules_install && make install 2>&1 Also tried with "-O3" and without any "-O" -- same error. The same issue on Gentoo bugtracker https://bugs.gentoo.org/show_bug.cgi?id=627890 Regards, Alex
Created attachment 257991 [details] /proc/cpuinfo
Tried to debug this issue following this https://sourceware.org/bugzilla/show_bug.cgi?id=17421 With "make V=1 -j1" The last command before fail is: ------------------------------------------------------------------ gcc -Wp,-MD,arch/x86/boot/.cpucheck.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include -I./arch/x86/include -I./arch/x86/include/generated/uapi -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -O2 -march=native -fno-stack-protector -fomit-frame-pointer -m16 -g -Os -D__KERNEL__ -DDISABLE_BRANCH_PROFILING -Wall -Wstrict-prototypes -march=i386 -mregparm=3 -fno-strict-aliasing -fomit-frame-pointer -fno-pic -mno-mmx -mno-sse -ffreestanding -fno-stack-protector -D_SETUP -DKBUILD_BASENAME='"cpucheck"' -DKBUILD_MODNAME='"cpucheck"' -c -o arch/x86/boot/cpucheck.o arch/x86/boot/cpucheck.c --------------------------------------------------------------- Adjusted it to get asm source: ------------------------------------------------------------------ gcc -Wp,-MD,arch/x86/boot/.cpucheck.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include -I./arch/x86/include -I./arch/x86/include/generated/uapi -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -O2 -march=native -fno-stack-protector -fomit-frame-pointer -m16 -g -Os -D__KERNEL__ -DDISABLE_BRANCH_PROFILING -Wall -Wstrict-prototypes -march=i386 -mregparm=3 -fno-strict-aliasing -fomit-frame-pointer -fno-pic -mno-mmx -mno-sse -ffreestanding -fno-stack-protector -D_SETUP -DKBUILD_BASENAME='"cpucheck"' -DKBUILD_MODNAME='"cpucheck"' -c -S -o arch/x86/boot/cpucheck.S arch/x86/boot/cpucheck.c ----------------------------------------------------------------- Compiling the resulted cpucheck.S gives (almost) the same errors: ------------------------------------------------------------------- # as arch/x86/boot/cpucheck.S -c -o temp.o arch/x86/boot/cpucheck.S: Assembler messages: arch/x86/boot/cpucheck.S:32: Error: instruction `andn' isn't supported in 16-bit mode. arch/x86/boot/cpucheck.S:40: Error: instruction `shlx' isn't supported in 16-bit mode. arch/x86/boot/cpucheck.S:84: Error: register save offset not a multiple of 8 arch/x86/boot/cpucheck.S:91: Error: register save offset not a multiple of 8 ---------------------------------------------------------------- Adjusted the command again to get more verbose asm source. Compiling cpucheck.SV also shows the same errors: ------------------------------------------------------------------------ # as arch/x86/boot/cpucheck.SV -c -o temp.o arch/x86/boot/cpucheck.SV: Assembler messages: arch/x86/boot/cpucheck.SV:105: Error: instruction `andn' isn't supported in 16-bit mode. arch/x86/boot/cpucheck.SV:113: Error: instruction `shlx' isn't supported in 16-bit mode. arch/x86/boot/cpucheck.SV:157: Error: register save offset not a multiple of 8 arch/x86/boot/cpucheck.SV:164: Error: register save offset not a multiple of 8 ------------------------------------------------------------------------------- Both cpucheck.S and cpucheck.SV are attached and they do have the specified instructions in specified lines. However, I still have no idea how to fix it.
Created attachment 258003 [details] cpucheck.S
Created attachment 258005 [details] cpucheck.SV (verbose)
It seems to me something is wrong with AND NOT and left shift in this function of cpucheck.c: ----------------------------------------------------------------------- /* Returns a bitmask of which words we have error bits in */ static int check_cpuflags(void) { u32 err; int i; err = 0; for (i = 0; i < NCAPINTS; i++) { err_flags[i] = req_flags[i] & ~cpu.flags[i]; if (err_flags[i]) err |= 1 << i; } return err; } ------------------------------------------------------------------------
https://sourceware.org/bugzilla/show_bug.cgi?id=21965
The bug finally landed here https://sourceware.org/bugzilla/show_bug.cgi?id=21965 4.12.5 builds with gcc-5.4.0 and '--march=broadwell' Sorry, kernel guys. Regards, Alex
Needs newer gcc or don't use -march=native.