re PR target/57260 (Generated R_MIPS_GOT_MIPS relocation for direct function call while compiling with -O2 on MIPS N64)
gcc/ PR target/57260 * config/mips/mips.c (mips_function_ok_for_sibcall): Don't allow sibling calls to functions that would normally be lazily bound, unless $gp is call-clobbered. gcc/testsuite/ PR target/57260 * gcc.target/mips/call-1.c: Restrict to o32. * gcc.target/mips/call-5.c, gcc.target/mips/call-6.c: New test. From-SVN: r198945
This commit is contained in:
parent
1e6cf26ea8
commit
e299a383a9
6 changed files with 140 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
2013-05-15 Richard Sandiford <rdsandiford@googlemail.com>
|
||||
|
||||
PR target/57260
|
||||
* config/mips/mips.c (mips_function_ok_for_sibcall): Don't allow
|
||||
sibling calls to functions that would normally be lazily bound,
|
||||
unless $gp is call-clobbered.
|
||||
|
||||
2013-05-15 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
* config/i386/i386.c (iy86_option_override_internal): Update
|
||||
|
|
|
@ -6995,6 +6995,15 @@ mips_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
|
|||
&& mips_call_may_need_jalx_p (decl))
|
||||
return false;
|
||||
|
||||
/* Sibling calls should not prevent lazy binding. Lazy-binding stubs
|
||||
require $gp to be valid on entry, so sibcalls can only use stubs
|
||||
if $gp is call-clobbered. */
|
||||
if (decl
|
||||
&& TARGET_CALL_SAVED_GP
|
||||
&& !TARGET_ABICALLS_PIC0
|
||||
&& !targetm.binds_local_p (decl))
|
||||
return false;
|
||||
|
||||
/* Otherwise OK. */
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2013-05-15 Richard Sandiford <rdsandiford@googlemail.com>
|
||||
|
||||
PR target/57260
|
||||
* gcc.target/mips/call-1.c: Restrict to o32.
|
||||
* gcc.target/mips/call-5.c, gcc.target/mips/call-6.c: New test.
|
||||
|
||||
2013-05-15 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* g++.dg/cpp0x/lambda/lambda-shadow1.C: Replace dg-warnings with
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
/* { dg-options "-mrelax-pic-calls -mshared -foptimize-sibling-calls" } */
|
||||
/* { dg-options "-mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=32" } */
|
||||
/* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal2\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,staticfunc\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail\n1:\tjr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail2\n1:\tjr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail3\n1:\tjr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail4\n1:\tjr\t" } } */
|
||||
|
||||
__attribute__ ((noinline)) static void staticfunc () { asm (""); }
|
||||
int normal ();
|
||||
|
@ -31,3 +33,17 @@ NOMIPS16 void g ()
|
|||
{
|
||||
tail2 ();
|
||||
}
|
||||
|
||||
__attribute__ ((visibility ("hidden"))) void tail3 ();
|
||||
|
||||
NOMIPS16 void j ()
|
||||
{
|
||||
tail3 ();
|
||||
}
|
||||
|
||||
__attribute__ ((noinline)) static void tail4 () { asm (""); }
|
||||
|
||||
NOMIPS16 void k ()
|
||||
{
|
||||
tail4 ();
|
||||
}
|
||||
|
|
51
gcc/testsuite/gcc.target/mips/call-5.c
Normal file
51
gcc/testsuite/gcc.target/mips/call-5.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
/* Like call-1.c, but for n32. We cannot use sibling calls for tail and tail2
|
||||
in this case (PR target/57260). */
|
||||
/* { dg-options "-mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=n32" } */
|
||||
/* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal2\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,staticfunc\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail2\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail3\n1:\tjr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail4\n1:\tjr\t" } } */
|
||||
|
||||
__attribute__ ((noinline)) static void staticfunc () { asm (""); }
|
||||
int normal ();
|
||||
void normal2 ();
|
||||
|
||||
NOMIPS16 f (int *p)
|
||||
{
|
||||
*p = normal ();
|
||||
normal2 ();
|
||||
staticfunc ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int tail ();
|
||||
|
||||
NOMIPS16 h ()
|
||||
{
|
||||
return tail ();
|
||||
}
|
||||
|
||||
void tail2 ();
|
||||
|
||||
NOMIPS16 void g ()
|
||||
{
|
||||
tail2 ();
|
||||
}
|
||||
|
||||
__attribute__ ((visibility ("hidden"))) void tail3 ();
|
||||
|
||||
NOMIPS16 void j ()
|
||||
{
|
||||
tail3 ();
|
||||
}
|
||||
|
||||
__attribute__ ((noinline)) static void tail4 () { asm (""); }
|
||||
|
||||
NOMIPS16 void k ()
|
||||
{
|
||||
tail4 ();
|
||||
}
|
50
gcc/testsuite/gcc.target/mips/call-6.c
Normal file
50
gcc/testsuite/gcc.target/mips/call-6.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
/* Like call-5.c, but for n64. */
|
||||
/* { dg-options "-mrelax-pic-calls -mshared -foptimize-sibling-calls -mabi=64" } */
|
||||
/* { dg-skip-if "requires -foptimize-sibling-calls" { *-*-* } { "-O0" } { "" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,normal2\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,staticfunc\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail2\n1:\tjalr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail3\n1:\tjr\t" } } */
|
||||
/* { dg-final { scan-assembler "\\.reloc\t1f,R_MIPS_JALR,tail4\n1:\tjr\t" } } */
|
||||
|
||||
__attribute__ ((noinline)) static void staticfunc () { asm (""); }
|
||||
int normal ();
|
||||
void normal2 ();
|
||||
|
||||
NOMIPS16 f (int *p)
|
||||
{
|
||||
*p = normal ();
|
||||
normal2 ();
|
||||
staticfunc ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int tail ();
|
||||
|
||||
NOMIPS16 h ()
|
||||
{
|
||||
return tail ();
|
||||
}
|
||||
|
||||
void tail2 ();
|
||||
|
||||
NOMIPS16 void g ()
|
||||
{
|
||||
tail2 ();
|
||||
}
|
||||
|
||||
__attribute__ ((visibility ("hidden"))) void tail3 ();
|
||||
|
||||
NOMIPS16 void j ()
|
||||
{
|
||||
tail3 ();
|
||||
}
|
||||
|
||||
__attribute__ ((noinline)) static void tail4 () { asm (""); }
|
||||
|
||||
NOMIPS16 void k ()
|
||||
{
|
||||
tail4 ();
|
||||
}
|
Loading…
Add table
Reference in a new issue