From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11341 invoked by alias); 25 Nov 2013 16:22:55 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 11294 invoked by uid 48); 25 Nov 2013 16:22:51 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/12306] GOT pointer (r12) reloaded unnecessarily Date: Mon, 25 Nov 2013 16:22:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 3.4.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-11/txt/msg02577.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12306 --- Comment #6 from Oleg Endo --- Maybe something like function multi-versioning could be used for that? When compiling as PIC, each function would be output twice. Once with the assumption that it can be called from non-PIC functions and once with the assumption that it can't. So we'll have one function that does the r12 stuff and another that doesn't. Then the linker could figure it out by e.g. dead code stripping, and maybe also taking into account the visibility. In the worst case, if the linker can't make a decision, it should leave the "with-r12-stuff" version.