Revert "Don't redefine macros from base/compiler_specific.h."

This reverts commit 458bdec9852280f091a72f9d90eb75f04d0af05f.

Reason for revert: Crashpad roll into Chrommium failed.

https://chromium-review.googlesource.com/c/5805903
https://ci.chromium.org/ui/p/chromium/builders/try/android-x64-rel/171929/
https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8738938901079891665/+/u/compile__with_patch_/stdout

While linking libcrashpad_handler_trampoline.so:

```
ld.lld: error: undefined symbol: std::__Cr::__libcpp_verbose_abort(char const*, ...)
>>> referenced by ascii.cc
>>>               obj/third_party/abseil-cpp/absl/strings/strings/ascii.o:(std::__Cr::__throw_out_of_range(char const*))
>>> referenced by lightweight_quarantine.cc
>>>               allocator_core/lightweight_quarantine.o:(partition_alloc::internal::LightweightQuarantineBranch::~LightweightQuarantineBranch()) in archive obj/base/allocator/partition_allocator/src/partition_alloc/liballocator_core.a
>>> referenced by lightweight_quarantine.cc
>>>               allocator_core/lightweight_quarantine.o:(partition_alloc::internal::LightweightQuarantineBranch::Purge()) in archive obj/base/allocator/partition_allocator/src/partition_alloc/liballocator_core.a
>>> referenced 1 more times
[…]
ld.lld: error: undefined symbol: std::get_new_handler()
[…]
ld.lld: error: undefined symbol: _Unwind_Backtrace
[…]
ld.lld: error: undefined symbol: _Unwind_GetIP
[…]
ld.lld: error: undefined symbol: __cxa_guard_acquire
[…]
ld.lld: error: undefined symbol: __cxa_guard_release
[…]
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```

Original change's description:
> Don't redefine macros from base/compiler_specific.h.
>
> `DISABLE_CFI_ICALL` is already defined in that header; use it.
>
> This is both simpler and less likely to trigger macro redefinition
> errors.
>
> Bug: none
> Change-Id: I3ecfe9b6dc4ac42c6a69b3fd9c6d2c68fe8e62a2
> Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5805458
> Reviewed-by: Mark Mentovai <mark@chromium.org>

Bug: none
Change-Id: Ie225e03e07ab3d0a00933217b377cee14fcdb8b7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5806223
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Mark Mentovai 2024-08-22 04:02:29 +00:00 committed by Crashpad LUCI CQ
parent 756637881a
commit 50faaf111e
2 changed files with 19 additions and 5 deletions

View File

@ -730,10 +730,7 @@ if (!crashpad_is_android && !crashpad_is_ios) {
source_set("no_cfi_icall") { source_set("no_cfi_icall") {
sources = [ "misc/no_cfi_icall.h" ] sources = [ "misc/no_cfi_icall.h" ]
public_configs = [ "..:crashpad_config" ] public_configs = [ "..:crashpad_config" ]
public_deps = [ public_deps = [ "$mini_chromium_source_parent:build" ]
"$mini_chromium_source_parent:base",
"$mini_chromium_source_parent:build",
]
} }
source_set("util_test") { source_set("util_test") {

View File

@ -18,7 +18,6 @@
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include "base/compiler_specific.h"
#include "build/build_config.h" #include "build/build_config.h"
#if BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_WIN)
@ -29,6 +28,24 @@ namespace crashpad {
namespace { namespace {
// Sanitizers annotations.
#if defined(__has_attribute)
#if __has_attribute(no_sanitize)
#define NO_SANITIZE(what) __attribute__((no_sanitize(what)))
#endif
#endif
#if !defined(NO_SANITIZE)
#define NO_SANITIZE(what)
#endif
// DISABLE_CFI_ICALL -- Disable Control Flow Integrity indirect call checks.
#if BUILDFLAG(IS_WIN)
// Windows also needs __declspec(guard(nocf)).
#define DISABLE_CFI_ICALL NO_SANITIZE("cfi-icall") __declspec(guard(nocf))
#else
#define DISABLE_CFI_ICALL NO_SANITIZE("cfi-icall")
#endif
template <typename Functor> template <typename Functor>
struct FunctorTraits; struct FunctorTraits;