acl: 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 functions are only used as placeholders within this library alone, we can replace them with non-weak functions using preprocessor ifdefs. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
This commit is contained in:
parent
996839793a
commit
e53ce4e413
@ -6,7 +6,7 @@ sources = files('acl_bld.c', 'acl_gen.c', 'acl_run_scalar.c',
|
||||
'rte_acl.c', 'tb_mem.c')
|
||||
headers = files('rte_acl.h', 'rte_acl_osdep.h')
|
||||
|
||||
if arch_subdir == 'x86'
|
||||
if dpdk_conf.has('RTE_ARCH_X86')
|
||||
sources += files('acl_run_sse.c')
|
||||
|
||||
# compile AVX2 version if either:
|
||||
@ -28,4 +28,9 @@ if arch_subdir == 'x86'
|
||||
cflags += '-DCC_AVX2_SUPPORT'
|
||||
endif
|
||||
|
||||
elif dpdk_conf.has('RTE_ARCH_ARM') or dpdk_conf.has('RTE_ARCH_ARM64')
|
||||
cflags += '-flax-vector-conversions'
|
||||
sources += files('acl_run_neon.c')
|
||||
elif dpdk_conf.has('RTE_ARCH_PPC_64')
|
||||
sources += files('acl_run_altivec.c')
|
||||
endif
|
||||
|
@ -13,11 +13,13 @@ static struct rte_tailq_elem rte_acl_tailq = {
|
||||
};
|
||||
EAL_REGISTER_TAILQ(rte_acl_tailq)
|
||||
|
||||
#ifndef RTE_ARCH_X86
|
||||
#ifndef CC_AVX2_SUPPORT
|
||||
/*
|
||||
* If the compiler doesn't support AVX2 instructions,
|
||||
* then the dummy one would be used instead for AVX2 classify method.
|
||||
*/
|
||||
__rte_weak int
|
||||
int
|
||||
rte_acl_classify_avx2(__rte_unused const struct rte_acl_ctx *ctx,
|
||||
__rte_unused const uint8_t **data,
|
||||
__rte_unused uint32_t *results,
|
||||
@ -26,8 +28,9 @@ rte_acl_classify_avx2(__rte_unused const struct rte_acl_ctx *ctx,
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif
|
||||
|
||||
__rte_weak int
|
||||
int
|
||||
rte_acl_classify_sse(__rte_unused const struct rte_acl_ctx *ctx,
|
||||
__rte_unused const uint8_t **data,
|
||||
__rte_unused uint32_t *results,
|
||||
@ -36,8 +39,11 @@ rte_acl_classify_sse(__rte_unused const struct rte_acl_ctx *ctx,
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif
|
||||
|
||||
__rte_weak int
|
||||
#ifndef RTE_ARCH_ARM
|
||||
#ifndef RTE_ARCH_ARM64
|
||||
int
|
||||
rte_acl_classify_neon(__rte_unused const struct rte_acl_ctx *ctx,
|
||||
__rte_unused const uint8_t **data,
|
||||
__rte_unused uint32_t *results,
|
||||
@ -46,8 +52,11 @@ rte_acl_classify_neon(__rte_unused const struct rte_acl_ctx *ctx,
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
__rte_weak int
|
||||
#ifndef RTE_ARCH_PPC_64
|
||||
int
|
||||
rte_acl_classify_altivec(__rte_unused const struct rte_acl_ctx *ctx,
|
||||
__rte_unused const uint8_t **data,
|
||||
__rte_unused uint32_t *results,
|
||||
@ -56,6 +65,7 @@ rte_acl_classify_altivec(__rte_unused const struct rte_acl_ctx *ctx,
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const rte_acl_classify_t classify_fns[] = {
|
||||
[RTE_ACL_CLASSIFY_DEFAULT] = rte_acl_classify_scalar,
|
||||
|
@ -46,10 +46,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
|
||||
# librte_acl needs --whole-archive because of weak functions
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += --whole-archive
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += --no-whole-archive
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += --no-as-needed
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += --whole-archive
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += -lrte_telemetry -ljansson
|
||||
|
Loading…
x
Reference in New Issue
Block a user