From: Andrew Cagney Date: Wed, 1 Apr 1998 04:52:37 +0000 (+0000) Subject: * d10v-tdep.c (d10v_extract_return_value): Wierd. GCC wants to return X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=19735aeaa1575ba240f240391c7c5ba96c576f0c;p=binutils-gdb.git * d10v-tdep.c (d10v_extract_return_value): Wierd. GCC wants to return odd sized register quantities with only half of the first register used! * config/d10v/tm-d10v.h (USE_STRUCT_CONVENTION): Use stack when size > 8. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3f91ef439a6..d8e2a194fd0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +Mon Feb 16 14:05:54 1998 Andrew Cagney + + * d10v-tdep.c (d10v_extract_return_value): Wierd. GCC wants to + return odd sized register quantities with only half of the first + register used! + + * config/d10v/tm-d10v.h (USE_STRUCT_CONVENTION): Use stack when + size > 8. + Mon Mar 30 16:42:12 1998 Jason Molenda (crash@bugshack.cygnus.com) * rdi-share/Makefile.am, rdi-share/aclocal.m4, diff --git a/gdb/config/d10v/tm-d10v.h b/gdb/config/d10v/tm-d10v.h index 93c634c1621..0a4c3b4da3c 100644 --- a/gdb/config/d10v/tm-d10v.h +++ b/gdb/config/d10v/tm-d10v.h @@ -187,7 +187,7 @@ extern CORE_ADDR d10v_skip_prologue (); registers. */ #define USE_STRUCT_CONVENTION(gcc_p, type) \ - (TYPE_LENGTH (type) > 1) + (TYPE_LENGTH (type) > 8) diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 6e5789172d8..10d249be2d2 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -654,8 +654,17 @@ d10v_extract_return_value (type, regbuf, valbuf) unsigned short c = extract_unsigned_integer (regbuf + REGISTER_BYTE (RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM)); store_unsigned_integer (valbuf, 1, c); } - else + else if ((len & 1) == 0) memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM), len); + else + { + /* For return values of odd size, the first byte is in the + least significant part of the first register. The + remaining bytes in remaining registers. Interestingly, + when such values are passed in, the last byte is in the + most significant byte of that same register - wierd. */ + memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM) + 1, len); + } } }