From patchwork Sun Jul 23 17:07:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 792575 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-458727-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="AkDePX5B"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xFrYD398mz9s7g for ; Mon, 24 Jul 2017 03:07:58 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=TX9fR ZtLX1TK9REv+8N3SH0EV6aYCcKDUL/8YQOdbpKP6Axq7qy+YAORuDoD5P/3BF06K ND5do0P6jwI5iULI4UUHz6MDkPOhrQc4dQzIzzqjGIcedRIySlNKXnLX+l5ejroz 32Cb/WDXgvew8qm2TYZGtlvfGHSalLXUzwrnNs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=taUbGww/cXj sKUp7/gR9yt0ghl8=; b=AkDePX5BvlWg0q6ZTd2/j59FOvpLfgz6RqupbTMgN7C wdnBjddrP8WpAKCo4Bmt/z0NNdVS2QG9ETDz7HgIRAocG8fim9TbIbABdY0MqfEV U2RSd0/N5Kc7vz5qg5gFqasA+pIQJbNjK6rUYK9B+/8MPgXvcvB1nyMZXIWB9JEY = Received: (qmail 99135 invoked by alias); 23 Jul 2017 17:07:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 93281 invoked by uid 89); 23 Jul 2017 17:07:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=ttc, courtesy X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Jul 2017 17:07:43 +0000 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6NH4W32012494 for ; Sun, 23 Jul 2017 13:07:41 -0400 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bv38dg1yc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sun, 23 Jul 2017 13:07:41 -0400 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 23 Jul 2017 13:07:40 -0400 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 23 Jul 2017 13:07:38 -0400 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6NH7bLQ17891464; Sun, 23 Jul 2017 17:07:37 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B63C2124037; Sun, 23 Jul 2017 13:05:03 -0400 (EDT) Received: from bigmac.rchland.ibm.com (unknown [9.10.86.172]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP id 85F9212403D; Sun, 23 Jul 2017 13:05:03 -0400 (EDT) To: GCC Patches Cc: Segher Boessenkool , amodra@gmail.com From: Bill Schmidt Subject: [PATCH, rs6000, 5/6] Backport patch to align .toc section Date: Sun, 23 Jul 2017 12:07:37 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17072317-0048-0000-0000-000001C876AC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007412; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00891801; UDB=6.00445678; IPR=6.00671965; BA=6.00005484; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016340; XFM=3.00000015; UTC=2017-07-23 17:07:38 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17072317-0049-0000-0000-000041FC3728 Message-Id: <14b717ac-c548-321d-e627-568f12730f02@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-23_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707230269 X-IsSubscribed: yes Hi, Alan added code to have GCC align the .toc section in GCC 7, aligning to four bytes for 32-bit mode, and 8 bytes for 64-bit mode. This is normally unnecessary since alignment of the .toc has historically been handled by the standard linker script. However, people using non-standard toolchains can still run into problems, so as a courtesy this is now done by the compiler as well. We've recently seen this encountered using an out-of-service compiler, and would like to prevent any more occurrences by people finding interesting ways to avoid the standard toolchain. Thus I'd like to backport Alan's patch to GCC 5 and 6. Alan, please review as well to be sure I didn't miss any release-specific differences. Bootstrapped and tested on powerpc64le-linux-gnu with no regressions. Are these backports ok? Thanks, Bill 2017-07-23 Bill Schmidt Backport from mainline r235874 2016-05-04 Alan Modra * config/rs6000/rs6000.c (rs6000_elf_output_toc_section_asm_op): Align .toc. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 250426) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -32699,8 +32699,8 @@ rs6000_elf_output_toc_section_asm_op (const void * { if (!toc_initialized) { - toc_initialized = 1; fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); + ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2); (*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0); fprintf (asm_out_file, "\t.tc "); ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); @@ -32708,8 +32708,10 @@ rs6000_elf_output_toc_section_asm_op (const void * fprintf (asm_out_file, "\n"); fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); + ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2); ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); fprintf (asm_out_file, " = .+32768\n"); + toc_initialized = 1; } else fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); @@ -32716,12 +32718,20 @@ rs6000_elf_output_toc_section_asm_op (const void * } else if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && !TARGET_RELOCATABLE) - fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); + { + fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); + if (!toc_initialized) + { + ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2); + toc_initialized = 1; + } + } else { fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); if (!toc_initialized) { + ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2); ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); fprintf (asm_out_file, " = .+32768\n"); toc_initialized = 1;