netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Yonghong Song <yhs@fb.com>
Cc: <ast@fb.com>, <daniel@iogearbox.net>, <netdev@vger.kernel.org>,
	<kernel-team@fb.com>
Subject: Re: [PATCH iproute2] bpf: check map symbol type properly with newer llvm compiler
Date: Wed, 31 Oct 2018 08:31:56 -0700	[thread overview]
Message-ID: <20181031083156.03621aa0@xeon-e3> (raw)
In-Reply-To: <20181029223203.3135200-1-yhs@fb.com>

On Mon, 29 Oct 2018 15:32:03 -0700
Yonghong Song <yhs@fb.com> wrote:

> With llvm 7.0 or earlier, the map symbol type is STT_NOTYPE.
>   -bash-4.4$ cat t.c
>   __attribute__((section("maps"))) int g;
>   -bash-4.4$ clang -target bpf -O2 -c t.c
>   -bash-4.4$ readelf -s t.o
> 
>   Symbol table '.symtab' contains 2 entries:
>      Num:    Value          Size Type    Bind   Vis      Ndx Name
>        0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
>        1: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    3 g
>   -bash-4.4$
> 
> The following llvm commit enables BPF target to generate
> proper symbol type and size.
>   commit bf6ec206615b9718869d48b4e5400d0c6e3638dd
>   Author: Yonghong Song <yhs@fb.com>
>   Date:   Wed Sep 19 16:04:13 2018 +0000
> 
>       [bpf] Symbol sizes and types in object file
> 
>       Clang-compiled object files currently don't include the symbol sizes and
>       types.  Some tools however need that information.  For example, ctfconvert
>       uses that information to generate FreeBSD's CTF representation from ELF
>       files.
>       With this patch, symbol sizes and types are included in object files.
> 
>       Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
>       Reported-by: Yutaro Hayakawa <yhayakawa3720@gmail.com>
> 
> Hence, for llvm 8.0.0 (currently trunk), symbol type will be not NOTYPE, but OBJECT.
>   -bash-4.4$ clang -target bpf -O2 -c t.c
>   -bash-4.4$ readelf -s t.o
> 
>   Symbol table '.symtab' contains 3 entries:
>      Num:    Value          Size Type    Bind   Vis      Ndx Name
>        0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
>        1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS t.c
>        2: 0000000000000000     4 OBJECT  GLOBAL DEFAULT    3 g
> -bash-4.4$
> 
> This patch makes sure bpf library accepts both NOTYPE and OBJECT types
> of global map symbols.
> 
> Signed-off-by: Yonghong Song <yhs@fb.com>


Looks good, applied.

      parent reply	other threads:[~2018-11-01  0:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 22:32 [PATCH iproute2] bpf: check map symbol type properly with newer llvm compiler Yonghong Song
2018-10-30  0:08 ` Daniel Borkmann
2018-10-31 15:31 ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181031083156.03621aa0@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=ast@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).