From 18fab8dd8412a06ce9417b78e48ac7d857e81df1 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 5 Feb 2026 13:26:42 +0000 Subject: [PATCH] [loong64] Fix error identifier generation for LoongArch64 The initial code contribution from Loongson defined ASM_NO_PREFIX as being "a" for this architecture. This seems to result in small values such as error line numbers being rendered as "$r0, " rather than just "". This seems to hit an undocumented behaviour path in the GNU assembler. For some reason ".long $r0" is not treated as a syntax error but will instead be treated as a zero value. The net effect is therefore that an extra zero value is emitted before the line number in the einfo structure, which in turn causes the error information parser to see all source code line numbers as zero. (The overall structure remains valid since the length and all string offsets are encoded within the structure itself, so nothing breaks when a spurious extra integer field is appended.) Fix by setting ASM_NO_PREFIX to the empty string (as for RISC-V), since there are no literal value prefixes anyway in LoongArch64 assembly. Signed-off-by: Michael Brown --- src/arch/loong64/include/bits/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arch/loong64/include/bits/compiler.h b/src/arch/loong64/include/bits/compiler.h index 8bdaf63fe..8be2f9c1e 100644 --- a/src/arch/loong64/include/bits/compiler.h +++ b/src/arch/loong64/include/bits/compiler.h @@ -9,7 +9,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #ifndef ASSEMBLY /** Unprefixed constant operand modifier */ -#define ASM_NO_PREFIX "a" +#define ASM_NO_PREFIX "" #define __asmcall #define __libgcc