binutils Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gas

Fix loongarch assembler build error with older GCC versions

Assembler code adjusted to avoid build errors with GCC 4.9 on loongarch.

A build error in the loongarch assembler (gas/config/tc-loongarch.c) when using GCC 4.9 has been resolved. The fix prevents an error where a label was incorrectly recognized as not being part of a statement, ensuring successful builds on the loongarch target with older GCC versions.

In Details

The md_apply_fix function in gas/config/tc-loongarch.c exhibited a build error with GCC 4.9. Specifically, including a declaration for unsigned int subtype; directly after a case label, before any statement, violated GCC 4.9's stricter parsing of labels. This commit refactors the code to group the declaration within a block or conditional statement, satisfying the compiler's requirements and resolving the build failure.

For Context
gas
The GNU Assembler, part of the GNU Binutils project, responsible for converting assembly language code into machine code.
loongarch
A RISC instruction set architecture developed in China.
GCC 4.9
A specific version of the GNU Compiler Collection, released in 2014.
BFD_RELOC_LARCH_CFA
A relocation type specific to the LoongArch architecture, used for Call Frame Information (CFA) in debugging symbols.
label
A marker in source code that identifies a specific location, often used for jump targets or defining data.
Filed Under: binutilsgasloongarchbuild-fix