public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/109253] New: libbpf: failed to find BTF info for global/extern symbol '__divdi3'
@ 2023-03-23  2:27 james.hilliard1 at gmail dot com
  2023-03-23 16:08 ` [Bug target/109253] " david.faust at oracle dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: james.hilliard1 at gmail dot com @ 2023-03-23  2:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109253

            Bug ID: 109253
           Summary: libbpf: failed to find BTF info for global/extern
                    symbol '__divdi3'
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: james.hilliard1 at gmail dot com
  Target Milestone: ---

I'm seeing this gen object error which does not occur in llvm for a bpf
test(tcp_ca_write_sk_pacing.c) in bpf-next.


GCC gen object failure:
$ /home/buildroot/bpf-next/tools/testing/selftests/bpf/tools/sbin/bpftool
--debug gen object
/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/tcp_ca_write_sk_pacing.bpf.linked1.o
/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/tcp_ca_write_sk_pacing.bpf.o
libbpf: linker: adding object file
'/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/tcp_ca_write_sk_pacing.bpf.o'...
libbpf: failed to find BTF info for global/extern symbol '__divdi3'
Error: failed to link
'/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/tcp_ca_write_sk_pacing.bpf.o':
No such file or directory (2)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/109253] libbpf: failed to find BTF info for global/extern symbol '__divdi3'
  2023-03-23  2:27 [Bug debug/109253] New: libbpf: failed to find BTF info for global/extern symbol '__divdi3' james.hilliard1 at gmail dot com
@ 2023-03-23 16:08 ` david.faust at oracle dot com
  2023-08-18 13:57 ` jemarch at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: david.faust at oracle dot com @ 2023-03-23 16:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109253

--- Comment #1 from David Faust <david.faust at oracle dot com> ---
See:
https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608152.html

Also related as Andrew pointed out in the above thread:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48783

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/109253] libbpf: failed to find BTF info for global/extern symbol '__divdi3'
  2023-03-23  2:27 [Bug debug/109253] New: libbpf: failed to find BTF info for global/extern symbol '__divdi3' james.hilliard1 at gmail dot com
  2023-03-23 16:08 ` [Bug target/109253] " david.faust at oracle dot com
