aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-10-05 14:30:10 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-10-05 14:30:10 +0000
commita9cc44581ac57b7138d7dea22fe4acc7c8a9f1ed (patch)
tree92361780d8563222d530a8515e625d920a179b6c /gcc
parentfd7588bcde3fd5a94a4e62b51a394a2a0926701b (diff)
downloadgcc-a9cc44581ac57b7138d7dea22fe4acc7c8a9f1ed.zip
gcc-a9cc44581ac57b7138d7dea22fe4acc7c8a9f1ed.tar.gz
gcc-a9cc44581ac57b7138d7dea22fe4acc7c8a9f1ed.tar.bz2
re PR lto/41281 (toplevel asms do not work)
2009-10-05 Richard Guenther <rguenther@suse.de> PR lto/41281 * lto-cgraph.c (output_cgraph): Output toplevel asms. (input_cgraph_1): Input toplevel asms. * gcc.dg/lto/20090914-2_0.c: New testcase. From-SVN: r152453
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/lto-cgraph.c27
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090914-2_0.c11
4 files changed, 49 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6060ebf..f3efe24 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2009-10-05 Richard Guenther <rguenther@suse.de>
+ PR lto/41281
+ * lto-cgraph.c (output_cgraph): Output toplevel asms.
+ (input_cgraph_1): Input toplevel asms.
+
+2009-10-05 Richard Guenther <rguenther@suse.de>
+
PR lto/40902
* lto-symtab.c (lto_compatible_attributes_p): Remove.
(external_aggregate_decl_p): Likewise.
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 47ccccd..14916473 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -318,6 +318,7 @@ output_cgraph (cgraph_node_set set)
int i, n_nodes;
bitmap written_decls;
lto_cgraph_encoder_t encoder;
+ struct cgraph_asm_node *can;
ob = lto_create_simple_output_block (LTO_section_cgraph);
@@ -375,6 +376,18 @@ output_cgraph (cgraph_node_set set)
lto_output_uleb128_stream (ob->main_stream, 0);
+ /* Emit toplevel asms. */
+ for (can = cgraph_asm_nodes; can; can = can->next)
+ {
+ int len = TREE_STRING_LENGTH (can->asm_str);
+ lto_output_uleb128_stream (ob->main_stream, len);
+ for (i = 0; i < len; ++i)
+ lto_output_1_stream (ob->main_stream,
+ TREE_STRING_POINTER (can->asm_str)[i]);
+ }
+
+ lto_output_uleb128_stream (ob->main_stream, 0);
+
lto_destroy_simple_output_block (ob);
}
@@ -573,6 +586,7 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
VEC(cgraph_node_ptr, heap) *nodes = NULL;
struct cgraph_node *node;
unsigned i;
+ unsigned HOST_WIDE_INT len;
tag = (enum LTO_cgraph_tags) lto_input_uleb128 (ib);
while (tag)
@@ -591,6 +605,19 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
tag = (enum LTO_cgraph_tags) lto_input_uleb128 (ib);
}
+ /* Input toplevel asms. */
+ len = lto_input_uleb128 (ib);
+ while (len)
+ {
+ char *str = (char *)xmalloc (len + 1);
+ for (i = 0; i < len; ++i)
+ str[i] = lto_input_1_unsigned (ib);
+ cgraph_add_asm_node (build_string (len, str));
+ free (str);
+
+ len = lto_input_uleb128 (ib);
+ }
+
for (i = 0; VEC_iterate (cgraph_node_ptr, nodes, i, node); i++)
{
const int ref = (int) (intptr_t) node->global.inlined_to;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c48f680..aa6181d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2009-10-05 Richard Guenther <rguenther@suse.de>
+ PR lto/41281
+ * gcc.dg/lto/20090914-2_0.c: New testcase.
+
+2009-10-05 Richard Guenther <rguenther@suse.de>
+
PR lto/40902
* gcc.dg/lto/20091005-1_0.c: New testcase.
* gcc.dg/lto/20091005-1_1.c: Likewise.
diff --git a/gcc/testsuite/gcc.dg/lto/20090914-2_0.c b/gcc/testsuite/gcc.dg/lto/20090914-2_0.c
new file mode 100644
index 0000000..f78ecf8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090914-2_0.c
@@ -0,0 +1,11 @@
+/* { dg-lto-do run { target x86_64-*-* i?86-*-* } } */
+
+/* Doesn't work without this dummy function with -fwhopr. */
+int foo(void) { }
+
+asm(".text\n"
+ ".globl main\n"
+ "\t.type main,@function\n"
+ "main:\n"
+ "\txorl %eax, %eax\n"
+ "\tret\n");