Pull in support from a future clang for __GCC_HAVE_SYNC_COMPARE_AND_SWAP_x
authorderaadt <deraadt@openbsd.org>
Fri, 25 Jun 2021 01:35:13 +0000 (01:35 +0000)
committerderaadt <deraadt@openbsd.org>
Fri, 25 Jun 2021 01:35:13 +0000 (01:35 +0000)
defines because we need it now
from https://reviews.llvm.org/D91784
ok mlarkin kettenis

gnu/llvm/clang/lib/Basic/Targets/RISCV.cpp

index 4ba703c..6154c0f 100644 (file)
@@ -115,8 +115,14 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts,
     Builder.defineMacro("__riscv_muldiv");
   }
 
-  if (HasA)
+  if (HasA) {
     Builder.defineMacro("__riscv_atomic");
+    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
+    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
+    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
+    if (Is64Bit)
+      Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
+  }
 
   if (HasF || HasD) {
     Builder.defineMacro("__riscv_flen", HasD ? "64" : "32");