diff --git a/0093-PGO-kernel-Add-PGO-kernel-support.patch b/0093-PGO-kernel-Add-PGO-kernel-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..92e30aed9e116787acd84e9c1036227383c361d7 --- /dev/null +++ b/0093-PGO-kernel-Add-PGO-kernel-support.patch @@ -0,0 +1,46 @@ +From 90d3ef0637c66045eeab78ccf04e9ff51b9b451a Mon Sep 17 00:00:00 2001 +From: xiongzhou4 +Date: Thu, 1 Jun 2023 09:28:27 +0800 +Subject: [PATCH] [PGO kernel] Add fkernel-pgo option to support PGO kernel + compilation. + +If specified, disable TLS setting of instrumentation variables in +gcc/tree-profile.c, as kernel does not support TLS. +--- + gcc/common.opt | 4 ++++ + gcc/tree-profile.c | 4 +++- + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/gcc/common.opt b/gcc/common.opt +index 238c97db8..6f0ed7cea 100644 +--- a/gcc/common.opt ++++ b/gcc/common.opt +@@ -2302,6 +2302,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 Report 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-partial-training + Common Report Var(flag_profile_partial_training) Optimization + Do not assume that functions never executed during the train run are cold. +diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c +index 6c0838261..924817472 100644 +--- a/gcc/tree-profile.c ++++ b/gcc/tree-profile.c +@@ -105,7 +105,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 + diff --git a/gcc.spec b/gcc.spec index 6c341cea7c7835aefa12c74c54b6b0cb5ca69de2..5028b1139a7e8353c5326cdd470cf1a14ed17a93 100644 --- a/gcc.spec +++ b/gcc.spec @@ -61,7 +61,7 @@ Summary: Various compilers (C, C++, Objective-C, ...) Name: gcc Version: %{gcc_version} -Release: 28 +Release: 29 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD URL: https://gcc.gnu.org @@ -201,6 +201,7 @@ Patch89: 0089-Backport-libsanitizer-cherry-pick-9cf13067cb5088626b.patch Patch90: 0090-State-sysroot-option-as-validated-once-processed.patch Patch91: 0091-bogus-Wstringop-overflow-with-VLA-of-elements-larger.patch Patch92: 0092-phiopt2-Add-option-to-control-the-simplify.patch +Patch93: 0093-PGO-kernel-Add-PGO-kernel-support.patch %global gcc_target_platform %{_arch}-linux-gnu @@ -747,6 +748,7 @@ not stable, so plugins must be rebuilt any time GCC is updated. %patch90 -p1 %patch91 -p1 %patch92 -p1 +%patch93 -p1 %build @@ -2771,6 +2773,13 @@ end %doc rpm.doc/changelogs/libcc1/ChangeLog* %changelog +* Fri Jun 2 2023 Xiong Zhou - 10.3.1-29 +- Type:Sync +- ID:NA +- SUG:NA +- DESC:Sync patch from openeuler/gcc + Add PGO kernel support. + * Mon May 22 2023 huangxiaoquan - 10.3.1-28 - Type:Sync - ID:NA