--- build2-toolchain-0.17.0/build2/libbuild2/target.hxx.orig	2024-01-16 14:14:32.696119639 +0100
+++ build2-toolchain-0.17.0/build2/libbuild2/target.hxx	2024-01-16 14:14:39.103465932 +0100
@@ -4,6 +4,8 @@
 #ifndef LIBBUILD2_TARGET_HXX
 #define LIBBUILD2_TARGET_HXX
 
+#define LIBBUILD2_ATOMIC_NON_LOCK_FREE
+
 #include <cstddef>      // max_align_t
 #include <iterator>     // tags, etc.
 #include <type_traits>  // is_*
--- build2-toolchain-0.17.0/build.sh.orig	2024-01-16 14:51:24.342555945 +0100
+++ build2-toolchain-0.17.0/build.sh	2024-01-16 15:31:07.822696709 +0100
@@ -308,8 +308,8 @@
 
 # Compile and link options.
 #
-compile_ops=
-link_ops=
+compile_ops="-O3 -latomic"
+link_ops=-latomic
 
 while test $# -ne 0; do
   if test "$1" != "--"; then
@@ -606,9 +606,9 @@
 #
 run cd build2
 if test -z "$make"; then
-  run ./bootstrap.sh "$cxx" -w
+  run ./bootstrap.sh "$cxx" -w -latomic
 else
-  run $make -f ./bootstrap.gmake "CXX=$cxx" CXXFLAGS=-w
+  run $make -f ./bootstrap.gmake "CXX=$cxx" CXXFLAGS='-w -latomic'
 fi
 run build2/b-boot --version
 
--- build2-toolchain-0.17.0/libbutl/libbutl/buildfile.orig	2024-08-15 14:55:05.608321330 +0200
+++ build2-toolchain-0.17.0/libbutl/libbutl/buildfile	2024-08-15 14:55:58.363149859 +0200
@@ -52,7 +52,7 @@
 switch $tclass, $tsys
 {
   case 'linux'
-    cxx.libs += -ldl
+    cxx.libs += -ldl -latomic
 
   case 'macos'
     cxx.libs += -framework CoreFoundation
