Mon Jun 30 15:30:38 1997 Michael Snyder (msnyder@cleaver.cygnus.com)
authorMichael Snyder <msnyder@vmware.com>
Mon, 30 Jun 1997 22:32:20 +0000 (22:32 +0000)
committerMichael Snyder <msnyder@vmware.com>
Mon, 30 Jun 1997 22:32:20 +0000 (22:32 +0000)
        * mips-tdep.c (mips_push_arguments): tweak alignment of small
        structs passed in registers for little-endian non-EABI mode.

gdb/ChangeLog
gdb/mips-tdep.c

index a8383fe9a7663aa28e595cfc28a4937983f497f7..b63a6cd6ead0e3cd34669850ae097f6b42503b0b 100644 (file)
@@ -1,3 +1,8 @@
+Mon Jun 30 15:30:38 1997  Michael Snyder  (msnyder@cleaver.cygnus.com)
+
+       * mips-tdep.c (mips_push_arguments): tweak alignment of small
+       structs passed in registers for little-endian non-EABI mode.
+
 Mon Jun 30 13:05:39 1997  Michael Snyder  (msnyder@cleaver.cygnus.com)
 
        * breakpoint.c (frame_in_dummy): use generic dummy if available.
index dfca27ac58eabd6157b9ecd961ebd12becb5f911..e08be0f1123f46821b9b643a6bff219b93325e2d 100644 (file)
@@ -1349,15 +1349,23 @@ mips_push_arguments(nargs, args, sp, struct_return, struct_addr)
                {
                  CORE_ADDR regval = extract_address (val, partial_len);
 
-                 /* It's a simple argument being passed in a general
-                    register.
-                    If the argument length is smaller than the register size,
-                    we have to adjust the argument on big endian targets.
+                 /* A simple argument being passed in a general register.
+                    If the length is smaller than the register size, we
+                    have to adjust the alignment on big endian targets.  
+
+                    For structs, it appears that we have to 
+                    do the same even in little endian mode.
+
                     But don't do this adjustment on EABI targets. */
-                 if (TARGET_BYTE_ORDER == BIG_ENDIAN
-                     && partial_len < MIPS_REGSIZE
-                     && !MIPS_EABI)
-                   regval <<= ((MIPS_REGSIZE - partial_len) * TARGET_CHAR_BIT);
+
+                 if (!MIPS_EABI &&
+                     TYPE_LENGTH (arg_type) < MIPS_REGSIZE &&
+                     (TARGET_BYTE_ORDER == BIG_ENDIAN ||
+                      typecode == TYPE_CODE_STRUCT    ||
+                      typecode == TYPE_CODE_UNION))
+                   regval <<= ((MIPS_REGSIZE - partial_len) * 
+                               TARGET_CHAR_BIT);
+
                  write_register (argreg, regval);
                  argreg++;
     
@@ -1384,7 +1392,6 @@ mips_push_arguments(nargs, args, sp, struct_return, struct_addr)
                              typecode == TYPE_CODE_UNION) &&
                             len < MIPS_REGSIZE)
                      longword_offset = MIPS_REGSIZE - len;
-
                  write_memory (sp + stack_offset + longword_offset, 
                                val, partial_len);
                  stack_offset += ROUND_UP (partial_len, MIPS_REGSIZE);