Subject: Re: ARM: The switch to ELF. Are we ready yet?
To: Todd Vierling <tv@wasabisystems.com>
From: Ben Harris <bjh21@netbsd.org>
List: port-arm
Date: 03/18/2002 22:59:02
On Mon, 18 Mar 2002, Ben Harris wrote:

[ struct return ]
> Yeah, and since the rules have got simpler (you just need to check the
> size of the structure to know how to return it), the change shouldn't be
> too hard to make.

Here's a grotty patch to minimally achieve ATPCS conformance in this area.
This isn't a nice solution, since we should at least have the behaviour
compile-time selectable, and it'd be nice to have it run-time selectable.
Still, it's enough to render the struct-return problem non-show-stopping.

Index: arm.c
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/gcc/config/arm/arm.c,v
retrieving revision 1.4
diff -u -r1.4 arm.c
--- arm.c	2001/12/19 23:14:50	1.4
+++ arm.c	2002/03/18 22:58:40
@@ -1353,6 +1353,11 @@
       /* All structures/unions bigger than one word are returned in memory. */
       return 1;
     }
+#if 1
+  else
+    /* In ATPCS, all small aggregates are in registers. */
+    return 0;
+#else
   else if (TREE_CODE (type) == RECORD_TYPE)
     {
       tree field;
@@ -1413,6 +1418,7 @@
   /* XXX Not sure what should be done for other aggregates, so put them in
      memory. */
   return 1;
+#endif
 }

 int

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/arm26               <URL:http://www.netbsd.org/Ports/arm26/>