Bug 15550 - powerpc gdb does not use Tag_GNU_Power_ABI_Struct_Return
Summary: powerpc gdb does not use Tag_GNU_Power_ABI_Struct_Return
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-30 13:18 UTC by Luis Machado
Modified: 2013-05-30 13:18 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luis Machado 2013-05-30 13:18:44 UTC
Although powerpc has a valid attribute Tag_GNU_Power_ABI_Struct_Return in binutils, it is not taken into account by GDB to handle the struct return convention for a specific target.

Small structures can be returned either in registers (r3/r4) or in memory.

--

/* For historic reasons, PPC 32 GNU/Linux follows PowerOpen rather
   than the 32 bit SYSV R4 ABI structure return convention - all
   structures, no matter their size, are put in memory.  Vectors,
   which were added later, do get returned in a register though.  */

static enum return_value_convention
ppc_linux_return_value (struct gdbarch *gdbarch, struct value *function,
                        struct type *valtype, struct regcache *regcache,
                        gdb_byte *readbuf, const gdb_byte *writebuf)
{
  if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
       || TYPE_CODE (valtype) == TYPE_CODE_UNION)
      && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)
           && TYPE_VECTOR (valtype)))
    return RETURN_VALUE_STRUCT_CONVENTION;
  else
    return ppc_sysv_abi_return_value (gdbarch, function, valtype, regcache,
                                      readbuf, writebuf);
}

--

The code above will return all the non-vector structures through memory, small vector structures (8 or 16 bytes in length) in registers and big vector structures in memory.