1From 8023dc2b7c6a3c1a2e51ffed30986df879060ca0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 13 Feb 2019 09:51:14 -0800
4Subject: [PATCH] execinfo implementation is glibc specific
5
6Upstream-Status: Pending
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8
9---
10 base/debug/stack_trace_posix.cc                      | 12 ++++++------
11 .../build/Linux/include/llvm/Config/config.h         |  2 +-
12 2 files changed, 7 insertions(+), 7 deletions(-)
13
14diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
15index 679118e189..94890f32b6 100644
16--- a/base/debug/stack_trace_posix.cc
17+++ b/base/debug/stack_trace_posix.cc
18@@ -31,7 +31,7 @@
19 #if !defined(USE_SYMBOLIZE)
20 #include <cxxabi.h>
21 #endif
22-#if !defined(__UCLIBC__) && !defined(_AIX)
23+#if !defined(__UCLIBC__) && defined(__GLIBC__) && !defined(_AIX)
24 #include <execinfo.h>
25 #endif
26
27@@ -98,7 +98,7 @@ void DemangleSymbols(std::string* text) {
28   // Note: code in this function is NOT async-signal safe (std::string uses
29   // malloc internally).
30
31-#if !defined(__UCLIBC__) && !defined(_AIX)
32+#if !defined(__UCLIBC__) && defined(__GLIBC__) && !defined(_AIX)
33   std::string::size_type search_from = 0;
34   while (search_from < text->size()) {
35     // Look for the start of a mangled symbol, from search_from.
36@@ -145,7 +145,7 @@ class BacktraceOutputHandler {
37   virtual ~BacktraceOutputHandler() = default;
38 };
39
40-#if !defined(__UCLIBC__) && !defined(_AIX)
41+#if !defined(__UCLIBC__) && defined(__GLIBC__) && !defined(_AIX)
42 void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
43   // This should be more than enough to store a 64-bit number in hex:
44   // 16 hex digits + 1 for null-terminator.
45@@ -872,7 +872,7 @@ size_t CollectStackTrace(void** trace, size_t count) {
46   // If we do not have unwind tables, then try tracing using frame pointers.
47   return base::debug::TraceStackFramePointers(const_cast<const void**>(trace),
48                                               count, 0);
49-#elif !defined(__UCLIBC__) && !defined(_AIX)
50+#elif !defined(__UCLIBC__) && defined(__GLIBC__) && !defined(_AIX)
51   // Though the backtrace API man page does not list any possible negative
52   // return values, we take no chance.
53   return base::saturated_cast<size_t>(
54@@ -886,13 +886,13 @@ void StackTrace::PrintWithPrefix(const char* prefix_string) const {
55 // NOTE: This code MUST be async-signal safe (it's used by in-process
56 // stack dumping signal handler). NO malloc or stdio is allowed here.
57
58-#if !defined(__UCLIBC__) && !defined(_AIX)
59+#if !defined(__UCLIBC__) && defined(__GLIBC__) && !defined(_AIX)
60   PrintBacktraceOutputHandler handler;
61   ProcessBacktrace(trace_, count_, prefix_string, &handler);
62 #endif
63 }
64
65-#if !defined(__UCLIBC__) && !defined(_AIX)
66+#if !defined(__UCLIBC__) && defined(__GLIBC__) && !defined(_AIX)
67 void StackTrace::OutputToStreamWithPrefix(std::ostream* os,
68                                           const char* prefix_string) const {
69   StreamBacktraceOutputHandler handler(os);
70diff --git a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
71index 0ffd1bf775..0e413c69a5 100644
72--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
73+++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
74@@ -58,7 +58,7 @@
75 #define HAVE_ERRNO_H 1
76
77 /* Define to 1 if you have the <execinfo.h> header file. */
78-#define HAVE_EXECINFO_H 1
79+#define HAVE_EXECINFO_H 0
80
81 /* Define to 1 if you have the <fcntl.h> header file. */
82 #define HAVE_FCNTL_H 1
83