* [PATCH] Simplify LTO section format.
@ 2019-07-17 10:38 Martin Liška
2019-07-21 20:04 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2019-07-17 10:38 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Biener
[-- Attachment #1: Type: text/plain, Size: 779 bytes --]
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 <mliska@suse.cz>
* 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(-)
[-- Attachment #2: 0001-Simplify-LTO-section-format.patch --]
[-- Type: text/x-patch, Size: 1916 bytes --]
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Simplify LTO section format.
2019-07-17 10:38 [PATCH] Simplify LTO section format Martin Liška
@ 2019-07-21 20:04 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2019-07-21 20:04 UTC (permalink / raw)
To: Martin Liška, gcc-patches; +Cc: Richard Biener
On 7/17/19 4:32 AM, Martin Liška wrote:
> 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 <mliska@suse.cz>
>
> * 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(-)
>
>
OK
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-21 20:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-17 10:38 [PATCH] Simplify LTO section format Martin Liška
2019-07-21 20:04 ` Jeff Law
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).