Bug 95671 - Fails to build kernel 5.7 with -march=bdver{2,3,4} workaround -mno-tbm
Summary: Fails to build kernel 5.7 with -march=bdver{2,3,4} workaround -mno-tbm
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 10.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-14 11:17 UTC by Maxim Britov
Modified: 2020-06-15 14:41 UTC (History)
2 users (show)

See Also:
Host:
Target: x86_64-*-* i?86-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-06-15 00:00:00


Attachments
some minimal config for kerknel 5.7 for reproduce (8.11 KB, text/plain)
2020-06-15 11:24 UTC, Maxim Britov
Details
gcc -E ... (246.16 KB, application/gzip)
2020-06-15 12:09 UTC, Maxim Britov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maxim Britov 2020-06-14 11:17:32 UTC
There is patch for build kernel with different march:
https://github.com/graysky2/kernel_gcc_patch/blob/master/enable_additional_cpu_optimizations_for_gcc_v9.1%2B_kernel_v5.7%2B.patch

Gentoo use this patch with USE='experimental'

Since 5.7 kernel builds fails on bdver{2,3,4}.
I can build kernel when add -mno-tbm

         cflags-$(CONFIG_MBULLDOZER) += $(call cc-option,-march=bdver1)
         cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2)
+        cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-mno-tbm)
         cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-march=bdver3)
+        cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-mno-tbm)
         cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-march=bdver4)
+        cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-mno-tbm)

Please look if it gcc issue. Thanks.

My build log:
  HOSTCC  scripts/kconfig/conf.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --syncconfig Kconfig
  HOSTCC  arch/x86/tools/relocs_32.o
  HOSTCC  arch/x86/tools/relocs_64.o
  HOSTCC  arch/x86/tools/relocs_common.o
  HOSTLD  arch/x86/tools/relocs
  HOSTCXX -fPIC scripts/gcc-plugins/structleak_plugin.o
  HOSTLLD -shared scripts/gcc-plugins/structleak_plugin.so
  GENSEED scripts/gcc-plugins/randomize_layout_seed.h
  HOSTCXX -fPIC scripts/gcc-plugins/randomize_layout_plugin.o
  HOSTLLD -shared scripts/gcc-plugins/randomize_layout_plugin.so
  HOSTCXX -fPIC scripts/gcc-plugins/stackleak_plugin.o
  HOSTLLD -shared scripts/gcc-plugins/stackleak_plugin.so
  HOSTCC  scripts/genksyms/genksyms.o
  YACC    scripts/genksyms/parse.tab.[ch]
  HOSTCC  scripts/genksyms/parse.tab.o
  LEX     scripts/genksyms/lex.lex.c
  HOSTCC  scripts/genksyms/lex.lex.o
  HOSTLD  scripts/genksyms/genksyms
  HOSTCC  scripts/bin2c
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/sorttable
  HOSTCC  scripts/asn1_compiler
  HOSTCC  scripts/extract-cert
  HOSTCC  scripts/mod/mk_elfconfig
  CC      scripts/mod/empty.o
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CC      kernel/bounds.s
  CC      arch/x86/kernel/asm-offsets.s
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  HOSTCC   /usr/src/linux-5.7.1-gentoo-2/tools/objtool/fixdep.o
  HOSTLD   /usr/src/linux-5.7.1-gentoo-2/tools/objtool/fixdep-in.o
  LINK     /usr/src/linux-5.7.1-gentoo-2/tools/objtool/fixdep
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/exec-cmd.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/help.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/pager.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/parse-options.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/run-command.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/sigchain.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/subcmd-config.o
  LD       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/libsubcmd-in.o
  AR       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/libsubcmd.a
  GEN      /usr/src/linux-5.7.1-gentoo-2/tools/objtool/arch/x86/lib/inat-tables.c
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/arch/x86/decode.o
  LD       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/arch/x86/objtool-in.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/builtin-check.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/builtin-orc.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/check.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/orc_gen.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/orc_dump.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/elf.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/special.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/objtool.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/libstring.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/libctype.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/str_error_r.o
  CC       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/librbtree.o
  LD       /usr/src/linux-5.7.1-gentoo-2/tools/objtool/objtool-in.o
  LINK     /usr/src/linux-5.7.1-gentoo-2/tools/objtool/objtool
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/main.o
init/main.o: warning: objtool: initcall_blacklisted()+0xd9: return with modified stack frame
  CC      init/version.o
  CC      init/do_mounts.o
  CC      init/noinitramfs.o
  CC      init/calibrate.o
  CC      init/init_task.o
  AR      init/built-in.a
  AR      usr/built-in.a
  CC      arch/x86/entry/vdso/vma.o
  LDS     arch/x86/entry/vdso/vdso.lds
  AS      arch/x86/entry/vdso/vdso-note.o
  CC      arch/x86/entry/vdso/vclock_gettime.o
  CC      arch/x86/entry/vdso/vgetcpu.o
  VDSO    arch/x86/entry/vdso/vdso64.so.dbg
  OBJCOPY arch/x86/entry/vdso/vdso64.so
  HOSTCC  arch/x86/entry/vdso/vdso2c
  VDSO2C  arch/x86/entry/vdso/vdso-image-64.c
  CC      arch/x86/entry/vdso/vdso-image-64.o
  AR      arch/x86/entry/vdso/built-in.a
  CC      arch/x86/entry/vsyscall/vsyscall_64.o
