libsoup3: update to 3.6.0; fix GTK2/3 app startup
[oi-userland.git] / components / developer / gcc-13 / patches / 0006-allow-the-global-disabling-of-function-cloning.patch
blobc573ae17d0070f2850bec1487081b949572cb32f
1 From b76e65d545bbf9c3c83e06ccecbe75f34a5ae07a 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 b1300018d1e8..6f17d96a8327 100644
22 --- a/gcc/attribs.cc
23 +++ b/gcc/attribs.cc
24 @@ -695,6 +695,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 73560e307c7a..d5460f4727c2 100644
42 --- a/gcc/common.opt
43 +++ b/gcc/common.opt
44 @@ -1216,6 +1216,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 8bd0a8357d12..cadce96a0f5b 100644
58 --- a/gcc/doc/invoke.texi
59 +++ b/gcc/doc/invoke.texi
60 @@ -535,6 +535,7 @@ Objective-C and Objective-C++ Dialects}.
61 -fassociative-math -fauto-profile -fauto-profile[=@var{path}]
62 -fauto-inc-dec -fbranch-probabilities
63 -fcaller-saves
64 +-fclone-functions
65 -fcombine-stack-adjustments -fconserve-stack
66 -fcompare-elim -fcprop-registers -fcrossjumping
67 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules
68 @@ -12777,6 +12778,15 @@ and then tries to find ways to combine them.
70 Enabled by default at @option{-O1} and higher.
72 +@opindex fno-clone-functions
73 +@item -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 @opindex fipa-ra
82 @item -fipa-ra
83 Use caller save registers for allocation if those registers are not used by