From 9bd75b508e11fcb38589c90ae435734d6343ad78 Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Wed, 10 Apr 2019 14:45:17 +0100 Subject: [PATCH] bpf: remove use of weak functions Weak functions don't work well with static libraries and require the use of "whole-archive" flag to ensure that the correct function is used when linking. Since the weak function is only used as a placeholder within this library alone, we can replace it with a non-weak version protected using preprocessor ifdefs. Signed-off-by: Bruce Richardson Acked-by: Konstantin Ananyev Tested-by: Konstantin Ananyev --- lib/librte_bpf/bpf_load.c | 4 +++- lib/librte_bpf/meson.build | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/librte_bpf/bpf_load.c b/lib/librte_bpf/bpf_load.c index d9d163b7d8..194103ec71 100644 --- a/lib/librte_bpf/bpf_load.c +++ b/lib/librte_bpf/bpf_load.c @@ -131,7 +131,8 @@ rte_bpf_load(const struct rte_bpf_prm *prm) return bpf; } -__rte_experimental __rte_weak struct rte_bpf * +#ifndef RTE_LIBRTE_BPF_ELF +__rte_experimental struct rte_bpf * rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname, const char *sname) { @@ -146,3 +147,4 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname, rte_errno = ENOTSUP; return NULL; } +#endif diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build index 8a79878ff3..11c1fb5586 100644 --- a/lib/librte_bpf/meson.build +++ b/lib/librte_bpf/meson.build @@ -20,6 +20,7 @@ deps += ['mbuf', 'net', 'ethdev'] dep = dependency('libelf', required: false) if dep.found() + dpdk_conf.set('RTE_LIBRTE_BPF_ELF', 1) sources += files('bpf_load_elf.c') ext_deps += dep endif -- 2.20.1