Merge branch 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / tools / lib / bpf / libbpf.c
index 32e6b6bc6f7d918bc4ceb259021be1cedbceec38..b699aea9a02586903dc0d7a683e8ff995de3298b 100644 (file)
 #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))) {
                pr_warning("%s is not an eBPF object file\n",
                        obj->path);
                err = -LIBBPF_ERRNO__FORMAT;
This page took 0.024837 seconds and 5 git commands to generate.