lkml.org 
[lkml]   [2021]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4] checkpatch: do not apply "initialise globals to 0" check to BPF progs
From
Date
On Wed, 2021-02-10 at 04:07 +0000, Song Liu wrote:
> > On Feb 9, 2021, at 6:10 PM, Joe Perches <joe@perches.com> wrote:
> > On Tue, 2021-02-09 at 13:19 -0800, Song Liu wrote:
> > > BPF programs explicitly initialise global variables to 0 to make sure
> > > clang (v10 or older) do not put the variables in the common section.
> >
> > Acked-by: Joe Perches <joe@perches.com>
> >
> > So the patch is OK now, but I have a question about the concept:
> >
> > Do you mean that these initialized to 0 global variables
> > should go into bss or another section?
>
> We want these variables to go to bss.

OK, then the patch is fine.

> > Perhaps it'd be useful to somehow mark variables into specific
> > sections rather than bss when initialized to 0 and data when not
> > initialized to 0.
>
> Currently, libbpf expects zero initialized global data in bss. This
> convention works well so far. Is there any reason that we specify
> section for global data?

There's no need I know of.

cheers, Joe

\
 
 \ /
  Last update: 2021-02-10 05:15    [W:0.035 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site