RISC-V GNU Toolchain - assembler assembles `clz` instruction incorrectly
Averill, Charles Charles
charles@utdallas.edu
Fri Nov 14 06:08:29 GMT 2025
Upon re-implementing "vTaskSwitchContext" from FreeRTOS in RISC-V (implementation attached), the "clz a5, a5" instruction is incorrectly assembled as 0x60079793, when the RISC-V Zbb extension specification (https://five-embeddev.com/riscv-bitmanip/1.0.0/bitmanip.html#insns-clz) specifies that it should be 0x600a9a93.
Version:
GNU assembler (xPack GNU RISC-V Embedded GCC x86_64) 2.43.1
Copyright (C) 2024 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `riscv-none-elf'.
I didn't compile these tools, I downloaded them here: https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack
I've also attached the two makefiles used to compile this project.
Thank you,
Charles Averill
UTD Software Languages Security Lab
Dartmouth Trust Lab
UTD Computer Security Group
https://www.charles.systems/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20251114/c7b9b4b8/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vTaskSwitchContext.S
Type: application/octet-stream
Size: 1309 bytes
Desc: vTaskSwitchContext.S
URL: <https://sourceware.org/pipermail/binutils/attachments/20251114/c7b9b4b8/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: makefile
Type: application/octet-stream
Size: 943 bytes
Desc: makefile
URL: <https://sourceware.org/pipermail/binutils/attachments/20251114/c7b9b4b8/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: common.mk
Type: text/x-makefile
Size: 17541 bytes
Desc: common.mk
URL: <https://sourceware.org/pipermail/binutils/attachments/20251114/c7b9b4b8/attachment-0001.bin>
More information about the Binutils
mailing list