Skip to content

Commit

Permalink
Workaround 'large atomic operation' zig warnings in cordxtra on 32-bi…
Browse files Browse the repository at this point in the history
…t arm

(fix of commit 7201f3f)

Issue #602 (bdwgc).

* build.zig [build_cord && enable_werror && !enable_threads
&& (t.abi==.gnueabi || t.abi==.gnueabihf || t.abi==.musleabi
|| t.abi==.musleabihf)] (build): Define AO_DISABLE_GCC_ATOMICS macro;
add TODO item.
  • Loading branch information
ivmai committed Apr 27, 2024
1 parent 4a30fab commit 2ccb138
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,15 @@ pub fn build(b: *std.Build) void {
flags.append("-D HAVE_DLADDR") catch unreachable;
}

if (build_cord and enable_werror and !enable_threads
and (t.abi == .gnueabi or t.abi == .gnueabihf or t.abi == .musleabi
or t.abi == .musleabihf)) {
// TODO: as of zig 0.12, if GCC built-in atomic intrinsic is used,
// "large atomic operation may incur significant performance penalty"
// warning is reported for 32-bit arm targets.
flags.append("-D AO_DISABLE_GCC_ATOMICS") catch unreachable;
}

// Extra user-defined flags (if any) to pass to the compiler.
if (cflags_extra.len > 0) {
// Split it up on a space and append each part to flags separately.
Expand Down

0 comments on commit 2ccb138

Please sign in to comment.