Print this page
Implement -fstrict-calling-conventions
Stock GCC is overly willing to violate the ABI when calling local functions,
such that it passes arguments in registers on i386. This hampers debugging
with anything other than a fully-aware DWARF debugger, and is generally not
something we desire.
Implement a flag which disables this behaviour, enabled by default. The flag is
global, though only effective on i386, to more easily allow its globalization
later which, given the odds, is likely to be necessary.
Split |
Close |
Expand all |
Collapse all |
--- old/gcc/testsuite/gcc.target/i386/local.c
+++ new/gcc/testsuite/gcc.target/i386/local.c
1 1 /* { dg-do compile } */
2 -/* { dg-options "-O2 -funit-at-a-time" } */
2 +/* { dg-options "-O2 -funit-at-a-time -fno-strict-calling-conventions" { target ilp32 } } */
3 +/* { dg-options "-O2 -funit-at-a-time" { target lp64 } } */
3 4 /* { dg-final { scan-assembler "magic\[^\\n\]*eax" { target ilp32 } } } */
4 5 /* { dg-final { scan-assembler "magic\[^\\n\]*edi" { target lp64 } } } */
5 6
6 7 /* Verify that local calling convention is used. */
7 8 static t(int) __attribute__ ((noinline));
8 9 m()
9 10 {
10 11 t(1);
11 12 }
12 13 static t(int a)
13 14 {
14 15 asm("magic %0"::"g"(a));
15 16 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX