Commit 50c9d049 by Richard Earnshaw Committed by Richard Earnshaw

re PR target/51643 (Incorrect code produced for tail-call of weak function with -O2/-O3 option)

	PR target/51643
	* arm.c (arm_function_ok_for_sibcall): Don't try to tailcall a
	weak function on bare-metal EABI targets.

	* gcc.target/arm/sibcall-2.c: New test.

From-SVN: r182621
parent 9dacb44b
2011-12-21 Richard Earnshaw <rearnsha@arm.com>
PR target/51643
* arm.c (arm_function_ok_for_sibcall): Don't try to tailcall a
weak function on bare-metal EABI targets.
2011-12-21 Jonathan Wakely <jwakely.gcc@gmail.com>
Jim Avera <james_avera@yahoo.com>
......@@ -5250,6 +5250,14 @@ arm_function_ok_for_sibcall (tree decl, tree exp)
if (IS_STACKALIGN (func_type))
return false;
/* The AAPCS says that, on bare-metal, calls to unresolved weak
references should become a NOP. Don't convert such calls into
sibling calls. */
if (TARGET_AAPCS_BASED
&& arm_abi == ARM_ABI_AAPCS
&& lookup_attribute ("weak", DECL_ATTRIBUTES (decl)))
return false;
/* Everything else is ok. */
return true;
}
......
2011-12-21 Richard Earnshaw <rearnsha@arm.com>
PR target/51643
* gcc.target/arm/sibcall-2.c: New test.
2011-12-22 Uros Bizjak <ubizjak@gmail.com>
PR testsuite/51645
......
/* { dg-require-effective-target arm_eabi } */
/* { dg-do compile } */
/* { dg-options "-O2 -mabi=aapcs" } */
extern void __attribute__((weak)) wfunc(void);
void main(void)
{
wfunc(); /* Must not tail-call. */
}
/* { dg-final { scan-assembler-not "b\[\\t \]+wfunc" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment