1From 569af712da94637091080943f6a0d69ccb35864e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 14 Sep 2017 23:24:08 -0700
4Subject: [PATCH 3/5] Dont include stab.h
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8Upstream-Status: Pending
9
10 src/common/stabs_reader.cc          |  1 -
11 src/common/stabs_reader.h           | 12 +++++++++++-
12 src/common/stabs_reader_unittest.cc |  1 -
13 3 files changed, 11 insertions(+), 3 deletions(-)
14
15--- a/src/common/stabs_reader.cc
16+++ b/src/common/stabs_reader.cc
17@@ -38,7 +38,9 @@
18 #include "common/stabs_reader.h"
19
20 #include <assert.h>
21+#ifdef HAVE_STAB_H
22 #include <stab.h>
23+#endif
24 #include <string.h>
25
26 #include <string>
27--- a/src/common/stabs_reader.h
28+++ b/src/common/stabs_reader.h
29@@ -54,6 +54,30 @@
30 #elif defined(HAVE_A_OUT_H)
31 #include <a.out.h>
32 #endif
33+// Definitions from <stab.h> and <a.out.h> for systems which
34+// do not have them
35+#ifndef HAVE_A_OUT_H
36+#undef N_UNDF
37+#define N_UNDF 0x0
38+#ifndef N_FUN
39+#define N_FUN 0x24
40+#endif
41+#ifndef N_SLINE
42+#define N_SLINE 0x44
43+#endif
44+#ifndef N_SO
45+#define N_SO 0x64
46+#endif
47+#ifndef N_LSYM
48+#define N_LSYM 0x80
49+#endif
50+#ifndef N_BINCL
51+#define N_BINCL 0x82
52+#endif
53+#ifndef N_SOL
54+#define N_SOL 0x84
55+#endif
56+#endif
57
58 #include <string>
59 #include <vector>
60--- a/src/common/stabs_reader_unittest.cc
61+++ b/src/common/stabs_reader_unittest.cc
62@@ -36,7 +36,9 @@
63
64 #include <assert.h>
65 #include <errno.h>
66+#ifdef HAVE_STAB_H
67 #include <stab.h>
68+#endif
69 #include <stdarg.h>
70 #include <stdlib.h>
71 #include <string.h>
72--- a/configure.ac
73+++ b/configure.ac
74@@ -61,7 +61,7 @@ fi
75
76 AC_SYS_LARGEFILE
77 AX_PTHREAD
78-AC_CHECK_HEADERS([a.out.h sys/mman.h sys/random.h])
79+AC_CHECK_HEADERS([a.out.h stab.h sys/mman.h sys/random.h])
80 AC_CHECK_FUNCS([arc4random getcontext getrandom memfd_create])
81 AM_CONDITIONAL([HAVE_GETCONTEXT], [test "x$ac_cv_func_getcontext" = xyes])
82 AM_CONDITIONAL([HAVE_MEMFD_CREATE], [test "x$ac_cv_func_memfd_create" = xyes])
83