Index: client/crashpad_info.cc |
diff --git a/client/crashpad_info.cc b/client/crashpad_info.cc |
index 507c5005e0855d53fbfdac4189928c98dd0ce98c..6d2c989b81a6cf4850eed70e5738046152ace663 100644 |
--- a/client/crashpad_info.cc |
+++ b/client/crashpad_info.cc |
@@ -14,10 +14,13 @@ |
#include "client/crashpad_info.h" |
-#include <mach-o/loader.h> |
- |
+#include "build/build_config.h" |
#include "util/stdlib/cxx.h" |
+#if defined(OS_MACOSX) |
+#include <mach-o/loader.h> |
+#endif |
+ |
#if CXX_LIBRARY_VERSION >= 2011 |
#include <type_traits> |
#endif |
@@ -45,21 +48,34 @@ union Compile_Assert { |
}; |
#endif |
-// Put the structure in __DATA,__crashpad_info where it can be easily found |
-// without having to consult the symbol table. The “used” attribute prevents it |
-// from being dead-stripped. This isn’t placed in an unnamed namespace: |
-// hopefully, this will catch attempts to place multiple copies of this |
-// structure into the same module. If that’s attempted, and the name of the |
-// symbol is the same in each translation unit, it will result in a linker |
-// error, which is better than having multiple structures show up. |
+// This structure needs to be stored somewhere that is easy to find without |
+// external information. |
+// |
+// It isn’t placed in an unnamed namespace: hopefully, this will catch attempts |
+// to place multiple copies of this structure into the same module. If that’s |
+// attempted, and the name of the symbol is the same in each translation unit, |
+// it will result in a linker error, which is better than having multiple |
+// structures show up. |
// |
// This may result in a static module initializer in debug-mode builds, but |
// because it’s POD, no code should need to run to initialize this under |
// release-mode optimization. |
+#if defined(OS_MACOSX) |
+ |
+// Put the structure in __DATA,__crashpad_info where it can be easily found |
+// without having to consult the symbol table. The “used” attribute prevents it |
+// from being dead-stripped. |
__attribute__((section(SEG_DATA ",__crashpad_info"), |
used, |
visibility("hidden"))) CrashpadInfo g_crashpad_info; |
+#elif defined(OS_WIN) |
+ |
+// TODO(scottmg): Tag in a way that makes it easy to locate on Windows. |
+CrashpadInfo g_crashpad_info; |
+ |
+#endif |
+ |
// static |
CrashpadInfo* CrashpadInfo::GetCrashpadInfo() { |
return &g_crashpad_info; |