From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7824) id 083CD385383F; Tue, 7 Sep 2021 21:07:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 083CD385383F MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: David Faust To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3400] doc: BPF CO-RE documentation X-Act-Checkin: gcc X-Git-Author: David Faust X-Git-Refname: refs/heads/master X-Git-Oldrev: f4cdfd4856f6e90376dbe277912cefda51922488 X-Git-Newrev: d9996ccb9414c1acaaaecf0803244fc018b5125d Message-Id: <20210907210716.083CD385383F@sourceware.org> Date: Tue, 7 Sep 2021 21:07:16 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:07:16 -0000 https://gcc.gnu.org/g:d9996ccb9414c1acaaaecf0803244fc018b5125d commit r12-3400-gd9996ccb9414c1acaaaecf0803244fc018b5125d Author: David Faust Date: Tue Aug 3 10:33:03 2021 -0700 doc: BPF CO-RE documentation Document the new command line options (-mco-re and -mno-co-re), the new BPF target builtin (__builtin_preserve_access_index), and the new BPF target attribute (preserve_access_index) introduced with BPF CO-RE. gcc/ChangeLog: * doc/extend.texi (BPF Type Attributes) New node. Document new preserve_access_index attribute. Document new preserve_access_index builtin. * doc/invoke.texi: Document -mco-re and -mno-co-re options. Diff: --- gcc/doc/extend.texi | 16 ++++++++++++++++ gcc/doc/invoke.texi | 13 ++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 7fb22ed8063..31319f7dd08 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -8256,6 +8256,7 @@ attributes. * Common Type Attributes:: * ARC Type Attributes:: * ARM Type Attributes:: +* BPF Type Attributes:: * MeP Type Attributes:: * PowerPC Type Attributes:: * x86 Type Attributes:: @@ -8830,6 +8831,17 @@ virtual table for @code{C} is not exported. (You can use @code{__attribute__} instead of @code{__declspec} if you prefer, but most Symbian OS code uses @code{__declspec}.) +@node BPF Type Attributes +@subsection BPF Type Attributes + +@cindex @code{preserve_access_index} type attribute, BPF +BPF Compile Once - Run Everywhere (CO-RE) support. When attached to a +@code{struct} or @code{union} type definition, indicates that CO-RE +relocation information should be generated for any access to a variable +of that type. The behavior is equivalent to the programmer manually +wrapping every such access with @code{__builtin_preserve_access_index}. + + @node MeP Type Attributes @subsection MeP Type Attributes @@ -15467,6 +15479,10 @@ Load 16-bits from the @code{struct sk_buff} packet data pointed by the register Load 32-bits from the @code{struct sk_buff} packet data pointed by the register @code{%r6} and return it. @end deftypefn +@deftypefn {Built-in Function} void * __builtin_preserve_access_index (@var{expr}) +BPF Compile Once-Run Everywhere (CO-RE) support. Instruct GCC to generate CO-RE relocation records for any accesses to aggregate data structures (struct, union, array types) in @var{expr}. This builtin is otherwise transparent, the return value is whatever @var{expr} evaluates to. It is also overloaded: @var{expr} may be of any type (not necessarily a pointer), the return type is the same. Has no effect if @code{-mco-re} is not in effect (either specified or implied). +@end deftypefn + @node FR-V Built-in Functions @subsection FR-V Built-in Functions diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a9580a08a65..e39dde009ef 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -904,7 +904,7 @@ Objective-C and Objective-C++ Dialects}. @emph{eBPF Options} @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version} --mframe-limit=@var{bytes} -mxbpf} +-mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re} @emph{FR30 Options} @gccoptlist{-msmall-model -mno-lsim} @@ -22635,6 +22635,17 @@ Generate code for a big-endian target. @opindex mlittle-endian Generate code for a little-endian target. This is the default. +@item -mco-re +@opindex mco-re +Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and +is implied by @option{-gbtf}. + +@item -mno-co-re +@opindex mno-co-re +Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE +support is enabled by default when generating BTF debug information for +the BPF target. + @item -mxbpf Generate code for an expanded version of BPF, which relaxes some of the restrictions imposed by the BPF architecture: