File: 0020-generic-64-compareandswap.patch

package info (click to toggle)
python-grpc-tools 1.14.1-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,312 kB
  • sloc: cpp: 168,051; makefile: 875; python: 209; javascript: 110; sh: 57
file content (33 lines) | stat: -rw-r--r-- 1,451 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Description: Adding Release_CompareAndSwap 64-bit variant
 While building Protobuf v3.5.0 (latest stable) facing an issue:
 undefined reference to
 `google::protobuf::internal::Release_CompareAndSwap(long volatile*,
 long, long)'

 Need to add 64-bit version for function : Release_CompareAndSwap

 I had already raised an issue here : #3937
Author: Nayana-ibn
Bug-Debian: https://bugs.debian.org/1030311 https://bugs.debian.org/1103718
Origin: https://github.com/protocolbuffers/protobuf/pull/3955
Last-updated: 2025-04-21
---
diff --git a/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h b/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
index 0b0b06c..075c406 100644
--- a/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
+++ b/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
@@ -146,6 +146,14 @@ inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
   return __atomic_load_n(ptr, __ATOMIC_RELAXED);
 }
 
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
+                                       Atomic64 old_value,
+                                       Atomic64 new_value) {
+  __atomic_compare_exchange_n(ptr, &old_value, new_value, false,
+                              __ATOMIC_RELEASE, __ATOMIC_ACQUIRE);
+  return old_value;
+}
+
 #endif // defined(__LP64__)
 
 }  // namespace internal