From: Bruce Richardson <bruce.richardson@intel.com>
To: konstantin.ananyev@intel.com, aconole@redhat.com
Cc: dev@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH 2/2] bpf: remove use of weak functions
Date: Wed, 10 Apr 2019 14:45:17 +0100 [thread overview]
Message-ID: <20190410134517.63896-3-bruce.richardson@intel.com> (raw)
In-Reply-To: <20190410134517.63896-1-bruce.richardson@intel.com>
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 <bruce.richardson@intel.com>
---
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 d9d163b7d..194103ec7 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 8a79878ff..11c1fb558 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
next prev parent reply other threads:[~2019-04-10 13:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-10 13:45 [dpdk-dev] [PATCH 0/2] remove use of weak functions from libraries Bruce Richardson
2019-04-10 13:45 ` [dpdk-dev] [PATCH 1/2] acl: remove use of weak functions Bruce Richardson
2019-04-10 13:54 ` Aaron Conole
2019-04-10 14:02 ` Bruce Richardson
2019-04-10 14:08 ` Aaron Conole
2019-04-10 14:57 ` Ananyev, Konstantin
2019-04-10 13:45 ` Bruce Richardson [this message]
2019-04-10 14:07 ` [dpdk-dev] [PATCH 2/2] bpf: " Aaron Conole
2019-04-10 14:27 ` Bruce Richardson
2019-04-10 14:57 ` Ananyev, Konstantin
2019-05-27 14:13 ` [dpdk-dev] [PATCH 0/2] remove use of weak functions from libraries David Marchand
2019-05-27 15:41 ` Bruce Richardson
2019-05-27 20:57 ` Aaron Conole
2019-05-28 8:06 ` Bruce Richardson
2019-06-05 14:41 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190410134517.63896-3-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=aconole@redhat.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.