From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F6C5C433E0 for ; Sun, 24 Jan 2021 06:09:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4076322B48 for ; Sun, 24 Jan 2021 06:09:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726054AbhAXGJE (ORCPT ); Sun, 24 Jan 2021 01:09:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725803AbhAXGJC (ORCPT ); Sun, 24 Jan 2021 01:09:02 -0500 Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A51DC061573; Sat, 23 Jan 2021 22:08:22 -0800 (PST) Received: by mail-yb1-xb2a.google.com with SMTP id i141so9997934yba.0; Sat, 23 Jan 2021 22:08:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5Z/2Ilxxmqb2VTfLDcIvMPIJEIfnk9D8Dw6wAk1T0KA=; b=tZoCItM+obRTF+olLdMs9aRJsVvaNcwJnhK1NJx5sITGBjJnTCs4wgrJErpeIoLdFN 1oGsCgTJiI6fIHabTRbdozYCWai99r6ERTBJTArx9tDAaTyiX/zdtl2sI1gkTaQZeKXQ ThtxQ1FFM4z/Fuv69oQmPoVX9QvF1aRHc+KxQYgYEHfvoaDMxshumIIO2o0abu14v46+ UlxdyP3Cs1xZERru4CKYa4an+TWQNBdpAarXVDFEw8gV9BYiJpEV3dx/FAtUge3G3NvT m+5xxQ/qR0smxedbeUmbxQ1vJEcbIRWI22ukliufRdPInQtBi8tDP9cq3d8MpfDQQAEG KYug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5Z/2Ilxxmqb2VTfLDcIvMPIJEIfnk9D8Dw6wAk1T0KA=; b=EcyFmStlYNQrlLdnG6wCIuB4tj1KZ9ncNhOPZWreCX3nvAPHb53Z3SJQOllW/mh4WO jFe4NnZpqnxMhe/ZIMJPxieVmuqvVWJGvT66IhRRy1jwK/dPD1oiGgvupXBSkewRD4Q3 7tHTyGyhk7L3mbiaaxz+tctOLt/uZBa6G6BEra3XRcqd6qix467GXiCnbB6mIwWDI2gt E6BcSPE6LpITSv0D9VHgLdYqpMsfO+y8aKAJprKW+3T35rxB0Fo6EzCa7YWu4b/73d3Z fKT49AnWmEqCojG76cCTm6rvb2eH9Qrjty4pF0EFhPDkriYnlna6a7HPsxw2epvsQdup 3n8w== X-Gm-Message-State: AOAM531Ca6YXXnXqUwtxmOQmvfrWg7Hu4369PrAZrtwtJNTpJxYZvx+C D4RqYCLcGaZOmBkSnTrzmA/MguubR/WLnYg3ZnU= X-Google-Smtp-Source: ABdhPJzkG8ibM33ns8CNui5frd1GsQEvbqOl9xdb0zXpOkDJrjh5qXop6Bkn+pvCEtnDeBE6IjihajEQ+whdPHcpU8M= X-Received: by 2002:a25:9882:: with SMTP id l2mr16341174ybo.425.1611468501020; Sat, 23 Jan 2021 22:08:21 -0800 (PST) MIME-Version: 1.0 References: <20210121202203.9346-1-jolsa@kernel.org> <20210121202203.9346-3-jolsa@kernel.org> <20210123212341.GC117714@krava> In-Reply-To: <20210123212341.GC117714@krava> From: Andrii Nakryiko Date: Sat, 23 Jan 2021 22:08:10 -0800 Message-ID: Subject: Re: [PATCH 2/3] bpf_encoder: Translate SHN_XINDEX in symbol's st_shndx values To: Jiri Olsa Cc: Jiri Olsa , Arnaldo Carvalho de Melo , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , dwarves@vger.kernel.org, Networking , bpf , Yonghong Song , Hao Luo , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , Joe Lawrence , Mark Wielaard Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Sat, Jan 23, 2021 at 1:23 PM Jiri Olsa wrote: > > On Thu, Jan 21, 2021 at 03:32:40PM -0800, Andrii Nakryiko wrote: > > SNIP > > > But the current variant looks broken. Oh, and > > elf_symtab__for_each_symbol() is similarly broken, can you please fix > > that as well? > > we'll have to change its callers a bit, because of hanging 'else' > I'll send this separately if that's ok, when I figure out how to > test ctf code > oh, else sucks. Sure, no problem doing it separately. > jirka > > > --- > diff --git a/elf_symtab.h b/elf_symtab.h > index 489e2b1a3505..6823a8c37ecf 100644 > --- a/elf_symtab.h > +++ b/elf_symtab.h > @@ -99,10 +99,9 @@ elf_sym__get(Elf_Data *syms, Elf_Data *syms_sec_idx_table, > * @index: uint32_t index > * @sym: GElf_Sym iterator > */ > -#define elf_symtab__for_each_symbol(symtab, index, sym) \ > - for (index = 0, gelf_getsym(symtab->syms, index, &sym);\ > - index < symtab->nr_syms; \ > - index++, gelf_getsym(symtab->syms, index, &sym)) > +#define elf_symtab__for_each_symbol(symtab, index, sym) \ > + for (index = 0; index < symtab->nr_syms; index++) \ > + if (gelf_getsym(symtab->syms, index, &sym)) > > /** > * elf_symtab__for_each_symbol_index - iterate through all the symbols, > diff --git a/libctf.h b/libctf.h > index 749be8955c52..ee5412bec77e 100644 > --- a/libctf.h > +++ b/libctf.h > @@ -90,11 +90,9 @@ char *ctf__string(struct ctf *ctf, uint32_t ref); > */ > #define ctf__for_each_symtab_function(ctf, index, sym) \ > elf_symtab__for_each_symbol(ctf->symtab, index, sym) \ > - if (ctf__ignore_symtab_function(&sym, \ > + if (!ctf__ignore_symtab_function(&sym, \ > elf_sym__name(&sym, \ > ctf->symtab))) \ > - continue; \ > - else > > /** > * ctf__for_each_symtab_object - iterate thru all the symtab objects > @@ -105,11 +103,9 @@ char *ctf__string(struct ctf *ctf, uint32_t ref); > */ > #define ctf__for_each_symtab_object(ctf, index, sym) \ > elf_symtab__for_each_symbol(ctf->symtab, index, sym) \ > - if (ctf__ignore_symtab_object(&sym, \ > + if (!ctf__ignore_symtab_object(&sym, \ > elf_sym__name(&sym, \ > ctf->symtab))) \ > - continue; \ > - else > > > #endif /* _LIBCTF_H */ >