@@ -815,13 +815,16 @@ BuildRequires: binutils-%{_build_arch}-linux-gnu, gcc-%{_build_arch}-linux-gnu
815815%define cross_opts CROSS_COMPILE=%{_build_arch}-linux-gnu-
816816%define __strip %{_build_arch}-linux-gnu-strip
817817
818+ %if 0%{?fedora} && 0%{?fedora} <= 41
818819# Work around find-debuginfo for cross builds.
819820# find-debuginfo doesn't support any of CROSS options (RHEL-21797),
820821# and since debugedit > 5.0-16.el10, or since commit
821822# dfe1f7ff30f4 ("find-debuginfo.sh: Exit with real exit status in parallel jobs")
822- # it now aborts and build fails.
823+ # it now aborts on failure and build fails.
824+ # debugedit-5.1-5 in F42 added support to override tools with target versions.
823825%undefine _include_gdb_index
824826%endif
827+ %endif
825828
826829# These below are required to build man pages
827830%if %{with_perf}
@@ -3290,12 +3293,24 @@ find Documentation -type d | xargs chmod u+w
32903293 rm -rf $RPM_BUILD_ROOT/usr/lib/debug/usr/src; \
32913294%{nil}
32923295
3296+ # Make debugedit and gdb-add-index use target versions of tools
3297+ # when cross-compiling. This is supported since debugedit-5.1-5.fc42
3298+ # https://inbox.sourceware.org/debugedit/20250220153858.963312-1-mark@klomp.org/
3299+ %if %{with_cross}
3300+ %define __override_target_tools_for_debugedit \
3301+ export OBJCOPY=%{_build_arch}-linux-gnu-objcopy \
3302+ export NM=%{_build_arch}-linux-gnu-nm \
3303+ export READELF=%{_build_arch}-linux-gnu-readelf \
3304+ %{nil}
3305+ %endif
3306+
32933307#
32943308# Disgusting hack alert! We need to ensure we sign modules *after* all
32953309# invocations of strip occur, which is in __debug_install_post if
32963310# find-debuginfo.sh runs, and __os_install_post if not.
32973311#
32983312%define __spec_install_post \
3313+ %{?__override_target_tools_for_debugedit:%{__override_target_tools_for_debugedit}}\
32993314 %{?__debug_package:%{__debug_install_post}}\
33003315 %{__arch_install_post}\
33013316 %{__os_install_post}\
0 commit comments