From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24694 invoked by alias); 16 Jan 2012 16:16:58 -0000 Received: (qmail 24686 invoked by uid 22791); 16 Jan 2012 16:16:57 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 Jan 2012 16:16:44 +0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug bootstrap/51872] New: [4.7 Regression] Shrink-wrapping with -mminimal-toc causes bootstrap failure Date: Mon, 16 Jan 2012 16:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: bootstrap X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-01/txt/msg01801.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51872 Bug #: 51872 Summary: [4.7 Regression] Shrink-wrapping with -mminimal-toc causes bootstrap failure Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: bootstrap AssignedTo: unassigned@gcc.gnu.org ReportedBy: jakub@gcc.gnu.org CC: amodra@gcc.gnu.org, bernds@gcc.gnu.org, dje@gcc.gnu.org Target: powerpc64-linux powerpc64-linux doesn't bootstrap with -mminimal-toc in CFLAGS/CXXFLAGS, due to shrink-wrapping, as crtbegin.o is miscompiled. Short testcase for -m64 -O2 -mminimal-toc: static void *var[] __attribute__ ((used, section("jlist"), aligned(sizeof(void*)))) = { }; extern void bar (void *) __attribute__ ((weak)); static void __attribute__((noinline, noclone)) baz (void) { asm volatile ("" : : : "memory"); } void foo (void) { if (var[0]) { void (*register_classes) (void *) = bar; __asm ("" : "+r" (register_classes)); if (register_classes) register_classes (var); } baz (); } The problem is that the TOC register (r30) isn't added to the set_up_by_prologue regset (flag_pic is 0, TARGET_MINIMAL_TOC is true and the prologue computes the TOC_REGISTER). I wonder if we don't need a target hook that will add additional registers to set_up_by_prologue regset.