* ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Handle

TYPE_CODE_BOOL and TYPE_CODE_CHAR the same as TYPE_CODE_INT.
	Handle TYPE_CODE_REF the same as TYPE_CODE_PTR.
	Handle TYPE_CODE_METHOD the same as TYPE_CODE_FUNC.
	Allow typedefs when checking for function pointer arguments.
	Right-align small structs passed on the stack.
	(ppc64_sysv_abi_return_value): Handle TYPE_CODE_BOOL and
	TYPE_CODE_CHAR the same as TYPE_CODE_INT.
	Handle TYPE_CODE_REF the same as TYPE_CODE_PTR.
This commit is contained in:
Ulrich Weigand
2008-05-02 23:24:44 +00:00
parent 60c5725ca9
commit 93d4208d62
2 changed files with 46 additions and 15 deletions

View File

@ -1,3 +1,15 @@
2008-05-02 Ulrich Weigand <uweigand@de.ibm.com>
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Handle
TYPE_CODE_BOOL and TYPE_CODE_CHAR the same as TYPE_CODE_INT.
Handle TYPE_CODE_REF the same as TYPE_CODE_PTR.
Handle TYPE_CODE_METHOD the same as TYPE_CODE_FUNC.
Allow typedefs when checking for function pointer arguments.
Right-align small structs passed on the stack.
(ppc64_sysv_abi_return_value): Handle TYPE_CODE_BOOL and
TYPE_CODE_CHAR the same as TYPE_CODE_INT.
Handle TYPE_CODE_REF the same as TYPE_CODE_PTR.
2008-05-02 Daniel Jacobowitz <dan@codesourcery.com> 2008-05-02 Daniel Jacobowitz <dan@codesourcery.com>
* Makefile.in (arm-tdep.o): Update. * Makefile.in (arm-tdep.o): Update.

View File

@ -1149,7 +1149,10 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
} }
else if ((TYPE_CODE (type) == TYPE_CODE_INT else if ((TYPE_CODE (type) == TYPE_CODE_INT
|| TYPE_CODE (type) == TYPE_CODE_ENUM || TYPE_CODE (type) == TYPE_CODE_ENUM
|| TYPE_CODE (type) == TYPE_CODE_PTR) || TYPE_CODE (type) == TYPE_CODE_BOOL
|| TYPE_CODE (type) == TYPE_CODE_CHAR
|| TYPE_CODE (type) == TYPE_CODE_PTR
|| TYPE_CODE (type) == TYPE_CODE_REF)
&& TYPE_LENGTH (type) <= 8) && TYPE_LENGTH (type) <= 8)
{ {
/* Scalars and Pointers get sign[un]extended and go in /* Scalars and Pointers get sign[un]extended and go in
@ -1161,12 +1164,19 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Convert any function code addresses into /* Convert any function code addresses into
descriptors. */ descriptors. */
if (TYPE_CODE (type) == TYPE_CODE_PTR if (TYPE_CODE (type) == TYPE_CODE_PTR
&& TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC) || TYPE_CODE (type) == TYPE_CODE_REF)
{
struct type *target_type;
target_type = check_typedef (TYPE_TARGET_TYPE (type));
if (TYPE_CODE (target_type) == TYPE_CODE_FUNC
|| TYPE_CODE (target_type) == TYPE_CODE_METHOD)
{ {
CORE_ADDR desc = word; CORE_ADDR desc = word;
convert_code_addr_to_desc_addr (word, &desc); convert_code_addr_to_desc_addr (word, &desc);
word = desc; word = desc;
} }
}
if (greg <= 10) if (greg <= 10)
regcache_cooked_write_unsigned (regcache, regcache_cooked_write_unsigned (regcache,
tdep->ppc_gp0_regnum + tdep->ppc_gp0_regnum +
@ -1206,6 +1216,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
greg++; greg++;
} }
if (write_pass) if (write_pass)
{
/* WARNING: cagney/2003-09-21: Strictly speaking, this /* WARNING: cagney/2003-09-21: Strictly speaking, this
isn't necessary, unfortunately, GCC appears to get isn't necessary, unfortunately, GCC appears to get
"struct convention" parameter passing wrong putting "struct convention" parameter passing wrong putting
@ -1213,7 +1224,12 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
register. Work around this by always writing the register. Work around this by always writing the
value to memory. Fortunately, doing this value to memory. Fortunately, doing this
simplifies the code. */ simplifies the code. */
write_memory (gparam, val, TYPE_LENGTH (type)); int len = TYPE_LENGTH (type);
if (len < tdep->wordsize)
write_memory (gparam + tdep->wordsize - len, val, len);
else
write_memory (gparam, val, len);
}
if (freg <= 13 if (freg <= 13
&& TYPE_CODE (type) == TYPE_CODE_STRUCT && TYPE_CODE (type) == TYPE_CODE_STRUCT
&& TYPE_NFIELDS (type) == 1 && TYPE_NFIELDS (type) == 1
@ -1356,7 +1372,9 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *func_type,
writebuf); writebuf);
/* Integers in r3. */ /* Integers in r3. */
if ((TYPE_CODE (valtype) == TYPE_CODE_INT if ((TYPE_CODE (valtype) == TYPE_CODE_INT
|| TYPE_CODE (valtype) == TYPE_CODE_ENUM) || TYPE_CODE (valtype) == TYPE_CODE_ENUM
|| TYPE_CODE (valtype) == TYPE_CODE_CHAR
|| TYPE_CODE (valtype) == TYPE_CODE_BOOL)
&& TYPE_LENGTH (valtype) <= 8) && TYPE_LENGTH (valtype) <= 8)
{ {
if (writebuf != NULL) if (writebuf != NULL)
@ -1377,7 +1395,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *func_type,
return RETURN_VALUE_REGISTER_CONVENTION; return RETURN_VALUE_REGISTER_CONVENTION;
} }
/* All pointers live in r3. */ /* All pointers live in r3. */
if (TYPE_CODE (valtype) == TYPE_CODE_PTR) if (TYPE_CODE (valtype) == TYPE_CODE_PTR
|| TYPE_CODE (valtype) == TYPE_CODE_REF)
{ {
/* All pointers live in r3. */ /* All pointers live in r3. */
if (writebuf != NULL) if (writebuf != NULL)