]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: LoongArch: Change default char data type to signed
authorHui Li <lihui@loongson.cn>
Thu, 30 Oct 2025 02:51:56 +0000 (10:51 +0800)
committerTiezhu Yang <yangtiezhu@loongson.cn>
Thu, 30 Oct 2025 14:08:15 +0000 (22:08 +0800)
According to "Procedure Call Standard for the LoongArch Architecture" [1],
for all base ABI types of LoongArch, the char data type in C is signed by
default, so change the char data type to signed in gdb/loongarch-tdep.c.

Before this patch:

make check-gdb TESTS="gdb.base/sizeof.exp"

=== gdb Summary ===

 # of expected passes 75
 # of unexpected failures 1

make check-gdb TESTS="gdb.base/charset.exp"

=== gdb Summary ===

 # of expected passes 277
 # of unexpected failures 6
 # of unsupported tests 1

After this patch:

make check-gdb TESTS="gdb.base/sizeof.exp"

=== gdb Summary ===

 # of expected passes 76

make check-gdb TESTS="gdb.base/charset.exp"

=== gdb Summary ===

 # of expected passes 283
 # of unsupported tests 1

[1] https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc#appendix-c-data-types-and-machine-data-types

Signed-off-by: Hui Li <lihui@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
gdb/loongarch-tdep.c

index 5e09125e400c2bb2ea29d3c32dc98349c5f5004e..21a3e53779344130f97808a340b969ef5fdbee60 100644 (file)
@@ -2176,7 +2176,7 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_long_double_bit (gdbarch, 128);
   set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
   set_gdbarch_ptr_bit (gdbarch, info.bfd_arch_info->bits_per_address);
-  set_gdbarch_char_signed (gdbarch, 0);
+  set_gdbarch_char_signed (gdbarch, 1);
 
   info.target_desc = tdesc;
   info.tdesc_data = tdesc_data.get ();