DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
To: <bruce.richardson@intel.com>
Cc: <david.marchand@redhat.com>, <dev@dpdk.org>,
	<ferruh.yigit@amd.com>, <neerav.parikh@amd.com>,
	<thomas@monjalon.net>
Subject: [PATCH v2] config: verify machine arch flag
Date: Thu, 26 Oct 2023 11:13:18 -0700	[thread overview]
Message-ID: <20231026181318.1463398-1-sivaprasad.tummala@amd.com> (raw)
In-Reply-To: <20231025141709.1448007-1-sivaprasad.tummala@amd.com>

Added additional checks for compiler support of specific cpu arch
flags to fix incorrect error reporting.

Without this patch, meson build reports '__SSE4_2__' not defined
error for x86 builds when the compiler does not support the specified
cpu_instruction_set (or) machine argument.

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

---
v2:
- fix build issues on arm platforms
---
 config/meson.build | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/config/meson.build b/config/meson.build
index d56b0f9bce..bd0918bb62 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -159,8 +159,18 @@ if not is_ms_compiler
     if host_machine.cpu_family().startswith('ppc')
         machine_args += '-mcpu=' + cpu_instruction_set
         machine_args += '-mtune=' + cpu_instruction_set
+        compiler_arch_support = cc.has_argument('-mcpu=' + cpu_instruction_set)
     else
         machine_args += '-march=' + cpu_instruction_set
+        # arm manages generic/auto config in config/arm/meson.build
+        if cpu_instruction_set != 'generic' and cpu_instruction_set != 'auto'
+            compiler_arch_support = cc.has_argument('-march=' + cpu_instruction_set)
+        else
+            compiler_arch_support = true
+        endif
+    endif
+    if not compiler_arch_support
+        error('Compiler does not support "@0@" arch flag.'.format(cpu_instruction_set))
     endif
 endif
 
-- 
2.34.1


  parent reply	other threads:[~2023-10-26 18:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 14:17 [PATCH] config: compiler support check for machine arch flags Sivaprasad Tummala
2023-10-25 14:29 ` Bruce Richardson
2023-10-26 18:13 ` Sivaprasad Tummala [this message]
2023-11-06 14:25   ` [PATCH v2] config: verify machine arch flag 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=20231026181318.1463398-1-sivaprasad.tummala@amd.com \
    --to=sivaprasad.tummala@amd.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=neerav.parikh@amd.com \
    --cc=thomas@monjalon.net \
    /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 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).