[PATCH] RISC-V: Move all global static target stuff into private data for disassembler.

Jan Beulich jbeulich@suse.com
Fri Feb 7 08:57:18 GMT 2025


On 06.02.2025 14:47, Nelson Chu wrote:
> I got a request said that the JDK multi-thread compiler may be broken
> if two or more threads are trying to print/disassemble stuff, and filling
> the disassemble_info, setting callbacks, and grabbing the function pointer
> to disasm at the same time.  Since such as the target global static stuff,
> including subset of extensions and mapping symbol stuff, seems to only be
> one globally.  Ideally, for dis-assembler, all global static target stuff
> should/can be better to be defined into the target private data, since they
> are target-dependency.
> 
> opcodes/
> 	* riscv-dis.c: Moved all global static target-dependency stuff into
> 	riscv_private_data, including architecture and mapping symbol stuff.
> 	(set_default_riscv_dis_options): Updated since global static target-
> 	dependency stuff are moved into riscv_private_data.
> 	(parse_riscv_dis_option_without_args): Likewise.
> 	(parse_riscv_dis_option): Likewise.
> 	(parse_riscv_dis_options): Likewise.
> 	(maybe_print_address): Likewise.
> 	(print_reg_list): Likewise.
> 	(riscv_get_spimm): Likewise.
> 	(print_insn_args): Likewise.
> 	(riscv_disassemble_insn): Likewise.
> 	(riscv_update_map_state): Likewise.
> 	(riscv_search_mapping_symbol): Likewise.
> 	(riscv_data_length): Likewise.
> 	(print_insn_riscv): Likewise.  Call the riscv_init_disasm_info before
> 	parsing any disassembler options, since the related stuff are moved
> 	into riscv_private_data.
> 	(riscv_init_disasm_info): Likewise.  Parse and set the architecture
> 	string and privileged spec version since riscv_get_disassembler is
> 	no longer needed.
> 	(riscv_get_disassembler): Removed.
> 	(disassemble_free_riscv): Only free the subset_list if
> 	riscv_private_data exsits.
> 	* disassemble.c (disassembler): Since riscv_get_disassembler is
> 	removed, call to print_insn_riscv.
> 	* disassemble.h: Removed extern riscv_get_disassembler.
> ---
>  opcodes/disassemble.c |   2 +-
>  opcodes/disassemble.h |   1 -
>  opcodes/riscv-dis.c   | 336 ++++++++++++++++++++++--------------------
>  3 files changed, 178 insertions(+), 161 deletions(-)

Lgtm, fwiw.

Jan


More information about the Binutils mailing list