xrandr: update to 1.5.3
[oi-userland.git] / components / developer / gcc-12 / patches / 0006-allow-the-global-disabling-of-function-cloning.patch
blob3c52f837a6232f7c4c9b2be4379526effbe97392
1 From 41bd15156e4b103ba00aeeea8665a262e341134c Mon Sep 17 00:00:00 2001
2 From: Richard Lowe <richlowe@richlowe.net>
3 Date: Sun, 30 Sep 2012 16:44:14 -0400
4 Subject: allow the global disabling of function cloning
6 Optimizations which clone functions to create call-specific implementations
7 which may be better optimized also dissociate these functions from their
8 symbol names in ways harmful to tracing and debugging (since there are now
9 several implementations of a single source symbol, quite possibly none of them
10 having the actual source symbol name).
12 This allows any function cloning to be disabled, and makes any such
13 optimization ineffective, and our source safe for debuggers everywhere.
14 ---
15 gcc/attribs.cc | 9 +++++++++
16 gcc/common.opt | 5 +++++
17 gcc/doc/invoke.texi | 10 ++++++++++
18 3 files changed, 24 insertions(+)
20 diff --git a/gcc/attribs.cc b/gcc/attribs.cc
21 index b219f878042..9370c903dc2 100644
22 --- a/gcc/attribs.cc
23 +++ b/gcc/attribs.cc
24 @@ -694,6 +694,15 @@ decl_attributes (tree *node, tree attributes, int flags,
25 attributes = tree_cons (get_identifier ("no_icf"), NULL, attributes);
28 + /* If the user passed -fno-clone-functions, all functions should be treated
29 + as "noclone" */
30 + if (TREE_CODE (*node) == FUNCTION_DECL
31 + && !flag_clone_functions)
32 + {
33 + if (lookup_attribute ("noclone", attributes) == NULL)
34 + attributes = tree_cons (get_identifier ("noclone"), NULL, attributes);
35 + }
37 targetm.insert_attributes (*node, &attributes);
39 /* Note that attributes on the same declaration are not necessarily
40 diff --git a/gcc/common.opt b/gcc/common.opt
41 index 314c1c6a478..9dad568d6e6 100644
42 --- a/gcc/common.opt
43 +++ b/gcc/common.opt
44 @@ -1201,6 +1201,11 @@ fcode-hoisting
45 Common Var(flag_code_hoisting) Optimization
46 Enable code hoisting.
48 +fclone-functions
49 +Common Var(flag_clone_functions) Init(1)
50 +Allow the compiler to clone functions to facilitate certain optimizations.
51 +Enabled by default.
53 fcombine-stack-adjustments
54 Common Var(flag_combine_stack_adjustments) Optimization
55 Looks for opportunities to reduce stack adjustments and stack references.
56 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
57 index 348df5caf1d..f003f8ce480 100644
58 --- a/gcc/doc/invoke.texi
59 +++ b/gcc/doc/invoke.texi
60 @@ -509,6 +509,7 @@ Objective-C and Objective-C++ Dialects}.
61 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
62 -fauto-inc-dec -fbranch-probabilities @gol
63 -fcaller-saves @gol
64 +-fclone-functions
65 -fcombine-stack-adjustments -fconserve-stack @gol
66 -fcompare-elim -fcprop-registers -fcrossjumping @gol
67 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
68 @@ -11812,6 +11813,15 @@ and then tries to find ways to combine them.
70 Enabled by default at @option{-O1} and higher.
72 +@item -fno-clone-functions
73 +@opindex fno-clone-functions
74 +Forbid the implicit cloning of functions implicit in certain
75 +optimizations. This also effectively will disable any optimization
76 +which wishes to clone functions, equivalent to each function having
77 +the ``noclone'' attribute. This allows the prevention of the
78 +dissociation of a piece of text from an intelligible and expected
79 +symbol name, which may hamper debugging and tracing.
81 @item -fipa-ra
82 @opindex fipa-ra
83 Use caller save registers for allocation if those registers are not used by