This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/65753] New: [i386] Incorrect tail call inhibition logic on i386 (32-bit)
- From: "bugdal at aerifal dot cx" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 13 Apr 2015 16:26:38 +0000
- Subject: [Bug target/65753] New: [i386] Incorrect tail call inhibition logic on i386 (32-bit)
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65753
Bug ID: 65753
Summary: [i386] Incorrect tail call inhibition logic on i386
(32-bit)
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: bugdal at aerifal dot cx
i386.c contains the following comment (line 5448 as of this writing):
/* 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.) */
And the subsequent code disables tail calls via function pointers. The claim in
the comment that %ebx must be live for PLT use by indirect calls, and the
corresponding code that inhibits sibcall, is wrong.
For PLT slots in the non-PIE main executable, %ebx is not required at all. PLT
slots in PIE or shared libraries need %ebx, but a function pointer can never
evaluate to such a PLT slot; it always evaluates to the nominal address of the
function which is the same in all DSOs and therefore fundamentally cannot
depend on the address of the GOT in the calling DSO.
Removing this incorrect check will significantly improve code generation in
certain circumstances.