All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/2] package/libgit2: depends on native 64bit atomics
Date: Wed, 24 Aug 2022 13:26:14 +0200	[thread overview]
Message-ID: <20220824132614.11268a58@windsurf> (raw)
In-Reply-To: <c471e49b-5842-78e7-dd11-5d1371396775@green-communications.fr>

Hello Nicolas,

On Tue, 9 Aug 2022 17:57:16 +0200
Nicolas Cavallari <nicolas.cavallari@green-communications.fr> wrote:

> It's a bit more complicated than that and i probably mixed things up.
> 
> libgit2 can use sync builtins or atomic builtins depending on the gcc 
> version.
> 
> But if we assume that the new gcc minimum version is 4.9, then I can 
> probably just ignore the sync builtins.

Looking at src/thread.h in libgit2, we can see:

# if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1))
#  error Atomic primitives do not exist on this version of gcc; configure libgit2 with -DUSE_THREADS=OFF
# elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
#  define GIT_BUILTIN_ATOMIC
# else
#  define GIT_BUILTIN_SYNC
# endif

So basically, with gcc >= 4.7, libgit2 uses atomic built-ins, with gcc
< 4.7, it uses sync built-ins. However neither are guaranteed to be
present on all architectures.

So if we want to be fully correct, we would probably need something
like this:

	depends on (BR2_TOOLCHAIN_HAS_ATOMIC && BR2_TOOLCHAIN_GCC_AT_LEAST_4_7) || \
		(BR2_TOOLCHAIN_HAS_SYNC_4 && BR2_TOOLCHAIN_HAS_SYNC_8 && !BR2_TOOLCHAIN_GCC_AT_LEAST_4_7)

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      reply	other threads:[~2022-08-24 11:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 15:06 [Buildroot] [PATCH 1/2] package/libgit2: depends on native 64bit atomics Nicolas Cavallari
2022-08-08 15:06 ` [Buildroot] [PATCH 2/2] package/libgit2: bump to 1.5.0 Nicolas Cavallari
2022-08-08 15:33   ` [Buildroot] [PATCH 2/2 v2] " Nicolas Cavallari
2022-08-08 20:41 ` [Buildroot] [PATCH 1/2] package/libgit2: depends on native 64bit atomics Thomas Petazzoni via buildroot
2022-08-09 15:57   ` Nicolas Cavallari
2022-08-24 11:26     ` Thomas Petazzoni via buildroot [this message]

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=20220824132614.11268a58@windsurf \
    --to=buildroot@buildroot.org \
    --cc=nicolas.cavallari@green-communications.fr \
    --cc=thomas.petazzoni@bootlin.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.