diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2014-09-10 09:01:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-10 17:05:07 -0400 |
commit | b954d83421d51d822c42e5ab7b65069b25ad3005 (patch) | |
tree | 0a419ab76ac8abbc459472b7c5b79800bc3cdc45 /kernel/bpf | |
parent | 17fa1f983649580772e95ee95e2c096baa650219 (diff) |
net: bpf: only build bpf_jit_binary_{alloc, free}() when jit selected
Since BPF JIT depends on the availability of module_alloc() and
module_free() helpers (HAVE_BPF_JIT and MODULES), we better build
that code only in case we have BPF_JIT in our config enabled, just
like with other JIT code. Fixes builds for arm/marzen_defconfig
and sh/rsk7269_defconfig.
====================
kernel/built-in.o: In function `bpf_jit_binary_alloc':
/home/cwang/linux/kernel/bpf/core.c:144: undefined reference to `module_alloc'
kernel/built-in.o: In function `bpf_jit_binary_free':
/home/cwang/linux/kernel/bpf/core.c:164: undefined reference to `module_free'
make: *** [vmlinux] Error 1
====================
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Fixes: 738cbe72adc5 ("net: bpf: consolidate JIT binary allocator")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 8ee520f0ec70..8b7002488251 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c | |||
@@ -128,6 +128,7 @@ void __bpf_prog_free(struct bpf_prog *fp) | |||
128 | } | 128 | } |
129 | EXPORT_SYMBOL_GPL(__bpf_prog_free); | 129 | EXPORT_SYMBOL_GPL(__bpf_prog_free); |
130 | 130 | ||
131 | #ifdef CONFIG_BPF_JIT | ||
131 | struct bpf_binary_header * | 132 | struct bpf_binary_header * |
132 | bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr, | 133 | bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr, |
133 | unsigned int alignment, | 134 | unsigned int alignment, |
@@ -163,6 +164,7 @@ void bpf_jit_binary_free(struct bpf_binary_header *hdr) | |||
163 | { | 164 | { |
164 | module_free(NULL, hdr); | 165 | module_free(NULL, hdr); |
165 | } | 166 | } |
167 | #endif /* CONFIG_BPF_JIT */ | ||
166 | 168 | ||
167 | /* Base function for offset calculation. Needs to go into .text section, | 169 | /* Base function for offset calculation. Needs to go into .text section, |
168 | * therefore keeping it non-static as well; will also be used by JITs | 170 | * therefore keeping it non-static as well; will also be used by JITs |