1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
From 30f4861499309bd81f1d59b41b1091fef0152680 Mon Sep 17 00:00:00 2001
From: Richard Lowe <richlowe@richlowe.net>
Date: Sun, 30 Sep 2012 16:44:14 -0400
Subject: [PATCH] allow the global disabling of function cloning
Optimizations which clone functions to create call-specific implementations
which may be better optimized also dissociate these functions from their
symbol names in ways harmful to tracing and debugging (since there are now
several implementations of a single source symbol, quite possibly none of them
having the actual source symbol name).
This allows any function cloning to be disabled, and makes any such
optimization ineffective, and our source safe for debuggers everywhere.
See http://wiki.illumos.org/display/illumos/GCC+Modifications
---
gcc/common.opt | 5 +++++
gcc/doc/invoke.texi | 11 ++++++++++-
gcc/tree-inline.c | 3 ++-
3 files changed, 17 insertions(+), 2 deletions(-)
Index: gcc-47/src/gcc/common.opt
===================================================================
--- gcc-47.orig/src/gcc/common.opt 2013-05-20 00:23:15.808770926 +0400
+++ gcc-47/src/gcc/common.opt 2013-05-20 00:23:56.300085656 +0400
@@ -895,6 +895,11 @@
Common Report Var(flag_check_data_deps)
Compare the results of several data dependence analyzers.
+fclone-functions
+Common Report Var(flag_clone_functions) Init(1)
+Allow the compiler to clone functions to facilitate certain optimizations.
+Enabled by default.
+
fcombine-stack-adjustments
Common Report Var(flag_combine_stack_adjustments) Optimization
Looks for opportunities to reduce stack adjustments and stack references.
Index: gcc-47/src/gcc/doc/invoke.texi
===================================================================
--- gcc-47.orig/src/gcc/doc/invoke.texi 2013-05-20 00:23:16.044530059 +0400
+++ gcc-47/src/gcc/doc/invoke.texi 2013-05-20 00:23:56.299879610 +0400
@@ -352,7 +352,7 @@
-falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol
-fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol
-fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol
--fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
+-fcheck-data-deps -fclone-functions -fcombine-stack-adjustments -fconserve-stack @gol
-fcompare-elim -fcprop-registers -fcrossjumping @gol
-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
-fcx-limited-range @gol
@@ -8030,6 +8030,15 @@
change in future releases when linker plugin enabled environments become more
common.
+@item -fno-clone-functions
+@opindex fno-clone-functions
+Forbid the implicit cloning of functions implicit in certain
+optimizations. This also effectively will disable any optimization
+which wishes to clone functions, equivalent to each function having
+the ``noclone'' attribute. This allows the prevention of the
+dissociation of a piece of text from an intelligible and expected
+symbol name, which may hamper debugging and tracing.
+
@item -fcompare-elim
@opindex fcompare-elim
After register allocation and post-register allocation instruction splitting,
Index: gcc-47/src/gcc/tree-inline.c
===================================================================
--- gcc-47.orig/src/gcc/tree-inline.c 2013-04-02 16:25:00.000000000 +0400
+++ gcc-47/src/gcc/tree-inline.c 2013-05-20 00:23:20.356097199 +0400
@@ -4953,7 +4953,8 @@
tree_versionable_function_p (tree fndecl)
{
return (!lookup_attribute ("noclone", DECL_ATTRIBUTES (fndecl))
- && copy_forbidden (DECL_STRUCT_FUNCTION (fndecl), fndecl) == NULL);
+ && (copy_forbidden (DECL_STRUCT_FUNCTION (fndecl), fndecl) == NULL)
+ && flag_clone_functions);
}
/* Delete all unreachable basic blocks and update callgraph.
|