[PATCH 1/2] Require gawk in maintainer mode

2018-07-04 Thread Ross Burton
gawk is required to build known_dwarf.h, so check for it in configure.ac.

Signed-off-by: Ross Burton 
---
 configure.ac | 4 
 1 file changed, 4 insertions(+)

diff --git a/configure.ac b/configure.ac
index 1cf6245b..a3b29939 100644
--- a/configure.ac
+++ b/configure.ac
@@ -618,6 +618,10 @@ if test "x$enable_maintainer_mode" = xyes; then
   if test "$HAVE_BISON" = "no"; then
 AC_MSG_ERROR([bison needed in maintainer mode])
   fi
+  AC_CHECK_PROG(HAVE_GAWK, gawk, yes, no)
+  if test "$HAVE_GAWK" = "no"; then
+AC_MSG_ERROR([gawk needed in maintainer mode])
+  fi
 else
   if test ! -f ${srcdir}/libdw/known-dwarf.h; then
 AC_MSG_ERROR([No libdw/known-dwarf.h. configure --enable-maintainer-mode])
-- 
2.11.0



[PATCH 2/2] Consolidate error.h inclusion in system.h

2018-07-04 Thread Ross Burton
error.h isn't standard and so isn't part of the musl C library.  To easy future
porting, consolidate the inclusion of error.h into system.h.

https://sourceware.org/bugzilla/show_bug.cgi?id=21008

Signed-off-by: Ross Burton 
---
 lib/color.c| 2 +-
 lib/system.h   | 1 +
 lib/xmalloc.c  | 1 -
 libasm/asm_end.c   | 1 -
 libasm/asm_newscn.c| 1 -
 libcpu/i386_gendis.c   | 3 +--
 libcpu/i386_lex.l  | 2 +-
 libcpu/i386_parse.y| 1 -
 libdw/libdw_alloc.c| 1 -
 libebl/eblopenbackend.c| 1 -
 src/addr2line.c| 1 -
 src/ar.c   | 1 -
 src/arlib.c| 2 +-
 src/arlib2.c   | 1 -
 src/elfcmp.c   | 3 +--
 src/elfcompress.c  | 2 +-
 src/elflint.c  | 1 -
 src/findtextrel.c  | 3 +--
 src/nm.c   | 1 -
 src/objdump.c  | 1 -
 src/ranlib.c   | 1 -
 src/readelf.c  | 1 -
 src/size.c | 1 -
 src/stack.c| 1 -
 src/strings.c  | 1 -
 src/strip.c| 1 -
 src/unstrip.c  | 2 +-
 tests/addrscopes.c | 2 +-
 tests/allregs.c| 2 +-
 tests/backtrace-data.c | 2 +-
 tests/backtrace-dwarf.c| 2 +-
 tests/backtrace.c  | 2 +-
 tests/buildid.c| 2 +-
 tests/debugaltlink.c   | 2 +-
 tests/debuglink.c  | 2 +-
 tests/deleted.c| 1 -
 tests/dwarfcfi.c   | 2 +-
 tests/dwfl-addr-sect.c | 2 +-
 tests/dwfl-bug-addr-overflow.c | 1 -
 tests/dwfl-bug-fd-leak.c   | 2 +-
 tests/dwfl-bug-getmodules.c| 2 +-
 tests/dwfl-proc-attach.c   | 2 +-
 tests/dwfl-report-elf-align.c  | 2 +-
 tests/dwfllines.c  | 2 +-
 tests/dwflmodtest.c| 2 +-
 tests/dwflsyms.c   | 1 -
 tests/early-offscn.c   | 2 +-
 tests/ecp.c| 2 +-
 tests/elfstrmerge.c| 1 -
 tests/find-prologues.c | 2 +-
 tests/funcretval.c | 2 +-
 tests/funcscopes.c | 2 +-
 tests/getsrc_die.c | 2 +-
 tests/line2addr.c  | 2 +-
 tests/low_high_pc.c| 1 -
 tests/next_cfi.c   | 2 +-
 tests/rdwrmmap.c   | 2 +-
 tests/saridx.c | 2 +-
 tests/sectiondump.c| 2 +-
 tests/varlocs.c| 2 +-
 tests/vdsosyms.c   | 2 +-
 61 files changed, 38 insertions(+), 63 deletions(-)

diff --git a/lib/color.c b/lib/color.c
index f62389d5..9ffbf55f 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -32,11 +32,11 @@
 #endif
 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
+#include "system.h"
 #include "libeu.h"
 #include "color.h"
 
diff --git a/lib/system.h b/lib/system.h
index 92033355..292082bd 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -30,6 +30,7 @@
 #define LIB_SYSTEM_H   1
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/lib/xmalloc.c b/lib/xmalloc.c
index 0cde384f..0424afc8 100644
--- a/lib/xmalloc.c
+++ b/lib/xmalloc.c
@@ -30,7 +30,6 @@
 # include 
 #endif
 
-#include 
 #include 
 #include 
 #include 
diff --git a/libasm/asm_end.c b/libasm/asm_end.c
index ced24f50..5aab8dfa 100644
--- a/libasm/asm_end.c
+++ b/libasm/asm_end.c
@@ -32,7 +32,6 @@
 #endif
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c
index ddbb25df..7cdf484f 100644
--- a/libasm/asm_newscn.c
+++ b/libasm/asm_newscn.c
@@ -32,7 +32,6 @@
 #endif
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/libcpu/i386_gendis.c b/libcpu/i386_gendis.c
index aae5eae6..37d2ecd6 100644
--- a/libcpu/i386_gendis.c
+++ b/libcpu/i386_gendis.c
@@ -31,12 +31,11 @@
 # include 
 #endif
 
-#include 
 #include 
 #include 
 #include 
 #include 
-
+#include "system.h"
 
 extern int i386_parse (void);
 
diff --git a/libcpu/i386_lex.l b/libcpu/i386_lex.l
index ef1b53b6..a4705aa9 100644
--- a/libcpu/i386_lex.l
+++ b/libcpu/i386_lex.l
@@ -31,10 +31,10 @@
 #endif
 
 #include 
-#include 
 #include 
 
 #include 
+#include "system.h"
 #include "i386_parse.h"
 
 
diff --git a/libcpu/i386_parse.y b/libcpu/i386_parse.y
index 5fc06825..910d5458 100644
--- a/libcpu/i386_parse.y
+++ b/libcpu/i386_parse.y
@@ -34,7 +34,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c
index d6af23a2..f1e08714 100644
--- a/libdw/libdw_alloc.c
+++ b/libdw/libdw_alloc.c
@@ -31,7 +31,6 @@
 # include 
 #endif
 
-#include 
 #include 
 #include 
 #include "libdwP.h"
diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
index 8b063f41..1962e608 100644
--- a/libebl/eblopenbackend.c
+++ b/libebl