From a6b8ce23eafdb8c968fd9bce248822573e00d354 Mon Sep 17 00:00:00 2001 From: Filip Kokosinski Date: Thu, 11 Jul 2024 13:37:33 +0200 Subject: [PATCH] run: fix disabling the `c` extension This commit fixes the way that the `c` extension is disabled, i.e. removed from the arch ISA string. Without this change, for GCC versions where Zicsr and Zifencei constitute separate extensions, the following ISA string: rv32imc_zicsr_zifencei_zba_zbb_zbc_zbs Would be changed to (note incorrect `_zisr` vs correct `_zicsr`): rv32im_zisr_zifenei_zba_zbb_zb_zbs Instead of the expected: rv32im_zicsr_zifencei_zba_zbb_zbc_zbs Signed-off-by: Filip Kokosinski --- run.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/run.py b/run.py index ac323177..b266444c 100644 --- a/run.py +++ b/run.py @@ -446,7 +446,12 @@ def gcc_compile(test_list, output_dir, isa, mabi, opts, debug_cmd): if 'gen_opts' in test: # Disable compressed instruction if re.search('disable_compressed_instr', test['gen_opts']): - test_isa = re.sub("c", "", test_isa) + # Note that this substitution assumes the cannonical order + # of extensions, i.e. that extensions with a preceding + # underscores will be provided after all letter extensions. + # This assumption should hold true, as this is a + # requirement enforced by e.g. gcc + test_isa = re.sub(r"(rv.+?)c", r"\1", test_isa) # If march/mabi is not defined in the test gcc_opts, use the default # setting from the command line. if not re.search('march', cmd):