|
|
2c2fa1 |
commit a1da2672bdc5adc551ad30d73eccea902063f583
|
|
|
2c2fa1 |
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
|
|
|
2c2fa1 |
Date: Fri Jun 12 17:43:48 2015 +0200
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
ppc64: Handle short vectors as function return types
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
Short synthetic vector types (i.e. those defined using GCC's
|
|
|
2c2fa1 |
attribute ((vector_size)) instead of AltiVec vector types)
|
|
|
2c2fa1 |
are returned in r3. Fix ppc64_sysv_abi_return_value to
|
|
|
2c2fa1 |
correctly handle this.
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
gdb/ChangeLog:
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
* ppc-sysv-tdep.c (ppc64_sysv_abi_return_value_base): Handle short
|
|
|
2c2fa1 |
synthetic (non-AltiVec) vector types.
|
|
|
2c2fa1 |
(ppc64_sysv_abi_return_value): Likewise.
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
### a/gdb/ChangeLog
|
|
|
2c2fa1 |
### b/gdb/ChangeLog
|
|
|
2c2fa1 |
## -1,3 +1,9 @@
|
|
|
2c2fa1 |
+2015-05-12 Ulrich Weigand <uweigand@de.ibm.com>
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ * ppc-sysv-tdep.c (ppc64_sysv_abi_return_value_base): Handle short
|
|
|
2c2fa1 |
+ synthetic (non-AltiVec) vector types.
|
|
|
2c2fa1 |
+ (ppc64_sysv_abi_return_value): Likewise.
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
2015-06-12 Antoine Tremblay <antoine.tremblay@ericsson.com>
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
PR breakpoints/16465
|
|
|
2c2fa1 |
--- a/gdb/ppc-sysv-tdep.c
|
|
|
2c2fa1 |
+++ b/gdb/ppc-sysv-tdep.c
|
|
|
2c2fa1 |
@@ -1892,7 +1892,8 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* AltiVec vectors are returned in VRs starting at v2. */
|
|
|
2c2fa1 |
- if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
|
|
|
2c2fa1 |
+ if (TYPE_LENGTH (valtype) == 16
|
|
|
2c2fa1 |
+ && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
|
|
|
2c2fa1 |
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC)
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
int regnum = tdep->ppc_vr0_regnum + 2 + index;
|
|
|
2c2fa1 |
@@ -1904,6 +1905,25 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
|
|
|
2c2fa1 |
return 1;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
+ /* Short vectors are returned in GPRs starting at r3. */
|
|
|
2c2fa1 |
+ if (TYPE_LENGTH (valtype) <= 8
|
|
|
2c2fa1 |
+ && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype))
|
|
|
2c2fa1 |
+ {
|
|
|
2c2fa1 |
+ int regnum = tdep->ppc_gp0_regnum + 3 + index;
|
|
|
2c2fa1 |
+ int offset = 0;
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
|
|
|
2c2fa1 |
+ offset = 8 - TYPE_LENGTH (valtype);
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
+ if (writebuf != NULL)
|
|
|
2c2fa1 |
+ regcache_cooked_write_part (regcache, regnum,
|
|
|
2c2fa1 |
+ offset, TYPE_LENGTH (valtype), writebuf);
|
|
|
2c2fa1 |
+ if (readbuf != NULL)
|
|
|
2c2fa1 |
+ regcache_cooked_read_part (regcache, regnum,
|
|
|
2c2fa1 |
+ offset, TYPE_LENGTH (valtype), readbuf);
|
|
|
2c2fa1 |
+ return 1;
|
|
|
2c2fa1 |
+ }
|
|
|
2c2fa1 |
+
|
|
|
2c2fa1 |
return 0;
|
|
|
2c2fa1 |
}
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
@@ -1993,6 +2013,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
|
|
|
2c2fa1 |
|
|
|
2c2fa1 |
/* Small character arrays are returned, right justified, in r3. */
|
|
|
2c2fa1 |
if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY
|
|
|
2c2fa1 |
+ && !TYPE_VECTOR (valtype)
|
|
|
2c2fa1 |
&& TYPE_LENGTH (valtype) <= 8
|
|
|
2c2fa1 |
&& TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT
|
|
|
2c2fa1 |
&& TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1)
|
|
|
2c2fa1 |
@@ -2012,7 +2033,13 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
|
|
|
2c2fa1 |
/* In the ELFv2 ABI, homogeneous floating-point or vector
|
|
|
2c2fa1 |
aggregates are returned in registers. */
|
|
|
2c2fa1 |
if (tdep->elf_abi == POWERPC_ELF_V2
|
|
|
2c2fa1 |
- && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt))
|
|
|
2c2fa1 |
+ && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt)
|
|
|
2c2fa1 |
+ && (TYPE_CODE (eltype) == TYPE_CODE_FLT
|
|
|
2c2fa1 |
+ || TYPE_CODE (eltype) == TYPE_CODE_DECFLOAT
|
|
|
2c2fa1 |
+ || (TYPE_CODE (eltype) == TYPE_CODE_ARRAY
|
|
|
2c2fa1 |
+ && TYPE_VECTOR (eltype)
|
|
|
2c2fa1 |
+ && tdep->vector_abi == POWERPC_VEC_ALTIVEC
|
|
|
2c2fa1 |
+ && TYPE_LENGTH (eltype) == 16)))
|
|
|
2c2fa1 |
{
|
|
|
2c2fa1 |
for (i = 0; i < nelt; i++)
|
|
|
2c2fa1 |
{
|