Bug 2281043

Summary: Request to add bpf-unknown-none as another cross-gcc target
Product: [Fedora] Fedora Reporter: Elena Zannoni <elena.zannoni>
Component: cross-gccAssignee: David Howells <dhowells>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: dan, dhowells, elena.zannoni, epel-packagers-sig, ezannoni, jose.marchesi, kloczko.tomasz, lkundrak, ngompa13, sam
Target Milestone: ---Keywords: RFE
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: cross-gcc-14.1.1-2.fc42 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-08-29 13:56:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2281056    
Bug Blocks:    

Description Elena Zannoni 2024-05-17 20:44:42 UTC
The gcc bpf port in gcc 14 is in good shape and usable. 
It can build the bpf self tests and pass a large number of these tests.

The project wiki page is here:
https://gcc.gnu.org/wiki/BPFBackEnd

The cross-gcc bpf target (and cross-binutils bpf target) has been added to debian and also gentoo.

Would it be possible to add it to Fedora? No additional gcc patches should be needed, aside from the specfile changes.

Note that this needs cross-binutils 2.42 (I believe, David F. and Jose can correct me) (Will submit a bugzilla for that too).




Reproducible: Always




Something like this patch might be enough (note, untested!):

--- cross-gcc.spec      2024-05-17 14:31:47.699326051 -0600
+++ /home/ezannoni/cross-gcc-orcl/cross-gcc/cross-gcc.spec      2024-05-17 14:16:33.846425873 -0600
@@ -11,6 +11,7 @@
 %global build_arc              %{build_all}
 %global build_avr32            %{build_all}
 %global build_blackfin         %{build_all}
+%global build_bpf              %{build_all}
 %global build_c6x              %{build_all}
 %global build_cris             %{build_all}
 %global build_frv              %{build_all}
@@ -225,6 +233,7 @@
 %do_package arm-linux-gnu      %{build_arm}
 %do_package avr32-linux-gnu    %{build_avr32}
 %do_package bfin-linux-gnu     %{build_blackfin}
+%do_package bpf-unknown-none   %{build_bpf}
 %do_package c6x-linux-gnu      %{build_c6x}
 %do_package cris-linux-gnu     %{build_cris}
 %do_package frv-linux-gnu      %{build_frv}
@@ -318,6 +333,7 @@
     prep_target arm-linux-gnu          %{build_arm}
     prep_target avr32-linux-gnu                %{build_avr32}
     prep_target bfin-linux-gnu         %{build_blackfin}
+    prep_target bpf-unknown-none       %{build_bpf}
     prep_target c6x-linux-gnu          %{build_c6x}
     prep_target cris-linux-gnu         %{build_cris}
     prep_target frv-linux-gnu          %{build_frv}
@@ -739,7 +820,13 @@
        echo '%{_bindir}/'$arch'*-gcc-ar'
        echo '%{_bindir}/'$arch'*-gcc-nm'
        echo '%{_bindir}/'$arch'*-gcc-ranlib'
-       echo '%{_bindir}/'$arch'*-gcov*'
+       case $cpu in
+           bpf*)
+               ;;
+           *)
+               echo '%{_bindir}/'$arch'*-gcov*'
+               ;;
+       esac
        echo '%{_bindir}/'$arch'*-lto-dump'
        echo '%{_mandir}/man1/'$arch'*-cpp*'
        echo '%{_mandir}/man1/'$arch'*-gcc*'
@@ -814,6 +901,7 @@
 %do_files arm-linux-gnu                %{build_arm}
 %do_files avr32-linux-gnu      %{build_avr32}
 %do_files bfin-linux-gnu       %{build_blackfin}
+%do_files bpf-unknown-none     %{build_bpf}
 %do_files c6x-linux-gnu                %{build_c6x}
 %do_files cris-linux-gnu       %{build_cris}
 %do_files frv-linux-gnu                %{build_frv}

Comment 1 Tomasz Kłoczko 2024-06-15 10:29:50 UTC
I'm not 100% sure but theoretically it should be possible to embed bpf code compile into regular gcc package.

Comment 2 Ezannoni 2024-08-16 22:58:06 UTC
I was wondering where this request is at.. and if there is anything that can be done to help.
Having this cross and the companion cross for binutils-bpf would allow to switch back to gcc to build systemd, for instance.

Comment 3 Dan Horák 2024-08-19 08:44:18 UTC
Providing a tested patch would definitely help. Ideally via a PR at https://src.fedoraproject.org/rpms/cross-gcc.

Comment 4 Fedora Update System 2024-08-29 13:41:28 UTC
FEDORA-2024-7083508bc0 (cross-gcc-14.1.1-2.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-7083508bc0

Comment 5 Fedora Update System 2024-08-29 13:56:02 UTC
FEDORA-2024-7083508bc0 (cross-gcc-14.1.1-2.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Sam James 2024-08-31 06:21:26 UTC
I can't edit the field, but fwiw, this was depending on bug 2281056 (now fixed, of course).

It should now be possible to build systemd's bpf support with gcc, not clang, too.