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