[PATCH v3 1/1] bfd/loongarch: set PRSTATUS_SIZE=0x1e0 to match kernel's struct elf_prstatus size

lijian1@kylinos.cn lijian1@kylinos.cn
Wed Nov 5 06:24:52 GMT 2025


From: lijian1 <lijian1@kylinos.cn>

The size of struct elf_prstatus in the Linux kernel for loongarch64
is 0x1e0 (480 bytes, including padding).  The current PRSTATUS_SIZE
value in BFD was 0x1d8, which causes inconsistency with the kernel
definition and can not lead to the correct branch for loongarch64 backend.

This patch updates PRSTATUS_SIZE to 0x1e0 for loongarch64 to match
the kernel's definition.

Tested with Linux kernel 6.6 and GDB 14.1; verified that core file
sections (.reg, NT_PRSTATUS) are parsed in correct branch.

Signed-off-by: Li Jian <lijian1@kylinos.cn>
---
 bfd/elfnn-loongarch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 1eff3b134ee..efaebd76741 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -6538,7 +6538,7 @@ loongarch_elf_copy_indirect_symbol (struct bfd_link_info *info,
   _bfd_elf_link_hash_copy_indirect (info, dir, ind);
 }
 
-#define PRSTATUS_SIZE		    0x1d8
+#define PRSTATUS_SIZE		    0x1e0
 #define PRSTATUS_OFFSET_PR_CURSIG   0xc
 #define PRSTATUS_OFFSET_PR_PID	    0x20
 #define ELF_GREGSET_T_SIZE	    0x168
-- 
2.43.0



More information about the Binutils mailing list