summaryrefslogtreecommitdiff
path: root/gcc/lto-section-out.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-30 12:14:58 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-30 12:14:58 +0000
commit2d97af95e9aa82975d6876f4fc86473e8c2f1bb5 (patch)
tree17ed7ba165f1d2672b9045df3792853564446f62 /gcc/lto-section-out.c
parent5bfeb3fa5d6ab6eaf2c99e4453f31fe1fa0c43eb (diff)
downloadgcc-2d97af95e9aa82975d6876f4fc86473e8c2f1bb5.tar.gz
2014-07-30 Richard Biener <rguenther@suse.de>
* lto-streamer.h (lto_write_data): New function. * langhooks.c (lhd_append_data): Do not free block. * lto-section-out.c (lto_write_data): New function writing raw data to the current section. (lto_write_stream): Adjust for langhook semantic change. (lto_destroy_simple_output_block): Write header directly. * lto-opts.c (lto_write_options): Write options directly. * lto-streamer-out.c (produce_asm): Write heaeder directly. (lto_output_toplevel_asms): Likewise. (copy_function_or_variable): Copy data directly. (write_global_references): Output index table directly. (lto_output_decl_state_refs): Likewise. (write_symbol): Write data directly. (produce_symtab): Adjust. (produce_asm_for_decls): Output header and refs directly. lto/ * lto-object.c (lto_obj_append_data): Do not free block. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213253 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-section-out.c')
-rw-r--r--gcc/lto-section-out.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c
index 00b18016a83..2494191f288 100644
--- a/gcc/lto-section-out.c
+++ b/gcc/lto-section-out.c
@@ -98,6 +98,16 @@ lto_end_section (void)
lang_hooks.lto.end_section ();
}
+/* Write SIZE bytes starting at DATA to the assembler. */
+
+void
+lto_write_data (const void *data, unsigned int size)
+{
+ if (compression_stream)
+ lto_compress_block (compression_stream, (const char *)data, size);
+ else
+ lang_hooks.lto.append_data ((const char *)data, size, NULL);
+}
/* Write all of the chars in OBS to the assembler. Recycle the blocks
in obs as this is being done. */
@@ -128,12 +138,10 @@ lto_write_stream (struct lto_output_stream *obs)
blocks up output differently to the way it's blocked here. So for
now, we don't compress WPA output. */
if (compression_stream)
- {
- lto_compress_block (compression_stream, base, num_chars);
- lang_hooks.lto.append_data (NULL, 0, block);
- }
+ lto_compress_block (compression_stream, base, num_chars);
else
lang_hooks.lto.append_data (base, num_chars, block);
+ free (block);
block_size *= 2;
}
}
@@ -335,7 +343,6 @@ lto_destroy_simple_output_block (struct lto_simple_output_block *ob)
{
char *section_name;
struct lto_simple_header header;
- struct lto_output_stream *header_stream;
section_name = lto_get_section_name (ob->section_type, NULL, NULL);
lto_begin_section (section_name, !flag_wpa);
@@ -346,15 +353,9 @@ lto_destroy_simple_output_block (struct lto_simple_output_block *ob)
memset (&header, 0, sizeof (struct lto_simple_header));
header.lto_header.major_version = LTO_major_version;
header.lto_header.minor_version = LTO_minor_version;
-
header.compressed_size = 0;
-
header.main_size = ob->main_stream->total_size;
-
- header_stream = XCNEW (struct lto_output_stream);
- lto_output_data_stream (header_stream, &header, sizeof header);
- lto_write_stream (header_stream);
- free (header_stream);
+ lto_write_data (&header, sizeof header);
lto_write_stream (ob->main_stream);