From f5cb31a8ba76b5ab3fa763c642d0e8f4ac292d00 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Tue, 4 Oct 2022 09:44:44 +0200 Subject: [PATCH] RISC-V/gas: drop riscv_subsets static variable It's fully redundant with the subset_list member of riscv_rps_as. --- gas/config/tc-riscv.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 98a954a2df0..3230c5c69b3 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -265,11 +265,10 @@ riscv_set_tso (void) elf_flags |= EF_RISCV_TSO; } -/* This linked list records all enabled extensions, which are parsed from - the architecture string. The architecture string can be set by the - -march option, the elf architecture attributes, and the --with-arch - configure option. */ -static riscv_subset_list_t *riscv_subsets = NULL; +/* The linked list hanging off of .subsets_list records all enabled extensions, + which are parsed from the architecture string. The architecture string can + be set by the -march option, the elf architecture attributes, and the + --with-arch configure option. */ static riscv_parse_subset_t riscv_rps_as = { NULL, /* subset_list, we will set it later once @@ -302,14 +301,13 @@ riscv_set_arch (const char *s) return; } - if (riscv_subsets == NULL) + if (riscv_rps_as.subset_list == NULL) { - riscv_subsets = XNEW (riscv_subset_list_t); - riscv_subsets->head = NULL; - riscv_subsets->tail = NULL; - riscv_rps_as.subset_list = riscv_subsets; + riscv_rps_as.subset_list = XNEW (riscv_subset_list_t); + riscv_rps_as.subset_list->head = NULL; + riscv_rps_as.subset_list->tail = NULL; } - riscv_release_subset_list (riscv_subsets); + riscv_release_subset_list (riscv_rps_as.subset_list); riscv_parse_subset (&riscv_rps_as, s); riscv_set_rvc (false); @@ -3986,10 +3984,9 @@ s_riscv_option (int x ATTRIBUTE_UNUSED) s = XNEW (struct riscv_option_stack); s->next = riscv_opts_stack; s->options = riscv_opts; - s->subset_list = riscv_subsets; + s->subset_list = riscv_rps_as.subset_list; riscv_opts_stack = s; - riscv_subsets = riscv_copy_subset_list (s->subset_list); - riscv_rps_as.subset_list = riscv_subsets; + riscv_rps_as.subset_list = riscv_copy_subset_list (s->subset_list); } else if (strcmp (name, "pop") == 0) { @@ -4000,11 +3997,10 @@ s_riscv_option (int x ATTRIBUTE_UNUSED) as_bad (_(".option pop with no .option push")); else { - riscv_subset_list_t *release_subsets = riscv_subsets; + riscv_subset_list_t *release_subsets = riscv_rps_as.subset_list; riscv_opts_stack = s->next; riscv_opts = s->options; - riscv_subsets = s->subset_list; - riscv_rps_as.subset_list = riscv_subsets; + riscv_rps_as.subset_list = s->subset_list; riscv_release_subset_list (release_subsets); free (s); } @@ -4505,7 +4501,7 @@ riscv_write_out_attrs (void) unsigned int i; /* Re-write architecture elf attribute. */ - arch_str = riscv_arch_str (xlen, riscv_subsets); + arch_str = riscv_arch_str (xlen, riscv_rps_as.subset_list); bfd_elf_add_proc_attr_string (stdoutput, Tag_RISCV_arch, arch_str); xfree ((void *) arch_str); -- 2.30.2