All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Wang Nan <wangnan0@huawei.com>
Cc: acme@kernel.org, lizefan@huawei.com,
	linux-kernel@vger.kernel.org, pi3orama@163.com,
	Alexei Starovoitov <ast@kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Daniel Borkmann <daniel@iogearbox.net>
Subject: Re: [PATCH] tools lib bpf: Use official ELF e_machine value
Date: Mon, 18 Jul 2016 14:37:00 -0700	[thread overview]
Message-ID: <20160718213658.GA44350@ast-mbp.thefacebook.com> (raw)
In-Reply-To: <1468821668-60088-1-git-send-email-wangnan0@huawei.com>

On Mon, Jul 18, 2016 at 06:01:08AM +0000, Wang Nan wrote:
> New LLVM will issue newly assigned EM_BPF machine code. The new code
> will be propogated to glibc and libelf.
> 
> This patch introduces the new machine code to libbpf.
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Zefan Li <lizefan@huawei.com>
> Cc: pi3orama@163.com
> ---
>  tools/lib/bpf/libbpf.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 32e6b6b..b699aea 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -37,6 +37,10 @@
>  #include "libbpf.h"
>  #include "bpf.h"
>  
> +#ifndef EM_BPF
> +#define EM_BPF 247
> +#endif
> +
>  #define __printf(a, b)	__attribute__((format(printf, a, b)))
>  
>  __printf(1, 2)
> @@ -439,7 +443,8 @@ static int bpf_object__elf_init(struct bpf_object *obj)
>  	}
>  	ep = &obj->efile.ehdr;
>  
> -	if ((ep->e_type != ET_REL) || (ep->e_machine != 0)) {
> +	/* Old LLVM set e_machine to EM_NONE */
> +	if ((ep->e_type != ET_REL) || (ep->e_machine && (ep->e_machine != EM_BPF))) {

Thanks for the fix. Didn't realize we already check for zero here.
btw EM_BPF will be in llvm 3.9 release.

Acked-by: Alexei Starovoitov <ast@kernel.org>

  reply	other threads:[~2016-07-18 21:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18  6:01 [PATCH] tools lib bpf: Use official ELF e_machine value Wang Nan
2016-07-18 21:37 ` Alexei Starovoitov [this message]
2016-07-26  2:15   ` Wangnan (F)
2016-07-27 10:40 ` [tip:perf/urgent] " tip-bot for Wang Nan

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=20160718213658.GA44350@ast-mbp.thefacebook.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.