Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc

Issue 2756543002: Statically link libprotobuf_lite on Linux component builds (Closed)
Patch Set: Extract all global data to globals.cc Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
diff --git a/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc b/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
index 53c9eae0fa73fcabac3f6acb493130e754d2169a..3eb6687804889d9b1c2680ce638bcd04d35da4ad 100644
--- a/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
+++ b/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
@@ -58,23 +58,13 @@
: "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp))
#endif
-#if defined(cpuid) // initialize the struct only on x86
-
namespace google {
namespace protobuf {
namespace internal {
-// Set the flags so that code will run correctly and conservatively, so even
-// if we haven't been initialized yet, we're probably single threaded, and our
-// default values should hopefully be pretty safe.
-struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures = {
- false, // bug can't exist before process spawns multiple threads
- false, // no SSE2
-};
+#if defined(cpuid) // initialize the struct only on x86
-namespace {
-
-// Initialize the AtomicOps_Internalx86CPUFeatures struct.
+// Initialize the cr_AtomicOps_Internalx86CPUFeatures struct.
void AtomicOps_Internalx86CPUFeaturesInit() {
uint32_t eax;
uint32_t ebx;
@@ -107,31 +97,20 @@ void AtomicOps_Internalx86CPUFeaturesInit() {
if (strcmp(vendor, "AuthenticAMD") == 0 && // AMD
family == 15 &&
32 <= model && model <= 63) {
- AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = true;
+ cr_AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = true;
} else {
- AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = false;
+ cr_AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = false;
}
// edx bit 26 is SSE2 which we use to tell use whether we can use mfence
- AtomicOps_Internalx86CPUFeatures.has_sse2 = ((edx >> 26) & 1);
+ cr_AtomicOps_Internalx86CPUFeatures.has_sse2 = ((edx >> 26) & 1);
}
-
-class AtomicOpsx86Initializer {
- public:
- AtomicOpsx86Initializer() {
- AtomicOps_Internalx86CPUFeaturesInit();
- }
-};
-
-// A global to get use initialized on startup via static initialization :/
-AtomicOpsx86Initializer g_initer;
-
-} // namespace
+#else
+void AtomicOps_Internalx86CPUFeaturesInit() {}
+#endif // __i386__
} // namespace internal
} // namespace protobuf
} // namespace google
-#endif // __i386__
-
#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_

Powered by Google App Engine
This is Rietveld 408576698