binutils Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
risc-v/bfd

Warn about non-boolean unaligned-access attribute in RISC-V

RISC-V linker warns and converts non-boolean unaligned-access attributes to boolean true.

The RISC-V BFD linker now warns when the unaligned_access attribute is not strictly boolean (0 or 1) and converts any non-zero value to 1. This ensures that the attribute is treated correctly, preventing potential issues with systems that might incorrectly set this flag to values other than 0 or 1.

In Details

In bfd/elfxx-riscv.c, the riscv_merge_attributes function now validates the Tag_RISCV_unaligned_access attribute. Incoming values greater than 1 will trigger a warning, and the attribute will be normalized to 1. The logic out_attr[i].i |= !!in_attr[i].i; ensures that the final value is 0 only if the input was 0, and 1 otherwise, effectively converting any non-zero input to a boolean true.

For Context
RISC-V
An open-source instruction set architecture (ISA) that is modular and extensible.
BFD
Binary File Descriptor library. A layer in GNU Binutils that provides a common interface to various object file formats.
unaligned access
Accessing data in memory at an address that is not a multiple of its size. Some architectures handle this poorly or not at all.
boolean attribute
An attribute that can only take two values, typically representing true or false (often 0 and 1).
Filed Under: RISC-Vlinkerattributeunaligned access