[PATCH] Check native binary format

2017-04-28 Thread Ulf Hermann
If our native binary format is not ELF, there is no point in doing the
textrel check and we have to exclude some tests that compile source
code with the native compiler and then check something on the resulting
binary with elfutils.

Signed-off-by: Ulf Hermann 
---
 ChangeLog  |  4 
 config/ChangeLog   |  4 
 config/eu.am   |  4 
 configure.ac   |  3 +++
 tests/ChangeLog| 16 
 tests/run-disasm-x86-64.sh |  5 +
 tests/run-disasm-x86.sh|  5 +
 tests/run-dwfllines.sh |  5 +
 tests/run-elf_cntl_gelf_getshdr.sh |  5 +
 tests/run-elflint-self.sh  |  5 +
 tests/run-low_high_pc.sh   |  6 ++
 tests/run-native-test.sh   |  5 +
 tests/run-nm-self.sh   |  5 +
 tests/run-readelf-self.sh  |  5 +
 tests/run-strip-reloc.sh   |  5 +
 tests/run-strip-strmerge.sh|  5 +
 tests/test-nlist.c |  6 +-
 17 files changed, 92 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 3613beb..d43eeb6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-04-28  Ulf Hermann  
 
+   * configure.ac: Determine the binary format we're building natively.
+
+2017-04-28  Ulf Hermann  
+
* configure.ac: Determine library naming conventions and define
LIBPREFIX, LIBEXT and common names for elf, dw, asm accordingly.
 
diff --git a/config/ChangeLog b/config/ChangeLog
index 59569e3..0f240ea 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2017-04-28  Ulf Hermann  
+
+   * eu.am: Disable textrel_check if we're not building ELF files.
+
 2017-04-27  Ulf Hermann  
 
* eu.am: Use fpic_CFLAGS.
diff --git a/config/eu.am b/config/eu.am
index bc8c767..e692341 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -107,7 +107,11 @@ textrel_found = $(textrel_msg); exit 1
 else
 textrel_found = $(textrel_msg)
 endif
+if NATIVE_ELF
 textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then $(textrel_found); 
fi
+else
+textrel_check =
+endif
 
 print-%:
@echo $*=$($*)
diff --git a/configure.ac b/configure.ac
index b2e03bb..18ef6d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,9 @@ AC_SUBST([LIBPREFIX])
 AC_DEFINE_UNQUOTED(LIBPREFIX, "$LIBPREFIX")
 AH_TEMPLATE([LIBPREFIX], [Host system file name prefix for dynamic libraries.])
 AM_CONDITIONAL(POSTFIX_LIB_VERSION, test "$eu_postfix_lib_version" = "yes")
+AM_CONDITIONAL(NATIVE_ELF, test "$LIBEXT" = ".so")
+AM_CONDITIONAL(NATIVE_PE, test "$LIBEXT" = ".dll")
+AM_CONDITIONAL(NATIVE_MACHO, test "$LIBEXT" = ".dylib")
 
 eu_LIBNAME(elf,1)
 eu_LIBNAME(dw,1)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index d5bda6d..a9bc6fa 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,21 @@
 2017-04-28  Ulf Hermann  
 
+   * run-disasm-x86-64.sh: Disable if the native binary format is not
+   ELF.
+   * run-disasm-x86.sh: Likewise.
+   * run-dwfllines.sh: Likewise.
+   * run-elf_cntl_gelf_getshdr.sh: Likewise.
+   * run-elflint-self.sh: Likewise.
+   * run-low_high_pc.sh: Likewise.
+   * run-native-test.sh: Likewise.
+   * run-nm-self.sh: Likewise.
+   * run-readelf-self.sh: Likewise.
+   * run-strip-reloc.sh: Likewise.
+   * run-strip-strmerge.sh: Likewise.
+   * test-nlist.c: Likewise.
+
+2017-04-28  Ulf Hermann  
+
* Makefile.am: Use the predefined names for libelf, libdw, libasm,
rather than hardcoding to the elf conventions and add the right
extension to deleted-lib..
diff --git a/tests/run-disasm-x86-64.sh b/tests/run-disasm-x86-64.sh
index a6be62b..c5256b7 100755
--- a/tests/run-disasm-x86-64.sh
+++ b/tests/run-disasm-x86-64.sh
@@ -17,6 +17,11 @@
 
 . $srcdir/test-subr.sh
 
