Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 853
    • Issues 853
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 43
    • Merge requests 43
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Merge requests
  • !434

meson: Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 on GNU/Linux if needed

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Simon McVittie requested to merge smcv/glib:1576-meson-armv5-atomic into master Oct 30, 2018
  • Overview 1
  • Commits 1
  • Pipelines 1
  • Changes 1

armv5 Linux systems implement __sync_bool_compare_and_swap() and friends by calling a function provided by the kernel. This is not technically an atomic intrinsic, so gcc doesn't define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 in this case, but it's good enough for us. Extend the current Android special case to cover GNU/Linux too.

The possibilities are:

  • __sync_foo detected and __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 predefined: calls to __atomic_foo or __sync_foo primitives are inlined into user code by gatomic.h

  • __sync_foo detected but __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not predefined: user code has an extern reference to g_atomic_foo(), which calls __atomic_foo or __sync_foo because we defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 when compiling GLib itself

  • Windows: user code has an extern reference to g_atomic_foo(), which calls InterlockedFoo()

  • !defined(G_ATOMIC_LOCK_FREE): user code has an extern reference to g_atomic_foo(), which emulates atomic operations with a mutex

Closes #1576 (closed)


Testing still needed:

  • Test on Debian armel (armv5 EABI softfloat)
  • Test on Debian armhf (armv7 EABI hardfloat)
Edited Nov 02, 2018 by Simon McVittie
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: 1576-meson-armv5-atomic