Re: [PATCH 1/1] x86/tools: Use tools headers for instruction decoder selftests

From: Masami Hiramatsu
Date: Thu Nov 05 2020 - 21:24:20 EST


On Wed, 4 Nov 2020 10:18:43 +0100
Vasily Gorbik <gor@xxxxxxxxxxxxx> wrote:

> On Wed, Nov 04, 2020 at 05:11:28PM +0800, kernel test robot wrote:
> > Hi Vasily,
> >
> > I love your patch! Yet something to improve:
> >
> > [auto build test ERROR on tip/x86/core]
> > [also build test ERROR on v5.10-rc2 next-20201103]
> > [If your patch is applied to the wrong git tree, kindly drop us a note.
> > And when submitting patch, we suggest to use '--base' as documented in
> > https://git-scm.com/docs/git-format-patch]
> >
> > url: https://github.com/0day-ci/linux/commits/Vasily-Gorbik/x86-tools-Use-tools-headers-for-instruction-decoder-selftests/20201104-043600
> > base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 238c91115cd05c71447ea071624a4c9fe661f970
> > config: x86_64-randconfig-a005-20201104 (attached as .config)
> > compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 1fcd5d5655e29f85e12b402e32974f207cfedf32)
> > reproduce (this is a W=1 build):
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # install x86_64 cross compiling tool for clang build
> > # apt-get install binutils-x86-64-linux-gnu
> > # https://github.com/0day-ci/linux/commit/ab4952becdfae8a76a6f0e0fb4ec7d078e80d5d6
> > git remote add linux-review https://github.com/0day-ci/linux
> > git fetch --no-tags linux-review Vasily-Gorbik/x86-tools-Use-tools-headers-for-instruction-decoder-selftests/20201104-043600
> > git checkout ab4952becdfae8a76a6f0e0fb4ec7d078e80d5d6
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> >
> > All error/warnings (new ones prefixed by >>):
> >
> > In file included from arch/x86/tools/insn_sanity.c:19:
> > >> tools/arch/x86/lib/insn.c:72:7: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > if (peek_nbyte_next(insn_byte_t, insn, i) != prefix[i])
> > ^
> > tools/arch/x86/lib/insn.c:32:9: note: expanded from macro 'peek_nbyte_next'
> > ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); })
> > ^
> > tools/arch/x86/lib/insn.c:115:6: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > b = peek_next(insn_byte_t, insn);
> > ^
> > tools/arch/x86/lib/insn.c:34:28: note: expanded from macro 'peek_next'
> > #define peek_next(t, insn) peek_nbyte_next(t, insn, 0)
> > ^
> > tools/arch/x86/lib/insn.c:32:9: note: expanded from macro 'peek_nbyte_next'
> > ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); })
> > ^
> > tools/arch/x86/lib/insn.c:140:7: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > b = peek_next(insn_byte_t, insn);
> > ^
> > tools/arch/x86/lib/insn.c:34:28: note: expanded from macro 'peek_next'
> > #define peek_next(t, insn) peek_nbyte_next(t, insn, 0)
> > ^
> > tools/arch/x86/lib/insn.c:32:9: note: expanded from macro 'peek_nbyte_next'
> > ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); })
> > ^
> > tools/arch/x86/lib/insn.c:145:7: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > if (unlikely(insn->prefixes.bytes[3])) {
> > ^
> > tools/arch/x86/lib/insn.c:157:7: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > b = peek_next(insn_byte_t, insn);
> > ^
> > tools/arch/x86/lib/insn.c:34:28: note: expanded from macro 'peek_next'
> > #define peek_next(t, insn) peek_nbyte_next(t, insn, 0)
> > ^
> > tools/arch/x86/lib/insn.c:32:9: note: expanded from macro 'peek_nbyte_next'
> > ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); })
> > ^
> > tools/arch/x86/lib/insn.c:171:6: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > b = peek_next(insn_byte_t, insn);
> > ^
> > tools/arch/x86/lib/insn.c:34:28: note: expanded from macro 'peek_next'
> > #define peek_next(t, insn) peek_nbyte_next(t, insn, 0)
> > ^
> > tools/arch/x86/lib/insn.c:32:9: note: expanded from macro 'peek_nbyte_next'
> > ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); })
> > ^
> > tools/arch/x86/lib/insn.c:174:20: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn_byte_t b2 = peek_nbyte_next(insn_byte_t, insn, 1);
> > ^
> > tools/arch/x86/lib/insn.c:32:9: note: expanded from macro 'peek_nbyte_next'
> > ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); })
> > ^
> > tools/arch/x86/lib/insn.c:187:9: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > b2 = peek_nbyte_next(insn_byte_t, insn, 2);
> > ^
> > tools/arch/x86/lib/insn.c:32:9: note: expanded from macro 'peek_nbyte_next'
> > ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); })
> > ^
> > tools/arch/x86/lib/insn.c:189:9: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > b2 = peek_nbyte_next(insn_byte_t, insn, 3);
> > ^
> > tools/arch/x86/lib/insn.c:32:9: note: expanded from macro 'peek_nbyte_next'
> > ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); })
> > ^
> > tools/arch/x86/lib/insn.c:197:9: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > b2 = peek_nbyte_next(insn_byte_t, insn, 2);
> > ^
> > tools/arch/x86/lib/insn.c:32:9: note: expanded from macro 'peek_nbyte_next'
> > ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); })
> > ^
> > tools/arch/x86/lib/insn.c:245:7: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > op = get_next(insn_byte_t, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:265:8: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > op = get_next(insn_byte_t, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:297:9: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > mod = get_next(insn_byte_t, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:359:22: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->sib.value = get_next(insn_byte_t, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:410:31: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->displacement.value = get_next(signed char, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:415:7: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > get_next(short, insn);
> > --
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:448:26: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->moffset2.value = get_next(int, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:467:27: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate.value = get_next(short, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:472:27: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate.value = get_next(int, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:490:28: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate1.value = get_next(short, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:494:28: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate1.value = get_next(int, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:498:28: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate1.value = get_next(int, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:500:28: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate2.value = get_next(int, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:518:28: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate1.value = get_next(short, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:522:28: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate1.value = get_next(int, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:531:27: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate2.value = get_next(unsigned short, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:568:27: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate.value = get_next(signed char, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:572:27: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate.value = get_next(short, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:576:27: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate.value = get_next(int, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:580:28: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate1.value = get_next(int, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:582:28: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate2.value = get_next(int, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > tools/arch/x86/lib/insn.c:602:28: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
> > insn->immediate2.value = get_next(signed char, insn);
> > ^
> > tools/arch/x86/lib/insn.c:29:9: note: expanded from macro 'get_next'
> > ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
> > ^
> > >> arch/x86/tools/insn_sanity.c:128:19: warning: implicit declaration of function 'ARRAY_SIZE' [-Wimplicit-function-declaration]
> > tmp = fgets(buf, ARRAY_SIZE(buf), input_file);
> > ^
> > 37 warnings generated.
> > /usr/bin/ld: /tmp/insn_sanity-8655a9.o: in function `insn_get_prefixes':
> > >> insn_sanity.c:(.text+0x1bd): undefined reference to `unlikely'
> > >> /usr/bin/ld: insn_sanity.c:(.text+0x203): undefined reference to `unlikely'
> > /usr/bin/ld: insn_sanity.c:(.text+0x24d): undefined reference to `unlikely'
> > /usr/bin/ld: insn_sanity.c:(.text+0x30f): undefined reference to `unlikely'
> > /usr/bin/ld: insn_sanity.c:(.text+0x353): undefined reference to `unlikely'
> > /usr/bin/ld: /tmp/insn_sanity-8655a9.o:insn_sanity.c:(.text+0x38e): more undefined references to `unlikely' follow
> > /usr/bin/ld: /tmp/insn_sanity-8655a9.o: in function `main':
> > >> insn_sanity.c:(.text+0x13cf): undefined reference to `ARRAY_SIZE'
> > /usr/bin/ld: /tmp/insn_sanity-8655a9.o: in function `__insn_get_emulate_prefix':
> > insn_sanity.c:(.text+0x1cc1): undefined reference to `unlikely'
> > /usr/bin/ld: insn_sanity.c:(.text+0x1cef): undefined reference to `unlikely'
> > /usr/bin/ld: insn_sanity.c:(.text+0x1d1f): undefined reference to `unlikely'
> > /usr/bin/ld: insn_sanity.c:(.text+0x1d47): undefined reference to `unlikely'
> > /usr/bin/ld: insn_sanity.c:(.text+0x1d6f): undefined reference to `unlikely'
> > clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
>
> Right, this is expected. The patch is based on jpoimboe/objtool/core,
> which has extra commits.

Has that series already submitted to LKML? I need to look at the series too.
Or, Josh, can you review it and if it is OK, please pick it to your series
and send it.

Thank you,

--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>