RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1990029 - Enable LTO build of libbpf for RHEL 9
Summary: Enable LTO build of libbpf for RHEL 9
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libbpf
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: beta
: ---
Assignee: Viktor Malik
QA Contact: Zhiqian Guan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-08-04 15:22 UTC by Marek Polacek
Modified: 2022-11-15 13:17 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-15 11:21:16 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-92348 0 None None None 2021-08-04 15:24:43 UTC
Red Hat Product Errata RHBA-2022:8364 0 None None None 2022-11-15 11:21:18 UTC

Comment 3 Viktor Malik 2022-06-24 10:44:19 UTC
Build is ready:

https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=2063365

Currently running gating, there may be some problems but it should be ready for testing.

Comment 9 Zhiqian Guan 2022-07-14 07:37:10 UTC
[root@netqe2 xdp-tools]# ./configure
Found clang binary 'clang' with version 14 (from 'clang version 14.0.5 (Red Hat 14.0.5-1.el9)')
using emacs: GNU Emacs 27.2
libbpf support: system v0.6.0
  perf_buffer__consume support: yes
  btf__load_from_kernel_by_id support: yes
  btf__type_cnt support: yes
  bpf_object__next_map support: yes
  bpf_object__next_program support: yes
  bpf_program__insn_cnt support: yes
  bpf_map_create support: no
  perf_buffer__new_raw support: no
secure_getenv support: yes
[root@netqe2 xdp-tools]#
[root@netqe2 xdp-tools]# make

lib

  libxdp
    CC       staticobjs/libxdp.o
    CC       staticobjs/xsk.o
    CLANG    xdp-dispatcher.o
    LLC      xdp-dispatcher.o
    GEN      xdp-dispatcher.embed.o
    CLANG    xsk_def_xdp_prog.o
    LLC      xsk_def_xdp_prog.o
    GEN      xsk_def_xdp_prog.embed.o
    CLANG    xsk_def_xdp_prog_5.3.o
    LLC      xsk_def_xdp_prog_5.3.o
    GEN      xsk_def_xdp_prog_5.3.embed.o
    LINK     libxdp.a
    CC       sharedobjs/libxdp.o
    CC       sharedobjs/xsk.o
    LINK     libxdp.so.1.2.0
    GEN      libxdp.3

  util
    CC       params.o
    CC       logging.o
    CC       util.o
    CC       stats.o
    CC       xpcapng.o

  testing
    CLANG    test_long_func_name.o
    LLC      test_long_func_name.o
    CLANG    xdp_drop.o
    LLC      xdp_drop.o
    CLANG    xdp_pass.o
    LLC      xdp_pass.o

xdp-filter
    CLANG    xdpfilt_dny_udp.o
    LLC      xdpfilt_dny_udp.o
    CLANG    xdpfilt_dny_tcp.o
    LLC      xdpfilt_dny_tcp.o
    CLANG    xdpfilt_dny_ip.o
    LLC      xdpfilt_dny_ip.o
    CLANG    xdpfilt_dny_eth.o
    LLC      xdpfilt_dny_eth.o
    CLANG    xdpfilt_dny_all.o
    LLC      xdpfilt_dny_all.o
    CLANG    xdpfilt_alw_udp.o
    LLC      xdpfilt_alw_udp.o
    CLANG    xdpfilt_alw_tcp.o
    LLC      xdpfilt_alw_tcp.o
    CLANG    xdpfilt_alw_ip.o
    LLC      xdpfilt_alw_ip.o
    CLANG    xdpfilt_alw_eth.o
    LLC      xdpfilt_alw_eth.o
    CLANG    xdpfilt_alw_all.o
    LLC      xdpfilt_alw_all.o
    CC       xdp-filter
    GEN      xdp-filter.8

xdp-loader
    CC       xdp-loader
    GEN      xdp-loader.8

xdp-dump
    CC       xdpdump
    CLANG    xdpdump_bpf.o
    LLC      xdpdump_bpf.o
    CLANG    xdpdump_xdp.o
    LLC      xdpdump_xdp.o
    GEN      xdpdump.8
[root@netqe2 xdp-tools]# uname -r
5.14.0-127.el9.x86_64
[root@netqe2 xdp-tools]# rpm -q libbpf
libbpf-0.6.0-1.el9.x86_64
[root@netqe2 xdp-tools]#

Comment 10 Zhiqian Guan 2022-07-14 07:46:04 UTC
Hi Viktor, 
I couldn't see the .gnu.lto_.* section in the ELF of libbpf, Not sure if I did it right, please kindly advise :)

[root@netqe2 ~]# find / -name "*libbpf*"
/usr/lib64/libbpf.so.0
/usr/lib64/libbpf.so.0.6.0
[root@netqe2 ~]# readelf -S /usr/lib64/libbpf.so.0 | grep lto
[root@netqe2 ~]# readelf -S /usr/lib64/libbpf.so.0.6.0 | grep lto
[root@netqe2 ~]#
[root@netqe2 ~]# rpm -q libbpf
libbpf-0.6.0-1.el9.x86_64
[root@netqe2 ~]#
[root@netqe2 ~]# readelf -t -z -W /usr/lib64/libbpf.so.0
There are 30 section headers, starting at offset 0x55460:

Section Headers:
  [Nr] Name
       Type            Address          Off    Size   ES   Lk Inf Al
       Flags
  [ 0]
       NULL            0000000000000000 000000 000000 00   0   0  0
       [0000000000000000]:
  [ 1] .note.gnu.property
       NOTE            00000000000002a8 0002a8 000020 00   0   0  8
       [0000000000000002]: ALLOC
  [ 2] .note.gnu.build-id
       NOTE            00000000000002c8 0002c8 000024 00   0   0  4
       [0000000000000002]: ALLOC
  [ 3] .gnu.hash
       GNU_HASH        00000000000002f0 0002f0 000abc 00   4   0  8
       [0000000000000002]: ALLOC
  [ 4] .dynsym
       DYNSYM          0000000000000db0 000db0 002bb0 18   5   1  8
       [0000000000000002]: ALLOC
  [ 5] .dynstr
       STRTAB          0000000000003960 003960 0021a7 00   0   0  1
       [0000000000000002]: ALLOC
  [ 6] .gnu.version
       VERSYM          0000000000005b08 005b08 0003a4 02   4   0  2
       [0000000000000002]: ALLOC
  [ 7] .gnu.version_d
       VERDEF          0000000000005eb0 005eb0 000230 00   5  16  8
       [0000000000000002]: ALLOC
  [ 8] .gnu.version_r
       VERNEED         00000000000060e0 0060e0 000110 00   5   3  8
       [0000000000000002]: ALLOC
  [ 9] .rela.dyn
       RELA            00000000000061f0 0061f0 0014b8 18   4   0  8
       [0000000000000002]: ALLOC
  [10] .rela.plt
       RELA            00000000000076a8 0076a8 0015d8 18   4  23  8
       [0000000000000042]: ALLOC, INFO LINK
  [11] .init
       PROGBITS        0000000000009000 009000 00001b 00   0   0  4
       [0000000000000006]: ALLOC, EXEC
  [12] .plt
       PROGBITS        0000000000009020 009020 000ea0 10   0   0 16
       [0000000000000006]: ALLOC, EXEC
  [13] .plt.sec
       PROGBITS        0000000000009ec0 009ec0 000e90 10   0   0 16
       [0000000000000006]: ALLOC, EXEC
  [14] .text
       PROGBITS        000000000000ad50 00ad50 03276c 00   0   0 16
       [0000000000000006]: ALLOC, EXEC
  [15] .fini
       PROGBITS        000000000003d4bc 03d4bc 00000d 00   0   0  4
       [0000000000000006]: ALLOC, EXEC
  [16] .rodata
       PROGBITS        000000000003e000 03e000 00a74a 00   0   0 32
       [0000000000000002]: ALLOC
  [17] .eh_frame_hdr
       PROGBITS        000000000004874c 04874c 0011c4 00   0   0  4
       [0000000000000002]: ALLOC
  [18] .eh_frame
       PROGBITS        0000000000049910 049910 0074cc 00   0   0  8
       [0000000000000002]: ALLOC
  [19] .init_array
       INIT_ARRAY      0000000000052830 051830 000008 08   0   0  8
       [0000000000000003]: WRITE, ALLOC
  [20] .fini_array
       FINI_ARRAY      0000000000052838 051838 000008 08   0   0  8
       [0000000000000003]: WRITE, ALLOC
  [21] .data.rel.ro
       PROGBITS        0000000000052840 051840 000e00 00   0   0 32
       [0000000000000003]: WRITE, ALLOC
  [22] .dynamic
       DYNAMIC         0000000000053640 052640 000230 10   5   0  8
       [0000000000000003]: WRITE, ALLOC
  [23] .got
       PROGBITS        0000000000053870 052870 000788 08   0   0  8
       [0000000000000003]: WRITE, ALLOC
  [24] .data
       PROGBITS        0000000000054000 053000 0001f0 00   0   0 32
       [0000000000000003]: WRITE, ALLOC
  [25] .bss
       NOBITS          00000000000541f0 0531f0 000030 00   0   0 16
       [0000000000000003]: WRITE, ALLOC
  [26] .gnu.build.attributes
       NOTE            0000000000056220 0531f0 00043c 00   0   0  4
       [0000000000000000]:
  [27] .gnu_debuglink
       PROGBITS        0000000000000000 05362c 000030 00   0   0  4
       [0000000000000000]:
  [28] .gnu_debugdata
       PROGBITS        0000000000000000 05365c 001ccc 00   0   0  1
       [0000000000000000]:
  [29] .shstrtab
       STRTAB          0000000000000000 055328 000137 00   0   0  1
       [0000000000000000]:
[root@netqe2 ~]#

Comment 11 Viktor Malik 2022-07-14 08:29:20 UTC
Hi Zhiqian,

sorry about the wrong information, LTO usage cannot be detected on the resulting ELF file (only on object files).

Anyway, looking at the build log, e.g.:

http://download.eng.bos.redhat.com/brewroot/vol/rhel-9/packages/libbpf/0.6.0/1.el9/data/logs/x86_64/build.log

it can be seen that "-flto=auto" is used during the build, which confirms that LTO has been used.

Comment 12 Zhiqian Guan 2022-07-14 08:35:51 UTC
Got it, that's good enough, thanks for clarifying this~

Set this to VERIFIED

Comment 13 Zhiqian Guan 2022-07-14 08:37:24 UTC
Clear needinfo request.

Comment 15 errata-xmlrpc 2022-11-15 11:21:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (libbpf bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8364


Note You need to log in before you can comment on or make changes to this bug.