+if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then
+  echo "only works with native ELF binaries."
+  exit 77
+fi
+
 # Run x86-64 test.
 case "`uname -m`" in
   x86_64)
diff --git a/tests/run-disasm-x86.sh b/tests/run-disasm-x86.sh
index 28a3df7..e0b6ee3 100755
--- a/tests/run-disasm-x86.sh
+++ b/tests/run-disasm-x86.sh
@@ -17,6 +17,11 @@
 
 . $srcdir/test-subr.sh
 
+if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then
+  echo "only works with native ELF binaries."
+  exit 77
+fi
+
 # Run x86 test.
 case "`uname -m`" in
   x86_64 | i?86 )
diff --git a/tests/run-dwfllines.sh b/tests/run-dwfllines.sh
index b384de0..c228d7d 100755
--- a/tests/run-dwfllines.sh
+++ b/tests/run-dwfllines.sh
@@ -83,6 +83,11 @@ mod:  CU: [9e4] m.c
  time: 0, len: 0, idx: 0, b: 1, e: 1, pe: 0, eb: 0, block: 0, isa: 0, disc: 0
 EOF
 
+if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then
+  echo "self tests only work with native ELF 

[PATCH] Generalize library names

2017-04-28 Thread Ulf Hermann
On windows library names end with ".dll" and the prefix "lib" us usually
omitted. Take this into account and also drop the $(EXEEXT) workaround.
We don't need to use noinst_PROGRAMS as there is also noinst_DATA.

Change-Id: I7e4ba2432811d5ad85051ea0c9d5674eabf79b3c
Signed-off-by: Ulf Hermann 
---
 ChangeLog   |  5 +
 backends/ChangeLog  |  5 +
 backends/Makefile.am| 33 +
 configure.ac| 30 ++
 libasm/ChangeLog|  5 +
 libasm/Makefile.am  | 28 +---
 libdw/ChangeLog |  5 +
 libdw/Makefile.am   | 28 +---
 libebl/ChangeLog|  6 ++
 libebl/Makefile.am  |  2 ++
 libebl/eblopenbackend.c |  9 +
 libelf/ChangeLog|  5 +
 libelf/Makefile.am  | 26 --
 m4/ChangeLog|  4 
 m4/libname.m4   | 38 ++
 src/ChangeLog   |  5 +
 src/Makefile.am |  6 +++---
 tests/ChangeLog |  8 
 tests/Makefile.am   | 22 +-
 tests/run-deleted.sh|  8 +---
 20 files changed, 199 insertions(+), 79 deletions(-)
 create mode 100644 m4/libname.m4

diff --git a/ChangeLog b/ChangeLog
index 01f88f3..3613beb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-28  Ulf Hermann  
+
+   * configure.ac: Determine library naming conventions and define
+   LIBPREFIX, LIBEXT and common names for elf, dw, asm accordingly.
+
 2017-04-27  Ulf Hermann  
 
* configure.ac: Check if the compiler supports
diff --git a/backends/ChangeLog b/backends/ChangeLog
index baeb7b9..e2f0529 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-28  Ulf Hermann 
+
+   * Makefile.am: Have the backend file names follow the platform's
+   convention for naming shared libraries.
+
 2017-04-27  Ulf Hermann 
 
* Makefile.am: Use dso_LDFLAGS.
diff --git a/backends/Makefile.am b/backends/Makefile.am
index 6dc2022..55ff871 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -40,11 +40,12 @@ libebl_pic = libebl_i386_pic.a libebl_sh_pic.a 
libebl_x86_64_pic.a\
 libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
 libebl_m68k_pic.a libebl_bpf_pic.a
 noinst_LIBRARIES = $(libebl_pic)
-noinst_DATA = $(libebl_pic:_pic.a=.so)
+libebl_pic_prefixed = $(libebl_pic:lib%=$(LIBPREFIX)%)
+noinst_DATA = $(libebl_pic_prefixed:_pic.a=$(LIBEXT))
 
 
-libelf = ../libelf/libelf.so
-libdw = ../libdw/libdw.so
+libelf = ../libelf/$(libelf_BARE)
+libdw = ../libdw/$(libdw_BARE)
 if USE_GNULIB
 libgnu = ../libgnu/libgnu.a
 else
@@ -134,32 +135,32 @@ libebl_bpf_pic_a_SOURCES = $(bpf_SRCS)
 am_libebl_bpf_pic_a_OBJECTS = $(bpf_SRCS:.c=.os)
 
 
-libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) $(libgnu)
-   @rm -f $(@:.so=.map)
+$(LIBPREFIX)ebl_%$(LIBEXT) $(LIBPREFIX)ebl_%.map: libebl_%_pic.a $(libelf) 
$(libdw) $(libgnu)
+   @rm -f $(@:$(LIBEXT)=.map)
$(AM_V_at)echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: 
*; };' \
- > $(@:.so=.map)
-   $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $(@:.map=.so) \
+ > $(@:$(LIBEXT)=.map)
+   $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $(@:.map=$(LIBEXT)) \
-Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
-   -Wl,--version-script,$(@:.so=.map) \
+   -Wl,--version-script,$(@:$(LIBEXT)=.map) \
-Wl,--as-needed $(libelf) $(libdw) $(libgnu) $(intl_LDADD)
@$(textrel_check)
 
-libebl_i386.so: $(cpu_i386)
-libebl_x86_64.so: $(cpu_x86_64)
-libebl_bpf.so: $(cpu_bpf)
+$(LIBPREFIX)ebl_i386$(LIBEXT): $(cpu_i386)
+$(LIBPREFIX)ebl_x86_64$(LIBEXT): $(cpu_x86_64)
+$(LIBPREFIX)ebl_bpf$(LIBEXT): $(cpu_bpf)
 
 install: install-am install-ebl-modules
 install-ebl-modules:
