From da4eae278b56e698c64d0c39939a7a55c5b6abdd Mon Sep 17 00:00:00 2001 From: Pavan Nikhilesh Date: Sun, 19 Apr 2020 15:31:01 +0530 Subject: [PATCH] build: add global libatomic dependency for 32-bit clang Add libatomic as a global dependency when compiling for 32-bit using clang. As we need libatomic for 64-bit atomic ops. Signed-off-by: Pavan Nikhilesh Acked-by: Bruce Richardson --- config/meson.build | 7 +++++++ drivers/event/octeontx/meson.build | 5 ----- drivers/event/octeontx2/meson.build | 5 ----- drivers/event/opdl/meson.build | 5 ----- examples/l2fwd-event/meson.build | 5 ----- lib/librte_distributor/meson.build | 5 ----- lib/librte_rcu/meson.build | 5 ----- 7 files changed, 7 insertions(+), 30 deletions(-) diff --git a/config/meson.build b/config/meson.build index 58421342b1..224d29e1ce 100644 --- a/config/meson.build +++ b/config/meson.build @@ -173,6 +173,13 @@ if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep) dpdk_extra_ldflags += '-lpcap' endif +# for clang 32-bit compiles we need libatomic for 64-bit atomic ops +if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false + atomic_dep = cc.find_library('atomic', required: true) + add_project_link_arguments('-latomic', language: 'c') + dpdk_extra_ldflags += '-latomic' +endif + # add -include rte_config to cflags add_project_arguments('-include', 'rte_config.h', language: 'c') diff --git a/drivers/event/octeontx/meson.build b/drivers/event/octeontx/meson.build index 73118a4854..2b74bb62de 100644 --- a/drivers/event/octeontx/meson.build +++ b/drivers/event/octeontx/meson.build @@ -11,8 +11,3 @@ sources = files('ssovf_worker.c', ) deps += ['common_octeontx', 'mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] - -# for clang 32-bit compiles we need libatomic for 64-bit atomic ops -if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false - ext_deps += cc.find_library('atomic') -endif diff --git a/drivers/event/octeontx2/meson.build b/drivers/event/octeontx2/meson.build index 4b938416b9..0ade51cec7 100644 --- a/drivers/event/octeontx2/meson.build +++ b/drivers/event/octeontx2/meson.build @@ -18,11 +18,6 @@ if not dpdk_conf.get('RTE_ARCH_64') extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast'] endif -# for clang 32-bit compiles we need libatomic for 64-bit atomic ops -if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false - ext_deps += cc.find_library('atomic') -endif - foreach flag: extra_flags if cc.has_argument(flag) cflags += flag diff --git a/drivers/event/opdl/meson.build b/drivers/event/opdl/meson.build index 1fe034ea12..cc6029c6f0 100644 --- a/drivers/event/opdl/meson.build +++ b/drivers/event/opdl/meson.build @@ -9,8 +9,3 @@ sources = files( 'opdl_test.c', ) deps += ['bus_vdev'] - -# for clang 32-bit compiles we need libatomic for 64-bit atomic ops -if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false - ext_deps += cc.find_library('atomic') -endif diff --git a/examples/l2fwd-event/meson.build b/examples/l2fwd-event/meson.build index c4664c3a3c..4e9a069d6a 100644 --- a/examples/l2fwd-event/meson.build +++ b/examples/l2fwd-event/meson.build @@ -16,8 +16,3 @@ sources = files( 'l2fwd_event_internal_port.c', 'l2fwd_event_generic.c' ) - -# for clang 32-bit compiles we need libatomic for 64-bit atomic ops -if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false - ext_deps += cc.find_library('atomic') -endif diff --git a/lib/librte_distributor/meson.build b/lib/librte_distributor/meson.build index 266af64348..bd12ddb2f1 100644 --- a/lib/librte_distributor/meson.build +++ b/lib/librte_distributor/meson.build @@ -9,8 +9,3 @@ else endif headers = files('rte_distributor.h') deps += ['mbuf'] - -# for clang 32-bit compiles we need libatomic for 64-bit atomic ops -if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false - ext_deps += cc.find_library('atomic') -endif diff --git a/lib/librte_rcu/meson.build b/lib/librte_rcu/meson.build index 5929bd3a70..c009ae4b73 100644 --- a/lib/librte_rcu/meson.build +++ b/lib/librte_rcu/meson.build @@ -3,8 +3,3 @@ sources = files('rte_rcu_qsbr.c') headers = files('rte_rcu_qsbr.h') - -# for clang 32-bit compiles we need libatomic for 64-bit atomic ops -if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false - ext_deps += cc.find_library('atomic') -endif -- 2.20.1