Gentoo Archives: gentoo-dev

From: mpagano@g.o
To: gentoo-dev@l.g.o
Cc: Mike Pagano <mpagano@g.o>
Subject: [gentoo-dev] [PATCH] Transitional changes to the kernel-2 eclass to support future CPU OPT
Date: Thu, 29 Apr 2021 11:45:00
Message-Id: 20210429114448.599461-1-mpagano@gentoo.org
1 From: Mike Pagano <mpagano@g.o>
2
3 The CPU OPT patch now contains gcc ver checks within
4 the patch itself. This transitional change is to start supporting
5 just that patch while trying not to break the older versions.
6
7 The target state eclass code will *only* need the three line
8 gcc version check. We should be able to slowly remove the
9 legacy code as we stabilize kernels and remove old ones from the tree.
10
11 This will put cpu opt patch support in a much more maintainable state.
12
13 ---
14 eclass/kernel-2.eclass | 29 +++++++++++++++++++++++++++--
15 1 file changed, 27 insertions(+), 2 deletions(-)
16
17 diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
18 index 67ad4acc1..f676e8421 100644
19 --- a/eclass/kernel-2.eclass
20 +++ b/eclass/kernel-2.eclass
21 @@ -1241,8 +1241,32 @@ unipatch() {
22 local GCC_MAJOR_VER=$(gcc-major-version)
23 local GCC_MINOR_VER=$(gcc-minor-version)
24
25 - # optimization patch for gcc < 8.X and kernel > 4.13
26 - if kernel_is ge 4 13 ; then
27 + # this section should be the target state to handle the cpu opt
28 + # patch for kernels > 4.19.189, 5.4.115, 5.10.33 and 5.11.17,
29 + # 5.12.0 and gcc >= 9 The patch now handles the
30 + # gcc version enabled on the system through the Kconfig file as
31 + # 'depends'. The legacy section can hopefully be retired in the future
32 + # Note the patch for 4.19-5.8 version are the same and the patch for
33 + # 5.8+ version is the same
34 + # eventually we can remove everything except the gcc ver <9 check
35 + # based on stablization, time, kernel removals or a combo of all three
36 + if ((kernel_is eq 4 19 && kernel_is gt 4 19 189) ||
37 + (kernel_is eq 5 4 && kernel_is gt 5 4 115) ||
38 + (kernel_is eq 5 10 && kernel_is gt 5 10 33) ||
39 + (kernel_is eq 5 11 && kernel_is gt 5 11 17) ||
40 + (kernel_is eq 5 12 && kernel_is gt 5 12 0)); then
41 + UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
42 + UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
43 + UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
44 + UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
45 + UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
46 + if [[ ${GCC_MAJOR_VER} -lt 9 ]]; then
47 + UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
48 + fi
49 + # this legacy section should be targeted for removal
50 + # optimization patch for gcc < 8.X and kernel > 4.13 and < 4.19
51 + elif kernel_is ge 4 13; then
52 + UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
53 if [[ ${GCC_MAJOR_VER} -lt 8 ]] && [[ ${GCC_MAJOR_VER} -gt 4 ]]; then
54 UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
55 UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
56 @@ -1272,6 +1296,7 @@ unipatch() {
57 UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
58 fi
59 else
60 + UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
61 UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
62 UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
63 UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
64 --
65 2.26.3

Replies