From: Don Zickus <[email protected]>

There are two parts to this fix.  One is using the recommended way
to disable LTO.  The other is to make it work for the kernel.spec
file.

Various kernel-tool programs (like perf) can not handle LTO yet, so
they are disabled.

This is done with '%define _lto_cflags {nil}'.

However that doesn't quite work for the kernel for the %install
section.  It works for the %build section.

Oddly, back at the birth of dist-git, the initial kernel.spec
file was imported with a line at the top

%global __spec_install_pre %{___build_pre}

For whatever reason, the kernel was deemed special and that line
pre-built the %install scripts _before_ the lto_cflags could
dynamically be disabled.

Moving the _lto_cflags line above the _pre line disables LTO
for both the %build and %install sections of the spec file.

However, because that _pre line is unintiutive and caused hours
of debugging headache, I hacked up the output to see what the
%__spec_install_pre and ___build_pre looked like at the
beginning of the %install section.  The idea was __build_pre
is what we want going forward.

Of the 20 or so env vars defined, the only differences besides
the LTO flags was -fcommon.  This made sense because
_legacy_common_support is also set (enabled -fcommon) after
the _pre line.  Therefore the %install section was correctly
using -fno-common.

In other words having
%global __spec_install_pre %{___build_pre}

is now useless after 10 years.  Let's just get rid of
that and save future headaches and issues and use the
recommended way of disabling LTO.

Cc: Jeff Law <[email protected]>

Signed-off-by: Don Zickus <[email protected]>
---
 redhat/kernel.spec.template | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index 7cbfb9c139eb..439c22be33c9 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -1,5 +1,4 @@
-# We have to override the new %%install behavior because, well... the kernel 
is special.
-%global __spec_install_pre %{___build_pre}
+%global _lto_cflags %{nil}
 
 # Short-term fix so the package builds with GCC 10.
 # This should go away soon.
-- 
GitLab
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]

Reply via email to