From patchwork Wed Jul 17 10:32:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 1133233 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-505195-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="y0CK+8KY"; 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 45pYWK5R8Nz9s3Z for ; Wed, 17 Jul 2019 20:32:56 +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:from :subject:to:cc:message-id:date:mime-version:content-type; q=dns; s=default; b=xRjIaTsjDpK5T5NHqRCwZOI0w6HMS1/am42oijn0Y23MilUo6c LO40/qOWcLOcWPlr40YCaTC5FYncnpJmFFzjA+vUaaCNZVqG2jLmEf9SqyspSKG9 ck74tzSg11K3OapxksMgBfoX7fy1v6toq4sVqmMe10tnkwnJFGcM2PVY0= 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:from :subject:to:cc:message-id:date:mime-version:content-type; s= default; bh=mp7/eofWEdwhVrbh8K627ftOYl4=; b=y0CK+8KYo8Fmp7HJq6v4 LPLvnjOm8etBGeY3SWsciXPDBC0Y6z+8HGKF6zINsLRPuXOXyLmFyDXR4jSKWLI1 JPQ/O00AYmbWOljdithO/okIhEhXzoIMSQUlHsv7J+qSp46R/yYb6Mlw7dy5x+yS oskVusByqViiYzBsIV0vb+w= Received: (qmail 70166 invoked by alias); 17 Jul 2019 10:32:49 -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 70157 invoked by uid 89); 17 Jul 2019 10:32:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Jul 2019 10:32:47 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5B5F9AF05; Wed, 17 Jul 2019 10:32:45 +0000 (UTC) From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] Simplify LTO section format. To: gcc-patches@gcc.gnu.org Cc: Richard Biener Message-ID: Date: Wed, 17 Jul 2019 12:32:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 X-IsSubscribed: yes Hi. The patch is about simplified LTO ELF section header where want to make public fields major_version, minor_version and slim_object. The rest is implementation defined by GCC. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: 2019-07-15 Martin Liska * lto-section-in.c (lto_get_section_data): Use new function get_compression. * lto-streamer-out.c (produce_lto_section): Use set_compression to encode compression algorithm. * lto-streamer.h (struct lto_section): Do not use bitfields in the format. --- gcc/lto-section-in.c | 3 ++- gcc/lto-streamer-out.c | 3 ++- gcc/lto-streamer.h | 19 ++++++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c index 4c2870176ae..0bdcf62b1de 100644 --- a/gcc/lto-section-in.c +++ b/gcc/lto-section-in.c @@ -161,7 +161,8 @@ lto_get_section_data (struct lto_file_decl_data *file_data, stream = lto_start_uncompression (lto_append_data, &buffer); lto_uncompress_block (stream, data, *len); - lto_end_uncompression (stream, file_data->lto_section_header.compression); + lto_end_uncompression (stream, + file_data->lto_section_header.get_compression ()); *len = buffer.length - header_length; data = buffer.data + header_length; diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 35dcae4d589..e0881cf57af 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -2403,7 +2403,8 @@ produce_lto_section () bool slim_object = flag_generate_lto && !flag_fat_lto_objects; lto_section s - = { LTO_major_version, LTO_minor_version, slim_object, compression, 0 }; + = { LTO_major_version, LTO_minor_version, slim_object, 0 }; + s.set_compression (compression); lto_write_data (&s, sizeof s); lto_end_section (); destroy_output_block (ob); diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index 3c35d8a3f9a..bf755a64141 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -394,9 +394,22 @@ struct lto_section { int16_t major_version; int16_t minor_version; - unsigned char slim_object: 1; - lto_compression compression: 4; - int32_t reserved0: 27; + unsigned char slim_object; + + /* Flags is a private field that is not defined publicly. */ + uint16_t flags; + + /* Set compression to FLAGS. */ + inline void set_compression (lto_compression c) + { + flags = c; + } + + /* Get compression from FLAGS. */ + inline lto_compression get_compression () + { + return (lto_compression) flags; + } }; STATIC_ASSERT (sizeof (lto_section) == 8);