@ 2023-08-18 13:57 ` jemarch at gcc dot gnu.org
  2023-11-28 15:23 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jemarch at gcc dot gnu.org @ 2023-08-18 13:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109253

--- Comment #2 from Jose E. Marchesi <jemarch at gcc dot gnu.org> ---
A patch to fix this was sent
https://gcc.gnu.org/pipermail/gcc-patches/2023-August/627864.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/109253] libbpf: failed to find BTF info for global/extern symbol '__divdi3'
  2023-03-23  2:27 [Bug debug/109253] New: libbpf: failed to find BTF info for global/extern symbol '__divdi3' james.hilliard1 at gmail dot com
  2023-03-23 16:08 ` [Bug target/109253] " david.faust at oracle dot com
  2023-08-18 13:57 ` jemarch at gcc dot gnu.org
@ 2023-11-28 15:23 ` cvs-commit at gcc dot gnu.org
  2023-11-28 15:48 ` jemarch at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-28 15:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109253

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jose E. Marchesi <jemarch@gcc.gnu.org>:

https://gcc.gnu.org/g:f31a019d1161ec78846473da743aedf49cca8c27

commit r14-5930-gf31a019d1161ec78846473da743aedf49cca8c27
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date:   Fri Nov 24 06:30:28 2023 +0100

    Emit funcall external declarations only if actually used.

    There are many places in GCC where alternative local sequences are
    tried in order to determine what is the cheapest or best alternative
    to use in the current target.  When any of these sequences involve a
    libcall, the current implementation of emit_library_call_value_1
    introduce a side-effect consisting on emitting an external declaration
    for the funcall (such as __divdi3) which is thus emitted even if the
    sequence that does the libcall is not retained.

    This is problematic in targets such as BPF, because the kernel loader
    chokes on the spurious symbol __divdi3 and makes the resulting BPF
    object unloadable.  Note that BPF objects are not linked before being
    loaded.

    This patch changes asssemble_external_libcall to defer emitting
    declarations of external libcall symbols, by saving the call tree
    nodes in a temporary list pending_libcall_symbols and letting
    process_pending_assembly_externals to emit them only if they have been
    referenced.  Solution suggested and sketched by Richard Sandiford.

    Regtested in x86_64-linux-gnu.
    Tested with host x86_64-linux-gnu with target bpf-unknown-none.

    gcc/ChangeLog

            PR target/109253
            * varasm.cc (pending_libcall_symbols): New variable.
            (process_pending_assemble_externals): Process
            pending_libcall_symbols.
            (assemble_external_libcall): Defer emitting external libcall
            symbols to process_pending_assemble_externals.

    gcc/testsuite/ChangeLog

            PR target/109253
            * gcc.target/bpf/divmod-libcall-1.c: New test.
            * gcc.target/bpf/divmod-libcall-2.c: Likewise.
            * gcc.c-torture/compile/libcall-2.c: Likewise.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/109253] libbpf: failed to find BTF info for global/extern symbol '__divdi3'
  2023-03-23  2:27 [Bug debug/109253] New: libbpf: failed to find BTF info for global/extern symbol '__divdi3' james.hilliard1 at gmail dot com
                   ` (2 preceding siblings ...)
  2023-11-28 15:23 ` cvs-commit at gcc dot gnu.org
@ 2023-11-28 15:48 ` jemarch at gcc dot gnu.org
  2023-11-29 11:41 ` shung-hsi.yu at suse dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jemarch at gcc dot gnu.org @ 2023-11-28 15:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109253

Jose E. Marchesi <jemarch at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Jose E. Marchesi <jemarch at gcc dot gnu.org> ---
Fixed by the commit above.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/109253] libbpf: failed to find BTF info for global/extern symbol '__divdi3'
  2023-03-23  2:27 [Bug debug/109253] New: libbpf: failed to find BTF info for global/extern symbol '__divdi3' james.hilliard1 at gmail dot com
                   ` (3 preceding siblings ...)
  2023-11-28 15:48 ` jemarch at gcc dot gnu.org
@ 2023-11-29 11:41 ` shung-hsi.yu at suse dot com
  2023-11-29 12:45 ` jemarch at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: shung-hsi.yu at suse dot com @ 2023-11-29 11:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109253

--- Comment #5 from Shung-Hsi Yu <shung-hsi.yu at suse dot com> ---
any chance we will also have this fix in GCC 13?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/109253] libbpf: failed to find BTF info for global/extern symbol '__divdi3'
  2023-03-23  2:27 [Bug debug/109253] New: libbpf: failed to find BTF info for global/extern symbol '__divdi3' james.hilliard1 at gmail dot com
                   ` (4 preceding siblings ...)
  2023-11-29 11:41 ` shung-hsi.yu at suse dot com
@ 2023-11-29 12:45 ` jemarch at gcc dot gnu.org
  2023-11-30  1:38 ` shung-hsi.yu at suse dot com
  2024-01-20 17:23 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jemarch at gcc dot gnu.org @ 2023-11-29 12:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109253

--- Comment #6 from Jose E. Marchesi <jemarch at gcc dot gnu.org> ---
(In reply to Shung-Hsi Yu from comment #5)
> any chance we will also have this fix in GCC 13?

Yes.  We plan to backport this and many other BPF related fixes and
improvements to GCC 10, 11, 12 and 13, once the port is capable of building all
the kernel BPF selftests.  We are almost there.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/109253] libbpf: failed to find BTF info for global/extern symbol '__divdi3'
  2023-03-23  2:27 [Bug debug/109253] New: libbpf: failed to find BTF info for global/extern symbol '__divdi3' james.hilliard1 at gmail dot com
                   ` (5 preceding siblings ...)
  2023-11-29 12:45 ` jemarch at gcc dot gnu.org
@ 2023-11-30  1:38 ` shung-hsi.yu at suse dot com
  2024-01-20 17:23 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: shung-hsi.yu at suse dot com @ 2023-11-30  1:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109253

--- Comment #7 from Shung-Hsi Yu <shung-hsi.yu at suse dot com> ---
(In reply to Jose E. Marchesi from comment #6)
> Yes.  We plan to backport this and many other BPF related fixes and
> improvements to GCC 10, 11, 12 and 13, once the port is capable of building
> all the kernel BPF selftests.  We are almost there.

That's awesome! Thank you and others so much for this.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/109253] libbpf: failed to find BTF info for global/extern symbol '__divdi3'
  2023-03-23  2:27 [Bug debug/109253] New: libbpf: failed to find BTF info for global/extern symbol '__divdi3' james.hilliard1 at gmail dot com
                   ` (6 preceding siblings ...)
  2023-11-30  1:38 ` shung-hsi.yu at suse dot com
@ 2024-01-20 17:23 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-20 17:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109253

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-01-20 17:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23  2:27 [Bug debug/109253] New: libbpf: failed to find BTF info for global/extern symbol '__divdi3' james.hilliard1 at gmail dot com
2023-03-23 16:08 ` [Bug target/109253] " david.faust at oracle dot com
2023-08-18 13:57 ` jemarch at gcc dot gnu.org
2023-11-28 15:23 ` cvs-commit at gcc dot gnu.org
2023-11-28 15:48 ` jemarch at gcc dot gnu.org
2023-11-29 11:41 ` shung-hsi.yu at suse dot com
2023-11-29 12:45 ` jemarch at gcc dot gnu.org
2023-11-30  1:38 ` shung-hsi.yu at suse dot com
2024-01-20 17:23 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).