Skip to content

Commit

Permalink
RISC-V: Allow nested implications for extensions
Browse files Browse the repository at this point in the history
Certain extensions require two levels of implications.  For example,
zvkng implies zvkn and zvkn implies zvkned.  Enabling zvkng should also
enable zvkned.

This patch fixes this behavior.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_parse_add_implicit_subsets): Allow nested
	implications for extensions.

Signed-off-by: Nathan Huckleberry <[email protected]>
Signed-off-by: Christoph Müllner <[email protected]>
  • Loading branch information
nhukc authored and Jeff Law committed Jul 1, 2023
1 parent c62d5ac commit 48558a5
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions bfd/elfxx-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1873,14 +1873,29 @@ static void
riscv_parse_add_implicit_subsets (riscv_parse_subset_t *rps)
{
struct riscv_implicit_subset *t = riscv_implicit_subsets;
for (; t->subset_name; t++)
bool finished = false;
while (!finished)
{
riscv_subset_t *subset = NULL;
if (riscv_lookup_subset (rps->subset_list, t->subset_name, &subset)
&& t->check_func (t->implicit_name, subset))
riscv_parse_add_subset (rps, t->implicit_name,
RISCV_UNKNOWN_VERSION,
RISCV_UNKNOWN_VERSION, true);
finished = true;
for (; t->subset_name; t++)
{
riscv_subset_t *subset = NULL;
riscv_subset_t *implicit_subset = NULL;
if (riscv_lookup_subset (rps->subset_list, t->subset_name, &subset)
&& !riscv_lookup_subset (rps->subset_list, t->implicit_name,
&implicit_subset)
&& t->check_func (t->implicit_name, subset))
{
riscv_parse_add_subset (rps, t->implicit_name,
RISCV_UNKNOWN_VERSION,
RISCV_UNKNOWN_VERSION, true);

/* Restart the loop and pick up any new implications. */
finished = false;
t = riscv_implicit_subsets;
break;
}
}
}
}

Expand Down

0 comments on commit 48558a5

Please sign in to comment.