summaryrefslogtreecommitdiffstats
path: root/backends
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2017-07-18 14:12:36 +0200
committerMark Wielaard <mark@klomp.org>2017-07-24 12:06:14 +0200
commit1609679b1ef3611c71a08900c2f6b94bb97d454d (patch)
tree24b3f6dfa5308e4c3a1ddb37b5097694a263ac7f /backends
parentc8e16c12661d18e6ae724a6d89b81c0df9da365a (diff)
backends: Don't depend on linux/bpf.h to compile bpf disassembler.
We only need a few constants and one structure definition from linux/bpf. Just define those in a local lib/bpf.h file. This makes sure the bpf disassembler is always build and included even when elfutils is build on older GNU/Linux systems (and even on other platforms). Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'backends')
-rw-r--r--backends/ChangeLog7
-rw-r--r--backends/Makefile.am5
-rw-r--r--backends/bpf_init.c2
-rw-r--r--backends/bpf_regs.c6
4 files changed, 8 insertions, 12 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog
index 784e6b03..eb7e25f1 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,10 @@
+2017-07-18 Mark Wielaard <mark@klomp.org>
+
+ * Makefile.am (cpu_bpf): Always define.
+ * bpf_init.c (disasm): Always hook.
+ * bpf_regs.c: Include bpf.h instead of linux/bpf.h. Don't define
+ MAX_BPF_REG.
+
2017-02-17 Ulf Hermann <ulf.hermann@qt.io>
* Makefile.am: Add libeu.
diff --git a/backends/Makefile.am b/backends/Makefile.am
index 996602f2..37dc2d20 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -120,12 +120,7 @@ libebl_m68k_pic_a_SOURCES = $(m68k_SRCS)
am_libebl_m68k_pic_a_OBJECTS = $(m68k_SRCS:.c=.os)
bpf_SRCS = bpf_init.c bpf_regs.c
-# The disam hook depends on this if we have linux/bpf.h.
-if HAVE_LINUX_BPF_H
cpu_bpf = ../libcpu/libcpu_bpf.a
-else
-cpu_bpf =
-endif
libebl_bpf_pic_a_SOURCES = $(bpf_SRCS)
am_libebl_bpf_pic_a_OBJECTS = $(bpf_SRCS:.c=.os)
diff --git a/backends/bpf_init.c b/backends/bpf_init.c
index 22842e26..8ea1bc1a 100644
--- a/backends/bpf_init.c
+++ b/backends/bpf_init.c
@@ -52,9 +52,7 @@ bpf_init (Elf *elf __attribute__ ((unused)),
eh->name = "BPF";
bpf_init_reloc (eh);
HOOK (eh, register_info);
-#ifdef HAVE_LINUX_BPF_H
HOOK (eh, disasm);
-#endif
return MODVERSION;
}
diff --git a/backends/bpf_regs.c b/backends/bpf_regs.c
index 180af83b..1863a164 100644
--- a/backends/bpf_regs.c
+++ b/backends/bpf_regs.c
@@ -32,11 +32,7 @@
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_LINUX_BPF_H
-#include <linux/bpf.h>
-#else
-#define MAX_BPF_REG 10
-#endif
+#include "bpf.h"
#define BACKEND bpf_
#include "libebl_CPU.h"