Re: [PATCH 12/19] RISC-V: riscv_set_arch() can fail

Project / Subsystem

binutils / risc-v

Date

2026-04-29

Proposer

Jiawei <jiawei@iscas.ac.cn>

Source type

public_inbox

Consensus

Ready to Land

Sentiment

/10

Technical tradeoffs

  • Using a default architecture string might not always be the desired behavior, but it avoids a crash.
  • The assembler will proceed with a default arch if the expected arch string is missing.

All attributes

project
binutils
subsystem
risc-v
patch_id
discussion_id
9e1a5fd2-e547-4bbb-be77-c97e115e40bf@iscas.ac.cn
source_type
public_inbox
title
Re: [PATCH 12/19] RISC-V: riscv_set_arch() can fail
headline
RISC-V: riscv_set_arch() can fail
tldr
Avoid passing NULL pointers to functions when ``riscv_set_arch()`` fails to set architecture string.
proposer
Jiawei <jiawei@iscas.ac.cn>
consensus
Ready to Land
outcome
ready
sentiment_score
technical_tradeoffs
  • Using a default architecture string might not always be the desired behavior, but it avoids a crash.
  • The assembler will proceed with a default arch if the expected arch string is missing.
series_id
binutils:risc-v: riscv_set_arch() can fail
series_role
reply
series_parts
[]
tags
  • risc-v
  • error handling
  • null pointer
bugzilla_url
date
2026-04-29T00:00:00.000Z

Re: [PATCH 12/19] RISC-V: riscv_set_arch() can fail

This patch fixes a potential crash in riscv_set_arch() when the architecture string is empty. In such cases, the code now avoids passing NULL pointers to subsequent functions by using a default architecture string (DEFAULT_RISCV_ARCH_WITH_EXT). This prevents crashes when the frontend fails to provide a valid architecture string.