From 6d4626090db24cc4c05946c3b43962596e522d9a Mon Sep 17 00:00:00 2001 From: Joshua Peraza Date: Wed, 21 Mar 2018 11:34:07 -0700 Subject: [PATCH] linux: Add a second CaptureContext symbol name glibc 2.26 defines ucontext_t from a struct ucontext_t while Bionic and older versions of glibc use a struct ucontext. Bug: crashpad:30 Change-Id: I473c317dbdbbedfad601c7594cfa7df7f7c01cb9 Reviewed-on: https://chromium-review.googlesource.com/972613 Reviewed-by: Mark Mentovai --- util/misc/capture_context_linux.S | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/util/misc/capture_context_linux.S b/util/misc/capture_context_linux.S index c16d0c74..5541643f 100644 --- a/util/misc/capture_context_linux.S +++ b/util/misc/capture_context_linux.S @@ -15,10 +15,17 @@ // namespace crashpad { // void CaptureContext(ucontext_t* context); // } // namespace crashpad -#define CAPTURECONTEXT_SYMBOL _ZN8crashpad14CaptureContextEP8ucontext + +// The type name for a ucontext_t varies by libc implementation and version. +// Bionic and glibc 2.25 typedef ucontext_t from struct ucontext. glibc 2.26+ +// typedef ucontext_t from struct ucontext_t. Alias the symbol names to maintain +// compatibility with both possibilities. +#define CAPTURECONTEXT_SYMBOL _ZN8crashpad14CaptureContextEP10ucontext_t +#define CAPTURECONTEXT_SYMBOL2 _ZN8crashpad14CaptureContextEP8ucontext .text .globl CAPTURECONTEXT_SYMBOL + .globl CAPTURECONTEXT_SYMBOL2 #if defined(__i386__) || defined(__x86_64__) .balign 16, 0x90 #elif defined(__arm__) || defined(__aarch64__) @@ -26,6 +33,7 @@ #endif CAPTURECONTEXT_SYMBOL: +CAPTURECONTEXT_SYMBOL2: #if defined(__i386__)