Patchwork [testsuite,ARM] Fix gcc.dg/builtin-apply2.c for ARM EABI

login
register
mail settings
Submitter Jie Zhang
Date Aug. 10, 2010, 1:42 p.m.
Message ID <4C61573F.1070400@codesourcery.com>
Download mbox | patch
Permalink /patch/61380/
State New
Headers show

Comments

Jie Zhang - Aug. 10, 2010, 1:42 p.m.
When testing GCC on a Cortex-M4 board, gcc.dg/builtin-apply2.c will hang 
the testing. That is because we should not use 64 as the size of the 
stack argument. For ARM EABI, NAME is passed in r0. D is passed in r2 
and r3. E, F and G are passed on stack. So the size of the stack 
argument data is 20. When using 64, the test will try to access too much 
data on stack. For Cortex-M4 case, it will access invalid memory region, 
which causes testing hang.


Is it OK?
Mark Mitchell - Aug. 17, 2010, 4:29 p.m.
Jie Zhang wrote:

> When testing GCC on a Cortex-M4 board, gcc.dg/builtin-apply2.c will hang
> the testing. That is because we should not use 64 as the size of the
> stack argument. For ARM EABI, NAME is passed in r0. D is passed in r2
> and r3. E, F and G are passed on stack.

Is this true in all variants of the ABI?  Or do we need to worry about
hard-float vs. soft-float ABIs?

Thanks,
Chung-Lin Tang - Aug. 17, 2010, 7:55 p.m.
Mark Mitchell wrote:
> Jie Zhang wrote:
>> When testing GCC on a Cortex-M4 board, gcc.dg/builtin-apply2.c will hang
>> the testing. That is because we should not use 64 as the size of the
>> stack argument. For ARM EABI, NAME is passed in r0. D is passed in r2
>> and r3. E, F and G are passed on stack.
>>     
>
> Is this true in all variants of the ABI?  Or do we need to worry about
> hard-float vs. soft-float ABIs?
This test is skipped for hard-float, due to the case of passing 
arguments to a variadic function; it simply won't pass under 
-mfloat-abi=hard.

Jie, while you're at it, why not use the new __ARM_PCS symbol instead of 
__ARM_EABI__?
It more accurately marks the softfp conventions you're trying to assume 
here.

Chung-Lin

Patch


	* gcc.dg/builtin-apply2.c (STACK_ARGUMENTS_SIZE): Define to
	20 for ARM EABI otherwise 64.
	(bar): Use STACK_ARGUMENTS_SIZE for the third argument
	instead of hard coded 64.

Index: gcc.dg/builtin-apply2.c
===================================================================
--- gcc.dg/builtin-apply2.c	(revision 163048)
+++ gcc.dg/builtin-apply2.c	(working copy)
@@ -12,6 +12,15 @@ 
 
 #define INTEGER_ARG  5
 
+#ifdef __ARM_EABI__
+/* For ARM EABI, NAME is passed in r0.  D is passed in r2 and r3.
+   E, F and G are passed on stack.  So the size of the stack argument
+   data is 20.  */
+#define STACK_ARGUMENTS_SIZE  20
+#else
+#define STACK_ARGUMENTS_SIZE  64
+#endif
+
 extern void abort(void);
 
 void foo(char *name, double d, double e, double f, int g)
@@ -22,7 +31,7 @@  void foo(char *name, double d, double e,
 
 void bar(char *name, ...)
 {
-  __builtin_apply(foo, __builtin_apply_args(), 64);
+  __builtin_apply(foo, __builtin_apply_args(), STACK_ARGUMENTS_SIZE);
 }
 
 int main(void)