Skip to content

Commit e4bb020

Browse files
AndybnACTpalmer-dabbelt
authored andcommitted
riscv: detect assembler support for .option arch
Some extensions use .option arch directive to selectively enable certain extensions in parts of its assembly code. For example, Zbb uses it to inform assmebler to emit bit manipulation instructions. However, supporting of this directive only exist on GNU assembler and has not landed on clang at the moment, making TOOLCHAIN_HAS_ZBB depend on AS_IS_GNU. While it is still under review at https://reviews.llvm.org/D123515, the upcoming Vector patch also requires this feature in assembler. Thus, provide Kconfig AS_HAS_OPTION_ARCH to detect such feature. Then TOOLCHAIN_HAS_XXX will be turned on automatically when the feature land. Suggested-by: Nathan Chancellor <[email protected]> Signed-off-by: Andy Chiu <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Tested-by: Heiko Stuebner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 7ca7a7b commit e4bb020

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

arch/riscv/Kconfig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,12 @@ config RISCV_DMA_NONCOHERENT
262262
config AS_HAS_INSN
263263
def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
264264

265+
config AS_HAS_OPTION_ARCH
266+
# https://reviews.llvm.org/D123515
267+
def_bool y
268+
depends on $(as-instr, .option arch$(comma) +m)
269+
depends on !$(as-instr, .option arch$(comma) -i)
270+
265271
source "arch/riscv/Kconfig.socs"
266272
source "arch/riscv/Kconfig.errata"
267273

@@ -466,7 +472,7 @@ config TOOLCHAIN_HAS_ZBB
466472
depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
467473
depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
468474
depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
469-
depends on AS_IS_GNU
475+
depends on AS_HAS_OPTION_ARCH
470476

471477
config RISCV_ISA_ZBB
472478
bool "Zbb extension support for bit manipulation instructions"

0 commit comments

Comments
 (0)