aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-09-14 08:30:10 -0600
committerTom Tromey <tromey@adacore.com>2020-09-14 09:46:05 -0600
commit3eba3a011a89c75c10bd1860eee4589e65697165 (patch)
tree9465ab269218fe38dcdcbabc3220940c25817a1f /gdb/m68k-tdep.h
parentgdb: remove xfree in xml-support.c (diff)
downloadbinutils-gdb-3eba3a011a89c75c10bd1860eee4589e65697165.tar.gz
binutils-gdb-3eba3a011a89c75c10bd1860eee4589e65697165.tar.bz2
binutils-gdb-3eba3a011a89c75c10bd1860eee4589e65697165.zip
Various m68k fixes for gdb
Recently I tried the m68k port of gdb. It had some issues, which are fixed in this patch. * Various types of return values were not being handled properly. In particular: * arrays are returned by following the same convention as structures. This matters in languages like Ada, where an array can in fact be returned as a value. * "long double" was not being handled correctly in m68k_svr4_return_value. * GCC's m68k back end does not return vector types in registers, so change gdb to follow. * GCC's m68k back end doesn't faithfully implement the ABI, and so some objects with unusual size (not possible in C, but possible in Ada) are not returned correctly. * gcc implements an m68k ABI variant that it simply describes as "embedded". This ABI is similar to the SVR4 ABI, but rather than returning pointer-typed values in %a0, such values are returned in %d0. To support this, an ELF osabi sniffer is added. * Commit 85f7484a ("m68k: tag floating-point ABI used") adds an attribute that can be used to recognize when hard- or soft-float is in use. gdb can now read this tag and choose the ABI accordingly. I was unable to run the gdb test suite with this patch. Instead, I tested it using qemu and the internal AdaCore test suite. gdb/ChangeLog 2020-09-14 Tom Tromey <tromey@adacore.com> * m68k-tdep.c (m68k_extract_return_value): Use pointer_result_regnum. (m68k_store_return_value): Likewise. (m68k_reg_struct_return_p): Handle vectors and arrays. (m68k_return_value): Handle arrays. (m68k_svr4_return_value): Fix single-element aggregate handling. Handle long double. Adjust for embedded ABI. (m68k_svr4_init_abi): Set pointer_result_regnum. (m68k_embedded_init_abi): New function. (m68k_gdbarch_init): Handle Tag_GNU_M68K_ABI_FP. (m68k_osabi_sniffer): New function. (_initialize_m68k_tdep): Register osabi sniffer. * m68k-tdep.h (struct gdbarch_tdep) <pointer_result_regnum>: New member.
Diffstat (limited to 'gdb/m68k-tdep.h')
-rw-r--r--gdb/m68k-tdep.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/m68k-tdep.h b/gdb/m68k-tdep.h
index 1567505abf8..513190fe8cc 100644
--- a/gdb/m68k-tdep.h
+++ b/gdb/m68k-tdep.h
@@ -79,6 +79,10 @@ struct gdbarch_tdep
passed to a function. */
int struct_value_regnum;
+ /* Register in which a pointer value is returned. In the SVR4 ABI,
+ this is %a0, but in GCC's "embedded" ABI, this is %d0. */
+ int pointer_result_regnum;
+
/* Convention for returning structures. */
enum struct_return struct_return;