[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzZ+iEDwCtzzE=JxYQQJ-inkbRx4OOq70ejewUq1-8ahxQ@mail.gmail.com>
Date: Wed, 27 Nov 2019 12:07:45 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Yonghong Song <yhs@...com>
Cc: Andrii Nakryiko <andriin@...com>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
"daniel@...earbox.net" <daniel@...earbox.net>,
Kernel Team <Kernel-team@...com>
Subject: Re: [PATCH bpf] libbpf: fix global variable relocation
On Wed, Nov 27, 2019 at 10:19 AM Yonghong Song <yhs@...com> wrote:
>
>
>
> On 11/26/19 10:01 PM, Andrii Nakryiko wrote:
> > Similarly to a0d7da26ce86 ("libbpf: Fix call relocation offset calculation
> > bug"), relocations against global variables need to take into account
> > referenced symbol's st_value, which holds offset into a corresponding data
> > section (and, subsequently, offset into internal backing map). For static
> > variables this offset is always zero and data offset is completely described
> > by respective instruction's imm field.
> >
> > Convert a bunch of selftests to global variables. Previously they were relying
> > on `static volatile` trick to ensure Clang doesn't inline static variables,
> > which with global variables is not necessary anymore.
> >
> > Fixes: 393cdfbee809 ("libbpf: Support initialized global variables")
> > Signed-off-by: Andrii Nakryiko <andriin@...com>
>
> LGTM with a few nits below.
>
Good points, I was too laser-focused. Updated in v2, thanks!
> Acked-by: Yonghong Song <yhs@...com>
>
> > ---
> > tools/lib/bpf/libbpf.c | 40 +++++++++----------
> > .../testing/selftests/bpf/progs/fentry_test.c | 12 +++---
> > .../selftests/bpf/progs/fexit_bpf2bpf.c | 6 +--
> > .../testing/selftests/bpf/progs/fexit_test.c | 12 +++---
> > tools/testing/selftests/bpf/progs/test_mmap.c | 4 +-
> > 5 files changed, 35 insertions(+), 39 deletions(-)
> >
[...]
Powered by blists - more mailing lists