]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[loong64] Fix error identifier generation for LoongArch64
authorMichael Brown <mcb30@ipxe.org>
Thu, 5 Feb 2026 13:26:42 +0000 (13:26 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 5 Feb 2026 13:45:19 +0000 (13:45 +0000)
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, <value>" rather
than just "<value>".

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 <mcb30@ipxe.org>
src/arch/loong64/include/bits/compiler.h

index 8bdaf63fed4299b273af8b0121ecf67634f4bc06..8be2f9c1ecf27a9067dbe64f6a4e0156f1a868e5 100644 (file)
@@ -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