summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Richardson <bruce.richardson@intel.com>2018-09-26 10:15:36 +0100
committerKevin Traynor <ktraynor@redhat.com>2019-10-02 15:52:10 +0100
commitc97d4cd35e50c185c77d9e826d27e882d874edfa (patch)
tree2ef6fc7b47fab8406ad03c6f5c914522e141f479
parent86e56d5f98c9726c7549c09edf698370f7612b8b (diff)
downloaddpdk-stable-c97d4cd35e50c185c77d9e826d27e882d874edfa.zip
dpdk-stable-c97d4cd35e50c185c77d9e826d27e882d874edfa.tar.gz
dpdk-stable-c97d4cd35e50c185c77d9e826d27e882d874edfa.tar.xz
build: set RTE_ARCH_64 based on pointer size
[ upstream commit d23e141ffa52e3ae13a5fd1c1cfb88f40cbd06f3] Rather than relying on the target machine architecture, use the size of a pointer from the compiler to determine if we are 64-bits or not. This allows correct behaviour when you pass -m32 as a compile option. It also allows us to use this value repeatedly throughout the repo rather than continually testing for the sizeof(void*). Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Tested-by: Luca Boccassi <bluca@debian.org> Acked-by: Luca Boccassi <bluca@debian.org>
-rw-r--r--config/arm/meson.build3
-rw-r--r--config/meson.build5
-rw-r--r--config/ppc_64/meson.build4
-rw-r--r--config/x86/meson.build3
-rw-r--r--drivers/net/enic/meson.build4
-rw-r--r--drivers/net/sfc/meson.build2
-rw-r--r--lib/librte_bpf/meson.build2
-rw-r--r--lib/librte_kni/meson.build2
8 files changed, 14 insertions, 11 deletions
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 2a56158..0457e6f 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -90,7 +90,7 @@ impl_dpaa2 = ['NXP DPAA2', flags_dpaa2, machine_args_generic]
dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
-if cc.sizeof('void *') != 8
+if not dpdk_conf.get('RTE_ARCH_64')
dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)
dpdk_conf.set('RTE_ARCH_ARM', 1)
dpdk_conf.set('RTE_ARCH_ARMv7', 1)
@@ -100,7 +100,6 @@ if cc.sizeof('void *') != 8
else
dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128)
dpdk_conf.set('RTE_ARCH_ARM64', 1)
- dpdk_conf.set('RTE_ARCH_64', 1)
machine = []
cmd_generic = ['generic', '', '', 'default', '']
diff --git a/config/meson.build b/config/meson.build
index fd263b8..d4d4508 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -50,6 +50,8 @@ toolchain = cc.get_id()
dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper(), 1)
+dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8)
+
add_project_link_arguments('-Wl,--no-as-needed', language: 'c')
dpdk_extra_ldflags += '-Wl,--no-as-needed'
@@ -97,7 +99,7 @@ warning_flags = [
'-Wcast-qual',
'-Wno-address-of-packed-member'
]
-if cc.sizeof('void *') == 4
+if not dpdk_conf.get('RTE_ARCH_64')
# for 32-bit, don't warn about casting a 32-bit pointer to 64-bit int - it's fine!!
warning_flags += '-Wno-pointer-to-int-cast'
endif
@@ -117,6 +119,7 @@ dpdk_conf.set('RTE_MAX_VFIO_GROUPS', 64)
dpdk_conf.set('RTE_DRIVER_MEMPOOL_BUCKET_SIZE_KB', 64)
dpdk_conf.set('RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', true)
+
compile_time_cpuflags = []
if host_machine.cpu_family().startswith('x86')
arch_subdir = 'x86'
diff --git a/config/ppc_64/meson.build b/config/ppc_64/meson.build
index e207c43..7ceae1d 100644
--- a/config/ppc_64/meson.build
+++ b/config/ppc_64/meson.build
@@ -1,9 +1,11 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
+if not dpdk_conf.get('RTE_ARCH_64')
+ error('Only 64-bit compiles are supported for this platform type')
+endif
dpdk_conf.set('RTE_ARCH', 'ppc_64')
dpdk_conf.set('RTE_ARCH_PPC_64', 1)
-dpdk_conf.set('RTE_ARCH_64', 1)
# overrides specific to ppc64
dpdk_conf.set('RTE_MAX_LCORE', 256)
diff --git a/config/x86/meson.build b/config/x86/meson.build
index ae92f86..50a9edc 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -29,10 +29,9 @@ foreach f:base_flags
endforeach
dpdk_conf.set('RTE_ARCH_X86', 1)
-if (host_machine.cpu_family() == 'x86_64')
+if dpdk_conf.get('RTE_ARCH_64')
dpdk_conf.set('RTE_ARCH_X86_64', 1)
dpdk_conf.set('RTE_ARCH', 'x86_64')
- dpdk_conf.set('RTE_ARCH_64', 1)
else
dpdk_conf.set('RTE_ARCH_I686', 1)
dpdk_conf.set('RTE_ARCH', 'i686')
diff --git a/drivers/net/enic/meson.build b/drivers/net/enic/meson.build
index 0644871..9e9a567 100644
--- a/drivers/net/enic/meson.build
+++ b/drivers/net/enic/meson.build
@@ -19,13 +19,13 @@ deps += ['hash']
includes += include_directories('base')
# The current implementation assumes 64-bit pointers
-if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX2') and cc.sizeof('void *') == 8
+if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX2') and dpdk_conf.get('RTE_ARCH_64')
sources += files('enic_rxtx_vec_avx2.c')
# Build the avx2 handler if the compiler supports it, even though 'machine'
# does not. This is to support users who build for the min supported machine
# and need to run the binary on newer CPUs too.
# This part is from i40e meson.build
-elif cc.has_argument('-mavx2') and cc.sizeof('void *') == 8
+elif cc.has_argument('-mavx2') and dpdk_conf.get('RTE_ARCH_64')
enic_avx2_lib = static_library('enic_avx2_lib',
'enic_rxtx_vec_avx2.c',
dependencies: [static_rte_ethdev, static_rte_bus_pci],
diff --git a/drivers/net/sfc/meson.build b/drivers/net/sfc/meson.build
index 2d34e86..e675609 100644
--- a/drivers/net/sfc/meson.build
+++ b/drivers/net/sfc/meson.build
@@ -6,7 +6,7 @@
# This software was jointly developed between OKTET Labs (under contract
# for Solarflare) and Solarflare Communications, Inc.
-if arch_subdir != 'x86' or cc.sizeof('void *') == 4
+if arch_subdir != 'x86' or not dpdk_conf.get('RTE_ARCH_64')
build = false
endif
diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build
index bc0cd78..4fbb29d 100644
--- a/lib/librte_bpf/meson.build
+++ b/lib/librte_bpf/meson.build
@@ -8,7 +8,7 @@ sources = files('bpf.c',
'bpf_pkt.c',
'bpf_validate.c')
-if arch_subdir == 'x86' and cc.sizeof('void *') == 8
+if arch_subdir == 'x86' and dpdk_conf.get('RTE_ARCH_64')
sources += files('bpf_jit_x86.c')
endif
diff --git a/lib/librte_kni/meson.build b/lib/librte_kni/meson.build
index a738a03..055ae12 100644
--- a/lib/librte_kni/meson.build
+++ b/lib/librte_kni/meson.build
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation
-if host_machine.system() != 'linux' or cc.sizeof('void *') == 4
+if host_machine.system() != 'linux' or not dpdk_conf.get('RTE_ARCH_64')
build = false
endif
version = 2