[PATCH v2 1/1] bfd/loongarch: set PRSTATUS_SIZE=0x1e0 to match kernel's struct elf_prstatus size
lijian1@kylinos.cn
lijian1@kylinos.cn
Tue Oct 28 13:52:51 GMT 2025
From: lijian1 <lijian1@kylinos.cn>
If PRSTATUS_SIZE is incorrect on LoongArch64, BFD cannot properly handle
core files generated on this architecture. As a result, GDB emits repeated
warnings during core analysis such as:
warning: Unexpected size of section `.reg/3925' in core file.
This happens because the default BFD handler fails to synthesize the `.reg` section correctly.
With the correct PRSTATUS_SIZE value defined in loongarch_elf_grok_prstatus
(elfnn-loongarch64.c), GDB successfully generates LWP threads without the
above warnings, and core analysis proceeds normally.
Signed-off-by: lijian1 <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 e579babc7ec..4328cdbe2fd 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 /*480 bytes*/
#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