| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // This may result in a static module initializer in debug-mode builds, but | 59 // This may result in a static module initializer in debug-mode builds, but |
| 60 // because it’s POD, no code should need to run to initialize this under | 60 // because it’s POD, no code should need to run to initialize this under |
| 61 // release-mode optimization. | 61 // release-mode optimization. |
| 62 #if defined(OS_MACOSX) | 62 #if defined(OS_MACOSX) |
| 63 | 63 |
| 64 // Put the structure in __DATA,__crashpad_info where it can be easily found | 64 // Put the structure in __DATA,__crashpad_info where it can be easily found |
| 65 // without having to consult the symbol table. The “used” attribute prevents it | 65 // without having to consult the symbol table. The “used” attribute prevents it |
| 66 // from being dead-stripped. | 66 // from being dead-stripped. |
| 67 __attribute__((section(SEG_DATA ",__crashpad_info"), | 67 __attribute__((section(SEG_DATA ",__crashpad_info"), |
| 68 used, | 68 used, |
| 69 visibility("hidden"))) CrashpadInfo g_crashpad_info; | 69 visibility("hidden") |
| 70 #if __has_feature(address_sanitizer) |
| 71 // AddressSanitizer would add a trailing red zone of at least 32 bytes, which |
| 72 // would be reflected in the size of the custom section. This confuses |
| 73 // MachOImageReader::GetCrashpadInfo(), which finds that the section’s size |
| 74 // disagrees with the structure’s size_ field. By specifying an alignment |
| 75 // greater than the red zone size, the red zone will be suppressed. |
| 76 , |
| 77 aligned(64) |
| 78 #endif |
| 79 )) CrashpadInfo g_crashpad_info; |
| 70 | 80 |
| 71 #elif defined(OS_WIN) | 81 #elif defined(OS_WIN) |
| 72 | 82 |
| 73 // Put the struct in a section name CPADinfo where it can be found without the | 83 // Put the struct in a section name CPADinfo where it can be found without the |
| 74 // symbol table. | 84 // symbol table. |
| 75 #pragma section("CPADinfo", read, write) | 85 #pragma section("CPADinfo", read, write) |
| 76 __declspec(allocate("CPADinfo")) CrashpadInfo g_crashpad_info; | 86 __declspec(allocate("CPADinfo")) CrashpadInfo g_crashpad_info; |
| 77 | 87 |
| 78 #endif | 88 #endif |
| 79 | 89 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 92 simple_annotations_(nullptr) | 102 simple_annotations_(nullptr) |
| 93 #if defined(OS_WIN) | 103 #if defined(OS_WIN) |
| 94 , | 104 , |
| 95 exception_pointers_(nullptr), | 105 exception_pointers_(nullptr), |
| 96 thread_id_(0) | 106 thread_id_(0) |
| 97 #endif // OS_WIN | 107 #endif // OS_WIN |
| 98 { | 108 { |
| 99 } | 109 } |
| 100 | 110 |
| 101 } // namespace crashpad | 111 } // namespace crashpad |
| OLD | NEW |