DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [RFC PATCH] build/pkg-config: remove machine arch flag
@ 2020-12-11 15:51 Bruce Richardson
  2020-12-16 18:45 ` David Christensen
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Bruce Richardson @ 2020-12-11 15:51 UTC (permalink / raw)
  To: dev
  Cc: bluca, david.marchand, ian.stokes, Ilya Maximets,
	Bruce Richardson, Jerin Jacob, Ruifeng Wang,
	Honnappa Nagarahalli, David Christensen

Traditionally any apps built using DPDK had to support the same
instruction sets as supported when the DPDK SDK itself was built, since
that was "leaked" through to the end-app and DPDK headers via
RTE_MACHINE_CPUFLAG_* values. Therefore, when converting over to meson
for app build correctness the "-march=" flag was included in the
pkg-config cflags output.

However, since the DPDK-specific CPU flags are now obsolete, and we
instead check directly for compiler-defined flags, we should no longer
need to force the exact same architecture match in all cases. To
faciliate such flexibility, a new pkg_config_machine_args array - which
defaults to the existing machine_args array has been defined. The
individual architectures - x86, arm and ppc - can choose if and how to
override this value themselves.

For x86, since SSE4.2 is the minimum instruction-set level needed to run
DPDK, and since some header files assume that minimum level of
instruction set support, we override the "-march=" value with "-msse4"
for the pkg-config file. This allows end applications to set their own
"march" value while still ensuring valid DPDK compilation.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---

CC: Jerin Jacob <jerinj@marvell.com>
CC: Ruifeng Wang <ruifeng.wang@arm.com>
CC: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
CC: David Christensen <drc@linux.vnet.ibm.com>
Feedback requested from ARM and PPC maintainers as to this change
and what flags, if any, need to be in the .pc file for DPDK on such
platforms. For example - is setting 'pkg_config_machine_args' to
'machine_args' by default necessary behaviour?

---
 buildtools/pkg-config/meson.build | 2 +-
 config/meson.build                | 1 +
 config/x86/meson.build            | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build
index 5f1930428..8e2e24681 100644
--- a/buildtools/pkg-config/meson.build
+++ b/buildtools/pkg-config/meson.build
@@ -2,7 +2,7 @@
 # Copyright(c) 2020 Intel Corporation

 pkg = import('pkgconfig')
-pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
+pkg_extra_cflags = ['-include', 'rte_config.h'] + pkg_config_machine_args
 if is_freebsd
 	pkg_extra_cflags += ['-D__BSD_VISIBLE']
 endif
diff --git a/config/meson.build b/config/meson.build
index 3ddcc3539..d58ff781d 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -100,6 +100,7 @@ if host_machine.cpu_family().startswith('ppc')
 else
 	machine_args += '-march=' + machine
 endif
+pkg_config_machine_args = machine_args # may be overriden late per arch

 toolchain = cc.get_id()
 dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
diff --git a/config/x86/meson.build b/config/x86/meson.build
index 31bfa63b1..fcd75502e 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -16,6 +16,9 @@ if cc.get_define('__SSE4_2__', args: machine_args) == ''
 	machine_args += '-msse4'
 endif

+# require SSE4.2 in pkg-config file - don't use -march
+pkg_config_machine_args = ['-msse4']
+
 base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
 foreach f:base_flags
 	compile_time_cpuflags += ['RTE_CPUFLAG_' + f]
--
2.27.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-06-15  8:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 15:51 [dpdk-dev] [RFC PATCH] build/pkg-config: remove machine arch flag Bruce Richardson
2020-12-16 18:45 ` David Christensen
2021-09-15 16:28 ` Bruce Richardson
2021-09-15 21:23   ` David Christensen
2021-09-16  3:43     ` Jerin Jacob
2021-09-16 10:16       ` Ruifeng Wang
2021-09-16 14:11         ` Ruifeng Wang
2023-06-14 19:33 ` Stephen Hemminger
2023-06-15  8:44   ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).