On Thu, 21 May 2015, H.J. Lu wrote: > On Thu, May 21, 2015 at 12:06 PM, Richard Henderson <r...@redhat.com> wrote: > > On 05/21/2015 12:01 PM, H.J. Lu wrote: > >> +++ b/gcc/testsuite/gcc.target/i386/pr66232-1.c > >> @@ -0,0 +1,13 @@ > >> +/* { dg-do compile { target *-*-linux* } } */ > >> +/* { dg-options "-O2 -fpic -fno-plt" } */ > >> + > >> +extern void bar (void); > >> + > >> +void > >> +foo (void) > >> +{ > >> + bar (); > >> +} > >> + > >> +/* { dg-final { scan-assembler "jmp\[ \t\]*.bar@GOTPCREL" { target { ! > >> ia32 } } } } */ > >> +/* { dg-final { scan-assembler "call\[ \t\]*.bar@GOT\\(" { target ia32 } > >> } } */ > > > > Do you really want to check for no tail call for ia32 here? > > That's really just a missed optimization, surely. > > > > > > I'd like to keep it. When it is fixed, we can update it. I tried: > > https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00230.html > > and got > > call __x86.get_pc_thunk.ax > addl $_GLOBAL_OFFSET_TABLE_, %eax > subl $28, %esp > .cfi_def_cfa_offset 32 > movl bar@GOT(%eax), %eax > movl %eax, 12(%esp) > addl $28, %esp > .cfi_def_cfa_offset 4 > jmp *%eax > > This is very odd code, comparing against
To avoid that, you need the CLOBBERED_REGS patch too: https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00227.html Alexander > call __x86.get_pc_thunk.ax > addl $_GLOBAL_OFFSET_TABLE_, %eax > subl $12, %esp > .cfi_def_cfa_offset 16 > call *bar@GOT(%eax) > addl $12, %esp > .cfi_def_cfa_offset 4 > ret