arch/riscv/lib/strncmp.S:11: Error: unrecognized opcode `__alternative_cfg("nop", "j strncmp_zbb",0,30,'

From: kernel test robot
Date: Sat Apr 12 2025 - 19:19:26 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b676ac484f847bbe5c7d29603f41475b64fefe55
commit: 9343aaba1f256ff42730db5a61efc32a86149776 RISC-V: separate Zbb optimisations requiring and not requiring toolchain support
date: 4 weeks ago
config: riscv-randconfig-001-20250413 (https://download.01.org/0day-ci/archive/20250413/202504130710.3IKz6Ibs-lkp@xxxxxxxxx/config)
compiler: riscv32-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250413/202504130710.3IKz6Ibs-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504130710.3IKz6Ibs-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

arch/riscv/lib/strncmp.S: Assembler messages:
>> arch/riscv/lib/strncmp.S:11: Error: unrecognized opcode `__alternative_cfg("nop", "j strncmp_zbb",0,30,'
>> arch/riscv/lib/strncmp.S:12: Error: junk at end of line, first unrecognized character is `0'
--
arch/riscv/lib/strlen.S: Assembler messages:
>> arch/riscv/lib/strlen.S:11: Error: unrecognized opcode `__alternative_cfg("nop", "j strlen_zbb",0,30,'
>> arch/riscv/lib/strlen.S:12: Error: junk at end of line, first unrecognized character is `0'
--
arch/riscv/lib/strcmp.S: Assembler messages:
>> arch/riscv/lib/strcmp.S:11: Error: unrecognized opcode `__alternative_cfg("nop", "j strcmp_zbb",0,30,'
>> arch/riscv/lib/strcmp.S:12: Error: junk at end of line, first unrecognized character is `0'


vim +11 arch/riscv/lib/strncmp.S

10
> 11 __ALTERNATIVE_CFG("nop", "j strncmp_zbb", 0, RISCV_ISA_EXT_ZBB,
> 12 IS_ENABLED(CONFIG_RISCV_ISA_ZBB) && IS_ENABLED(CONFIG_TOOLCHAIN_HAS_ZBB))
13
14 /*
15 * Returns
16 * a0 - comparison result, value like strncmp
17 *
18 * Parameters
19 * a0 - string1
20 * a1 - string2
21 * a2 - number of characters to compare
22 *
23 * Clobbers
24 * t0, t1, t2
25 */
26 li t2, 0
27 1:
28 beq a2, t2, 2f
29 lbu t0, 0(a0)
30 lbu t1, 0(a1)
31 addi a0, a0, 1
32 addi a1, a1, 1
33 bne t0, t1, 3f
34 addi t2, t2, 1
35 bnez t0, 1b
36 2:
37 li a0, 0
38 ret
39 3:
40 /*
41 * strncmp only needs to return (< 0, 0, > 0) values
42 * not necessarily -1, 0, +1
43 */
44 sub a0, t0, t1
45 ret
46

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki