diff options
author | Alexander Monakov <amonakov@ispras.ru> | 2015-05-11 19:10:24 +0300 |
---|---|---|
committer | Alexander Monakov <amonakov@gcc.gnu.org> | 2015-05-11 19:10:24 +0300 |
commit | f1ed9790a36ceff598fc2ad873a0bb7778c9fa6e (patch) | |
tree | d7e75304c1814d63228cee7fbd6020e839dbb714 /gcc | |
parent | b91fd3c76ac503f11d94ff00fd9399e949735148 (diff) | |
download | gcc-f1ed9790a36ceff598fc2ad873a0bb7778c9fa6e.zip gcc-f1ed9790a36ceff598fc2ad873a0bb7778c9fa6e.tar.gz gcc-f1ed9790a36ceff598fc2ad873a0bb7778c9fa6e.tar.bz2 |
re PR target/65753 ([i386] Incorrect tail call inhibition logic on i386 (32-bit))
PR target/65753
* config/i386/i386.c (ix86_function_ok_for_sibcall): Allow PIC sibcalls
via function pointers.
testsuite:
* gcc.target/i386/pr65753.c: New test.
From-SVN: r223005
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr65753.c | 8 |
4 files changed, 22 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 38f929b..7640c5b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2015-05-11 Alexander Monakov <amonakov@ispras.ru> + PR target/65753 + * config/i386/i386.c (ix86_function_ok_for_sibcall): Allow PIC sibcalls + via function pointers. + +2015-05-11 Alexander Monakov <amonakov@ispras.ru> + * calls.c (prepare_call_address): Transform PLT call to GOT lookup and indirect call by forcing address into a pseudo with -fno-plt. * common.opt (flag_plt): New option. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 7bd9ff3..fb7977f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -5473,12 +5473,12 @@ ix86_function_ok_for_sibcall (tree decl, tree exp) rtx a, b; /* If we are generating position-independent code, we cannot sibcall - optimize any indirect call, or a direct call to a global function, - as the PLT requires %ebx be live. (Darwin does not have a PLT.) */ + optimize direct calls to global functions, as the PLT requires + %ebx be live. (Darwin does not have a PLT.) */ if (!TARGET_MACHO && !TARGET_64BIT && flag_pic - && (!decl || !targetm.binds_local_p (decl))) + && decl && !targetm.binds_local_p (decl)) return false; /* If we need to align the outgoing stack, then sibcalling would diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b327b7..e5fda8b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-05-11 Alexander Monakov <amonakov@ispras.ru> + + PR target/65753 + * gcc.target/i386/pr65753.c: New test. + 2015-05-11 Richard Sandiford <richard.sandiford@arm.com> PR rtl-optimization/66076 diff --git a/gcc/testsuite/gcc.target/i386/pr65753.c b/gcc/testsuite/gcc.target/i386/pr65753.c new file mode 100644 index 0000000..70061e2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr65753.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-fPIC -O" } */ +/* { dg-final { scan-assembler-not "call" } } */ + +void foo(void (*bar)(void)) +{ + bar(); +} |