1/* Test if functions marked __attribute__((used)), but with address never 2 taken in C code, don't use alternate calling convention for local 3 functions on IA-32. */ 4/* { dg-do run } */ 5/* The asm in this test uses an absolute address. */ 6/* { dg-require-effective-target nonpic } */ 7/* { dg-options "-O2" } */ 8 9extern void abort (void); 10 11static int foo (int, int, int, int) __asm ("foo"); 12static __attribute__((noinline, used)) int 13foo (int i, int j, int k, int l) 14{ 15 return i + j + k + l; 16} 17 18void 19bar (void) 20{ 21 if (foo (1, 2, 3, 4) != 10) 22 abort (); 23} 24 25int (*fn) (int, int, int, int); 26 27void 28baz (void) 29{ 30 /* Darwin loads 64-bit regions above the 4GB boundary so 31 we need to use this instead. */ 32#if defined (__LP64__) && defined (__MACH__) 33 __asm ("leaq foo(%%rip), %0" : "=r" (fn)); 34#else 35 __asm ("movl $foo, %k0" : "=r" (fn)); 36#endif 37 if (fn (2, 3, 4, 5) != 14) 38 abort (); 39} 40 41int 42main (void) 43{ 44 bar (); 45 baz (); 46 return 0; 47} 48