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>
---
 src/common/dwarf/elf_reader.cc | 1 +
 1 file changed, 1 insertion(+)

Index: git/src/common/dwarf/elf_reader.cc
===================================================================
--- git.orig/src/common/dwarf/elf_reader.cc
+++ git/src/common/dwarf/elf_reader.cc
@@ -29,10 +29,13 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE  // needed for pread()
 #endif
-
+#include <config.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
+#ifdef HAVE_SYS_REG_H
+#include <sys/reg.h>
+#endif
 #include <unistd.h>
 #include <fcntl.h>
 #include <string.h>
Index: git/configure.ac
===================================================================
--- git.orig/configure.ac
+++ git/configure.ac
@@ -72,7 +72,7 @@ AC_ARG_ENABLE(m32,
 AC_HEADER_STDC
 AC_SYS_LARGEFILE
 AX_PTHREAD
-AC_CHECK_HEADERS([a.out.h stab.h sys/random.h])
+AC_CHECK_HEADERS([a.out.h stab.h sys/random.h sys/reg.h])
 AC_CHECK_FUNCS([arc4random getrandom])
 
 AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
