[PATCH v2 0/1] bfd/loongarch: set PRSTATUS_SIZE=0x1e0 to match kernel's struct elf_prstatus size
Tiezhu Yang
yangtiezhu@loongson.cn
Fri Oct 31 07:29:58 GMT 2025
On 2025/10/31 下午2:24, lijian1@kylinos.cn wrote:
> From: Li Jian <lijian1@kylinos.cn>
>
> Hi Tiezhu,
> Thank you for taking the time to review my patch.
...
> Notice that for general-purpose registers, the section_min_size is 280 bytes while the actual size is 360 bytes.
> According to the definition of LOONGARCH_LINUX_NUM_GREGSET in GDB 14.1-5, its value is 35 then the len is calced to 35*8=280(bytes).
As far as I can tell, LOONGARCH_LINUX_NUM_GREGSET is 45 in gdb 14.1:
$ git clone git://sourceware.org/git/binutils-gdb.git gdb
$ cd gdb && git checkout gdb-14.1-release
$ grep -rn "LOONGARCH_LINUX_NUM_GREGSET =" gdb
gdb/arch/loongarch.h:36: LOONGARCH_LINUX_NUM_GREGSET = 45, /* 32 GPR,
ORIG_A0, PC, BADV, RESERVED 10. */
Where does your code come from? Please test with the official
gdb 14.1 or the mainline code.
> Therefore, the warning is triggered due to the LOONGARCH_LINUX_NUM_GREGSET value, not because of the PRSTATUS_SIZE value.
If you want to submit patch for the upstream GDB, you should
test and base on the official mainline code, not your local
version.
For this warning with your local GDB version, you should check
the code and analysis why LOONGARCH_LINUX_NUM_GREGSET is 35.
> Therefore, if PRSTATUS_SIZE is inconsistent with the kernel’s struct elf_prstatus, the LoongArch64 backend logic will not be taken, resulting in an incorrect code path without observable failure.
Yes, but this is another issue, not related with the warning
"Unexpected size of section". If you want to fix the wrong
value of PRSTATUS_SIZE, you should evaluate the impact.
Thanks,
Tiezhu
More information about the Binutils
mailing list