summaryrefslogtreecommitdiff
path: root/0023-PGO-kernel-Add-fkernel-pgo-option-to-support-PGO-ker.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-02-28 10:03:49 +0000
committerCoprDistGit <infra@openeuler.org>2025-02-28 10:03:49 +0000
commit73127104a245052cd5cf29cdaaca3e5c32c70348 (patch)
tree8e28b63e478c43c252f18b49836dff7313affe54 /0023-PGO-kernel-Add-fkernel-pgo-option-to-support-PGO-ker.patch
parent49d3feaf4665cdb07576fc1a2382a4d82a612d35 (diff)
automatic import of gccopeneuler24.03_LTS_SP1
Diffstat (limited to '0023-PGO-kernel-Add-fkernel-pgo-option-to-support-PGO-ker.patch')
-rw-r--r--0023-PGO-kernel-Add-fkernel-pgo-option-to-support-PGO-ker.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/0023-PGO-kernel-Add-fkernel-pgo-option-to-support-PGO-ker.patch b/0023-PGO-kernel-Add-fkernel-pgo-option-to-support-PGO-ker.patch
new file mode 100644
index 0000000..7577a01
--- /dev/null
+++ b/0023-PGO-kernel-Add-fkernel-pgo-option-to-support-PGO-ker.patch
@@ -0,0 +1,44 @@
+From 9dc6d315ba350c9113f486ec897217a82838fb73 Mon Sep 17 00:00:00 2001
+From: Xiong Zhou <xiongzhou4@huawei.com>
+Date: Mon, 7 Aug 2023 14:44:56 +0800
+Subject: [PATCH 1/2] [PGO kernel] Add fkernel-pgo option to support PGO kernel
+ compilation.
+
+---
+ gcc/common.opt | 4 ++++
+ gcc/tree-profile.cc | 4 +++-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/common.opt b/gcc/common.opt
+index e365a48bc..bd3b7dcb1 100644
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -2363,6 +2363,10 @@ fprofile-generate=
+ Common Joined RejectNegative
+ Enable common options for generating profile info for profile feedback directed optimizations, and set -fprofile-dir=.
+
++fkernel-pgo
++Common Var(flag_kernel_pgo) Optimization Init(0)
++Disable TLS setting of instrumentation variables to support PGO kernel compilation in -fprofile-generate, as kernel does not support TLS.
++
+ fprofile-info-section
+ Common RejectNegative
+ Register the profile information in the .gcov_info section instead of using a constructor/destructor.
+diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc
+index 6d40401f8..e7646f1a1 100644
+--- a/gcc/tree-profile.cc
++++ b/gcc/tree-profile.cc
+@@ -108,7 +108,9 @@ init_ic_make_global_vars (void)
+ DECL_ARTIFICIAL (ic_tuple_var) = 1;
+ DECL_INITIAL (ic_tuple_var) = NULL;
+ DECL_EXTERNAL (ic_tuple_var) = 1;
+- if (targetm.have_tls)
++ /* Disable TLS setting when compiling kernel in -fprofile-generate,
++ as kernel does not support TLS. */
++ if (targetm.have_tls && !flag_kernel_pgo)
+ set_decl_tls_model (ic_tuple_var, decl_default_tls_model (ic_tuple_var));
+ }
+
+--
+2.33.0
+