public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-51872-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2012-01-16 16:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16 16:25 jakub at gcc dot gnu.org [this message]
2012-01-16 16:18 ` [Bug bootstrap/51872] " jakub at gcc dot gnu.org
2012-01-16 17:39 ` jakub at gcc dot gnu.org
2012-01-16 18:46 ` pinskia at gcc dot gnu.org
2012-01-16 18:56 ` [Bug target/51872] " jakub at gcc dot gnu.org
2012-01-17 16:35 ` jakub at gcc dot gnu.org
2012-01-17 17:03 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-51872-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).