From 680f9590d19a6e35c7c5587e3f4d8194aab0fcd2 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 14 Sep 2017 23:28:36 -0700
Subject: [PATCH 4/5] elf_reader.cc: include <sys/reg.h> to get __WORDSIZE on
 musl libc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending

 src/common/dwarf/elf_reader.cc | 1 +
 1 file changed, 1 insertion(+)

--- a/src/common/dwarf/elf_reader.cc
+++ b/src/common/dwarf/elf_reader.cc
@@ -34,12 +34,16 @@
 #include <config.h>  // Must come first
 #endif
 
+#include <config.h>
 #include <fcntl.h>
 #include <limits.h>
 #include <string.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#ifdef HAVE_SYS_REG_H
+#include <sys/reg.h>
+#endif
 #include <unistd.h>
 
 #include <algorithm>
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,7 @@ fi
 
 AC_SYS_LARGEFILE
 AX_PTHREAD
-AC_CHECK_HEADERS([a.out.h stab.h sys/mman.h sys/random.h])
+AC_CHECK_HEADERS([a.out.h stab.h sys/mman.h sys/random.h sys/reg.h])
 AC_CHECK_FUNCS([arc4random getcontext getrandom memfd_create])
 AM_CONDITIONAL([HAVE_GETCONTEXT], [test "x$ac_cv_func_getcontext" = xyes])
 AM_CONDITIONAL([HAVE_MEMFD_CREATE], [test "x$ac_cv_func_memfd_create" = xyes])
