+2017-06-9 Ian Lance Taylor <iant@golang.org>
+
+ * opts.c (finish_options): If -fsplit-stack, disable implicit
+ -forder-blocks-and-partition.
+ * doc/invoke.texi (Optimize Options): Document that when using
+ -fsplit-stack -forder-blocks-and-partition is not implicitly
+ enabled.
+
2017-06-09 Jan Hubicka <hubicka@ucw.cz>
* builtin-attrs.def (ATTR_NORETURN_NOTHROW_LEAF_COLD_LIST,
This optimization is automatically turned off in the presence of
exception handling, for linkonce sections, for functions with a user-defined
section attribute and on any architecture that does not support named
-sections.
+sections. When @option{-fsplit-stack} is used this option is not
+enabled by default (to avoid linker errors), but may be enabled
+explicitly (if using a working linker).
Enabled for x86 at levels @option{-O2}, @option{-O3}.
+2017-06-09 Ian Lance Taylor <iant@golang.org>
+
+ * go-lang.c (go_langhook_post_options): If -fsplit-stack is turned
+ on, disable implicit -forder-blocks-and-partition.
+
2017-05-12 Than McIntosh <thanm@google.com>
* go-gcc.cc (Gcc_backend::call_expression): Add caller parameter.
&& targetm_common.supports_split_stack (false, &global_options))
global_options.x_flag_split_stack = 1;
+ /* If stack splitting is turned on, and the user did not explicitly
+ request function partitioning, turn off partitioning, as it
+ confuses the linker when trying to handle partitioned split-stack
+ code that calls a non-split-stack function. */
+ if (global_options.x_flag_split_stack
+ && global_options.x_flag_reorder_blocks_and_partition
+ && !global_options_set.x_flag_reorder_blocks_and_partition)
+ global_options.x_flag_reorder_blocks_and_partition = 0;
+
/* Returning false means that the backend should be used. */
return false;
}
opts->x_flag_reorder_blocks = 1;
}
+ /* If stack splitting is turned on, and the user did not explicitly
+ request function partitioning, turn off partitioning, as it
+ confuses the linker when trying to handle partitioned split-stack
+ code that calls a non-split-stack functions. But if partitioning
+ was turned on explicitly just hope for the best. */
+ if (opts->x_flag_split_stack
+ && opts->x_flag_reorder_blocks_and_partition
+ && !opts_set->x_flag_reorder_blocks_and_partition)
+ opts->x_flag_reorder_blocks_and_partition = 0;
+
if (opts->x_flag_reorder_blocks_and_partition
&& !opts_set->x_flag_reorder_functions)
opts->x_flag_reorder_functions = 1;
+2017-06-09 Ian Lance Taylor <iant@golang.org>
+
+ * gcc.dg/tree-prof/split-1.c: New test.
+
2017-06-09 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/predict-14.c: Avoid cold function detection.
--- /dev/null
+/* Test case that we don't get a link-time error when using
+ -fsplit-stack with -freorder-blocks-and-partition. */
+/* { dg-require-effective-target freorder } */
+/* { dg-options "-O2 -fsplit-stack" } */
+
+extern unsigned int sleep (unsigned int);
+
+#define SIZE 10000
+
+const char *sarr[SIZE];
+const char *buf_hot;
+const char *buf_cold;
+
+__attribute__((noinline))
+void
+foo (int path)
+{
+ int i;
+ if (path)
+ {
+ for (i = 0; i < SIZE; i++)
+ sarr[i] = buf_hot;
+ }
+ else
+ {
+ for (i = 0; i < SIZE; i++)
+ sarr[i] = buf_cold;
+ sleep (0);
+ }
+}
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+ buf_hot = "hello";
+ buf_cold = "world";
+ for (i = 0; i < 1000000; i++)
+ foo (argc);
+ return 0;
+}