public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113225] New: bpf: attributekernel_helper function declarations create a BTF_FUNC_EXTERN.
@ 2024-01-03 20:54 cupertino.miranda at oracle dot com
  2024-01-08 18:36 ` [Bug target/113225] bpf: attribute((kernel_helper)) adds inconsistent BTF extern function decl entry cvs-commit at gcc dot gnu.org
  2024-01-09 16:46 ` jemarch at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: cupertino.miranda at oracle dot com @ 2024-01-03 20:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113225
           Summary: bpf: attributekernel_helper function declarations
                    create a BTF_FUNC_EXTERN.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cupertino.miranda at oracle dot com
  Target Milestone: ---

When using attribute kernel_helper such as the one in the example:

extern int foo (int arg) __attribute__((kernel_helper (666)));

int bar ()
{
  return foo (20);
}

The following BTF entries are created: 

[1] int 'int'(1U#B) size=4U#B offset=0UB#b bits=32UB#b SIGNED 
[2] func_proto <anonymous> type=1
         param '' type=1
[3] func_proto <anonymous> type=1
[4] func 'foo'(5U#B) type=2 linkage=0 (extern)
[5] func 'bar'(9U#B) type=3 linkage=1 (global)

BTF information is generated for the extern function declaration, imposing some
problem to tools such as bpftool that relies on BTF information to validate
completeness of the BTF information.
Since kernel helpers are not true functions the BTF information created,
although accurate with how the function is declared, it is not accurate with
its semantics.

Plan resolution is to skip btf output to any attributed kernel_helper function
declaration, since the BTF information in this case is not really required.

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

* [Bug target/113225] bpf: attribute((kernel_helper)) adds inconsistent BTF extern function decl entry.
  2024-01-03 20:54 [Bug target/113225] New: bpf: attributekernel_helper function declarations create a BTF_FUNC_EXTERN cupertino.miranda at oracle dot com
@ 2024-01-08 18:36 ` cvs-commit at gcc dot gnu.org
  2024-01-09 16:46 ` jemarch at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-08 18:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Cupertino Miranda <cupermir@gcc.gnu.org>:

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

commit r14-7011-gdfc88fb51c1f9c26215adf6a308c18e23992cdd9
Author: Cupertino Miranda <cupertino.miranda@oracle.com>
Date:   Wed Jan 3 11:37:34 2024 +0000

    bpf: Correct BTF for kernel_helper attributed decls

    This patch fix a problem with kernel_helper attribute BTF information,
    which incorrectly generates BTF_KIND_FUNC entry.
    This BTF entry although accurate with traditional extern function
    declarations, once the function is attributed with kernel_helper, it is
    semantically incompatible of the kernel helpers in BPF infrastructure.

    gcc/ChangeLog:
            PR target/113225
            * btfout.cc (btf_collect_datasec): Skip creating BTF info for
            extern and kernel_helper attributed function decls.
    gcc/testsuite/ChangeLog:
            * gcc.target/bpf/attr-kernel-helper.c: New test.

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

* [Bug target/113225] bpf: attribute((kernel_helper)) adds inconsistent BTF extern function decl entry.
  2024-01-03 20:54 [Bug target/113225] New: bpf: attributekernel_helper function declarations create a BTF_FUNC_EXTERN cupertino.miranda at oracle dot com
  2024-01-08 18:36 ` [Bug target/113225] bpf: attribute((kernel_helper)) adds inconsistent BTF extern function decl entry cvs-commit at gcc dot gnu.org
@ 2024-01-09 16:46 ` jemarch at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jemarch at gcc dot gnu.org @ 2024-01-09 16:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jemarch at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #2 from Jose E. Marchesi <jemarch at gcc dot gnu.org> ---
This is fixed by the commit above.

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

end of thread, other threads:[~2024-01-09 16:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03 20:54 [Bug target/113225] New: bpf: attributekernel_helper function declarations create a BTF_FUNC_EXTERN cupertino.miranda at oracle dot com
2024-01-08 18:36 ` [Bug target/113225] bpf: attribute((kernel_helper)) adds inconsistent BTF extern function decl entry cvs-commit at gcc dot gnu.org
2024-01-09 16:46 ` jemarch 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).