arch/x86/entry/vsyscall/vsyscall_64.o: warning: objtool: emulate_vsyscall()+0x287: stack state mismatch: cfa1=7+64 cfa2=7+56
  AS      arch/x86/entry/vsyscall/vsyscall_emu_64.o
  AR      arch/x86/entry/vsyscall/built-in.a
  AS      arch/x86/entry/entry_64.o
  AS      arch/x86/entry/thunk_64.o
  CC      arch/x86/entry/syscall_64.o
  CC      arch/x86/entry/common.o
  AR      arch/x86/entry/built-in.a
  CC      arch/x86/events/amd/core.o
arch/x86/events/amd/core.o: warning: objtool: amd_pmu_handle_irq()+0x30: stack state mismatch: cfa1=7+16 cfa2=7+0
  CC      arch/x86/events/amd/uncore.o
  CC      arch/x86/events/amd/power.o
  CC      arch/x86/events/amd/ibs.o
arch/x86/events/amd/ibs.o: warning: objtool: perf_ibs_init()+0x23: can't find jump dest instruction at .text+0xe5
make[3]: *** [scripts/Makefile.build:267: arch/x86/events/amd/ibs.o] Error 255
make[3]: *** Deleting file 'arch/x86/events/amd/ibs.o'
make[2]: *** [scripts/Makefile.build:488: arch/x86/events/amd] Error 2
make[1]: *** [scripts/Makefile.build:488: arch/x86/events] Error 2
make: *** [Makefile:1729: arch/x86] Error 2
Comment 1 Martin Liška 2020-06-15 06:49:51 UTC
Can you please attach a pre-processed file for an object that fails with objtool?
Comment 2 Richard Biener 2020-06-15 06:56:30 UTC
Assuming GCC 10.1 - you didn't specify.
Comment 3 Maxim Britov 2020-06-15 11:19:24 UTC
(In reply to Richard Biener from comment #2)
> Assuming GCC 10.1 - you didn't specify.

In my env I can reproduce it on 8.3.0 / 9.2.0 / 9.3.0/ 10.1.0

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/8.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-8.3.0-r1/work/gcc-8.3.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/8.3.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 8.3.0-r1 p1.1' --enable-esp --enable-libstdcxx-time --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --with-multilib-list=m64 --disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-libmpx --disable-systemtap --enable-vtable-verify --enable-lto --without-isl --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 8.3.0 (Gentoo Hardened 8.3.0-r1 p1.1) 



Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-9.3.0/work/gcc-9.3.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/9.3.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/python --enable-languages=c,c++ --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 9.3.0 p2' --enable-esp --enable-libstdcxx-time --with-build-config=bootstrap-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --with-multilib-list=m64 --disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-libada --disable-systemtap --enable-vtable-verify --disable-libquadmath --enable-lto --without-isl --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 9.3.0 (Gentoo Hardened 9.3.0 p2) 



built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/10.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/10.1.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/10.1.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/10.1.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/10.1.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/g++-v10 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/10.1.0/python --enable-languages=c,c++ --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 10.1.0-r1 p2' --disable-esp --enable-libstdcxx-time --with-build-config=bootstrap-lto --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --with-multilib-list=m64 --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-libada --disable-systemtap --enable-vtable-verify --with-zstd --disable-libquadmath --enable-lto --with-isl --disable-isl-version-check --enable-default-pie --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.1.0 (Gentoo 10.1.0-r1 p2)
Comment 4 Maxim Britov 2020-06-15 11:23:31 UTC
(In reply to Martin Liška from comment #1)
> Can you please attach a pre-processed file for an object that fails with
> objtool?

Heh... I'm afraid I need some howto for this... :(

But I made some minimal reproducible .config for kernel 5.7

$ tar xf linux-5.7.tar.xz
$ cd linux-5.7
$ curl https://raw.githubusercontent.com/graysky2/kernel_gcc_patch/master/enable_additional_cpu_optimizations_for_gcc_v9.1%2B_kernel_v5.7%2B.patch | patch -p1

$ copy .config10 .config
$ make oldconfig
$ make

I will attach my .config10

For me it fails:
  CC      arch/x86/entry/vdso/vma.o
  LDS     arch/x86/entry/vdso/vdso.lds
  AS      arch/x86/entry/vdso/vdso-note.o
  CC      arch/x86/entry/vdso/vclock_gettime.o
  CC      arch/x86/entry/vdso/vgetcpu.o
  VDSO    arch/x86/entry/vdso/vdso64.so.dbg
  OBJCOPY arch/x86/entry/vdso/vdso64.so
  HOSTCC  arch/x86/entry/vdso/vdso2c
  VDSO2C  arch/x86/entry/vdso/vdso-image-64.c
  CC      arch/x86/entry/vdso/vdso-image-64.o
  AR      arch/x86/entry/vdso/built-in.a
  CC      arch/x86/entry/vsyscall/vsyscall_64.o
arch/x86/entry/vsyscall/vsyscall_64.o: warning: objtool: emulate_vsyscall()+0x60: can't find jump dest instruction at .text+0x10a
make[3]: *** [scripts/Makefile.build:267: arch/x86/entry/vsyscall/vsyscall_64.o] Error 255
make[3]: *** Deleting file 'arch/x86/entry/vsyscall/vsyscall_64.o'
make[2]: *** [scripts/Makefile.build:488: arch/x86/entry/vsyscall] Error 2
make[1]: *** [scripts/Makefile.build:488: arch/x86/entry] Error 2
make: *** [Makefile:1729: arch/x86] Error 2
Comment 5 Maxim Britov 2020-06-15 11:24:28 UTC
Created attachment 48732 [details]
some minimal config for kerknel 5.7 for reproduce
Comment 6 Martin Liška 2020-06-15 11:25:05 UTC
(In reply to Maxim Britov from comment #4)
> (In reply to Martin Liška from comment #1)
> > Can you please attach a pre-processed file for an object that fails with
> > objtool?
> 
> Heh... I'm afraid I need some howto for this... :(
> 

Add -E option to the compilation and attach the output file.
Comment 7 Andreas Schwab 2020-06-15 11:57:28 UTC
make arch/x86/entry/vsyscall/vsyscall_64.i
Comment 8 Martin Liška 2020-06-15 12:05:04 UTC
I've got a reduced test-case:

$ cat lbr.i
int a, c, d;
long b;

void
fn1() {
  for (; c; c++) {
    int e, f = 0;
    if (a) {
      e = !(d & 1ULL << 63);
      f = e;
    }
    d = fn1;
    b = f;
  }
}

$ gcc lbr.i -c -O2 -march=bdver2 -c && ~/Programming/linux/tools/objtool/objtool check --uaccess lbr.o
lbr.i: In function ‘fn1’:
lbr.i:12:7: warning: assignment to ‘int’ from ‘void (*)()’ makes integer from pointer without a cast [-Wint-conversion]
   12 |     d = fn1;
      |       ^
lbr.o: warning: objtool: fn1()+0x26: can't find jump dest instruction at .text+0x36

disassembly:
  26:	74 0e                	je     36 <fn1+0x36>
  28:	48 0f ba fa 1f       	btc    $0x1f,%rdx
  2d:	8f ea f8 10 ca 1f 01 	bextr  $0x11f,%rdx,%rcx
  34:	00 00 
  36:	ff c0                	inc    %eax

It seems to me bextr is not supported (parsed) by objtool?
Comment 9 Maxim Britov 2020-06-15 12:09:09 UTC
Created attachment 48733 [details]
gcc -E ...

I believe attachment is what you aksed. I did

gcc -E -Wp,-MD,arch/x86/entry/vsyscall/.vsyscall_64.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/10.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__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -march=bdver2 -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fno-stack-protector -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -Wno-packed-not-aligned    -DKBUILD_MODFILE='"arch/x86/entry/vsyscall/vsyscall_64"' -DKBUILD_BASENAME='"vsyscall_64"' -DKBUILD_MODNAME='"vsyscall_64"' -c -o arch/x86/entry/vsyscall/vsyscall_64.o arch/x86/entry/vsyscall/vsyscall_64.c


Fail was:

make -f ./scripts/Makefile.build obj=arch/x86/entry/vsyscall \
 \
need-builtin=1 \
need-modorder=1
  gcc -Wp,-MD,arch/x86/entry/vsyscall/.vsyscall_64.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/10.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__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -march=bdver2 -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fno-stack-protector -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -Wno-packed-not-aligned    -DKBUILD_MODFILE='"arch/x86/entry/vsyscall/vsyscall_64"' -DKBUILD_BASENAME='"vsyscall_64"' -DKBUILD_MODNAME='"vsyscall_64"' -c -o arch/x86/entry/vsyscall/vsyscall_64.o arch/x86/entry/vsyscall/vsyscall_64.c
   ./tools/objtool/objtool check  --uaccess arch/x86/entry/vsyscall/vsyscall_64.o
arch/x86/entry/vsyscall/vsyscall_64.o: warning: objtool: emulate_vsyscall()+0x60: can't find jump dest instruction at .text+0xca
make[3]: *** [scripts/Makefile.build:267: arch/x86/entry/vsyscall/vsyscall_64.o] Error 255
make[3]: *** Deleting file 'arch/x86/entry/vsyscall/vsyscall_64.o'
make[2]: *** [scripts/Makefile.build:488: arch/x86/entry/vsyscall] Error 2
make[1]: *** [scripts/Makefile.build:488: arch/x86/entry] Error 2
make: *** [Makefile:1729: arch/x86] Error 2
Comment 10 Martin Liška 2020-06-15 12:17:47 UTC
Yep, I've already created a reduced-testcase myself:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95671#c6
Comment 11 Jakub Jelinek 2020-06-15 12:34:57 UTC
That is clearly a kernel/objtool bug.
Seems it has its own x86_64 instruction decoder and has some VEX decoding code, but either not well tested or not working in this particular case.
Kernel doesn't normally use floating point or SIMD instructions, therefore I'd expect that it only rarely uses VEX encoded instructions, and BEXTR is one of the few general purpose instructions that are VEX encoded.
Comment 12 Jakub Jelinek 2020-06-15 13:18:24 UTC
Please report it to kernel bugzilla or whatever objtool has bugtracker.
https://bugs.gentoo.org/642924
is very likely exactly the same thing, but not sure if they have reported it upstream.
Comment 13 Maxim Britov 2020-06-15 14:41:33 UTC
New report https://bugzilla.kernel.org/show_bug.cgi?id=208187

Thanks!