diff options
-rw-r--r-- | gdb/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/ppc-linux-tdep.c | 30 | ||||
-rw-r--r-- | gdb/ppc-sysv-tdep.c | 14 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 14 |
4 files changed, 49 insertions, 22 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 76ed750..ccc93eb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,18 @@ 2003-09-16 Andrew Cagney <cagney@redhat.com> + * ppc-linux-tdep.c (ppc_linux_init_abi): Set the 32 bit + "use_struct_convention" to "ppc_linux_use_struct_convention". + (ppc_linux_use_struct_convention): New function. + * rs6000-tdep.c (rs6000_use_struct_convention): New function. + (rs6000_gdbarch_init): For AIX, set "use_struct_convention" to + "rs6000_use_struct_convention". + * ppc-tdep.h (ppc_sysv_abi_broken_use_struct_convention): Delete + declaration. + * ppc-sysv-tdep.c (ppc_sysv_abi_broken_use_struct_convention): + Delete function. + +2003-09-16 Andrew Cagney <cagney@redhat.com> + * buildsym.c: Remove more occurances of "register". * coffread.c, dbxread.c, dcache.c, dwarf2read.c: Ditto. * environ.c, eval.c, f-valprint.c, findvar.c: Ditto. diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 3134132..22ebfd2 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -591,6 +591,20 @@ ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache) return val; } +/* 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 int +ppc_linux_use_struct_convention (int gcc_p, struct type *value_type) +{ + if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8) + && TYPE_VECTOR (value_type)) + return 0; + return 1; +} + /* Fetch (and possibly build) an appropriate link_map_offsets structure for GNU/Linux PPC targets using the struct offsets defined in link.h (but without actual reference to that file). @@ -1017,15 +1031,17 @@ ppc_linux_init_abi (struct gdbarch_info info, { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - /* Until November 2001, gcc was not complying to the SYSV ABI for - returning structures less than or equal to 8 bytes in size. It was - returning everything in memory. When this was corrected, it wasn't - fixed for native platforms. */ - set_gdbarch_use_struct_convention (gdbarch, - ppc_sysv_abi_broken_use_struct_convention); - if (tdep->wordsize == 4) { + /* Until November 2001, gcc did not comply with the 32 bit SysV + R4 ABI requirement that structures less than or equal to 8 + bytes should be returned in registers. Instead GCC was using + the the AIX/PowerOpen ABI - everything returned in memory + (well ignoring vectors that is). When this was corrected, it + wasn't fixed for GNU/Linux native platform. Use the + PowerOpen struct convention. */ + set_gdbarch_use_struct_convention (gdbarch, ppc_linux_use_struct_convention); + /* Note: kevinb/2002-04-12: See note in rs6000_gdbarch_init regarding *_push_arguments(). The same remarks hold for the methods below. */ set_gdbarch_frameless_function_invocation (gdbarch, diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 777cbbc..622bc65 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -329,20 +329,6 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, return sp; } -/* Until November 2001, gcc was not complying to the SYSV ABI for - returning structures less than or equal to 8 bytes in size. It was - returning everything in memory. When this was corrected, it wasn't - fixed for native platforms. */ -int -ppc_sysv_abi_broken_use_struct_convention (int gcc_p, struct type *value_type) -{ - if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8) - && TYPE_VECTOR (value_type)) - return 0; - - return generic_use_struct_convention (gcc_p, value_type); -} - /* Structures 8 bytes or less long are returned in the r3 & r4 registers, according to the SYSV ABI. */ int diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index a631ffc..43fb799 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1372,6 +1372,18 @@ e500_extract_return_value (struct type *valtype, struct regcache *regbuf, void * } } +/* PowerOpen always puts structures in memory. Vectors, which were + added later, do get returned in a register though. */ + +static int +rs6000_use_struct_convention (int gcc_p, struct type *value_type) +{ + if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8) + && TYPE_VECTOR (value_type)) + return 0; + return 1; +} + static void rs6000_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) { @@ -2957,7 +2969,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) ppc_sysv_abi_use_struct_convention); else set_gdbarch_use_struct_convention (gdbarch, - generic_use_struct_convention); + rs6000_use_struct_convention); set_gdbarch_frameless_function_invocation (gdbarch, rs6000_frameless_function_invocation); |