From patchwork Wed May 4 05:07:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 618247 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3r05fQ01Mdz9sp7 for ; Wed, 4 May 2016 15:08:29 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Dd+1e/LP; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=B6jMI+0hOC2P3TxzioyvB3ykMCO0S81/VSIBYu+YjElWN6cjHX F3J9X7sMs1HwBZAZbug3+dhPZilvGCyB5Zljl2YA7S1T1gQvv9DBvxhTeW9scSPP ieDXcOlL42W4R/auvAYtptzQzPpi24whwiGPWFUzoP8bHFvVGQhOVpMgU= 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:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=tvAQ+pc6F5s0YdeDVwcrdIIU1h0=; b=Dd+1e/LPfxZD1Xecf6II q6FyScECz/L24JP4ov56JZeVQvmtEevSXUOrFWxmtkYBBqfy9kROezFGjGdGKnwG DuHrn7HSGYCK3mCF1VCpQLiBJufc7kViJu44VY1bJevilQeibLIqBLJ3SOuQm5x1 wzxCTI7lMJ5TBJ5sK6rf7/0= Received: (qmail 91651 invoked by alias); 4 May 2016 05:08:16 -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 91594 invoked by uid 89); 4 May 2016 05:08:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_05, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:toc_in, sk:asm_out, ABI_AIX, sk:TOC_SEC X-HELO: mail-pa0-f45.google.com Received: from mail-pa0-f45.google.com (HELO mail-pa0-f45.google.com) (209.85.220.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 04 May 2016 05:08:05 +0000 Received: by mail-pa0-f45.google.com with SMTP id r5so20150914pag.1 for ; Tue, 03 May 2016 22:08:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=VMdscjJZHmujstz3vkenekZsOs8SqmJfEtv96HjtO/0=; b=GRb3WL+shXkeG+0K36hNFSwU1E7iUPOJVVV05SauP00xayS32a5MiTZuTXIYvAJo+a PbACKAWTGHdwfVCadGbBlSajC0vKbN1tgMAYsU3ClWffV4PFzTmiTVdPQbBu7hc4PZOc S6wwaRzwonNtebvPFmmIbvmxXh/PKpFPWZPYdT2lGHf3aL9DvGDcLzz0WkuFeN6zWErT 92VSeke+GTdTQ3MWQvzaglb/+0m5srxQnPX/7cOtDkwMcoL8sL5geEWMWdRPt5zaNkjJ Hlncx5Z/rUwdc5Ba48wrqW08vagNHhoCk+klb1iKKdWIbpoozHubshd4IWo13lQ261Mm 4lxg== X-Gm-Message-State: AOPr4FWu3mp+D2NrDX8grXM6gCQakGlxP/cE7S595Tamzm/mO8bkkZlVI05NVSnY77Fqxw== X-Received: by 10.66.189.135 with SMTP id gi7mr9352392pac.158.1462338483671; Tue, 03 May 2016 22:08:03 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-146-233.sa.bigpond.net.au. [58.160.146.233]) by smtp.gmail.com with ESMTPSA id dr4sm2181227pac.11.2016.05.03.22.08.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 May 2016 22:08:03 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 3A0EEEA0153; Wed, 4 May 2016 14:37:59 +0930 (ACST) Date: Wed, 4 May 2016 14:37:59 +0930 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: Segher Boessenkool , David Edelsohn Subject: [RS6000] Align .toc section Message-ID: <20160504050759.GU18915@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Lack of any .toc section alignment causes kexec and kdump failure when linking without the usual linker script. This of course is really a kexec-tools error, now fixed, but it is also true that .toc ought to always be word aligned. Bootstrapped and regression tested powerpc64le-linux and powerpc64-linux. OK to apply? * config/rs6000/rs6000.c (rs6000_elf_output_toc_section_asm_op): Align .toc. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index a88cb19..fb522fb 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -31339,8 +31339,8 @@ rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED) { 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],"); @@ -31348,20 +31348,30 @@ rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED) 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); } 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;