get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/810294/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 810294,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/810294/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20170905212725.GA2291@tucnak/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/17/?format=api",
        "name": "GNU Compiler Collection",
        "link_name": "gcc",
        "list_id": "gcc-patches.gcc.gnu.org",
        "list_email": "gcc-patches@gcc.gnu.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170905212725.GA2291@tucnak>",
    "list_archive_url": null,
    "date": "2017-09-05T21:27:25",
    "name": "Fix rs6000 sysv4 -fPIC hot/cold partitioning handling (PR target/81979)",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "9561f05e8aa6fb7131259532a7636a96768894bb",
    "submitter": {
        "id": 671,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/671/?format=api",
        "name": "Jakub Jelinek",
        "email": "jakub@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20170905212725.GA2291@tucnak/mbox/",
    "series": [
        {
            "id": 1653,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/1653/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=1653",
            "date": "2017-09-05T21:27:25",
            "name": "Fix rs6000 sysv4 -fPIC hot/cold partitioning handling (PR target/81979)",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/1653/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/810294/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/810294/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<gcc-patches-return-461541-incoming=patchwork.ozlabs.org@gcc.gnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "mailing list gcc-patches@gcc.gnu.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461541-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"soJQDxy5\"; dkim-atps=neutral",
            "sourceware.org; auth=none",
            "ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jakub@redhat.com"
        ],
        "Received": [
            "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xn0Dj4Hhyz9ryv\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  6 Sep 2017 07:27:48 +1000 (AEST)",
            "(qmail 43445 invoked by alias); 5 Sep 2017 21:27:39 -0000",
            "(qmail 43024 invoked by uid 89); 5 Sep 2017 21:27:38 -0000",
            "from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tTue, 05 Sep 2017 21:27:33 +0000",
            "from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.14])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id BC5913E2A8;\n\tTue,  5 Sep 2017 21:27:31 +0000 (UTC)",
            "from tucnak.zalov.cz (ovpn-116-33.ams2.redhat.com\n\t[10.36.116.33])\tby smtp.corp.redhat.com (Postfix) with ESMTPS\n\tid 10F3B18660; Tue,  5 Sep 2017 21:27:30 +0000 (UTC)",
            "from tucnak.zalov.cz (localhost [127.0.0.1])\tby tucnak.zalov.cz\n\t(8.15.2/8.15.2) with ESMTP id v85LRRpR002567;\n\tTue, 5 Sep 2017 23:27:27 +0200",
            "(from jakub@localhost)\tby tucnak.zalov.cz (8.15.2/8.15.2/Submit)\n\tid v85LRPgU002566; Tue, 5 Sep 2017 23:27:25 +0200"
        ],
        "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:mime-version\n\t:content-type; q=dns; s=default; b=sVMoJPZBTd+udKiAUPGJxjW/w0Ocl\n\tex+T+cP5ICNofJCrGovVemnDxolzDsiGOxLSXTYXtOcDwjoFcmnJF6zED6uep8Pz\n\t7Re6kHB6IER6NPOGDTxRdNsjKrkESMftGUD+UhlLrKlcS0n0Ohy4DaiYM/RleYPO\n\t1NWSK7Qs5YUPug=",
        "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:mime-version\n\t:content-type; s=default; bh=P+ltJD/JMfUVyLweCnRIz0ont4s=; b=soJ\n\tQDxy5slICnYMnOOmJReOwMvKNKImvXiHUSvcSN+/6PeoKhoSY6aA7dsOUNNtHqRE\n\tGgCE9D0k5VQqZXtSidzOuvHJrklD2bECX+l7iun7iUe71rgdwJPPrAaBGeZVf9Yq\n\tBuOjXkTbVJIpBm9I2mXDlOu3oOsSBIYim9GYSY4w=",
        "Mailing-List": "contact gcc-patches-help@gcc.gnu.org; run by ezmlm",
        "Precedence": "bulk",
        "List-Id": "<gcc-patches.gcc.gnu.org>",
        "List-Unsubscribe": "<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>",
        "List-Archive": "<http://gcc.gnu.org/ml/gcc-patches/>",
        "List-Post": "<mailto:gcc-patches@gcc.gnu.org>",
        "List-Help": "<mailto:gcc-patches-help@gcc.gnu.org>",
        "Sender": "gcc-patches-owner@gcc.gnu.org",
        "X-Virus-Found": "No",
        "X-Spam-SWARE-Status": "No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=TOC, lcl, LCL",
        "X-HELO": "mx1.redhat.com",
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com BC5913E2A8",
        "Date": "Tue, 5 Sep 2017 23:27:25 +0200",
        "From": "Jakub Jelinek <jakub@redhat.com>",
        "To": "Segher Boessenkool <segher@kernel.crashing.org>,\n\tDavid Edelsohn <dje.gcc@gmail.com>",
        "Cc": "gcc-patches@gcc.gnu.org, Andrew Jenner <andrew@codesourcery.com>",
        "Subject": "[PATCH] Fix rs6000 sysv4 -fPIC hot/cold partitioning handling (PR\n\ttarget/81979)",
        "Message-ID": "<20170905212725.GA2291@tucnak>",
        "Reply-To": "Jakub Jelinek <jakub@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "User-Agent": "Mutt/1.7.1 (2016-10-04)",
        "X-IsSubscribed": "yes"
    },
    "content": "Hi!\n\nCCing Andrew, because powerpcspe needs the same thing.\n\nOn powerpc with sysv4 -fPIC we emit something like\n.LCL0:\n\t.long .LCTOC1-.LCF0\nbefore we start emitting the function, and in the prologue we emit\n.LCF0:\nand some code.  This fails to assemble if the prologue is emitted in a\ndifferent partition from the start of the function, as e.g. the following\ntestcase, where the start of the function is hot, i.e. in .text section,\nbut the shrink-wrapped prologue is cold, emitted in .text.unlikely section.\n.LCL0 is still emitted in the section the function starts, thus .text, and\nthere is no relocation for subtraction of two symbols in other sections\n(the second - operand has to be in the current section so that a PC-relative\nrelocation can be used).  This probably never worked, but is now more\nsevere, as we enable hot/cold partitioning in GCC 8, where it\nhas been previously only enabled for -fprofile-use.\n\nFixed thusly, bootstrapped on powerpc64-linux, regtested with\n--target_board=unix\\{,-m32\\}, ok for trunk?\n\n2017-09-05  Jakub Jelinek  <jakub@redhat.com>\n\n\tPR target/81979\n\t* config/rs6000/rs6000.c (uses_TOC): Return 2 if\n\tNOTE_INSN_SWITCH_TEXT_SECTIONS is seen before finding load_toc_* insn.\n\t(rs6000_elf_declare_function_name): If uses_TOC returned 2, switch\n\tto the other text partition before emitting LCL label and switch back\n\tafter emitting the word after it.\n\n\t* gcc.dg/pr81979.c: New test.\n\n\n\tJakub",
    "diff": "--- gcc/config/rs6000/rs6000.c.jj\t2017-09-04 09:55:28.000000000 +0200\n+++ gcc/config/rs6000/rs6000.c\t2017-09-04 16:36:49.033213325 +0200\n@@ -25248,12 +25248,15 @@ get_TOC_alias_set (void)\n \n /* This returns nonzero if the current function uses the TOC.  This is\n    determined by the presence of (use (unspec ... UNSPEC_TOC)), which\n-   is generated by the ABI_V4 load_toc_* patterns.  */\n+   is generated by the ABI_V4 load_toc_* patterns.\n+   Return 2 instead of 1 if the load_toc_* pattern is in the function\n+   partition that doesn't start the function.  */\n #if TARGET_ELF\n static int\n uses_TOC (void)\n {\n   rtx_insn *insn;\n+  int ret = 1;\n \n   for (insn = get_insns (); insn; insn = NEXT_INSN (insn))\n     if (INSN_P (insn))\n@@ -25270,10 +25273,14 @@ uses_TOC (void)\n \t\t  sub = XEXP (sub, 0);\n \t\t  if (GET_CODE (sub) == UNSPEC\n \t\t      && XINT (sub, 1) == UNSPEC_TOC)\n-\t\t    return 1;\n+\t\t    return ret;\n \t\t}\n \t    }\n       }\n+    else if (crtl->has_bb_partition\n+\t     && NOTE_P (insn)\n+\t     && NOTE_KIND (insn) == NOTE_INSN_SWITCH_TEXT_SECTIONS)\n+      ret = 2;\n   return 0;\n }\n #endif\n@@ -33304,14 +33311,20 @@ rs6000_elf_declare_function_name (FILE *\n       return;\n     }\n \n+  int uses_toc;\n   if (DEFAULT_ABI == ABI_V4\n       && (TARGET_RELOCATABLE || flag_pic > 1)\n       && !TARGET_SECURE_PLT\n       && (!constant_pool_empty_p () || crtl->profile)\n-      && uses_TOC ())\n+      && (uses_toc = uses_TOC ()))\n     {\n       char buf[256];\n \n+      if (uses_toc == 2)\n+\t{\n+\t  in_cold_section_p = !in_cold_section_p;\n+\t  switch_to_section (current_function_section ());\n+\t}\n       (*targetm.asm_out.internal_label) (file, \"LCL\", rs6000_pic_labelno);\n \n       fprintf (file, \"\\t.long \");\n@@ -33321,6 +33334,11 @@ rs6000_elf_declare_function_name (FILE *\n       ASM_GENERATE_INTERNAL_LABEL (buf, \"LCF\", rs6000_pic_labelno);\n       assemble_name (file, buf);\n       putc ('\\n', file);\n+      if (uses_toc == 2)\n+\t{\n+\t  in_cold_section_p = !in_cold_section_p;\n+\t  switch_to_section (current_function_section ());\n+\t}\n     }\n \n   ASM_OUTPUT_TYPE_DIRECTIVE (file, name, \"function\");\n--- gcc/testsuite/gcc.dg/pr81979.c.jj\t2017-09-04 16:49:08.839334897 +0200\n+++ gcc/testsuite/gcc.dg/pr81979.c\t2017-09-04 16:48:54.000000000 +0200\n@@ -0,0 +1,32 @@\n+/* PR target/81979 */\n+/* { dg-do link } */\n+/* { dg-options \"-O2 -w\" } */\n+/* { dg-additional-options \"-fPIC\" { target fpic } } */\n+/* { dg-additional-options \"-freorder-blocks-and-partition\" { target freorder } } */\n+\n+int d;\n+\n+__attribute__((noinline, noclone)) void\n+foo (int x)\n+{\n+  int c;\n+  while (c < 1)\n+    {\n+      int o;\n+      for (o = 0; o < 4; ++o)\n+\tc /= (x != 0) ? 2 : x;\n+    }\n+\n+  d = 1;\n+  for (;;)\n+    ;\n+}\n+\n+int\n+main ()\n+{\n+  asm volatile (\"\" : : \"r\" (&d) : \"memory\");\n+  foo (d);\n+  asm volatile (\"\" : : \"r\" (&d) : \"memory\");\n+  return 0;\n+}\n",
    "prefixes": []
}