$(mkinstalldirs) $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
for m in $(modules); do \
- $(INSTALL_PROGRAM) libebl_$${m}.so 
$(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
- ln -fs libebl_$${m}-$(PACKAGE_VERSION).so 
$(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
+ $(INSTALL_PROGRAM) $(LIBPREFIX)ebl_$${m}$(LIBEXT) 
$(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/$(LIBPREFIX)ebl_$${m}-$(PACKAGE_VERSION)$(LIBEXT);
 \
+ ln -fs $(LIBPREFIX)ebl_$${m}-$(PACKAGE_VERSION)$(LIBEXT) 
$(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/$(LIBPREFIX)ebl_$${m}$(LIBEXT); \
done
 
 uninstall: uninstall-am
for m in $(modules); do \
- rm -f 
$(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
- rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
+ rm -f 
$(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/$(LIBPREFIX)ebl_$${m}-$(PACKAGE_VERSION)$(LIBEXT);
 

[PATCH] Disable symbol versioning if .symver doesn't work

2017-04-28 Thread Ulf Hermann

Signed-off-by: Ulf Hermann 
---
 ChangeLog|  5 +
 configure.ac | 12 
 2 files changed, 17 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 01f88f3..fb7317c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-28  Ulf Hermann  
+
+   * configure.ac: Test if symbol versioning is supported and
+   automatically disable it if not.
+
 2017-04-27  Ulf Hermann  
 
* configure.ac: Check if the compiler supports
diff --git a/configure.ac b/configure.ac
index 0266a36..efcd3c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -376,6 +376,18 @@ AS_IF([test "x$enable_textrelcheck" != "xno"],
 AC_ARG_ENABLE([symbol-versioning],
 AS_HELP_STRING([--disable-symbol-versioning],
[Disable symbol versioning in shared objects]))
+
+AC_CACHE_CHECK([whether symbol versioning is supported], 
ac_cv_symbol_versioning, [dnl
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl
+#define NEW_VERSION(name, version) \
+  asm (".symver " #name "," #name "@@@" #version);
+int foo(int x) { return x + 1; }
+NEW_VERSION (foo, ELFUTILS_12.12)
+])], ac_cv_symbol_versioning=yes, ac_cv_symbol_versioning=no)])
+if test "$ac_cv_symbol_versioning" = "no"; then
+   enable_symbol_versioning=no
+fi
+
 AM_CONDITIONAL(SYMBOL_VERSIONING, [test "x$enable_symbol_versioning" != "xno"])
 AS_IF([test "x$enable_symbol_versioning" = "xno"],
   [AC_MSG_WARN([Disabling symbol versioning breaks ABI compatibility.])
-- 
2.1.4



[PATCH] Check if we need -lintl for linking gettext

2017-04-28 Thread Ulf Hermann
We might not have gettext available from libc and we cannot get it from
gnulib either.

Signed-off-by: Ulf Hermann 
---
 ChangeLog|  5 +
 backends/ChangeLog   |  4 
 backends/Makefile.am |  2 +-
 configure.ac | 25 +
 libasm/ChangeLog |  4 
 libasm/Makefile.am   |  2 +-
 libcpu/ChangeLog |  4 
 libcpu/Makefile.am   |  2 +-
 libdw/ChangeLog  |  4 
 libdw/Makefile.am|  2 +-
 libelf/ChangeLog |  4 
 libelf/Makefile.am   |  2 +-
 src/ChangeLog|  4 
 src/Makefile.am  | 30 +++---
 tests/ChangeLog  |  4 
 tests/Makefile.am| 18 +-
 16 files changed, 87 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 01f88f3..ccfb3ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-28  Ulf Hermann  
+
+   * configure.ac: Check for availability of dgettext from either libc or
+   a separate libintl.
+
 2017-04-27  Ulf Hermann  
 
* configure.ac: Check if the compiler supports
diff --git a/backends/ChangeLog b/backends/ChangeLog
index baeb7b9..a35d83a 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,7 @@
+2017-04-28  Ulf Hermann 
+
+   * Makefile.am: Use intl_LDADD.
+
 2017-04-27  Ulf Hermann 
 
* Makefile.am: Use dso_LDFLAGS.
diff --git a/backends/Makefile.am b/backends/Makefile.am
index 3e1992e..6dc2022 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -141,7 +141,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) 
$(libgnu)
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $(@:.map=.so) \
-Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
-Wl,--version-script,$(@:.so=.map) \
-   -Wl,--as-needed $(libelf) $(libdw) $(libgnu)
+   -Wl,--as-needed $(libelf) $(libdw) $(libgnu) $(intl_LDADD)
@$(textrel_check)
 
 libebl_i386.so: $(cpu_i386)
diff --git a/configure.ac b/configure.ac
index 165149d..0266a36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -431,6 +431,31 @@ CFLAGS="$old_CFLAGS"])
 AM_CONDITIONAL(HAVE_IMPLICIT_FALLTHROUGH_WARNING,
   [test "x$ac_cv_implicit_fallthrough" != "xno"])
 
+dnl Check if gettext is available form libc
+AC_LINK_IFELSE(
+   [AC_LANG_PROGRAM(
+   [#include ],
+   [dgettext("foo", "bar"); return 0;]
+   )],
+   [libc_has_gettext="true"],
+   [libc_has_gettext="false"]
+)
+
+dnl If our libc doesn't provide gettext, then test for libintl
+if test "$libc_has_gettext" = "false" ; then
+   AC_MSG_WARN("libc does not have gettext")
+   AC_CHECK_LIB([intl], [dgettext], [have_intl="true"], 
[have_intl="false"], [-liconv])
+
+   if test "$have_intl" = "false"; then
+   AC_MSG_ERROR("no libintl found")
+   else
+   intl_LDADD="-lintl -liconv"
+   fi
+else
+   intl_LDADD=""
+fi
+AC_SUBST([intl_LDADD])
+
 dnl Check if we have  for EM_BPF disassembly.
 AC_CHECK_HEADERS(linux/bpf.h)
 AM_CONDITIONAL(HAVE_LINUX_BPF_H, [test "x$ac_cv_header_linux_bpf_h" = "xyes"])
diff --git a/libasm/ChangeLog b/libasm/ChangeLog
index 971492a..066c64e 100644
--- a/libasm/ChangeLog
+++ b/libasm/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-28  Ulf Hermann  
+
+   * Makefile.am: Use intl_LDADD.
+
 2017-02-27  Ulf Hermann  
 
* Makefile.am: Use dso_LDFLAGS.
diff --git a/libasm/Makefile.am b/libasm/Makefile.am
index a5fc9fc..30f7fa9 100644
--- a/libasm/Makefile.am
+++ b/libasm/Makefile.am
@@ -55,7 +55,7 @@ libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c 
asm_error.c \
 libasm_pic_a_SOURCES =
 am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
 
-libasm_so_LDLIBS =
+libasm_so_LDLIBS = $(intl_LDADD)
 if USE_LOCKS
 libasm_so_LDLIBS += -lpthread
 endif
diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog
index ef5da58..42cfb58 100644
--- a/libcpu/ChangeLog
+++ b/libcpu/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-28  Ulf Hermann  
+
+   * Makefile.am: Use intl_LDADD.
+
 2017-02-27  Ulf Hermann  
 
* Makefile.am: Use fpic_CFLAGS.
diff --git a/libcpu/Makefile.am b/libcpu/Makefile.am
index 9ca0f43..d277583 100644
--- a/libcpu/Makefile.am
+++ b/libcpu/Makefile.am
@@ -90,7 +90,7 @@ i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function 
-Wno-sign-compare
 i386_parse.o: i386_parse.c i386.mnemonics
 i386_parse_CFLAGS = -DNMNES="`wc -l < i386.mnemonics`"
 i386_lex.o: i386_parse.h
-i386_gendis_LDADD = $(libeu) $(libgnu) -lm
+i386_gendis_LDADD = $(libeu) $(libgnu) $(intl_LDADD) -lm
 
 i386_parse.h: i386_parse.c ;
 
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 79c3898..7c6e19a 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-28  Ulf Hermann  
+
+   * Makefile.am: Use intl_LDADD.
+
 

Re: [PATCH] Make elf section sorting more deterministic

2017-04-28 Thread Ulf Hermann
On 04/27/2017 09:41 PM, Mark Wielaard wrote:
> On Thu, Apr 20, 2017 at 04:54:26PM +0200, Ulf Hermann wrote:
>> At least one test (dwfl-addr-sect) depends on the order of elf sections
>> with equal addresses. This is not guaranteed by the code. Compare also
>> by end address and name to tell entries apart.
> 
> O, interesting find. If the start addresses match the order depends on
> the specific qsort algorithm. So you need a real tie breaker.
> 
> I think it is simpler and more predictable if we just take the section
> number into account. It seem to have the added benefit that it provide
> the same ordering as before with the glibc qsort, so no testcases need
> to be adjusted. Does the following work for you?
> 
> diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c
> index 439a24e..0d10672 100644
> --- a/libdwfl/derelocate.c
> +++ b/libdwfl/derelocate.c
> @@ -63,7 +63,10 @@ compare_secrefs (const void *a, const void *b)
>if ((*p1)->start > (*p2)->start)
>  return 1;
>  
> -  return 0;
> +  /* Same start address, then just compare which section came first.  */
> +  size_t n1 = elf_ndxscn ((*p1)->scn);
> +  size_t n2 = elf_ndxscn ((*p2)->scn);
> +  return n1 - n2;

I would inline the whole thing to

return elf_ndxscn (p1->scn) - elf_ndxscn (p2->scn);

There is no point in forcing the compiler to keep the intermediate numbers as 
(signed) size_t. Also, I would still keep the check for p1->end and p2->end 
before this. If we have a section of size 0, and another one of size > 0 
starting at the same place, we want them to be sorted by end address. The 
zero-sized section should be squeezed in before the one that actually has a 
size, not after it.

Ulf


Re: [PATCH] On elf_update, remember when we mmap()

2017-04-28 Thread Ulf Hermann
On 04/28/2017 12:23 AM, Mark Wielaard wrote:
> On Thu, Apr 20, 2017 at 04:57:41PM +0200, Ulf Hermann wrote:
>> Otherwise we skip the munmap() later. This leaks resources.
> 
> Oops. Good find. Applied to master.
> 
> When configured --with-valgrind the tests are run under valgrind
> and memory leaks will fail the tests. But since this is mmap
> valgrind won't report it. How did you find it?

On windows you cannot rename or unlink files if there are still open views on 
it (and the win32 view mechanism is how I implement mmap on windows). So, the 
test cases fail then because the directories are not empty.

Ulf


Re: [PATCH] Don't look for kernel version if not running on linux

2017-04-28 Thread Ulf Hermann
On 04/27/2017 08:02 PM, Mark Wielaard wrote:
> On Thu, Apr 20, 2017 at 04:08:48PM +0200, Ulf Hermann wrote:
>> We don't want to use it, even if it exists.
> 
> I am not sure this is really the right place to patch.
> The value is retrieved through uname () which is POSIX and so should
> be available even on non-GNU/Linux systems. When kernel_release ()
> returns NULL the callers expect errno to be set so they can use it
> to return a failure code.

You can get uname() on Windows through gnulib, but at the cost at linking to 
additional windows DLLs. It calls gethostname and for that we need to link 
against ws2_32.dll. That's an unreasonable dependency for getting something we 
cannot use anyway. I suggest we just set errno to ENOTSUP then.

Ulf