From: Jan Stancek <jstan...@redhat.com>

redhat/kernel.spec: use target versions of tools for debugedit and gdb-add-index

debugedit-5.1-5.fc42 adds support to override tools with target versions:
  find-debuginfo relies on a couple of binutils tools (readelf, objcopy
  and nm) that might not have been build with cross-arch support. Make
  it possible to configure with specific (target) versions and to
  override the specific binaries by setting READELF, OBJCOPY or NM
  environment variables.

which means we can now have find-debuginfo working also for cross builds
when we give it correct version of nm, readelf and objcopy.

Signed-off-by: Jan Stancek <jstan...@redhat.com>

diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -3276,12 +3276,24 @@ find Documentation -type d | xargs chmod u+w
   rm -rf $RPM_BUILD_ROOT/usr/lib/debug/usr/src; \
 %{nil}
 
+# Make debugedit and gdb-add-index use target versions of tools
+# when cross-compiling. This is supported since debugedit-5.1-5.fc42
+# 
https://inbox.sourceware.org/debugedit/20250220153858.963312-1-m...@klomp.org/
+%if %{with_cross}
+%define __override_target_tools_for_debugedit \
+       export OBJCOPY=%{_build_arch}-linux-gnu-objcopy \
+       export NM=%{_build_arch}-linux-gnu-nm \
+       export READELF=%{_build_arch}-linux-gnu-readelf \
+%{nil}
+%endif
+
 #
 # Disgusting hack alert! We need to ensure we sign modules *after* all
 # invocations of strip occur, which is in __debug_install_post if
 # find-debuginfo.sh runs, and __os_install_post if not.
 #
 %define __spec_install_post \
+  
%{?__override_target_tools_for_debugedit:%{__override_target_tools_for_debugedit}}\
   %{?__debug_package:%{__debug_install_post}}\
   %{__arch_install_post}\
   %{__os_install_post}\

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/3714

-- 
_______________________________________________
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
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/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to