binutils Newspaper
JULY 29, 2026
risc-v/bfd Ready to Land

RISC-V/bfd: warn about non-boolean unaligned-access attribute

Warn about and normalize non-boolean values for the RISC-V unaligned-access attribute.

This patch enhances the RISC-V BFD implementation to warn when the unaligned_access attribute is set to a value other than 0 or 1. Non-zero values are converted to 1, normalizing the attribute’s interpretation. This ensures that the boolean nature of the attribute is respected and potential misconfigurations are flagged.

In the Thread 2 participants
  1. Jan Beulich <jbeulich@suse.com> proposer

    Proposes to warn about and convert non-boolean values for the RISC-V unaligned_access attribute.

    “The attribute being a boolean one, incoming values should be solely 0 or 1. Convert other non-zero values to 1.”
  2. Jiawei jiawei@iscas.ac.cn reviewer

    Reviewed the patch, suggesting an underscore in the diagnostic message in version 4.

Technical Tradeoffs

  • Normalizes eclectic input values to a boolean interpretation, simplifying attribute handling.
  • Warns users about potentially incorrect attribute usage without outright rejecting the object file.

In Details

This change in binutils' BFD frontend addresses the Tag_RISCV_unaligned_access ELF attribute. It ensures that values other than 0 or 1 are reported as warnings and normalized to 1, correctly enforcing the boolean nature of this attribute for accurate code generation and security-related checks (e.g., related to speculative execution vulnerabilities that might be mitigated by alignment).

For Context
BFD
Binary File Descriptor library, a GNU component that abstracts different object file formats.
ELF
Executable and Linkable Format, a standard file format for executables, object code, shared libraries, and core dumps.
RISC-V
An open-source instruction set architecture (ISA) that is gaining popularity for its modularity and extensibility.
Tag_RISCV_unaligned_access
An ELF tag specific to RISC-V that indicates whether unaligned memory access is permitted.
Filed Under: binutilsrisc-vbfdelfattribute