This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/68937] i686: -fno-plt produces wrong code (maybe only with tailcall)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68937

--- Comment #12 from uros at gcc dot gnu.org ---
Author: uros
Date: Tue Dec 22 15:38:25 2015
New Revision: 231903

URL: https://gcc.gnu.org/viewcvs?rev=231903&root=gcc&view=rev
Log:
[PATCH] Use call-clobbered register for sibcall via GOT

From: H.J. Lu  <hongjiu.lu@intel.com>

Since sibcall never returns, we can only use call-clobbered register as
GOT base.  Otherwise, callee-saved register used as GOT base won't be
properly restored.  sibcall_memory_operand is changed to allow 32-bit
GOT slot only with pseudo register as GOT base for RTL expansion.  2
new patterns, *sibcall_GOT_32 and *sibcall_value_GOT_32, are added to
expose GOT base register to register allocator so that call-clobbered
register will be used for GOT base.

gcc/

        PR target/68937
        * config/i386/i386.c (ix86_function_ok_for_sibcall): Count
        call to global function via GOT slot as indirect call.
        * config/i386/i386.md (*sibcall_GOT_32): New pattern.
        (*sibcall_value_GOT_32): Likewise.
        * config/i386/predicates.md (sibcall_memory_operand): Rewrite.
        Allow 32-bit GOT slot only with pseudo register as GOT base.
        (GOT32_symbol_operand): New predicate.

gcc/testsuite/

        PR target/68937
        * gcc.target/i386/pr68937-1.c: New test.
        * gcc.target/i386/pr68937-2.c: Likewise.
        * gcc.target/i386/pr68937-3.c: Likewise.
        * gcc.target/i386/pr68937-4.c: Likewise.
        * gcc.target/i386/pr68937-5.c: Likewise.
        * gcc.target/i386/pr68937-6.c: Likewise.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr68937-1.c
    trunk/gcc/testsuite/gcc.target/i386/pr68937-2.c
    trunk/gcc/testsuite/gcc.target/i386/pr68937-3.c
    trunk/gcc/testsuite/gcc.target/i386/pr68937-4.c
    trunk/gcc/testsuite/gcc.target/i386/pr68937-5.c
    trunk/gcc/testsuite/gcc.target/i386/pr68937-6.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.md
    trunk/gcc/config/i386/predicates.md
    trunk/gcc/testsuite/ChangeLog

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]