DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: dev <dev@dpdk.org>, Ali Alnubani <alialnu@nvidia.com>,
	 Bruce Richardson <bruce.richardson@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2] net/sfc: fix broken build with clang 3.4.x
Date: Thu, 22 Jul 2021 11:12:48 +0200	[thread overview]
Message-ID: <CAJFAV8yMZ8si_q936U6CxjvNvHMe_=WJsw_o_DDgPhu9CnOGoA@mail.gmail.com> (raw)
In-Reply-To: <20210722074905.1838130-1-andrew.rybchenko@oktetlabs.ru>

Hi Andrew,


On Thu, Jul 22, 2021 at 9:49 AM Andrew Rybchenko
<andrew.rybchenko@oktetlabs.ru> wrote:
>
> Old clanng requires libatomic as well as gcc. Avoid compiler name and

s/nn/n/


> version based checks. Add custom test for 16-byte atomic operations
> to find out if libatomic is required to build.
>
> Bugzilla ID: 760
> Fixes: 96fd2bd69b58 ("net/sfc: support flow action count in transfer rules")
>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
>  drivers/net/sfc/meson.build | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/sfc/meson.build b/drivers/net/sfc/meson.build
> index 4625859077..a1ad792b80 100644
> --- a/drivers/net/sfc/meson.build
> +++ b/drivers/net/sfc/meson.build
> @@ -40,8 +40,20 @@ foreach flag: extra_flags
>      endif
>  endforeach
>
> -# for gcc compiles we need -latomic for 128-bit atomic ops
> -if cc.get_id() == 'gcc'
> +# for gcc and old Clang compiles we need -latomic for 128-bit atomic ops
> +atomic_check_code = '''
> +int main(void)
> +{
> +    __int128 a = 0;
> +    __int128 b;
> +
> +    b = __atomic_load_n(&a, __ATOMIC_RELAXED);
> +    __atomic_store(&b, &a, __ATOMIC_RELAXED);
> +    __atomic_store_n(&b, a, __ATOMIC_RELAXED);
> +    return 0;
> +}
> +'''
> +if not cc.links(atomic_check_code)

Nice.


>      libatomic_dep = cc.find_library('atomic', required: false)
>      if not libatomic_dep.found()
>          build = false
> @@ -51,11 +63,7 @@ if cc.get_id() == 'gcc'
>
>      # libatomic could be half-installed when above check finds it but
>      # linkage fails
> -    atomic_link_code = '''
> -    #include <stdio.h>
> -    void main() { printf("libatomic link check\n"); }
> -    '''
> -    if not cc.links(atomic_link_code, dependencies: libatomic_dep)
> +    if not cc.links(atomic_check_code, dependencies: libatomic_dep)
>          build = false
>          reason = 'broken dependency, "libatomic"'
>          subdir_done()
> --
> 2.30.2
>

Such a check will have its place in a common place if another
component in DPDK starts to depend on libatomic in the future.
But for now, this patch lgtm.
Thanks.

Acked-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


  reply	other threads:[~2021-07-22  9:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  7:46 [dpdk-dev] [PATCH] " Andrew Rybchenko
2021-07-22  7:49 ` [dpdk-dev] [PATCH v2] " Andrew Rybchenko
2021-07-22  9:12   ` David Marchand [this message]
2021-07-22 19:44     ` David Marchand

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='CAJFAV8yMZ8si_q936U6CxjvNvHMe_=WJsw_o_DDgPhu9CnOGoA@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=alialnu@nvidia.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /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).