win: Get client/crashpad_info.cc to compile

Just avoid the Mac-specific __attribute__ tagging for now. There will need
to be some Windows-specific pragmas added here once the reader has been
written.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/808623002
This commit is contained in:
Scott Graham 2014-12-16 10:22:41 -08:00
parent 086714261a
commit b0cf01978d

View File

@ -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 isnt placed in an unnamed namespace:
// hopefully, this will catch attempts to place multiple copies of this
// structure into the same module. If thats 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 isnt placed in an unnamed namespace: hopefully, this will catch attempts
// to place multiple copies of this structure into the same module. If thats
// 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 its 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;