From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755378AbcGZCQS (ORCPT ); Mon, 25 Jul 2016 22:16:18 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:6432 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753432AbcGZCQP (ORCPT ); Mon, 25 Jul 2016 22:16:15 -0400 Subject: Re: [PATCH] tools lib bpf: Use official ELF e_machine value References: <1468821668-60088-1-git-send-email-wangnan0@huawei.com> <20160718213658.GA44350@ast-mbp.thefacebook.com> CC: , , To: From: "Wangnan (F)" Message-ID: <5796C7C2.7080508@huawei.com> Date: Tue, 26 Jul 2016 10:15:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160718213658.GA44350@ast-mbp.thefacebook.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.5796C7DA.0115,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6715687706ce10492dbce21bd30487e4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnaldo, Please don't forget this patch. Thank you. On 2016/7/19 5:37, Alexei Starovoitov wrote: > 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 >> Cc: Alexei Starovoitov >> Cc: Arnaldo Carvalho de Melo >> Cc: Zefan Li >> 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 >