All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/73] powertop: Include right headers for timval struct
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 02/73] blktrace: Include <sys/types.h for dev_t Khem Raj
                   ` (72 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...0001-include-rquired-headers-for-typedefs.patch | 47 ++++++++++++++++++++++
 meta/recipes-kernel/powertop/powertop_2.8.bb       |  4 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-kernel/powertop/powertop/0001-include-rquired-headers-for-typedefs.patch

diff --git a/meta/recipes-kernel/powertop/powertop/0001-include-rquired-headers-for-typedefs.patch b/meta/recipes-kernel/powertop/powertop/0001-include-rquired-headers-for-typedefs.patch
new file mode 100644
index 0000000..0fd6310
--- /dev/null
+++ b/meta/recipes-kernel/powertop/powertop/0001-include-rquired-headers-for-typedefs.patch
@@ -0,0 +1,47 @@
+From 0856d8145d187a7e5a49625247abe43a13f95acc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 15 Sep 2015 19:36:28 +0000
+Subject: [PATCH] include rquired headers for typedefs
+
+timeval struct needs to include sys/time.h and sprintf() usage requires
+to include stdio.h headers from system
+
+Fixes
+src/perf/perf_bundle.cpp:141:2: error: use of undeclared identifier 'sprintf'; did you mean 'vswprintf'?
+src/devices/devfreq.h:35:18: error: field has incomplete type 'struct timeval'
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ src/devices/devfreq.h    | 1 +
+ src/perf/perf_bundle.cpp | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/src/devices/devfreq.h b/src/devices/devfreq.h
+index 16a60fb..4bede7c 100644
+--- a/src/devices/devfreq.h
++++ b/src/devices/devfreq.h
+@@ -25,6 +25,7 @@
+ #ifndef _INCLUDE_GUARD_DEVFREQ_H
+ #define _INCLUDE_GUARD_DEVFREQ_H
+ 
++#include <sys/time.h>
+ #include "device.h"
+ #include "../parameters/parameters.h"
+ 
+diff --git a/src/perf/perf_bundle.cpp b/src/perf/perf_bundle.cpp
+index cf1ae11..232f894 100644
+--- a/src/perf/perf_bundle.cpp
++++ b/src/perf/perf_bundle.cpp
+@@ -27,6 +27,7 @@
+ #include <algorithm>
+ #include <string.h>
+ #include <stdint.h>
++#include <stdio.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+-- 
+2.5.2
+
diff --git a/meta/recipes-kernel/powertop/powertop_2.8.bb b/meta/recipes-kernel/powertop/powertop_2.8.bb
index a466067..1f2dfb8 100644
--- a/meta/recipes-kernel/powertop/powertop_2.8.bb
+++ b/meta/recipes-kernel/powertop/powertop_2.8.bb
@@ -6,7 +6,9 @@ DEPENDS = "ncurses libnl pciutils"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e"
 
-SRC_URI = "http://01.org/sites/default/files/downloads/powertop/powertop-${PV}.tar.gz"
+SRC_URI = "http://01.org/sites/default/files/downloads/powertop/powertop-${PV}.tar.gz \
+           file://0001-include-rquired-headers-for-typedefs.patch \
+"
 
 SRC_URI[md5sum] = "c55fedb69203e480801b18bd7b886241"
 SRC_URI[sha256sum] = "a87b563f73106babfa3e74dcf92f252938c061e309ace20a361358bbfa579c5a"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 02/73] blktrace: Include <sys/types.h for dev_t
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
  2016-01-17 11:35 ` [PATCH 01/73] powertop: Include right headers for timval struct Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 03/73] ppp: Fix build with musl Khem Raj
                   ` (71 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...-include-sys-types.h-for-dev_t-definition.patch | 30 ++++++++++++++++++++++
 meta/recipes-kernel/blktrace/blktrace_git.bb       |  4 ++-
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-kernel/blktrace/blktrace/0001-include-sys-types.h-for-dev_t-definition.patch

diff --git a/meta/recipes-kernel/blktrace/blktrace/0001-include-sys-types.h-for-dev_t-definition.patch b/meta/recipes-kernel/blktrace/blktrace/0001-include-sys-types.h-for-dev_t-definition.patch
new file mode 100644
index 0000000..a4b7157
--- /dev/null
+++ b/meta/recipes-kernel/blktrace/blktrace/0001-include-sys-types.h-for-dev_t-definition.patch
@@ -0,0 +1,30 @@
+From 6b5bbdfaac7f216fe8a02c4cf29e5eb2aee5a409 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 15 Sep 2015 00:01:00 +0000
+Subject: [PATCH] include sys/types.h for dev_t definition
+
+Avoids the build failures when sys/types.h does not get included
+indirectly through other headers.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ blktrace.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/blktrace.h b/blktrace.h
+index 380aec7..944fc08 100644
+--- a/blktrace.h
++++ b/blktrace.h
+@@ -5,6 +5,7 @@
+ #include <limits.h>
+ #include <byteswap.h>
+ #include <endian.h>
++#include <sys/types.h>
+ 
+ #include "blktrace_api.h"
+ #include "rbtree.h"
+-- 
+2.5.2
+
diff --git a/meta/recipes-kernel/blktrace/blktrace_git.bb b/meta/recipes-kernel/blktrace/blktrace_git.bb
index 5b0be42..957cb70 100644
--- a/meta/recipes-kernel/blktrace/blktrace_git.bb
+++ b/meta/recipes-kernel/blktrace/blktrace_git.bb
@@ -9,7 +9,9 @@ SRCREV = "43fc870ce04e963def45dfc0d1ed4ea21ef10d4b"
 PV = "1.1.0+git${SRCPV}"
 
 SRC_URI = "git://git.kernel.dk/blktrace.git \
-           file://ldflags.patch"
+           file://ldflags.patch \
+           file://0001-include-sys-types.h-for-dev_t-definition.patch \
+"
 
 S = "${WORKDIR}/git"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 03/73] ppp: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
  2016-01-17 11:35 ` [PATCH 01/73] powertop: Include right headers for timval struct Khem Raj
  2016-01-17 11:35 ` [PATCH 02/73] blktrace: Include <sys/types.h for dev_t Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 04/73] tcp-wrappers: " Khem Raj
                   ` (70 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

Therer are assumptions about glibc headers and features which needs to
be addressed for musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../ppp/ppp/0001-Fix-build-with-musl.patch         | 163 +++++++++++++++++++++
 meta/recipes-connectivity/ppp/ppp_2.4.7.bb         |   3 +
 2 files changed, 166 insertions(+)
 create mode 100644 meta/recipes-connectivity/ppp/ppp/0001-Fix-build-with-musl.patch

diff --git a/meta/recipes-connectivity/ppp/ppp/0001-Fix-build-with-musl.patch b/meta/recipes-connectivity/ppp/ppp/0001-Fix-build-with-musl.patch
new file mode 100644
index 0000000..763e374
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/0001-Fix-build-with-musl.patch
@@ -0,0 +1,163 @@
+From 52a1e41d7541b2c936285844c59bd1be21797860 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 29 May 2015 14:57:05 -0700
+Subject: [PATCH] Fix build with musl
+
+There are several assumption about glibc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ include/net/ppp_defs.h                  | 2 ++
+ pppd/Makefile.linux                     | 2 +-
+ pppd/magic.h                            | 6 +++---
+ pppd/plugins/rp-pppoe/config.h          | 5 ++++-
+ pppd/plugins/rp-pppoe/plugin.c          | 1 -
+ pppd/plugins/rp-pppoe/pppoe-discovery.c | 8 ++++----
+ pppd/plugins/rp-pppoe/pppoe.h           | 2 +-
+ pppd/sys-linux.c                        | 3 ++-
+ 8 files changed, 17 insertions(+), 12 deletions(-)
+
+diff --git a/include/net/ppp_defs.h b/include/net/ppp_defs.h
+index b06eda5..dafa36c 100644
+--- a/include/net/ppp_defs.h
++++ b/include/net/ppp_defs.h
+@@ -38,6 +38,8 @@
+ #ifndef _PPP_DEFS_H_
+ #define _PPP_DEFS_H_
+ 
++#include <sys/time.h>
++
+ /*
+  * The basic PPP frame.
+  */
+diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux
+index 8ab2102..d7e2564 100644
+--- a/pppd/Makefile.linux
++++ b/pppd/Makefile.linux
+@@ -126,7 +126,7 @@ LIBS	+= -lcrypt
+ #endif
+ 
+ ifdef USE_LIBUTIL
+-CFLAGS	+= -DHAVE_LOGWTMP=1
++#CFLAGS	+= -DHAVE_LOGWTMP=1
+ LIBS	+= -lutil
+ endif
+ 
+diff --git a/pppd/magic.h b/pppd/magic.h
+index c81213b..9d399e3 100644
+--- a/pppd/magic.h
++++ b/pppd/magic.h
+@@ -42,8 +42,8 @@
+  * $Id: magic.h,v 1.5 2003/06/11 23:56:26 paulus Exp $
+  */
+ 
+-void magic_init __P((void));	/* Initialize the magic number generator */
+-u_int32_t magic __P((void));	/* Returns the next magic number */
++void magic_init (void);	/* Initialize the magic number generator */
++u_int32_t magic (void);	/* Returns the next magic number */
+ 
+ /* Fill buffer with random bytes */
+-void random_bytes __P((unsigned char *buf, int len));
++void random_bytes (unsigned char *buf, int len);
+diff --git a/pppd/plugins/rp-pppoe/config.h b/pppd/plugins/rp-pppoe/config.h
+index 5703087..fff032e 100644
+--- a/pppd/plugins/rp-pppoe/config.h
++++ b/pppd/plugins/rp-pppoe/config.h
+@@ -78,8 +78,9 @@
+ #define HAVE_NET_IF_ARP_H 1
+ 
+ /* Define if you have the <net/ethernet.h> header file.  */
++#ifdef __GLIBC__
+ #define HAVE_NET_ETHERNET_H 1
+-
++#endif
+ /* Define if you have the <net/if.h> header file.  */
+ #define HAVE_NET_IF_H 1
+ 
+@@ -102,7 +103,9 @@
+ #define HAVE_NETPACKET_PACKET_H 1
+ 
+ /* Define if you have the <sys/cdefs.h> header file.  */
++#ifdef __GLIBC__
+ #define HAVE_SYS_CDEFS_H 1
++#endif
+ 
+ /* Define if you have the <sys/dlpi.h> header file.  */
+ /* #undef HAVE_SYS_DLPI_H */
+diff --git a/pppd/plugins/rp-pppoe/plugin.c b/pppd/plugins/rp-pppoe/plugin.c
+index a8c2bb4..ca34d79 100644
+--- a/pppd/plugins/rp-pppoe/plugin.c
++++ b/pppd/plugins/rp-pppoe/plugin.c
+@@ -46,7 +46,6 @@ static char const RCSID[] =
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <signal.h>
+-#include <net/ethernet.h>
+ #include <net/if_arp.h>
+ #include <linux/ppp_defs.h>
+ #include <linux/if_pppox.h>
+diff --git a/pppd/plugins/rp-pppoe/pppoe-discovery.c b/pppd/plugins/rp-pppoe/pppoe-discovery.c
+index 3d3bf4e..d42f619 100644
+--- a/pppd/plugins/rp-pppoe/pppoe-discovery.c
++++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c
+@@ -27,10 +27,6 @@
+ #include <linux/if_packet.h>
+ #endif
+ 
+-#ifdef HAVE_NET_ETHERNET_H
+-#include <net/ethernet.h>
+-#endif
+-
+ #ifdef HAVE_ASM_TYPES_H
+ #include <asm/types.h>
+ #endif
+@@ -47,6 +43,10 @@
+ #include <net/if_arp.h>
+ #endif
+ 
++#ifndef __GLIBC__
++#define error(x...) fprintf(stderr, x)
++#endif
++
+ char *xstrdup(const char *s);
+ void usage(void);
+ 
+diff --git a/pppd/plugins/rp-pppoe/pppoe.h b/pppd/plugins/rp-pppoe/pppoe.h
+index 9ab2eee..75b9004 100644
+--- a/pppd/plugins/rp-pppoe/pppoe.h
++++ b/pppd/plugins/rp-pppoe/pppoe.h
+@@ -92,7 +92,7 @@ typedef unsigned long UINT32_t;
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
+-#ifndef HAVE_SYS_DLPI_H
++#if !defined HAVE_SYS_DLPI_H && defined HAVE_NET_ETHERNET_H
+ #include <netinet/if_ether.h>
+ #endif
+ #endif
+diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c
+index a105505..49b0273 100644
+--- a/pppd/sys-linux.c
++++ b/pppd/sys-linux.c
+@@ -112,7 +112,7 @@
+ #include <linux/types.h>
+ #include <linux/if.h>
+ #include <linux/if_arp.h>
+-#include <linux/route.h>
++/* #include <linux/route.h> */
+ #include <linux/if_ether.h>
+ #endif
+ #include <netinet/in.h>
+@@ -145,6 +145,7 @@
+ #endif
+ 
+ #ifdef INET6
++#include <net/route.h>
+ #ifndef _LINUX_IN6_H
+ /*
+  *    This is in linux/include/net/ipv6.h.
+-- 
+2.1.4
+
diff --git a/meta/recipes-connectivity/ppp/ppp_2.4.7.bb b/meta/recipes-connectivity/ppp/ppp_2.4.7.bb
index 5f06034..4437b5c 100644
--- a/meta/recipes-connectivity/ppp/ppp_2.4.7.bb
+++ b/meta/recipes-connectivity/ppp/ppp_2.4.7.bb
@@ -32,6 +32,9 @@ SRC_URI = "http://ppp.samba.org/ftp/ppp/ppp-${PV}.tar.gz \
            file://fix-CVE-2015-3310.patch \
 "
 
+SRC_URI_append_libc-musl = "\
+           file://0001-Fix-build-with-musl.patch \
+"
 SRC_URI[md5sum] = "78818f40e6d33a1d1de68a1551f6595a"
 SRC_URI[sha256sum] = "02e0a3dd3e4799e33103f70ec7df75348c8540966ee7c948e4ed8a42bbccfb30"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 04/73] tcp-wrappers: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (2 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 03/73] ppp: Fix build with musl Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 05/73] fts: Add recipe Khem Raj
                   ` (69 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch | 31 ++++++++++++++++++++++
 .../tcp-wrappers/tcp-wrappers_7.6.bb               |  4 +++
 2 files changed, 35 insertions(+)
 create mode 100644 meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch

diff --git a/meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch b/meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch
new file mode 100644
index 0000000..eee640e
--- /dev/null
+++ b/meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch
@@ -0,0 +1,31 @@
+__BEGIN_DECLS/__END_DECLS are BSD specific and not defined in musl
+glibc and uclibc had sys/cdefs.h doing it.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: tcp_wrappers_7.6/tcpd.h
+===================================================================
+--- tcp_wrappers_7.6.orig/tcpd.h
++++ tcp_wrappers_7.6/tcpd.h
+@@ -11,7 +11,9 @@
+ #include <netinet/in.h>
+ #include <stdio.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /* Structure to describe one communications endpoint. */
+ 
+@@ -252,6 +254,8 @@ extern char *fix_strtok();
+ extern char *my_strtok();
+ #endif
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif
diff --git a/meta/recipes-extended/tcp-wrappers/tcp-wrappers_7.6.bb b/meta/recipes-extended/tcp-wrappers/tcp-wrappers_7.6.bb
index 2630478..5fdbbce 100644
--- a/meta/recipes-extended/tcp-wrappers/tcp-wrappers_7.6.bb
+++ b/meta/recipes-extended/tcp-wrappers/tcp-wrappers_7.6.bb
@@ -43,6 +43,7 @@ SRC_URI = "ftp://ftp.porcupine.org/pub/security/tcp_wrappers_${PV}.tar.gz \
            file://try-from.8 \
            file://safe_finger.8 \
            file://makefile-fix-parallel.patch \
+           file://musl-decls.patch \
            "
 
 SRC_URI[md5sum] = "e6fa25f71226d090f34de3f6b122fb5a"
@@ -73,6 +74,9 @@ EXTRA_OEMAKE = "'CC=${CC}' \
 
 EXTRA_OEMAKE_NETGROUP = "-DNETGROUP -DUSE_GETDOMAIN"
 EXTRA_OEMAKE_NETGROUP_libc-uclibc = "-DUSE_GETDOMAIN"
+EXTRA_OEMAKE_NETGROUP_libc-musl = "-DUSE_GETDOMAIN"
+
+EXTRA_OEMAKE_append_libc-musl = " 'LIBS='"
 
 do_compile () {
 	oe_runmake 'TABLES=-DHOSTS_DENY=\"${sysconfdir}/hosts.deny\" -DHOSTS_ALLOW=\"${sysconfdir}/hosts.allow\"' \
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 05/73] fts: Add recipe
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (3 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 04/73] tcp-wrappers: " Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 06/73] connman: include config.h for HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR Khem Raj
                   ` (68 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

fts is not implemented in musl but many packages depend on it
glibc implements it even though posix does not requir it to do so.
So provide an alternative provider for fts

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/fts/fts.bb                       |   39 +
 .../fts/fts/fts-header-correctness.patch           |   25 +
 meta/recipes-core/fts/fts/fts-uclibc.patch         |   50 +
 meta/recipes-core/fts/fts/gcc5.patch               | 1368 ++++++++++++++++++++
 meta/recipes-core/fts/fts/remove_cdefs.patch       |   69 +
 meta/recipes-core/fts/fts/stdint.patch             |   15 +
 6 files changed, 1566 insertions(+)
 create mode 100644 meta/recipes-core/fts/fts.bb
 create mode 100644 meta/recipes-core/fts/fts/fts-header-correctness.patch
 create mode 100644 meta/recipes-core/fts/fts/fts-uclibc.patch
 create mode 100644 meta/recipes-core/fts/fts/gcc5.patch
 create mode 100644 meta/recipes-core/fts/fts/remove_cdefs.patch
 create mode 100644 meta/recipes-core/fts/fts/stdint.patch

diff --git a/meta/recipes-core/fts/fts.bb b/meta/recipes-core/fts/fts.bb
new file mode 100644
index 0000000..d8b4ed2
--- /dev/null
+++ b/meta/recipes-core/fts/fts.bb
@@ -0,0 +1,39 @@
+# Copyright (C) 2015 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "keith bostic's POSIX file tree stream operations library"
+HOMEPAGE = "https://sites.google.com/a/bostic.com/keithbostic"
+LICENSE = "BSD-4-Clause"
+LIC_FILES_CHECKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD-4-Clause;md5=624d9e67e8ac41a78f6b6c2c55a83a2b"
+SECTION = "libs"
+
+SRC_URI = "https://sites.google.com/a/bostic.com/keithbostic/files/fts.tar.gz \
+           file://fts-header-correctness.patch \
+           file://fts-uclibc.patch \
+           file://remove_cdefs.patch \
+           file://stdint.patch \
+           file://gcc5.patch \
+"
+
+SRC_URI[md5sum] = "120c14715485ec6ced14f494d059d20a"
+SRC_URI[sha256sum] = "3df9b9b5a45aeaf16f33bb84e692a10dc662e22ec8a51748f98767d67fb6f342"
+
+S = "${WORKDIR}/${BPN}"
+
+do_configure[noexec] = "1"
+
+VER = "0"
+do_compile () {
+    ${CC} -I${S} -fPIC -shared -o libfts.so.${VER} -Wl,-soname,libfts.so.${VER} ${S}/fts.c
+}
+
+do_install() {
+    install -Dm755 ${B}/libfts.so.${VER} ${D}${libdir}/libfts.so.${VER}
+    ln -sf libfts.so.${VER} ${D}${libdir}/libfts.so
+    install -Dm644 ${S}/fts.h ${D}${includedir}/fts.h
+}
+#
+# We will skip parsing for non-musl systems
+#
+COMPATIBLE_HOST = ".*-musl.*"
+
diff --git a/meta/recipes-core/fts/fts/fts-header-correctness.patch b/meta/recipes-core/fts/fts/fts-header-correctness.patch
new file mode 100644
index 0000000..c73ddc9
--- /dev/null
+++ b/meta/recipes-core/fts/fts/fts-header-correctness.patch
@@ -0,0 +1,25 @@
+Included needed headers for compiling with musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate
+
+--- fts.orig/fts.h
++++ fts/fts.h
+@@ -38,6 +38,17 @@
+ #ifndef	_FTS_H_
+ #define	_FTS_H_
+ 
++#include <sys/types.h>
++#include <sys/param.h>
++#include <sys/stat.h>
++
++#include <dirent.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
++
+ typedef struct {
+ 	struct _ftsent *fts_cur;	/* current node */
+ 	struct _ftsent *fts_child;	/* linked list of children */
diff --git a/meta/recipes-core/fts/fts/fts-uclibc.patch b/meta/recipes-core/fts/fts/fts-uclibc.patch
new file mode 100644
index 0000000..397654b
--- /dev/null
+++ b/meta/recipes-core/fts/fts/fts-uclibc.patch
@@ -0,0 +1,50 @@
+Add missing defines for uclibc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate
+
+--- fts.orig/fts.c
++++ fts/fts.c
+@@ -31,6 +31,10 @@
+  * SUCH DAMAGE.
+  */
+ 
++#define	alignof(TYPE)   ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2)
++#define	ALIGNBYTES	(alignof(long double) - 1)
++#define	ALIGN(p)	(((uintptr_t)(p) + ALIGNBYTES) & ~ALIGNBYTES) 
++
+ #if defined(LIBC_SCCS) && !defined(lint)
+ static char sccsid[] = "@(#)fts.c	8.6 (Berkeley) 8/14/94";
+ #endif /* LIBC_SCCS and not lint */
+@@ -652,10 +656,10 @@
+ 		if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
+ 			continue;
+ 
+-		if ((p = fts_alloc(sp, dp->d_name, (int)dp->d_namlen)) == NULL)
++		if ((p = fts_alloc(sp, dp->d_name, (int)dp->d_reclen)) == NULL)
+ 			goto mem1;
+-		if (dp->d_namlen > maxlen) {
+-			if (fts_palloc(sp, (size_t)dp->d_namlen)) {
++		if (dp->d_reclen > maxlen) {
++			if (fts_palloc(sp, (size_t)dp->d_reclen)) {
+ 				/*
+ 				 * No more memory for path or structures.  Save
+ 				 * errno, free up the current structure and the
+@@ -675,7 +679,7 @@
+ 			maxlen = sp->fts_pathlen - sp->fts_cur->fts_pathlen - 1;
+ 		}
+ 
+-		p->fts_pathlen = len + dp->d_namlen + 1;
++		p->fts_pathlen = len + dp->d_reclen + 1;
+ 		p->fts_parent = sp->fts_cur;
+ 		p->fts_level = level;
+ 
+@@ -784,7 +788,7 @@
+ 	/* If user needs stat info, stat buffer already allocated. */
+ 	sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
+ 
+-#ifdef DT_WHT
++#ifdef S_IFWHT
+ 	/*
+ 	 * Whited-out files don't really exist.  However, there's stat(2) file
+ 	 * mask for them, so we set it so that programs (i.e., find) don't have
diff --git a/meta/recipes-core/fts/fts/gcc5.patch b/meta/recipes-core/fts/fts/gcc5.patch
new file mode 100644
index 0000000..f5b948e
--- /dev/null
+++ b/meta/recipes-core/fts/fts/gcc5.patch
@@ -0,0 +1,1368 @@
+Forward port the sources to be able to compile with c99/gcc5
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate
+
+Index: fts/fts.c
+===================================================================
+--- fts.orig/fts.c
++++ fts/fts.c
+@@ -51,16 +51,6 @@ static char sccsid[] = "@(#)fts.c	8.6 (B
+ #include <string.h>
+ #include <unistd.h>
+ 
+-static FTSENT	*fts_alloc __P(FTS *, char *, int);
+-static FTSENT	*fts_build __P(FTS *, int);
+-static void	 fts_lfree __P(FTSENT *);
+-static void	 fts_load __P(FTS *, FTSENT *);
+-static size_t	 fts_maxarglen __P(char * const *);
+-static void	 fts_padjust __P(FTS *, void *);
+-static int	 fts_palloc __P(FTS *, size_t);
+-static FTSENT	*fts_sort __P(FTS *, FTSENT *, int);
+-static u_short	 fts_stat __P(FTS *, struct dirent *, FTSENT *, int);
+-
+ #define	ISDOT(a)	(a[0] == '.' && (!a[1] || a[1] == '.' && !a[2]))
+ 
+ #define	ISSET(opt)	(sp->fts_options & opt)
+@@ -73,119 +63,16 @@ static u_short	 fts_stat __P(FTS *, stru
+ #define	BCHILD		1		/* fts_children */
+ #define	BNAMES		2		/* fts_children, names only */
+ #define	BREAD		3		/* fts_read */
+-
+-FTS *
+-fts_open(argv, options, compar)
+-	char * const *argv;
+-	register int options;
+-	int (*compar)();
+-{
+-	register FTS *sp;
+-	register FTSENT *p, *root;
+-	register int nitems;
+-	FTSENT *parent, *tmp;
+-	int len;
+-
+-	/* Options check. */
+-	if (options & ~FTS_OPTIONMASK) {
+-		errno = EINVAL;
+-		return (NULL);
+-	}
+-
+-	/* Allocate/initialize the stream */
+-	if ((sp = malloc((u_int)sizeof(FTS))) == NULL)
+-		return (NULL);
+-	memset(sp, 0, sizeof(FTS));
+-	sp->fts_compar = compar;
+-	sp->fts_options = options;
+-
+-	/* Logical walks turn on NOCHDIR; symbolic links are too hard. */
+-	if (ISSET(FTS_LOGICAL))
+-		SET(FTS_NOCHDIR);
+-
+-	/*
+-	 * Start out with 1K of path space, and enough, in any case,
+-	 * to hold the user's paths.
+-	 */
+-	if (fts_palloc(sp, MAX(fts_maxarglen(argv), MAXPATHLEN)))
+-		goto mem1;
+-
+-	/* Allocate/initialize root's parent. */
+-	if ((parent = fts_alloc(sp, "", 0)) == NULL)
+-		goto mem2;
+-	parent->fts_level = FTS_ROOTPARENTLEVEL;
+-
+-	/* Allocate/initialize root(s). */
+-	for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) {
+-		/* Don't allow zero-length paths. */
+-		if ((len = strlen(*argv)) == 0) {
+-			errno = EINVAL;
+-			goto mem3;
+-		}
+-
+-		p = fts_alloc(sp, *argv, len);
+-		p->fts_level = FTS_ROOTLEVEL;
+-		p->fts_parent = parent;
+-		p->fts_accpath = p->fts_name;
+-		p->fts_info = fts_stat(sp, NULL, p, ISSET(FTS_COMFOLLOW));
+-
+-		/* Command-line "." and ".." are real directories. */
+-		if (p->fts_info == FTS_DOT)
+-			p->fts_info = FTS_D;
+-
+-		/*
+-		 * If comparison routine supplied, traverse in sorted
+-		 * order; otherwise traverse in the order specified.
+-		 */
+-		if (compar) {
+-			p->fts_link = root;
+-			root = p;
+-		} else {
+-			p->fts_link = NULL;
+-			if (root == NULL)
+-				tmp = root = p;
+-			else {
+-				tmp->fts_link = p;
+-				tmp = p;
+-			}
+-		}
+-	}
+-	if (compar && nitems > 1)
+-		root = fts_sort(sp, root, nitems);
+-
+-	/*
+-	 * Allocate a dummy pointer and make fts_read think that we've just
+-	 * finished the node before the root(s); set p->fts_info to FTS_INIT
+-	 * so that everything about the "current" node is ignored.
+-	 */
+-	if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
+-		goto mem3;
+-	sp->fts_cur->fts_link = root;
+-	sp->fts_cur->fts_info = FTS_INIT;
+-
+-	/*
+-	 * If using chdir(2), grab a file descriptor pointing to dot to insure
+-	 * that we can get back here; this could be avoided for some paths,
+-	 * but almost certainly not worth the effort.  Slashes, symbolic links,
+-	 * and ".." are all fairly nasty problems.  Note, if we can't get the
+-	 * descriptor we run anyway, just more slowly.
+-	 */
+-	if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)
+-		SET(FTS_NOCHDIR);
+-
+-	return (sp);
+-
+-mem3:	fts_lfree(root);
+-	free(parent);
+-mem2:	free(sp->fts_path);
+-mem1:	free(sp);
+-	return (NULL);
+-}
++/*
++ * Special case a root of "/" so that slashes aren't appended which would
++ * cause paths to be written as "//foo".
++ */
++#define	NAPPEND(p)							\
++	(p->fts_level == FTS_ROOTLEVEL && p->fts_pathlen == 1 &&	\
++	    p->fts_path[0] == '/' ? 0 : p->fts_pathlen)
+ 
+ static void
+-fts_load(sp, p)
+-	FTS *sp;
+-	register FTSENT *p;
++fts_load(FTS *sp, register FTSENT *p)
+ {
+ 	register int len;
+ 	register char *cp;
+@@ -208,332 +95,214 @@ fts_load(sp, p)
+ 	sp->fts_dev = p->fts_dev;
+ }
+ 
+-int
+-fts_close(sp)
+-	FTS *sp;
++static void
++fts_lfree(register FTSENT *head)
+ {
+-	register FTSENT *freep, *p;
+-	int saved_errno;
++	register FTSENT *p;
+ 
+-	/*
+-	 * This still works if we haven't read anything -- the dummy structure
+-	 * points to the root list, so we step through to the end of the root
+-	 * list which has a valid parent pointer.
+-	 */
+-	if (sp->fts_cur) {
+-		for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
+-			freep = p;
+-			p = p->fts_link ? p->fts_link : p->fts_parent;
+-			free(freep);
+-		}
++	/* Free a linked list of structures. */
++	while (p = head) {
++		head = head->fts_link;
+ 		free(p);
+ 	}
++}
+ 
+-	/* Free up child linked list, sort array, path buffer. */
+-	if (sp->fts_child)
+-		fts_lfree(sp->fts_child);
+-	if (sp->fts_array)
+-		free(sp->fts_array);
+-	free(sp->fts_path);
++static size_t
++fts_maxarglen(char * const *argv)
++{
++	size_t len, max;
+ 
+-	/* Return to original directory, save errno if necessary. */
+-	if (!ISSET(FTS_NOCHDIR)) {
+-		saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
+-		(void)close(sp->fts_rfd);
+-	}
++	for (max = 0; *argv; ++argv)
++		if ((len = strlen(*argv)) > max)
++			max = len;
++	return (max);
++}
+ 
+-	/* Free up the stream pointer. */
+-	free(sp);
+ 
+-	/* Set errno and return. */
+-	if (!ISSET(FTS_NOCHDIR) && saved_errno) {
+-		errno = saved_errno;
+-		return (-1);
++/*
++ * When the path is realloc'd, have to fix all of the pointers in structures
++ * already returned.
++ */
++static void
++fts_padjust(FTS *sp, void *addr)
++{
++	FTSENT *p;
++
++#define	ADJUST(p) {							\
++	(p)->fts_accpath =						\
++	    (char *)addr + ((p)->fts_accpath - (p)->fts_path);		\
++	(p)->fts_path = addr;						\
++}
++	/* Adjust the current set of children. */
++	for (p = sp->fts_child; p; p = p->fts_link)
++		ADJUST(p);
++
++	/* Adjust the rest of the tree. */
++	for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
++		ADJUST(p);
++		p = p->fts_link ? p->fts_link : p->fts_parent;
+ 	}
+-	return (0);
+ }
+ 
+ /*
+- * Special case a root of "/" so that slashes aren't appended which would
+- * cause paths to be written as "//foo".
++ * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
++ * Most systems will allow creation of paths much longer than MAXPATHLEN, even
++ * though the kernel won't resolve them.  Add the size (not just what's needed)
++ * plus 256 bytes so don't realloc the path 2 bytes at a time.
+  */
+-#define	NAPPEND(p)							\
+-	(p->fts_level == FTS_ROOTLEVEL && p->fts_pathlen == 1 &&	\
+-	    p->fts_path[0] == '/' ? 0 : p->fts_pathlen)
++static int
++fts_palloc(FTS *sp, size_t more)
++{
++	sp->fts_pathlen += more + 256;
++	sp->fts_path = realloc(sp->fts_path, (size_t)sp->fts_pathlen);
++	return (sp->fts_path == NULL);
++}
+ 
+-FTSENT *
+-fts_read(sp)
+-	register FTS *sp;
++static FTSENT *
++fts_alloc(FTS *sp, char *name, register int namelen)
+ {
+-	register FTSENT *p, *tmp;
+-	register int instr;
+-	register char *t;
+-	int saved_errno;
++	register FTSENT *p;
++	size_t len;
+ 
+-	/* If finished or unrecoverable error, return NULL. */
+-	if (sp->fts_cur == NULL || ISSET(FTS_STOP))
++	/*
++	 * The file name is a variable length array and no stat structure is
++	 * necessary if the user has set the nostat bit.  Allocate the FTSENT
++	 * structure, the file name and the stat structure in one chunk, but
++	 * be careful that the stat structure is reasonably aligned.  Since the
++	 * fts_name field is declared to be of size 1, the fts_name pointer is
++	 * namelen + 2 before the first possible address of the stat structure.
++	 */
++	len = sizeof(FTSENT) + namelen;
++	if (!ISSET(FTS_NOSTAT))
++		len += sizeof(struct stat) + ALIGNBYTES;
++	if ((p = malloc(len)) == NULL)
+ 		return (NULL);
+ 
+-	/* Set current node pointer. */
+-	p = sp->fts_cur;
++	/* Copy the name plus the trailing NULL. */
++	memmove(p->fts_name, name, namelen + 1);
+ 
+-	/* Save and zero out user instructions. */
+-	instr = p->fts_instr;
++	if (!ISSET(FTS_NOSTAT))
++		p->fts_statp = (struct stat *)ALIGN(p->fts_name + namelen + 2);
++	p->fts_namelen = namelen;
++	p->fts_path = sp->fts_path;
++	p->fts_errno = 0;
++	p->fts_flags = 0;
+ 	p->fts_instr = FTS_NOINSTR;
++	p->fts_number = 0;
++	p->fts_pointer = NULL;
++	return (p);
++}
+ 
+-	/* Any type of file may be re-visited; re-stat and re-turn. */
+-	if (instr == FTS_AGAIN) {
+-		p->fts_info = fts_stat(sp, NULL, p, 0);
+-		return (p);
+-	}
+ 
++static u_short
++fts_stat(FTS *sp, register FTSENT *p, struct dirent *dp, int follow)
++{
++	register FTSENT *t;
++	register dev_t dev;
++	register ino_t ino;
++	struct stat *sbp, sb;
++	int saved_errno;
++
++	/* If user needs stat info, stat buffer already allocated. */
++	sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
++
++#ifdef S_IFWHT
+ 	/*
+-	 * Following a symlink -- SLNONE test allows application to see
+-	 * SLNONE and recover.  If indirecting through a symlink, have
+-	 * keep a pointer to current location.  If unable to get that
+-	 * pointer, follow fails.
+-	 */
+-	if (instr == FTS_FOLLOW &&
+-	    (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
+-		p->fts_info = fts_stat(sp, NULL, p, 1);
+-		if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
+-			if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
+-				p->fts_errno = errno;
+-				p->fts_info = FTS_ERR;
+-			} else
+-				p->fts_flags |= FTS_SYMFOLLOW;
+-		return (p);
++	 * Whited-out files don't really exist.  However, there's stat(2) file
++	 * mask for them, so we set it so that programs (i.e., find) don't have
++	 * to test FTS_W separately from other file types.
++	 */
++	if (dp != NULL && dp->d_type == DT_WHT) {
++		memset(sbp, 0, sizeof(struct stat));
++		sbp->st_mode = S_IFWHT;
++		return (FTS_W);
+ 	}
+-
+-	/* Directory in pre-order. */
+-	if (p->fts_info == FTS_D) {
+-		/* If skipped or crossed mount point, do post-order visit. */
+-		if (instr == FTS_SKIP ||
+-		    ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev) {
+-			if (p->fts_flags & FTS_SYMFOLLOW)
+-				(void)close(p->fts_symfd);
+-			if (sp->fts_child) {
+-				fts_lfree(sp->fts_child);
+-				sp->fts_child = NULL;
+-			}
+-			p->fts_info = FTS_DP;
+-			return (p);
+-		} 
+-
+-		/* Rebuild if only read the names and now traversing. */
+-		if (sp->fts_child && sp->fts_options & FTS_NAMEONLY) {
+-			sp->fts_options &= ~FTS_NAMEONLY;
+-			fts_lfree(sp->fts_child);
+-			sp->fts_child = NULL;
+-		}
+-
+-		/*
+-		 * Cd to the subdirectory.
+-		 *
+-		 * If have already read and now fail to chdir, whack the list
+-		 * to make the names come out right, and set the parent errno
+-		 * so the application will eventually get an error condition.
+-		 * Set the FTS_DONTCHDIR flag so that when we logically change
+-		 * directories back to the parent we don't do a chdir.
+-		 *
+-		 * If haven't read do so.  If the read fails, fts_build sets
+-		 * FTS_STOP or the fts_info field of the node.
+-		 */
+-		if (sp->fts_child) {
+-			if (CHDIR(sp, p->fts_accpath)) {
+-				p->fts_errno = errno;
+-				p->fts_flags |= FTS_DONTCHDIR;
+-				for (p = sp->fts_child; p; p = p->fts_link)
+-					p->fts_accpath =
+-					    p->fts_parent->fts_accpath;
+-			}
+-		} else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
+-			if (ISSET(FTS_STOP))
+-				return (NULL);
+-			return (p);
++#endif
++
++	/*
++	 * If doing a logical walk, or application requested FTS_FOLLOW, do
++	 * a stat(2).  If that fails, check for a non-existent symlink.  If
++	 * fail, set the errno from the stat call.
++	 */
++	if (ISSET(FTS_LOGICAL) || follow) {
++		if (stat(p->fts_accpath, sbp)) {
++			saved_errno = errno;
++			if (!lstat(p->fts_accpath, sbp)) {
++				errno = 0;
++				return (FTS_SLNONE);
++			}
++			p->fts_errno = saved_errno;
++			goto err;
+ 		}
+-		p = sp->fts_child;
+-		sp->fts_child = NULL;
+-		goto name;
++	} else if (lstat(p->fts_accpath, sbp)) {
++		p->fts_errno = errno;
++err:		memset(sbp, 0, sizeof(struct stat));
++		return (FTS_NS);
+ 	}
+ 
+-	/* Move to the next node on this level. */
+-next:	tmp = p;
+-	if (p = p->fts_link) {
+-		free(tmp);
+-
+-		/*
+-		 * If reached the top, return to the original directory, and
+-		 * load the paths for the next root.
+-		 */
+-		if (p->fts_level == FTS_ROOTLEVEL) {
+-			if (!ISSET(FTS_NOCHDIR) && FCHDIR(sp, sp->fts_rfd)) {
+-				SET(FTS_STOP);
+-				return (NULL);
+-			}
+-			fts_load(sp, p);
+-			return (sp->fts_cur = p);
+-		}
+-
++	if (S_ISDIR(sbp->st_mode)) {
+ 		/*
+-		 * User may have called fts_set on the node.  If skipped,
+-		 * ignore.  If followed, get a file descriptor so we can
+-		 * get back if necessary.
++		 * Set the device/inode.  Used to find cycles and check for
++		 * crossing mount points.  Also remember the link count, used
++		 * in fts_build to limit the number of stat calls.  It is
++		 * understood that these fields are only referenced if fts_info
++		 * is set to FTS_D.
+ 		 */
+-		if (p->fts_instr == FTS_SKIP)
+-			goto next;
+-		if (p->fts_instr == FTS_FOLLOW) {
+-			p->fts_info = fts_stat(sp, NULL, p, 1);
+-			if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
+-				if ((p->fts_symfd =
+-				    open(".", O_RDONLY, 0)) < 0) {
+-					p->fts_errno = errno;
+-					p->fts_info = FTS_ERR;
+-				} else
+-					p->fts_flags |= FTS_SYMFOLLOW;
+-			p->fts_instr = FTS_NOINSTR;
+-		}
+-
+-name:		t = sp->fts_path + NAPPEND(p->fts_parent);
+-		*t++ = '/';
+-		memmove(t, p->fts_name, p->fts_namelen + 1);
+-		return (sp->fts_cur = p);
+-	}
++		dev = p->fts_dev = sbp->st_dev;
++		ino = p->fts_ino = sbp->st_ino;
++		p->fts_nlink = sbp->st_nlink;
+ 
+-	/* Move up to the parent node. */
+-	p = tmp->fts_parent;
+-	free(tmp);
++		if (ISDOT(p->fts_name))
++			return (FTS_DOT);
+ 
+-	if (p->fts_level == FTS_ROOTPARENTLEVEL) {
+ 		/*
+-		 * Done; free everything up and set errno to 0 so the user
+-		 * can distinguish between error and EOF.
++		 * Cycle detection is done by brute force when the directory
++		 * is first encountered.  If the tree gets deep enough or the
++		 * number of symbolic links to directories is high enough,
++		 * something faster might be worthwhile.
+ 		 */
+-		free(p);
+-		errno = 0;
+-		return (sp->fts_cur = NULL);
+-	}
+-
+-	/* Nul terminate the pathname. */
+-	sp->fts_path[p->fts_pathlen] = '\0';
+-
+-	/*
+-	 * Return to the parent directory.  If at a root node or came through
+-	 * a symlink, go back through the file descriptor.  Otherwise, cd up
+-	 * one directory.
+-	 */
+-	if (p->fts_level == FTS_ROOTLEVEL) {
+-		if (!ISSET(FTS_NOCHDIR) && FCHDIR(sp, sp->fts_rfd)) {
+-			SET(FTS_STOP);
+-			return (NULL);
+-		}
+-	} else if (p->fts_flags & FTS_SYMFOLLOW) {
+-		if (FCHDIR(sp, p->fts_symfd)) {
+-			saved_errno = errno;
+-			(void)close(p->fts_symfd);
+-			errno = saved_errno;
+-			SET(FTS_STOP);
+-			return (NULL);
+-		}
+-		(void)close(p->fts_symfd);
+-	} else if (!(p->fts_flags & FTS_DONTCHDIR)) {
+-		if (CHDIR(sp, "..")) {
+-			SET(FTS_STOP);
+-			return (NULL);
+-		}
+-	}
+-	p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
+-	return (sp->fts_cur = p);
+-}
+-
+-/*
+- * Fts_set takes the stream as an argument although it's not used in this
+- * implementation; it would be necessary if anyone wanted to add global
+- * semantics to fts using fts_set.  An error return is allowed for similar
+- * reasons.
+- */
+-/* ARGSUSED */
+-int
+-fts_set(sp, p, instr)
+-	FTS *sp;
+-	FTSENT *p;
+-	int instr;
+-{
+-	if (instr && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
+-	    instr != FTS_NOINSTR && instr != FTS_SKIP) {
+-		errno = EINVAL;
+-		return (1);
++		for (t = p->fts_parent;
++		    t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
++			if (ino == t->fts_ino && dev == t->fts_dev) {
++				p->fts_cycle = t;
++				return (FTS_DC);
++			}
++		return (FTS_D);
+ 	}
+-	p->fts_instr = instr;
+-	return (0);
++	if (S_ISLNK(sbp->st_mode))
++		return (FTS_SL);
++	if (S_ISREG(sbp->st_mode))
++		return (FTS_F);
++	return (FTS_DEFAULT);
+ }
+ 
+-FTSENT *
+-fts_children(sp, instr)
+-	register FTS *sp;
+-	int instr;
++static FTSENT *
++fts_sort(FTS *sp, FTSENT *head, register int nitems)
+ {
+-	register FTSENT *p;
+-	int fd;
+-
+-	if (instr && instr != FTS_NAMEONLY) {
+-		errno = EINVAL;
+-		return (NULL);
+-	}
+-
+-	/* Set current node pointer. */
+-	p = sp->fts_cur;
+-
+-	/*
+-	 * Errno set to 0 so user can distinguish empty directory from
+-	 * an error.
+-	 */
+-	errno = 0;
+-
+-	/* Fatal errors stop here. */
+-	if (ISSET(FTS_STOP))
+-		return (NULL);
+-
+-	/* Return logical hierarchy of user's arguments. */
+-	if (p->fts_info == FTS_INIT)
+-		return (p->fts_link);
+-
+-	/*
+-	 * If not a directory being visited in pre-order, stop here.  Could
+-	 * allow FTS_DNR, assuming the user has fixed the problem, but the
+-	 * same effect is available with FTS_AGAIN.
+-	 */
+-	if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */)
+-		return (NULL);
+-
+-	/* Free up any previous child list. */
+-	if (sp->fts_child)
+-		fts_lfree(sp->fts_child);
+-
+-	if (instr == FTS_NAMEONLY) {
+-		sp->fts_options |= FTS_NAMEONLY;
+-		instr = BNAMES;
+-	} else 
+-		instr = BCHILD;
++	register FTSENT **ap, *p;
+ 
+ 	/*
+-	 * If using chdir on a relative path and called BEFORE fts_read does
+-	 * its chdir to the root of a traversal, we can lose -- we need to
+-	 * chdir into the subdirectory, and we don't know where the current
+-	 * directory is, so we can't get back so that the upcoming chdir by
+-	 * fts_read will work.
++	 * Construct an array of pointers to the structures and call qsort(3).
++	 * Reassemble the array in the order returned by qsort.  If unable to
++	 * sort for memory reasons, return the directory entries in their
++	 * current order.  Allocate enough space for the current needs plus
++	 * 40 so don't realloc one entry at a time.
+ 	 */
+-	if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' ||
+-	    ISSET(FTS_NOCHDIR))
+-		return (sp->fts_child = fts_build(sp, instr));
+-
+-	if ((fd = open(".", O_RDONLY, 0)) < 0)
+-		return (NULL);
+-	sp->fts_child = fts_build(sp, instr);
+-	if (fchdir(fd))
+-		return (NULL);
+-	(void)close(fd);
+-	return (sp->fts_child);
++	if (nitems > sp->fts_nitems) {
++		sp->fts_nitems = nitems + 40;
++		if ((sp->fts_array = realloc(sp->fts_array,
++		    (size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) {
++			sp->fts_nitems = 0;
++			return (head);
++		}
++	}
++	for (ap = sp->fts_array, p = head; p; p = p->fts_link)
++		*ap++ = p;
++	qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);
++	for (head = *(ap = sp->fts_array); --nitems; ++ap)
++		ap[0]->fts_link = ap[1];
++	ap[0]->fts_link = NULL;
++	return (head);
+ }
+ 
+ /*
+@@ -551,9 +320,7 @@ fts_children(sp, instr)
+  * been found, cutting the stat calls by about 2/3.
+  */
+ static FTSENT *
+-fts_build(sp, type)
+-	register FTS *sp;
+-	int type;
++fts_build(register FTS *sp, int type)
+ {
+ 	register struct dirent *dp;
+ 	register FTSENT *p, *head;
+@@ -716,283 +483,479 @@ mem1:				saved_errno = errno;
+ 				--nlinks;
+ 		}
+ 
+-		/* We walk in directory order so "ls -f" doesn't get upset. */
+-		p->fts_link = NULL;
+-		if (head == NULL)
+-			head = tail = p;
+-		else {
+-			tail->fts_link = p;
+-			tail = p;
++		/* We walk in directory order so "ls -f" doesn't get upset. */
++		p->fts_link = NULL;
++		if (head == NULL)
++			head = tail = p;
++		else {
++			tail->fts_link = p;
++			tail = p;
++		}
++		++nitems;
++	}
++	(void)closedir(dirp);
++
++	/*
++	 * If had to realloc the path, adjust the addresses for the rest
++	 * of the tree.
++	 */
++	if (adjaddr)
++		fts_padjust(sp, adjaddr);
++
++	/*
++	 * If not changing directories, reset the path back to original
++	 * state.
++	 */
++	if (ISSET(FTS_NOCHDIR)) {
++		if (cp - 1 > sp->fts_path)
++			--cp;
++		*cp = '\0';
++	}
++
++	/*
++	 * If descended after called from fts_children or after called from
++	 * fts_read and nothing found, get back.  At the root level we use
++	 * the saved fd; if one of fts_open()'s arguments is a relative path
++	 * to an empty directory, we wind up here with no other way back.  If
++	 * can't get back, we're done.
++	 */
++	if (descend && (type == BCHILD || !nitems) &&
++	    (cur->fts_level == FTS_ROOTLEVEL ?
++	    FCHDIR(sp, sp->fts_rfd) : CHDIR(sp, ".."))) {
++		cur->fts_info = FTS_ERR;
++		SET(FTS_STOP);
++		return (NULL);
++	}
++
++	/* If didn't find anything, return NULL. */
++	if (!nitems) {
++		if (type == BREAD)
++			cur->fts_info = FTS_DP;
++		return (NULL);
++	}
++
++	/* Sort the entries. */
++	if (sp->fts_compar && nitems > 1)
++		head = fts_sort(sp, head, nitems);
++	return (head);
++}
++
++
++FTS *
++fts_open(char * const *argv, register int options, int (*compar)())
++{
++	register FTS *sp;
++	register FTSENT *p, *root;
++	register int nitems;
++	FTSENT *parent, *tmp;
++	int len;
++
++	/* Options check. */
++	if (options & ~FTS_OPTIONMASK) {
++		errno = EINVAL;
++		return (NULL);
++	}
++
++	/* Allocate/initialize the stream */
++	if ((sp = malloc((u_int)sizeof(FTS))) == NULL)
++		return (NULL);
++	memset(sp, 0, sizeof(FTS));
++	sp->fts_compar = compar;
++	sp->fts_options = options;
++
++	/* Logical walks turn on NOCHDIR; symbolic links are too hard. */
++	if (ISSET(FTS_LOGICAL))
++		SET(FTS_NOCHDIR);
++
++	/*
++	 * Start out with 1K of path space, and enough, in any case,
++	 * to hold the user's paths.
++	 */
++	if (fts_palloc(sp, MAX(fts_maxarglen(argv), MAXPATHLEN)))
++		goto mem1;
++
++	/* Allocate/initialize root's parent. */
++	if ((parent = fts_alloc(sp, "", 0)) == NULL)
++		goto mem2;
++	parent->fts_level = FTS_ROOTPARENTLEVEL;
++
++	/* Allocate/initialize root(s). */
++	for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) {
++		/* Don't allow zero-length paths. */
++		if ((len = strlen(*argv)) == 0) {
++			errno = EINVAL;
++			goto mem3;
++		}
++
++		p = fts_alloc(sp, *argv, len);
++		p->fts_level = FTS_ROOTLEVEL;
++		p->fts_parent = parent;
++		p->fts_accpath = p->fts_name;
++		p->fts_info = fts_stat(sp, NULL, p, ISSET(FTS_COMFOLLOW));
++
++		/* Command-line "." and ".." are real directories. */
++		if (p->fts_info == FTS_DOT)
++			p->fts_info = FTS_D;
++
++		/*
++		 * If comparison routine supplied, traverse in sorted
++		 * order; otherwise traverse in the order specified.
++		 */
++		if (compar) {
++			p->fts_link = root;
++			root = p;
++		} else {
++			p->fts_link = NULL;
++			if (root == NULL)
++				tmp = root = p;
++			else {
++				tmp->fts_link = p;
++				tmp = p;
++			}
+ 		}
+-		++nitems;
+ 	}
+-	(void)closedir(dirp);
+-
+-	/*
+-	 * If had to realloc the path, adjust the addresses for the rest
+-	 * of the tree.
+-	 */
+-	if (adjaddr)
+-		fts_padjust(sp, adjaddr);
++	if (compar && nitems > 1)
++		root = fts_sort(sp, root, nitems);
+ 
+ 	/*
+-	 * If not changing directories, reset the path back to original
+-	 * state.
++	 * Allocate a dummy pointer and make fts_read think that we've just
++	 * finished the node before the root(s); set p->fts_info to FTS_INIT
++	 * so that everything about the "current" node is ignored.
+ 	 */
+-	if (ISSET(FTS_NOCHDIR)) {
+-		if (cp - 1 > sp->fts_path)
+-			--cp;
+-		*cp = '\0';
+-	}
++	if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
++		goto mem3;
++	sp->fts_cur->fts_link = root;
++	sp->fts_cur->fts_info = FTS_INIT;
+ 
+ 	/*
+-	 * If descended after called from fts_children or after called from
+-	 * fts_read and nothing found, get back.  At the root level we use
+-	 * the saved fd; if one of fts_open()'s arguments is a relative path
+-	 * to an empty directory, we wind up here with no other way back.  If
+-	 * can't get back, we're done.
++	 * If using chdir(2), grab a file descriptor pointing to dot to insure
++	 * that we can get back here; this could be avoided for some paths,
++	 * but almost certainly not worth the effort.  Slashes, symbolic links,
++	 * and ".." are all fairly nasty problems.  Note, if we can't get the
++	 * descriptor we run anyway, just more slowly.
+ 	 */
+-	if (descend && (type == BCHILD || !nitems) &&
+-	    (cur->fts_level == FTS_ROOTLEVEL ?
+-	    FCHDIR(sp, sp->fts_rfd) : CHDIR(sp, ".."))) {
+-		cur->fts_info = FTS_ERR;
+-		SET(FTS_STOP);
+-		return (NULL);
+-	}
++	if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)
++		SET(FTS_NOCHDIR);
+ 
+-	/* If didn't find anything, return NULL. */
+-	if (!nitems) {
+-		if (type == BREAD)
+-			cur->fts_info = FTS_DP;
+-		return (NULL);
+-	}
++	return (sp);
+ 
+-	/* Sort the entries. */
+-	if (sp->fts_compar && nitems > 1)
+-		head = fts_sort(sp, head, nitems);
+-	return (head);
++mem3:	fts_lfree(root);
++	free(parent);
++mem2:	free(sp->fts_path);
++mem1:	free(sp);
++	return (NULL);
+ }
+ 
+-static u_short
+-fts_stat(sp, dp, p, follow)
+-	FTS *sp;
+-	register FTSENT *p;
+-	struct dirent *dp;
+-	int follow;
++FTSENT *
++fts_read(register FTS *sp)
+ {
+-	register FTSENT *t;
+-	register dev_t dev;
+-	register ino_t ino;
+-	struct stat *sbp, sb;
++	register FTSENT *p, *tmp;
++	register int instr;
++	register char *t;
+ 	int saved_errno;
+ 
+-	/* If user needs stat info, stat buffer already allocated. */
+-	sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
++	/* If finished or unrecoverable error, return NULL. */
++	if (sp->fts_cur == NULL || ISSET(FTS_STOP))
++		return (NULL);
+ 
+-#ifdef S_IFWHT
+-	/*
+-	 * Whited-out files don't really exist.  However, there's stat(2) file
+-	 * mask for them, so we set it so that programs (i.e., find) don't have
+-	 * to test FTS_W separately from other file types.
+-	 */
+-	if (dp != NULL && dp->d_type == DT_WHT) {
+-		memset(sbp, 0, sizeof(struct stat));
+-		sbp->st_mode = S_IFWHT;
+-		return (FTS_W);
++	/* Set current node pointer. */
++	p = sp->fts_cur;
++
++	/* Save and zero out user instructions. */
++	instr = p->fts_instr;
++	p->fts_instr = FTS_NOINSTR;
++
++	/* Any type of file may be re-visited; re-stat and re-turn. */
++	if (instr == FTS_AGAIN) {
++		p->fts_info = fts_stat(sp, NULL, p, 0);
++		return (p);
+ 	}
+-#endif
+-	
++
+ 	/*
+-	 * If doing a logical walk, or application requested FTS_FOLLOW, do
+-	 * a stat(2).  If that fails, check for a non-existent symlink.  If
+-	 * fail, set the errno from the stat call.
++	 * Following a symlink -- SLNONE test allows application to see
++	 * SLNONE and recover.  If indirecting through a symlink, have
++	 * keep a pointer to current location.  If unable to get that
++	 * pointer, follow fails.
+ 	 */
+-	if (ISSET(FTS_LOGICAL) || follow) {
+-		if (stat(p->fts_accpath, sbp)) {
+-			saved_errno = errno;
+-			if (!lstat(p->fts_accpath, sbp)) {
+-				errno = 0;
+-				return (FTS_SLNONE);
+-			} 
+-			p->fts_errno = saved_errno;
+-			goto err;
++	if (instr == FTS_FOLLOW &&
++	    (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
++		p->fts_info = fts_stat(sp, NULL, p, 1);
++		if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
++			if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
++				p->fts_errno = errno;
++				p->fts_info = FTS_ERR;
++			} else
++				p->fts_flags |= FTS_SYMFOLLOW;
++		return (p);
++	}
++
++	/* Directory in pre-order. */
++	if (p->fts_info == FTS_D) {
++		/* If skipped or crossed mount point, do post-order visit. */
++		if (instr == FTS_SKIP ||
++		    ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev) {
++			if (p->fts_flags & FTS_SYMFOLLOW)
++				(void)close(p->fts_symfd);
++			if (sp->fts_child) {
++				fts_lfree(sp->fts_child);
++				sp->fts_child = NULL;
++			}
++			p->fts_info = FTS_DP;
++			return (p);
+ 		}
+-	} else if (lstat(p->fts_accpath, sbp)) {
+-		p->fts_errno = errno;
+-err:		memset(sbp, 0, sizeof(struct stat));
+-		return (FTS_NS);
++
++		/* Rebuild if only read the names and now traversing. */
++		if (sp->fts_child && sp->fts_options & FTS_NAMEONLY) {
++			sp->fts_options &= ~FTS_NAMEONLY;
++			fts_lfree(sp->fts_child);
++			sp->fts_child = NULL;
++		}
++
++		/*
++		 * Cd to the subdirectory.
++		 *
++		 * If have already read and now fail to chdir, whack the list
++		 * to make the names come out right, and set the parent errno
++		 * so the application will eventually get an error condition.
++		 * Set the FTS_DONTCHDIR flag so that when we logically change
++		 * directories back to the parent we don't do a chdir.
++		 *
++		 * If haven't read do so.  If the read fails, fts_build sets
++		 * FTS_STOP or the fts_info field of the node.
++		 */
++		if (sp->fts_child) {
++			if (CHDIR(sp, p->fts_accpath)) {
++				p->fts_errno = errno;
++				p->fts_flags |= FTS_DONTCHDIR;
++				for (p = sp->fts_child; p; p = p->fts_link)
++					p->fts_accpath =
++					    p->fts_parent->fts_accpath;
++			}
++		} else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
++			if (ISSET(FTS_STOP))
++				return (NULL);
++			return (p);
++		}
++		p = sp->fts_child;
++		sp->fts_child = NULL;
++		goto name;
+ 	}
+ 
+-	if (S_ISDIR(sbp->st_mode)) {
++	/* Move to the next node on this level. */
++next:	tmp = p;
++	if (p = p->fts_link) {
++		free(tmp);
++
+ 		/*
+-		 * Set the device/inode.  Used to find cycles and check for
+-		 * crossing mount points.  Also remember the link count, used
+-		 * in fts_build to limit the number of stat calls.  It is
+-		 * understood that these fields are only referenced if fts_info
+-		 * is set to FTS_D.
++		 * If reached the top, return to the original directory, and
++		 * load the paths for the next root.
+ 		 */
+-		dev = p->fts_dev = sbp->st_dev;
+-		ino = p->fts_ino = sbp->st_ino;
+-		p->fts_nlink = sbp->st_nlink;
++		if (p->fts_level == FTS_ROOTLEVEL) {
++			if (!ISSET(FTS_NOCHDIR) && FCHDIR(sp, sp->fts_rfd)) {
++				SET(FTS_STOP);
++				return (NULL);
++			}
++			fts_load(sp, p);
++			return (sp->fts_cur = p);
++		}
++
++		/*
++		 * User may have called fts_set on the node.  If skipped,
++		 * ignore.  If followed, get a file descriptor so we can
++		 * get back if necessary.
++		 */
++		if (p->fts_instr == FTS_SKIP)
++			goto next;
++		if (p->fts_instr == FTS_FOLLOW) {
++			p->fts_info = fts_stat(sp, NULL, p, 1);
++			if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
++				if ((p->fts_symfd =
++				    open(".", O_RDONLY, 0)) < 0) {
++					p->fts_errno = errno;
++					p->fts_info = FTS_ERR;
++				} else
++					p->fts_flags |= FTS_SYMFOLLOW;
++			p->fts_instr = FTS_NOINSTR;
++		}
+ 
+-		if (ISDOT(p->fts_name))
+-			return (FTS_DOT);
++name:		t = sp->fts_path + NAPPEND(p->fts_parent);
++		*t++ = '/';
++		memmove(t, p->fts_name, p->fts_namelen + 1);
++		return (sp->fts_cur = p);
++	}
+ 
++	/* Move up to the parent node. */
++	p = tmp->fts_parent;
++	free(tmp);
++
++	if (p->fts_level == FTS_ROOTPARENTLEVEL) {
+ 		/*
+-		 * Cycle detection is done by brute force when the directory
+-		 * is first encountered.  If the tree gets deep enough or the
+-		 * number of symbolic links to directories is high enough,
+-		 * something faster might be worthwhile.
++		 * Done; free everything up and set errno to 0 so the user
++		 * can distinguish between error and EOF.
+ 		 */
+-		for (t = p->fts_parent;
+-		    t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
+-			if (ino == t->fts_ino && dev == t->fts_dev) {
+-				p->fts_cycle = t;
+-				return (FTS_DC);
+-			}
+-		return (FTS_D);
++		free(p);
++		errno = 0;
++		return (sp->fts_cur = NULL);
+ 	}
+-	if (S_ISLNK(sbp->st_mode))
+-		return (FTS_SL);
+-	if (S_ISREG(sbp->st_mode))
+-		return (FTS_F);
+-	return (FTS_DEFAULT);
+-}
+ 
+-static FTSENT *
+-fts_sort(sp, head, nitems)
+-	FTS *sp;
+-	FTSENT *head;
+-	register int nitems;
+-{
+-	register FTSENT **ap, *p;
++	/* Nul terminate the pathname. */
++	sp->fts_path[p->fts_pathlen] = '\0';
+ 
+ 	/*
+-	 * Construct an array of pointers to the structures and call qsort(3).
+-	 * Reassemble the array in the order returned by qsort.  If unable to
+-	 * sort for memory reasons, return the directory entries in their
+-	 * current order.  Allocate enough space for the current needs plus
+-	 * 40 so don't realloc one entry at a time.
++	 * Return to the parent directory.  If at a root node or came through
++	 * a symlink, go back through the file descriptor.  Otherwise, cd up
++	 * one directory.
+ 	 */
+-	if (nitems > sp->fts_nitems) {
+-		sp->fts_nitems = nitems + 40;
+-		if ((sp->fts_array = realloc(sp->fts_array,
+-		    (size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) {
+-			sp->fts_nitems = 0;
+-			return (head);
++	if (p->fts_level == FTS_ROOTLEVEL) {
++		if (!ISSET(FTS_NOCHDIR) && FCHDIR(sp, sp->fts_rfd)) {
++			SET(FTS_STOP);
++			return (NULL);
++		}
++	} else if (p->fts_flags & FTS_SYMFOLLOW) {
++		if (FCHDIR(sp, p->fts_symfd)) {
++			saved_errno = errno;
++			(void)close(p->fts_symfd);
++			errno = saved_errno;
++			SET(FTS_STOP);
++			return (NULL);
++		}
++		(void)close(p->fts_symfd);
++	} else if (!(p->fts_flags & FTS_DONTCHDIR)) {
++		if (CHDIR(sp, "..")) {
++			SET(FTS_STOP);
++			return (NULL);
+ 		}
+ 	}
+-	for (ap = sp->fts_array, p = head; p; p = p->fts_link)
+-		*ap++ = p;
+-	qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);
+-	for (head = *(ap = sp->fts_array); --nitems; ++ap)
+-		ap[0]->fts_link = ap[1];
+-	ap[0]->fts_link = NULL;
+-	return (head);
++	p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
++	return (sp->fts_cur = p);
+ }
+ 
+-static FTSENT *
+-fts_alloc(sp, name, namelen)
+-	FTS *sp;
+-	char *name;
+-	register int namelen;
++/*
++ * Fts_set takes the stream as an argument although it's not used in this
++ * implementation; it would be necessary if anyone wanted to add global
++ * semantics to fts using fts_set.  An error return is allowed for similar
++ * reasons.
++ */
++/* ARGSUSED */
++int
++fts_set(FTS *sp, FTSENT *p, int instr)
++{
++	if (instr && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
++	    instr != FTS_NOINSTR && instr != FTS_SKIP) {
++		errno = EINVAL;
++		return (1);
++	}
++	p->fts_instr = instr;
++	return (0);
++}
++
++FTSENT *
++fts_children(register FTS *sp, int instr)
+ {
+ 	register FTSENT *p;
+-	size_t len;
++	int fd;
++
++	if (instr && instr != FTS_NAMEONLY) {
++		errno = EINVAL;
++		return (NULL);
++	}
++
++	/* Set current node pointer. */
++	p = sp->fts_cur;
+ 
+ 	/*
+-	 * The file name is a variable length array and no stat structure is
+-	 * necessary if the user has set the nostat bit.  Allocate the FTSENT
+-	 * structure, the file name and the stat structure in one chunk, but
+-	 * be careful that the stat structure is reasonably aligned.  Since the
+-	 * fts_name field is declared to be of size 1, the fts_name pointer is
+-	 * namelen + 2 before the first possible address of the stat structure.
++	 * Errno set to 0 so user can distinguish empty directory from
++	 * an error.
+ 	 */
+-	len = sizeof(FTSENT) + namelen;
+-	if (!ISSET(FTS_NOSTAT))
+-		len += sizeof(struct stat) + ALIGNBYTES;
+-	if ((p = malloc(len)) == NULL)
++	errno = 0;
++
++	/* Fatal errors stop here. */
++	if (ISSET(FTS_STOP))
+ 		return (NULL);
+ 
+-	/* Copy the name plus the trailing NULL. */
+-	memmove(p->fts_name, name, namelen + 1);
++	/* Return logical hierarchy of user's arguments. */
++	if (p->fts_info == FTS_INIT)
++		return (p->fts_link);
+ 
+-	if (!ISSET(FTS_NOSTAT))
+-		p->fts_statp = (struct stat *)ALIGN(p->fts_name + namelen + 2);
+-	p->fts_namelen = namelen;
+-	p->fts_path = sp->fts_path;
+-	p->fts_errno = 0;
+-	p->fts_flags = 0;
+-	p->fts_instr = FTS_NOINSTR;
+-	p->fts_number = 0;
+-	p->fts_pointer = NULL;
+-	return (p);
++	/*
++	 * If not a directory being visited in pre-order, stop here.  Could
++	 * allow FTS_DNR, assuming the user has fixed the problem, but the
++	 * same effect is available with FTS_AGAIN.
++	 */
++	if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */)
++		return (NULL);
++
++	/* Free up any previous child list. */
++	if (sp->fts_child)
++		fts_lfree(sp->fts_child);
++
++	if (instr == FTS_NAMEONLY) {
++		sp->fts_options |= FTS_NAMEONLY;
++		instr = BNAMES;
++	} else
++		instr = BCHILD;
++
++	/*
++	 * If using chdir on a relative path and called BEFORE fts_read does
++	 * its chdir to the root of a traversal, we can lose -- we need to
++	 * chdir into the subdirectory, and we don't know where the current
++	 * directory is, so we can't get back so that the upcoming chdir by
++	 * fts_read will work.
++	 */
++	if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' ||
++	    ISSET(FTS_NOCHDIR))
++		return (sp->fts_child = fts_build(sp, instr));
++
++	if ((fd = open(".", O_RDONLY, 0)) < 0)
++		return (NULL);
++	sp->fts_child = fts_build(sp, instr);
++	if (fchdir(fd))
++		return (NULL);
++	(void)close(fd);
++	return (sp->fts_child);
+ }
+ 
+-static void
+-fts_lfree(head)
+-	register FTSENT *head;
++int
++fts_close(FTS *sp)
+ {
+-	register FTSENT *p;
++	register FTSENT *freep, *p;
++	int saved_errno;
+ 
+-	/* Free a linked list of structures. */
+-	while (p = head) {
+-		head = head->fts_link;
++	/*
++	 * This still works if we haven't read anything -- the dummy structure
++	 * points to the root list, so we step through to the end of the root
++	 * list which has a valid parent pointer.
++	 */
++	if (sp->fts_cur) {
++		for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
++			freep = p;
++			p = p->fts_link ? p->fts_link : p->fts_parent;
++			free(freep);
++		}
+ 		free(p);
+ 	}
+-}
+ 
+-/*
+- * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
+- * Most systems will allow creation of paths much longer than MAXPATHLEN, even
+- * though the kernel won't resolve them.  Add the size (not just what's needed)
+- * plus 256 bytes so don't realloc the path 2 bytes at a time. 
+- */
+-static int
+-fts_palloc(sp, more)
+-	FTS *sp;
+-	size_t more;
+-{
+-	sp->fts_pathlen += more + 256;
+-	sp->fts_path = realloc(sp->fts_path, (size_t)sp->fts_pathlen);
+-	return (sp->fts_path == NULL);
+-}
++	/* Free up child linked list, sort array, path buffer. */
++	if (sp->fts_child)
++		fts_lfree(sp->fts_child);
++	if (sp->fts_array)
++		free(sp->fts_array);
++	free(sp->fts_path);
+ 
+-/*
+- * When the path is realloc'd, have to fix all of the pointers in structures
+- * already returned.
+- */
+-static void
+-fts_padjust(sp, addr)
+-	FTS *sp;
+-	void *addr;
+-{
+-	FTSENT *p;
++	/* Return to original directory, save errno if necessary. */
++	if (!ISSET(FTS_NOCHDIR)) {
++		saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
++		(void)close(sp->fts_rfd);
++	}
+ 
+-#define	ADJUST(p) {							\
+-	(p)->fts_accpath =						\
+-	    (char *)addr + ((p)->fts_accpath - (p)->fts_path);		\
+-	(p)->fts_path = addr;						\
+-}
+-	/* Adjust the current set of children. */
+-	for (p = sp->fts_child; p; p = p->fts_link)
+-		ADJUST(p);
++	/* Free up the stream pointer. */
++	free(sp);
+ 
+-	/* Adjust the rest of the tree. */
+-	for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
+-		ADJUST(p);
+-		p = p->fts_link ? p->fts_link : p->fts_parent;
++	/* Set errno and return. */
++	if (!ISSET(FTS_NOCHDIR) && saved_errno) {
++		errno = saved_errno;
++		return (-1);
+ 	}
++	return (0);
+ }
+ 
+-static size_t
+-fts_maxarglen(argv)
+-	char * const *argv;
+-{
+-	size_t len, max;
+-
+-	for (max = 0; *argv; ++argv)
+-		if ((len = strlen(*argv)) > max)
+-			max = len;
+-	return (max);
+-}
diff --git a/meta/recipes-core/fts/fts/remove_cdefs.patch b/meta/recipes-core/fts/fts/remove_cdefs.patch
new file mode 100644
index 0000000..c152704
--- /dev/null
+++ b/meta/recipes-core/fts/fts/remove_cdefs.patch
@@ -0,0 +1,69 @@
+Replace use of macros from sys/cdefs.h since cdefs.h is missing on musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate
+
+Index: fts/fts.h
+===================================================================
+--- fts.orig/fts.h
++++ fts/fts.h
+@@ -126,15 +126,21 @@ typedef struct _ftsent {
+ 	char fts_name[1];		/* file name */
+ } FTSENT;
+ 
+-#include <sys/cdefs.h>
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+-__BEGIN_DECLS
+-FTSENT	*fts_children __P((FTS *, int));
+-int	 fts_close __P((FTS *));
+-FTS	*fts_open __P((char * const *, int,
+-	    int (*)(const FTSENT **, const FTSENT **)));
+-FTSENT	*fts_read __P((FTS *));
+-int	 fts_set __P((FTS *, FTSENT *, int));
+-__END_DECLS
++#ifndef __P
++#define __P
++#endif
++FTSENT	*fts_children (FTS *p, int opts);
++int	 fts_close (FTS *p);
++FTS	*fts_open (char * const * path, int opts,
++	    int (*compfn)(const FTSENT **, const FTSENT **));
++FTSENT	*fts_read (FTS *p);
++int	 fts_set (FTS *p, FTSENT *f, int opts);
+ 
++#ifdef __cplusplus
++}
++#endif
+ #endif /* !_FTS_H_ */
+Index: fts/fts.c
+===================================================================
+--- fts.orig/fts.c
++++ fts/fts.c
+@@ -50,15 +50,15 @@ static char sccsid[] = "@(#)fts.c	8.6 (B
+ #include <string.h>
+ #include <unistd.h>
+ 
+-static FTSENT	*fts_alloc __P((FTS *, char *, int));
+-static FTSENT	*fts_build __P((FTS *, int));
+-static void	 fts_lfree __P((FTSENT *));
+-static void	 fts_load __P((FTS *, FTSENT *));
+-static size_t	 fts_maxarglen __P((char * const *));
+-static void	 fts_padjust __P((FTS *, void *));
+-static int	 fts_palloc __P((FTS *, size_t));
+-static FTSENT	*fts_sort __P((FTS *, FTSENT *, int));
+-static u_short	 fts_stat __P((FTS *, struct dirent *, FTSENT *, int));
++static FTSENT	*fts_alloc __P(FTS *, char *, int);
++static FTSENT	*fts_build __P(FTS *, int);
++static void	 fts_lfree __P(FTSENT *);
++static void	 fts_load __P(FTS *, FTSENT *);
++static size_t	 fts_maxarglen __P(char * const *);
++static void	 fts_padjust __P(FTS *, void *);
++static int	 fts_palloc __P(FTS *, size_t);
++static FTSENT	*fts_sort __P(FTS *, FTSENT *, int);
++static u_short	 fts_stat __P(FTS *, struct dirent *, FTSENT *, int);
+ 
+ #define	ISDOT(a)	(a[0] == '.' && (!a[1] || a[1] == '.' && !a[2]))
+ 
diff --git a/meta/recipes-core/fts/fts/stdint.patch b/meta/recipes-core/fts/fts/stdint.patch
new file mode 100644
index 0000000..89e6097
--- /dev/null
+++ b/meta/recipes-core/fts/fts/stdint.patch
@@ -0,0 +1,15 @@
+Include stdint.h for u_* typedefs
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate
+
+--- ./fts.c.orig
++++ ./fts.c
+@@ -46,6 +46,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <fts.h>
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 06/73] connman: include config.h for HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (4 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 05/73] fts: Add recipe Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 07/73] libcgroup: Add dependency on fts when building on musl Khem Raj
                   ` (67 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

We now check at configure time of libc has pktinfo struct

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0003-Fix-header-inclusions-for-musl.patch      | 79 +++++++++++++++-------
 1 file changed, 56 insertions(+), 23 deletions(-)

diff --git a/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch b/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch
index 6327aa2..eefc683 100644
--- a/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch
+++ b/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch
@@ -14,10 +14,10 @@ Upstream-Status: Pending
  tools/dnsproxy-test.c | 1 +
  5 files changed, 3 insertions(+), 5 deletions(-)
 
-diff --git a/gweb/gresolv.c b/gweb/gresolv.c
-index 3ad8e70..61d6fe8 100644
---- a/gweb/gresolv.c
-+++ b/gweb/gresolv.c
+Index: connman-1.30/gweb/gresolv.c
+===================================================================
+--- connman-1.30.orig/gweb/gresolv.c
++++ connman-1.30/gweb/gresolv.c
 @@ -28,6 +28,7 @@
  #include <stdarg.h>
  #include <string.h>
@@ -26,10 +26,10 @@ index 3ad8e70..61d6fe8 100644
  #include <resolv.h>
  #include <sys/types.h>
  #include <sys/socket.h>
-diff --git a/plugins/wifi.c b/plugins/wifi.c
-index dfe849f..99cff3f 100644
---- a/plugins/wifi.c
-+++ b/plugins/wifi.c
+Index: connman-1.30/plugins/wifi.c
+===================================================================
+--- connman-1.30.orig/plugins/wifi.c
++++ connman-1.30/plugins/wifi.c
 @@ -30,9 +30,8 @@
  #include <string.h>
  #include <sys/ioctl.h>
@@ -41,10 +41,10 @@ index dfe849f..99cff3f 100644
  
  #ifndef IFF_LOWER_UP
  #define IFF_LOWER_UP	0x10000
-diff --git a/src/tethering.c b/src/tethering.c
-index ceeec74..c44cb36 100644
---- a/src/tethering.c
-+++ b/src/tethering.c
+Index: connman-1.30/src/tethering.c
+===================================================================
+--- connman-1.30.orig/src/tethering.c
++++ connman-1.30/src/tethering.c
 @@ -31,10 +31,8 @@
  #include <stdio.h>
  #include <sys/ioctl.h>
@@ -56,10 +56,10 @@ index ceeec74..c44cb36 100644
  #include <netinet/in.h>
  #include <linux/if_bridge.h>
  
-diff --git a/tools/dhcp-test.c b/tools/dhcp-test.c
-index c34e10a..eae66fc 100644
---- a/tools/dhcp-test.c
-+++ b/tools/dhcp-test.c
+Index: connman-1.30/tools/dhcp-test.c
+===================================================================
+--- connman-1.30.orig/tools/dhcp-test.c
++++ connman-1.30/tools/dhcp-test.c
 @@ -33,7 +33,6 @@
  #include <arpa/inet.h>
  #include <net/route.h>
@@ -68,10 +68,10 @@ index c34e10a..eae66fc 100644
  
  #include <gdhcp/gdhcp.h>
  
-diff --git a/tools/dnsproxy-test.c b/tools/dnsproxy-test.c
-index 551cae9..226ba86 100644
---- a/tools/dnsproxy-test.c
-+++ b/tools/dnsproxy-test.c
+Index: connman-1.30/tools/dnsproxy-test.c
+===================================================================
+--- connman-1.30.orig/tools/dnsproxy-test.c
++++ connman-1.30/tools/dnsproxy-test.c
 @@ -27,6 +27,7 @@
  #include <stdlib.h>
  #include <string.h>
@@ -80,6 +80,39 @@ index 551cae9..226ba86 100644
  #include <arpa/inet.h>
  #include <netinet/in.h>
  #include <sys/types.h>
--- 
-2.5.1
-
+Index: connman-1.30/configure.ac
+===================================================================
+--- connman-1.30.orig/configure.ac
++++ connman-1.30/configure.ac
+@@ -173,6 +173,8 @@ AM_CONDITIONAL(PPTP_BUILTIN, test "${ena
+ 
+ AC_CHECK_HEADERS([execinfo.h])
+ 
++AC_CHECK_MEMBERS([struct in6_pktinfo.ipi6_addr], [], [], [[#include <netinet/in.h>]])
++
+ AC_CHECK_HEADERS(resolv.h, dummy=yes,
+ 	AC_MSG_ERROR(resolver header files are required))
+ AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
+Index: connman-1.30/gdhcp/common.h
+===================================================================
+--- connman-1.30.orig/gdhcp/common.h
++++ connman-1.30/gdhcp/common.h
+@@ -19,6 +19,7 @@
+  *
+  */
+ 
++#include <config.h>
+ #include <netinet/udp.h>
+ #include <netinet/ip.h>
+ 
+@@ -170,8 +171,8 @@ static const uint8_t dhcp_option_lengths
+ 	[OPTION_U32]	= 4,
+ };
+ 
+-/* already defined within netinet/in.h if using GNU compiler */
+-#ifndef __USE_GNU
++/* already defined within netinet/in.h if using GNU or musl libc */
++#ifndef HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR
+ struct in6_pktinfo {
+ 	struct in6_addr ipi6_addr;  /* src/dst IPv6 address */
+ 	unsigned int ipi6_ifindex;  /* send/recv interface index */
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 07/73] libcgroup: Add dependency on fts when building on musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (5 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 06/73] connman: include config.h for HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 08/73] linux-libc-headers: Port patches for linux-headers for musl Khem Raj
                   ` (66 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../libcgroup/libcgroup/musl-decls-compat.patch    | 235 +++++++++++++++++++++
 meta/recipes-core/libcgroup/libcgroup_0.41.bb      |   4 +
 2 files changed, 239 insertions(+)
 create mode 100644 meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch

diff --git a/meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch b/meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch
new file mode 100644
index 0000000..65f4ef9
--- /dev/null
+++ b/meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch
@@ -0,0 +1,235 @@
+commit ca780b4f7f71abeeb04a585f2a4d889caaa985fa
+Author: Isaac Dunham <ibid.ag@gmail.com>
+Date:   Fri Sep 5 22:35:32 2014 -0700
+
+    Remove __.*DECLS nonsense
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: libcgroup-0.41/include/libcgroup/config.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/config.h
++++ libcgroup-0.41/include/libcgroup/config.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_config 5. Configuration
+@@ -107,6 +109,8 @@ int cgroup_config_create_template_group(
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /*_LIBCGROUP_CONFIG_H*/
+Index: libcgroup-0.41/include/libcgroup/error.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/error.h
++++ libcgroup-0.41/include/libcgroup/error.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_errors 6. Error handling
+@@ -99,6 +101,8 @@ int cgroup_get_last_errno(void);
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_INIT_H */
+Index: libcgroup-0.41/include/libcgroup/groups.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/groups.h
++++ libcgroup-0.41/include/libcgroup/groups.h
+@@ -11,7 +11,9 @@
+ #include <stdbool.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * Flags for cgroup_delete_cgroup_ext().
+@@ -577,6 +579,8 @@ char *cgroup_get_cgroup_name(struct cgro
+  */
+ 
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_GROUPS_H */
+Index: libcgroup-0.41/include/libcgroup/init.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/init.h
++++ libcgroup-0.41/include/libcgroup/init.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_init 1. Initialization
+@@ -58,6 +60,8 @@ int cgroup_get_subsys_mount_point(const
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_INIT_H */
+Index: libcgroup-0.41/include/libcgroup/iterators.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/iterators.h
++++ libcgroup-0.41/include/libcgroup/iterators.h
+@@ -11,7 +11,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_iterators 3. Iterators
+@@ -423,6 +425,8 @@ int cgroup_get_subsys_mount_point_end(vo
+  * @}
+  */
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_ITERATORS_H */
+Index: libcgroup-0.41/include/libcgroup/tasks.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/tasks.h
++++ libcgroup-0.41/include/libcgroup/tasks.h
+@@ -12,7 +12,9 @@
+ #include <stdbool.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /** Flags for cgroup_change_cgroup_uid_gid(). */
+ enum cgflags {
+@@ -204,6 +206,8 @@ int cgroup_register_unchanged_process(pi
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_TASKS_H */
+Index: libcgroup-0.41/src/daemon/cgrulesengd.h
+===================================================================
+--- libcgroup-0.41.orig/src/daemon/cgrulesengd.h
++++ libcgroup-0.41/src/daemon/cgrulesengd.h
+@@ -17,7 +17,9 @@
+ 
+ #include <features.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ #include "config.h"
+ #include "libcgroup.h"
+@@ -119,7 +121,9 @@ void cgre_flash_templates(int signum);
+  */
+ void cgre_catch_term(int signum);
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _CGRULESENGD_H */
+ 
+Index: libcgroup-0.41/src/libcgroup-internal.h
+===================================================================
+--- libcgroup-0.41.orig/src/libcgroup-internal.h
++++ libcgroup-0.41/src/libcgroup-internal.h
+@@ -16,7 +16,9 @@
+ 
+ #define __LIBCG_INTERNAL
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ #include "config.h"
+ #include <fts.h>
+@@ -279,6 +281,8 @@ extern void cgroup_dictionary_iterator_e
+  */
+ int cg_chmod_path(const char *path, mode_t mode, int owner_is_umask);
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif
+Index: libcgroup-0.41/include/libcgroup/log.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/log.h
++++ libcgroup-0.41/include/libcgroup/log.h
+@@ -11,7 +11,9 @@
+ 
+ #include <stdarg.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_log 7. Logging
+@@ -142,6 +144,8 @@ extern int cgroup_parse_log_level_str(co
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_LOG_H */
diff --git a/meta/recipes-core/libcgroup/libcgroup_0.41.bb b/meta/recipes-core/libcgroup/libcgroup_0.41.bb
index 287aecd..9597963 100644
--- a/meta/recipes-core/libcgroup/libcgroup_0.41.bb
+++ b/meta/recipes-core/libcgroup/libcgroup_0.41.bb
@@ -11,12 +11,16 @@ inherit autotools pkgconfig
 DEPENDS = "bison-native flex-native ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/project/libcg/${BPN}/v0.41/${BPN}-${PV}.tar.bz2"
+SRC_URI_append_libc-musl = " file://musl-decls-compat.patch"
 
 SRC_URI[md5sum] = "3dea9d50b8a5b73ff0bf1cdcb210f63f"
 SRC_URI[sha256sum] = "e4e38bdc7ef70645ce33740ddcca051248d56b53283c0dc6d404e17706f6fb51"
 
 UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/libcg/files/libcgroup/"
 
+DEPENDS_append_libc-musl = " fts "
+EXTRA_OEMAKE_append_libc-musl = "LIBS=-lfts"
+
 EXTRA_OECONF = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam-module-dir=${base_libdir}/security --enable-pam=yes', '--enable-pam=no', d)}"
 
 PACKAGES =+ "cgroups-pam-plugin"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 08/73] linux-libc-headers: Port patches for linux-headers for musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (6 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 07/73] libcgroup: Add dependency on fts when building on musl Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 09/73] xserver-xorg: Fix build with musl Khem Raj
                   ` (65 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

These patches have revealed issues with linux kernel headers which has
been proposed upstream but hasnt been applied yet

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...mpat.h-fix-some-issues-arising-from-in6.h.patch | 82 ++++++++++++++++++++++
 ...t.h-prevent-redefinition-of-struct-ethhdr.patch | 59 ++++++++++++++++
 ...remove-inclusion-of-sysinfo.h-in-kernel.h.patch | 32 +++++++++
 .../linux-libc-headers/linux-libc-headers_4.1.bb   |  5 ++
 4 files changed, 178 insertions(+)
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch

diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch
new file mode 100644
index 0000000..3db52cf
--- /dev/null
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch
@@ -0,0 +1,82 @@
+From 2872f5d8bcef84e62b15b37ba4ffeccfb6402dad Mon Sep 17 00:00:00 2001
+From: rofl0r <retnyg@gmx.net>
+Date: Wed, 22 Jan 2014 00:48:28 +0100
+Subject: [PATCH 1/3] libc-compat.h: fix some issues arising from in6.h
+
+namely redefinition of some structs provided by netinet/in.h.
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Submitted
+
+ include/uapi/linux/libc-compat.h | 25 ++++++++-----------------
+ 1 file changed, 8 insertions(+), 17 deletions(-)
+
+diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
+index fa673e9..afe15c2 100644
+--- a/include/uapi/linux/libc-compat.h
++++ b/include/uapi/linux/libc-compat.h
+@@ -48,24 +48,15 @@
+ #ifndef _UAPI_LIBC_COMPAT_H
+ #define _UAPI_LIBC_COMPAT_H
+ 
+-/* We have included glibc headers... */
+-#if defined(__GLIBC__)
++#ifndef __KERNEL__ /* we're used from userspace */
+ 
+-/* Coordinate with glibc netinet/in.h header. */
++/* Coordinate with libc netinet/in.h header. */
+ #if defined(_NETINET_IN_H)
+ 
+-/* GLIBC headers included first so don't define anything
++/* libc headers included first so don't define anything
+  * that would already be defined. */
+ #define __UAPI_DEF_IN6_ADDR		0
+-/* The exception is the in6_addr macros which must be defined
+- * if the glibc code didn't define them. This guard matches
+- * the guard in glibc/inet/netinet/in.h which defines the
+- * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */
+-#if defined(__USE_MISC) || defined (__USE_GNU)
+ #define __UAPI_DEF_IN6_ADDR_ALT		0
+-#else
+-#define __UAPI_DEF_IN6_ADDR_ALT		1
+-#endif
+ #define __UAPI_DEF_SOCKADDR_IN6		0
+ #define __UAPI_DEF_IPV6_MREQ		0
+ #define __UAPI_DEF_IPPROTO_V6		0
+@@ -73,13 +64,13 @@
+ #define __UAPI_DEF_IN6_PKTINFO		0
+ #define __UAPI_DEF_IP6_MTUINFO		0
+ 
+-#else
++#else /* defined(_NETINET_IN_H) */
+ 
+ /* Linux headers included first, and we must define everything
+- * we need. The expectation is that glibc will check the
++ * we need. The expectation is that the libc will check the
+  * __UAPI_DEF_* defines and adjust appropriately. */
+ #define __UAPI_DEF_IN6_ADDR		1
+-/* We unconditionally define the in6_addr macros and glibc must
++/* We unconditionally define the in6_addr macros and libc must
+  * coordinate. */
+ #define __UAPI_DEF_IN6_ADDR_ALT		1
+ #define __UAPI_DEF_SOCKADDR_IN6		1
+@@ -101,7 +92,7 @@
+ /* If we did not see any headers from any supported C libraries,
+  * or we are being included in the kernel, then define everything
+  * that we need. */
+-#else /* !defined(__GLIBC__) */
++#else /* __KERNEL__ */
+ 
+ /* Definitions for in6.h */
+ #define __UAPI_DEF_IN6_ADDR		1
+@@ -116,6 +107,6 @@
+ /* Definitions for xattr.h */
+ #define __UAPI_DEF_XATTR		1
+ 
+-#endif /* __GLIBC__ */
++#endif /* __KERNEL__ */
+ 
+ #endif /* _UAPI_LIBC_COMPAT_H */
+-- 
+2.6.4
+
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch
new file mode 100644
index 0000000..c617093
--- /dev/null
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch
@@ -0,0 +1,59 @@
+From 75ba4a547282f91d653872a4bba5f5eae234ea6c Mon Sep 17 00:00:00 2001
+From: rofl0r <retnyg@gmx.net>
+Date: Wed, 22 Jan 2014 00:57:48 +0100
+Subject: [PATCH 2/3] libc-compat.h: prevent redefinition of struct ethhdr
+
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Submitted
+
+ include/uapi/linux/if_ether.h    | 4 +++-
+ include/uapi/linux/libc-compat.h | 6 ++++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
+index aa63ed0..e94da57 100644
+--- a/include/uapi/linux/if_ether.h
++++ b/include/uapi/linux/if_ether.h
+@@ -22,6 +22,7 @@
+ #define _UAPI_LINUX_IF_ETHER_H
+ 
+ #include <linux/types.h>
++#include <linux/libc-compat.h>
+ 
+ /*
+  *	IEEE 802.3 Ethernet magic constants.  The frame sizes omit the preamble
+@@ -134,11 +135,12 @@
+  *	This is an Ethernet frame header.
+  */
+ 
++#if __UAPI_DEF_ETHHDR
+ struct ethhdr {
+ 	unsigned char	h_dest[ETH_ALEN];	/* destination eth addr	*/
+ 	unsigned char	h_source[ETH_ALEN];	/* source ether addr	*/
+ 	__be16		h_proto;		/* packet type ID field	*/
+ } __attribute__((packed));
+-
++#endif
+ 
+ #endif /* _UAPI_LINUX_IF_ETHER_H */
+diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
+index afe15c2..7d0c78a 100644
+--- a/include/uapi/linux/libc-compat.h
++++ b/include/uapi/linux/libc-compat.h
+@@ -50,6 +50,12 @@
+ 
+ #ifndef __KERNEL__ /* we're used from userspace */
+ 
++#ifdef _NETINET_IF_ETHER_H /* musl */
++#define __UAPI_DEF_ETHHDR 0
++#else /* glibc uses __NETINET_IF_ETHER_H, and includes the kernel header. */
++#define __UAPI_DEF_ETHHDR 1
++#endif
++
+ /* Coordinate with libc netinet/in.h header. */
+ #if defined(_NETINET_IN_H)
+ 
+-- 
+2.6.4
+
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch
new file mode 100644
index 0000000..6d9e8d8
--- /dev/null
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch
@@ -0,0 +1,32 @@
+From 8e69b663d6ddef132041a1186f081fdd74d4a31d Mon Sep 17 00:00:00 2001
+From: rofl0r <retnyg@gmx.net>
+Date: Mon, 20 Jan 2014 21:31:34 +0100
+Subject: [PATCH 3/3] remove inclusion of sysinfo.h in kernel.h
+
+the declaration of struct sysinfo clashes with userspace.
+it's not quite clear why that header was included from kernel.h,
+as none of its functionality is needed.
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Submitted
+
+ include/uapi/linux/kernel.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h
+index 321e399..e8ff821 100644
+--- a/include/uapi/linux/kernel.h
++++ b/include/uapi/linux/kernel.h
+@@ -1,7 +1,9 @@
+ #ifndef _UAPI_LINUX_KERNEL_H
+ #define _UAPI_LINUX_KERNEL_H
+ 
++#ifdef __GLIBC__
+ #include <linux/sysinfo.h>
++#endif
+ 
+ /*
+  * 'kernel.h' contains some often-used function prototypes etc
+-- 
+2.6.4
+
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.1.bb b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.1.bb
index 01037c1..6f2c427 100644
--- a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.1.bb
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.1.bb
@@ -1,4 +1,9 @@
 require linux-libc-headers.inc
 
+SRC_URI_append_libc-musl = "\
+    file://0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch \
+    file://0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch \
+    file://0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch \
+   "
 SRC_URI[md5sum] = "fe9dc0f6729f36400ea81aa41d614c37"
 SRC_URI[sha256sum] = "caf51f085aac1e1cea4d00dbbf3093ead07b551fc07b31b2a989c05f8ea72d9f"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 09/73] xserver-xorg: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (7 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 08/73] linux-libc-headers: Port patches for linux-headers for musl Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 10/73] gdk-pixbuf: Fix latent build issue exposed by musl Khem Raj
                   ` (64 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

inb/outb are implemented for ARM on glibc but not on linux in general
therefore the conditional has to reflect that

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch  | 18 ++++++++++++++++++
 .../xorg-xserver/xserver-xorg_1.18.0.bb                |  4 +++-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch

diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch b/meta/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch
new file mode 100644
index 0000000..4be441f
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch
@@ -0,0 +1,18 @@
+inb/outb family for arm is only implemented on glibc
+so assumption across linux is wrong
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+Index: xorg-server-1.18.0/hw/xfree86/common/compiler.h
+===================================================================
+--- xorg-server-1.18.0.orig/hw/xfree86/common/compiler.h
++++ xorg-server-1.18.0/hw/xfree86/common/compiler.h
+@@ -758,7 +758,7 @@ inl(unsigned short port)
+     return xf86ReadMmio32Le((void *) ioBase, port);
+ }
+ 
+-#elif defined(__arm__) && defined(__linux__)
++#elif defined(__arm__) && defined(__GLIBC__)
+ 
+ /* for Linux on ARM, we use the LIBC inx/outx routines */
+ /* note that the appropriate setup via "ioperm" needs to be done */
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.18.0.bb b/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.18.0.bb
index 60973c5..e606dac 100644
--- a/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.18.0.bb
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.18.0.bb
@@ -1,6 +1,8 @@
 require xserver-xorg.inc
 
-SRC_URI += "file://configure.ac-Use-libsystemd-in-REQUIRED_LIBS-check.patch"
+SRC_URI += "file://configure.ac-Use-libsystemd-in-REQUIRED_LIBS-check.patch \
+            file://musl-arm-inb-outb.patch \
+           "
 SRC_URI[md5sum] = "3c1c1057d3ad27380d8dd87ffcc182cd"
 SRC_URI[sha256sum] = "195670819695d9cedd8dde95fbe069be0d0f488a77797a2d409f9f702daf312e"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 10/73] gdk-pixbuf: Fix latent build issue exposed by musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (8 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 09/73] xserver-xorg: Fix build with musl Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 11/73] argp-standalone: Add recipe Khem Raj
                   ` (63 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch      | 63 ++++++++++++++++++++++
 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch

diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch
new file mode 100644
index 0000000..82a27c3
--- /dev/null
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch
@@ -0,0 +1,63 @@
+From 205a3b04e1216c1df199aec95185f7f48b8e0491 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 6 Oct 2015 09:11:38 +0200
+Subject: Run only pixbuf-lowmem test on GNU libc
+
+The test case depends on GNU libc specific internals so we only run it
+on GNU libc.
+
+This fixes build on Linux with musl libc.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=756078
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Backport
+
+ tests/Makefile.am     | 5 -----
+ tests/pixbuf-lowmem.c | 8 ++++++++
+ 2 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index bdd68f3..c122188 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -19,13 +19,8 @@ LDADD = \
+ noinst_PROGRAMS += 			\
+ 	pixbuf-read			\
+ 	pixbuf-random			\
+-	$(NULL)
+-
+-if OS_LINUX
+-noinst_PROGRAMS += 			\
+ 	pixbuf-lowmem			\
+ 	$(NULL)
+-endif
+ 
+ test_programs = 			\
+ 	animation			\
+diff --git a/tests/pixbuf-lowmem.c b/tests/pixbuf-lowmem.c
+index ae71788..9e9571f 100644
+--- a/tests/pixbuf-lowmem.c
++++ b/tests/pixbuf-lowmem.c
+@@ -24,6 +24,7 @@
+ #include <time.h>
+ #include <string.h>
+ 
++#ifdef __GLIBC__
+ #define PRETEND_MEM_SIZE (16 * 1024 * 1024)
+ #define REMAINING_MEM_SIZE 100000
+ 
+@@ -225,3 +226,10 @@ main (int argc, char **argv)
+   
+   return 0;
+ }
++#else
++int
++main (int argc, char **argv)
++{
++	return 0;
++}
++#endif
+-- 
+cgit v0.11.2
+
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb
index 084fe36..104c743 100644
--- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb
@@ -17,6 +17,7 @@ SRC_URI = "${GNOME_MIRROR}/${BPN}/${MAJ_VER}/${BPN}-${PV}.tar.xz \
            file://extending-libinstall-dependencies.patch \
            file://run-ptest \
            file://fatal-loader.patch \
+           file://libc_memfuncs.patch \
            "
 
 SRC_URI[md5sum] = "b1590189a2e89fab9f871959c168508c"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 11/73] argp-standalone: Add recipe
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (9 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 10/73] gdk-pixbuf: Fix latent build issue exposed by musl Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 12/73] gnutls: Link with libargp on musl and depend on argp-standalone Khem Raj
                   ` (62 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

This helps packages like gnutls to compile with musl
any package that needs glibc's implementation of argp
can link to this library

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../argp-standalone/argp-standalone_1.3.bb         | 28 ++++++++
 .../files/0001-throw-in-funcdef.patch              | 84 ++++++++++++++++++++++
 .../argp-standalone/files/0002-isprint.patch       | 51 +++++++++++++
 3 files changed, 163 insertions(+)
 create mode 100644 meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
 create mode 100644 meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch
 create mode 100644 meta/recipes-support/argp-standalone/files/0002-isprint.patch

diff --git a/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb b/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
new file mode 100644
index 0000000..a5d20d3
--- /dev/null
+++ b/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
@@ -0,0 +1,28 @@
+# Copyright (C) 2015 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "Glibc hierarchical argument parsing standalone library"
+HOMEPAGE = "http://www.lysator.liu.se/~nisse/misc/"
+LICENSE = "LGPL-2.1"
+LIC_FILES_CHKSUM = "file://argp.h;beginline=1;endline=20;md5=008b7e53dea6f9e1d9fdef0d9cf3184a"
+SECTION = "libs"
+
+SRC_URI = "http://www.lysator.liu.se/~nisse/misc/argp-standalone-${PV}.tar.gz \
+           file://0001-throw-in-funcdef.patch \
+           file://0002-isprint.patch \
+          "
+SRC_URI[md5sum] = "720704bac078d067111b32444e24ba69"
+SRC_URI[sha256sum] = "dec79694da1319acd2238ce95df57f3680fea2482096e483323fddf3d818d8be"
+
+inherit autotools
+
+CFLAGS += "-fPIC -U__OPTIMIZE__"
+
+do_install() {
+	install -D -m 0644 ${B}/libargp.a ${D}${libdir}/libargp.a
+	install -D -m 0644 ${S}/argp.h ${D}${includedir}/argp.h
+}
+#
+# We will skip parsing for non-musl systems
+#
+COMPATIBLE_HOST = ".*-musl.*"
diff --git a/meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch b/meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch
new file mode 100644
index 0000000..a6e2759
--- /dev/null
+++ b/meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch
@@ -0,0 +1,84 @@
+# --- T2-COPYRIGHT-NOTE-BEGIN ---
+# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
+# 
+# T2 SDE: package/.../rng-tools/throw-in-funcdef.patch.argp-standalone
+# Copyright (C) 2006 The T2 SDE Project
+# 
+# More information can be found in the files COPYING and README.
+# 
+# This patch file is dual-licensed. It is available under the license the
+# patched project is licensed under, as long as it is an OpenSource license
+# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
+# of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+# --- T2-COPYRIGHT-NOTE-END ---
+
+
+No __THROW in function implementation.
+	--jsaw
+
+Taken from buildroot
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+--- argp-standalone-1.4-test2/argp.h.orig	2006-01-06 02:29:59.000000000 +0100
++++ argp-standalone-1.4-test2/argp.h	2006-01-06 02:41:10.000000000 +0100
+@@ -560,17 +560,17 @@
+ # endif
+ 
+ # ifndef ARGP_EI
+-#  define ARGP_EI extern __inline__
++#  define ARGP_EI extern inline
+ # endif
+ 
+ ARGP_EI void
+-__argp_usage (__const struct argp_state *__state) __THROW
++__argp_usage (__const struct argp_state *__state)
+ {
+   __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
+ }
+ 
+ ARGP_EI int
+-__option_is_short (__const struct argp_option *__opt) __THROW
++__option_is_short (__const struct argp_option *__opt)
+ {
+   if (__opt->flags & OPTION_DOC)
+     return 0;
+@@ -582,7 +582,7 @@
+ }
+ 
+ ARGP_EI int
+-__option_is_end (__const struct argp_option *__opt) __THROW
++__option_is_end (__const struct argp_option *__opt)
+ {
+   return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
+ }
+--- argp-standalone-1.4-test2/argp-parse.c.orig	2006-01-06 02:47:48.000000000 +0100
++++ argp-standalone-1.4-test2/argp-parse.c	2006-01-06 02:48:16.000000000 +0100
+@@ -1290,13 +1290,13 @@
+ /* Defined here, in case a user is not inlining the definitions in
+  * argp.h */
+ void
+-__argp_usage (__const struct argp_state *__state) __THROW
++__argp_usage (__const struct argp_state *__state)
+ {
+   __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
+ }
+ 
+ int
+-__option_is_short (__const struct argp_option *__opt) __THROW
++__option_is_short (__const struct argp_option *__opt) 
+ {
+   if (__opt->flags & OPTION_DOC)
+     return 0;
+@@ -1310,7 +1310,7 @@
+ }
+ 
+ int
+-__option_is_end (__const struct argp_option *__opt) __THROW
++__option_is_end (__const struct argp_option *__opt) 
+ {
+   return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
+ }
diff --git a/meta/recipes-support/argp-standalone/files/0002-isprint.patch b/meta/recipes-support/argp-standalone/files/0002-isprint.patch
new file mode 100644
index 0000000..1c07eea
--- /dev/null
+++ b/meta/recipes-support/argp-standalone/files/0002-isprint.patch
@@ -0,0 +1,51 @@
+Subject: restrict value range passed to isprint function
+
+According to C standards isprint argument shall be representable as an
+unsigned char or be equal to EOF, otherwise the behaviour is undefined.
+
+Passing arbitrary ints leads to segfault in nm program from elfutils.
+
+Restrict isprint argument range to values representable by unsigned char.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+
+Taken from buildroot
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+Index: b/argp.h
+===================================================================
+--- a/argp.h
++++ b/argp.h
+@@ -23,6 +23,7 @@
+ 
+ #include <stdio.h>
+ #include <ctype.h>
++#include <limits.h>
+ 
+ #define __need_error_t
+ #include <errno.h>
+@@ -577,7 +578,7 @@
+   else
+     {
+       int __key = __opt->key;
+-      return __key > 0 && isprint (__key);
++      return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
+     }
+ }
+ 
+Index: b/argp-parse.c
+===================================================================
+--- a/argp-parse.c
++++ b/argp-parse.c
+@@ -1292,7 +1292,7 @@
+       int __key = __opt->key;
+       /* FIXME: whether or not a particular key implies a short option
+        * ought not to be locale dependent. */
+-      return __key > 0 && isprint (__key);
++      return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
+     }
+ }
+ 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 12/73] gnutls: Link with libargp on musl and depend on argp-standalone
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (10 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 11/73] argp-standalone: Add recipe Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 13/73] util-linux: Fix ptest builds on musl Khem Raj
                   ` (61 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-support/gnutls/gnutls.inc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-support/gnutls/gnutls.inc b/meta/recipes-support/gnutls/gnutls.inc
index c1ec120..5bcfc9c 100644
--- a/meta/recipes-support/gnutls/gnutls.inc
+++ b/meta/recipes-support/gnutls/gnutls.inc
@@ -2,6 +2,7 @@ SUMMARY = "GNU Transport Layer Security Library"
 HOMEPAGE = "http://www.gnu.org/software/gnutls/"
 BUGTRACKER = "https://savannah.gnu.org/support/?group=gnutls"
 DEPENDS = "nettle libidn"
+DEPENDS_append_libc-musl = " argp-standalone "
 
 LICENSE = "GPLv3+ & LGPLv2.1+"
 LICENSE_${PN} = "LGPLv2.1+"
@@ -28,6 +29,7 @@ EXTRA_OECONF="--disable-rpath \
               --without-p11-kit \
               --enable-openssl-compatibility \
               "
+LDFLAGS_append_libc-musl = " -largp "
 
 do_configure_prepend() {
 	for dir in . lib; do
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 13/73] util-linux: Fix ptest builds on musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (11 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 12/73] gnutls: Link with libargp on musl and depend on argp-standalone Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 14/73] elfutils: Fix build with uclibc/musl Khem Raj
                   ` (60 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

musl doesnt implement error() API, hence provide one

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../util-linux/uuid-test-error-api.patch           | 92 ++++++++++++++++++++++
 meta/recipes-core/util-linux/util-linux_2.27.1.bb  |  1 +
 2 files changed, 93 insertions(+)
 create mode 100644 meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch

diff --git a/meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch b/meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch
new file mode 100644
index 0000000..1b0ff79
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch
@@ -0,0 +1,92 @@
+This patch adds error() API implementation for non-glibc system C libs
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: util-linux-2.27.1/tests/helpers/test_uuidd.c
+===================================================================
+--- util-linux-2.27.1.orig/tests/helpers/test_uuidd.c
++++ util-linux-2.27.1/tests/helpers/test_uuidd.c
+@@ -23,7 +23,6 @@
+  *
+  *	make uuidd uuidgen localstatedir=/var
+  */
+-#include <error.h>
+ #include <libgen.h>
+ #include <pthread.h>
+ #include <stdio.h>
+@@ -39,6 +38,17 @@
+ #include "xalloc.h"
+ #include "strutils.h"
+ 
++#ifdef __GLIBC__
++#include <error.h>
++#else
++extern void (*error_print_progname)(void);
++extern unsigned int error_message_count;
++extern int error_one_per_line;
++
++void error(int, int, const char *, ...);
++void error_at_line(int, int, const char *, unsigned int, const char *, ...);
++#endif
++
+ #define LOG(level,args) if (loglev >= level) { fprintf args; }
+ 
+ size_t nprocesses = 4;
+@@ -257,6 +267,56 @@ static void object_dump(size_t idx, obje
+ 	fprintf(stderr, "}\n");
+ }
+ 
++#ifndef __GLIBC__
++extern char *__progname;
++
++void (*error_print_progname)(void) = 0;
++unsigned int error_message_count = 0;
++int error_one_per_line = 0;
++
++static void eprint(int status, int e, const char *file, unsigned int line, const char *fmt, va_list ap)
++{
++	if (file && error_one_per_line) {
++		static const char *oldfile;
++		static unsigned int oldline;
++		if (line == oldline && strcmp(file, oldfile) == 0)
++			return;
++		oldfile = file;
++		oldline = line;
++	}
++	if (error_print_progname)
++		error_print_progname();
++	else
++		fprintf(stderr, "%s: ", __progname);
++	if (file)
++		fprintf(stderr, "%s:%u: ", file, line);
++	vfprintf(stderr, fmt, ap);
++	if (e)
++		fprintf(stderr, ": %s", strerror(e));
++	putc('\n', stderr);
++	fflush(stderr);
++	error_message_count++;
++	if (status)
++		exit(status);
++}
++
++void error(int status, int e, const char *fmt, ...)
++{
++	va_list ap;
++	va_start(ap,fmt);
++	eprint(status, e, 0, 0, fmt, ap);
++	va_end(ap);
++}
++
++void error_at_line(int status, int e, const char *file, unsigned int line, const char *fmt, ...)
++{
++	va_list ap;
++	va_start(ap,fmt);
++	eprint(status, e, file, line, fmt, ap);
++	va_end(ap);
++}
++#endif /* __GLIBC__ */
++
+ int main(int argc, char *argv[])
+ {
+ 	size_t i, nfailed = 0, nignored = 0;
diff --git a/meta/recipes-core/util-linux/util-linux_2.27.1.bb b/meta/recipes-core/util-linux/util-linux_2.27.1.bb
index 14a77ca..7549158 100644
--- a/meta/recipes-core/util-linux/util-linux_2.27.1.bb
+++ b/meta/recipes-core/util-linux/util-linux_2.27.1.bb
@@ -19,6 +19,7 @@ SRC_URI += "file://util-linux-ng-2.16-mount_lock_path.patch \
             file://avoid_unsupported_grep_opts.patch \
             file://display_testname_for_subtest.patch \
             file://avoid_parallel_tests.patch \
+            file://uuid-test-error-api.patch \
 "
 SRC_URI[md5sum] = "3cd2698d1363a2c64091c2dadc974647"
 SRC_URI[sha256sum] = "0a818fcdede99aec43ffe6ca5b5388bff80d162f2f7bd4541dca94fecb87a290"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 14/73] elfutils: Fix build with uclibc/musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (12 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 13/73] util-linux: Fix ptest builds on musl Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-22 12:26   ` Burton, Ross
  2016-01-17 11:35 ` [PATCH 15/73] systemd: Update and fix build with uclibc Khem Raj
                   ` (59 subsequent siblings)
  73 siblings, 1 reply; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

Remove mempcpy patch its already in uclibc now
refresh libargp patch to match latest elfutils

Add ALLOW_EMPTY for musl

core-image-cmdline-full asks for elfutils package to be added to package
it has all eu-* tools but we dont build them on musl. nevertheless lets
satisfy the dependency so image can build for musl

Build libdw,libasm,libebl along with libelf

enhance the musl portability patch to compile every other library
except the eu-* tools

Fix build on aarch64/musl issues

Header inclusion ends up with duplicate definitions of iovec struct
since uclibc defines the same in usersapce, we have been depending upong
including the kernel header on aarch64, using sys/uio.h is the right
approach

Fix x86 build warning seen on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...de-alternatives-for-glibc-assumptions-hel.patch | 1161 ++++++++++++++++++++
 .../elfutils/elfutils-0.164/aarch64_uio.patch      |   47 +
 .../elfutils/elfutils-0.164/shadow.patch           |   23 +
 .../elfutils/elfutils-0.164/uclibc-support.patch   |  129 +++
 .../elfutils/elfutils/mempcpy.patch                |   24 -
 meta/recipes-devtools/elfutils/elfutils_0.148.bb   |    1 -
 meta/recipes-devtools/elfutils/elfutils_0.164.bb   |   13 +-
 7 files changed, 1368 insertions(+), 30 deletions(-)
 create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
 create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/aarch64_uio.patch
 create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/shadow.patch
 create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/uclibc-support.patch
 delete mode 100644 meta/recipes-devtools/elfutils/elfutils/mempcpy.patch

diff --git a/meta/recipes-devtools/elfutils/elfutils-0.164/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch b/meta/recipes-devtools/elfutils/elfutils-0.164/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
new file mode 100644
index 0000000..ffab4c2
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.164/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
@@ -0,0 +1,1161 @@
+From 4b0fe80b3951f044c1c1b14d1d7f5f0b8ab67507 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 06:35:34 +0000
+Subject: [PATCH] build: Provide alternatives for glibc assumptions helps
+ compiling it on musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile.am                      |  2 +-
+ lib/color.c                      |  2 +-
+ lib/crc32_file.c                 |  4 +++-
+ lib/fixedsizehash.h              |  4 ++--
+ lib/system.h                     | 11 +++++++++++
+ lib/xmalloc.c                    |  2 +-
+ libasm/asm_end.c                 |  2 +-
+ libasm/asm_newscn.c              |  2 +-
+ libcpu/i386_gendis.c             |  2 +-
+ libcpu/i386_lex.c                |  2 +-
+ libcpu/i386_parse.c              |  2 +-
+ libdw/Makefile.am                |  2 +-
+ libdw/libdw_alloc.c              |  3 ++-
+ libdwfl/Makefile.am              |  2 ++
+ libdwfl/dwfl_build_id_find_elf.c |  3 ++-
+ libdwfl/dwfl_error.c             |  4 +++-
+ libdwfl/dwfl_module_getdwarf.c   |  1 +
+ libdwfl/find-debuginfo.c         |  2 +-
+ libdwfl/libdwfl_crc32_file.c     | 10 ++++++++++
+ libdwfl/linux-kernel-modules.c   |  1 +
+ libebl/eblopenbackend.c          |  2 +-
+ libebl/eblwstrtab.c              |  2 +-
+ libelf/elf.h                     |  9 ++++++---
+ libelf/libelf.h                  |  1 +
+ libelf/libelfP.h                 |  1 +
+ src/addr2line.c                  |  2 +-
+ src/ar.c                         |  2 +-
+ src/arlib.c                      |  2 +-
+ src/arlib2.c                     |  2 +-
+ src/elfcmp.c                     |  2 +-
+ src/elflint.c                    |  2 +-
+ src/findtextrel.c                |  2 +-
+ src/i386_ld.c                    |  2 +-
+ src/ld.c                         |  2 +-
+ src/ldgeneric.c                  |  2 +-
+ src/ldlex.c                      |  2 +-
+ src/ldscript.c                   |  2 +-
+ src/nm.c                         |  2 +-
+ src/objdump.c                    |  2 +-
+ src/ranlib.c                     |  2 +-
+ src/readelf.c                    |  2 +-
+ src/size.c                       |  2 +-
+ src/stack.c                      |  2 +-
+ src/strings.c                    |  2 +-
+ src/strip.c                      |  2 +-
+ 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                  |  2 +-
+ tests/dwfl-addr-sect.c           |  2 +-
+ tests/dwfl-bug-addr-overflow.c   |  2 +-
+ tests/dwfl-bug-fd-leak.c         |  2 +-
+ tests/dwfl-bug-getmodules.c      |  2 +-
+ tests/dwfl-report-elf-align.c    |  2 +-
+ tests/dwfllines.c                |  2 +-
+ tests/dwflmodtest.c              |  2 +-
+ tests/dwflsyms.c                 |  2 +-
+ tests/early-offscn.c             |  2 +-
+ tests/ecp.c                      |  2 +-
+ 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              |  2 +-
+ tests/md5-sha1-test.c            |  2 +-
+ tests/rdwrmmap.c                 |  2 +-
+ tests/saridx.c                   |  2 +-
+ tests/sectiondump.c              |  2 +-
+ tests/varlocs.c                  |  2 +-
+ tests/vdsosyms.c                 |  2 +-
+ 77 files changed, 109 insertions(+), 73 deletions(-)
+
+Index: elfutils-0.164/Makefile.am
+===================================================================
+--- elfutils-0.164.orig/Makefile.am
++++ elfutils-0.164/Makefile.am
+@@ -24,7 +24,7 @@ pkginclude_HEADERS = version.h
+ 
+ # Add doc back when we have some real content.
+ SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libcpu libasm \
+-	  backends src po tests
++	  backends po tests
+ 
+ EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
+ 	     COPYING COPYING-GPLV2 COPYING-LGPLV3
+Index: elfutils-0.164/lib/color.c
+===================================================================
+--- elfutils-0.164.orig/lib/color.c
++++ elfutils-0.164/lib/color.c
+@@ -32,7 +32,7 @@
+ #endif
+ 
+ #include <argp.h>
+-#include <error.h>
++#include <err.h>
+ #include <libintl.h>
+ #include <stdlib.h>
+ #include <string.h>
+Index: elfutils-0.164/lib/crc32_file.c
+===================================================================
+--- elfutils-0.164.orig/lib/crc32_file.c
++++ elfutils-0.164/lib/crc32_file.c
+@@ -30,12 +30,14 @@
+ # include <config.h>
+ #endif
+ 
+-#include "system.h"
+ #include <errno.h>
+ #include <unistd.h>
++#include <stdint.h>
+ #include <sys/stat.h>
+ #include <sys/mman.h>
+ 
++#include "system.h"
++
+ int
+ crc32_file (int fd, uint32_t *resp)
+ {
+Index: elfutils-0.164/lib/fixedsizehash.h
+===================================================================
+--- elfutils-0.164.orig/lib/fixedsizehash.h
++++ elfutils-0.164/lib/fixedsizehash.h
+@@ -30,12 +30,12 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <sys/cdefs.h>
+ #include <sys/param.h>
+ 
+ #include <system.h>
+ 
+-#define CONCAT(t1,t2) __CONCAT (t1,t2)
++#define CONCAT1(x,y) x##y
++#define CONCAT(x,y) CONCAT1(x,y)
+ 
+ /* Before including this file the following macros must be defined:
+ 
+Index: elfutils-0.164/lib/system.h
+===================================================================
+--- elfutils-0.164.orig/lib/system.h
++++ elfutils-0.164/lib/system.h
+@@ -49,6 +49,16 @@
+ #else
+ # error "Unknown byte order"
+ #endif
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++  (__extension__							      \
++    ({ long int __result;						      \
++       do __result = (long int) (expression);				      \
++       while (__result == -1L && errno == EINTR);			      \
++       __result; }))
++#endif
++
++#define error(status, errno, ...) err(status, __VA_ARGS__)
+ 
+ extern void *xmalloc (size_t) __attribute__ ((__malloc__));
+ extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
+Index: elfutils-0.164/lib/xmalloc.c
+===================================================================
+--- elfutils-0.164.orig/lib/xmalloc.c
++++ elfutils-0.164/lib/xmalloc.c
+@@ -30,7 +30,7 @@
+ # include <config.h>
+ #endif
+ 
+-#include <error.h>
++#include <err.h>
+ #include <libintl.h>
+ #include <stddef.h>
+ #include <stdlib.h>
+Index: elfutils-0.164/libasm/asm_end.c
+===================================================================
+--- elfutils-0.164.orig/libasm/asm_end.c
++++ elfutils-0.164/libasm/asm_end.c
+@@ -32,7 +32,7 @@
+ #endif
+ 
+ #include <assert.h>
+-#include <error.h>
++#include <err.h>
+ #include <libintl.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+Index: elfutils-0.164/libasm/asm_newscn.c
+===================================================================
+--- elfutils-0.164.orig/libasm/asm_newscn.c
++++ elfutils-0.164/libasm/asm_newscn.c
+@@ -32,7 +32,7 @@
+ #endif
+ 
+ #include <assert.h>
+-#include <error.h>
++#include <err.h>
+ #include <libintl.h>
+ #include <stdlib.h>
+ #include <string.h>
+Index: elfutils-0.164/libcpu/i386_gendis.c
+===================================================================
+--- elfutils-0.164.orig/libcpu/i386_gendis.c
++++ elfutils-0.164/libcpu/i386_gendis.c
+@@ -31,7 +31,7 @@
+ # include <config.h>
+ #endif
+ 
+-#include <error.h>
++#include <err.h>
+ #include <errno.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+Index: elfutils-0.164/libcpu/i386_lex.c
+===================================================================
+--- elfutils-0.164.orig/libcpu/i386_lex.c
++++ elfutils-0.164/libcpu/i386_lex.c
+@@ -571,7 +571,7 @@ char *i386_text;
+ #endif
+ 
+ #include <ctype.h>
+-#include <error.h>
++#include <err.h>
+ #include <libintl.h>
+ 
+ #include <system.h>
+Index: elfutils-0.164/libcpu/i386_parse.c
+===================================================================
+--- elfutils-0.164.orig/libcpu/i386_parse.c
++++ elfutils-0.164/libcpu/i386_parse.c
+@@ -107,7 +107,7 @@
+ #include <assert.h>
+ #include <ctype.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <inttypes.h>
+ #include <libintl.h>
+ #include <math.h>
+Index: elfutils-0.164/libdw/Makefile.am
+===================================================================
+--- elfutils-0.164.orig/libdw/Makefile.am
++++ elfutils-0.164/libdw/Makefile.am
+@@ -117,7 +117,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l
+ 		-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
+ 		-Wl,--version-script,$<,--no-undefined \
+ 		-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+-		-ldl $(argp_LDADD) $(zip_LIBS) $(libdw_so_LDLIBS)
++		-ldl $(argp_LDADD) $(zip_LIBS) $(libdw_so_LDLIBS) -lfts -largp
+ 	@$(textrel_check)
+ 	$(AM_V_at)ln -fs $@ $@.$(VERSION)
+ 
+Index: elfutils-0.164/libdw/libdw_alloc.c
+===================================================================
+--- elfutils-0.164.orig/libdw/libdw_alloc.c
++++ elfutils-0.164/libdw/libdw_alloc.c
+@@ -31,11 +31,12 @@
+ # include <config.h>
+ #endif
+ 
+-#include <error.h>
++#include <err.h>
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <sys/param.h>
+ #include "libdwP.h"
++#include "system.h"
+ 
+ 
+ void *
+Index: elfutils-0.164/libdwfl/Makefile.am
+===================================================================
+--- elfutils-0.164.orig/libdwfl/Makefile.am
++++ elfutils-0.164/libdwfl/Makefile.am
+@@ -86,6 +86,8 @@ libelf = ../libelf/libelf.so
+ libebl = ../libebl/libebl.a
+ libeu = ../lib/libeu.a
+ 
++LDADD = -lfts
++
+ libdwfl_pic_a_SOURCES =
+ am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os)
+ 
+Index: elfutils-0.164/libdwfl/dwfl_build_id_find_elf.c
+===================================================================
+--- elfutils-0.164.orig/libdwfl/dwfl_build_id_find_elf.c
++++ elfutils-0.164/libdwfl/dwfl_build_id_find_elf.c
+@@ -27,6 +27,7 @@
+    not, see <http://www.gnu.org/licenses/>.  */
+ 
+ #include "libdwflP.h"
++#include "system.h"
+ #include <inttypes.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+@@ -94,7 +95,7 @@ __libdwfl_open_by_build_id (Dwfl_Module
+ 	{
+ 	  if (*file_name != NULL)
+ 	    free (*file_name);
+-	  *file_name = canonicalize_file_name (name);
++	  *file_name = realpath (name, NULL);
+ 	  if (*file_name == NULL)
+ 	    {
+ 	      *file_name = name;
+Index: elfutils-0.164/libdwfl/dwfl_error.c
+===================================================================
+--- elfutils-0.164.orig/libdwfl/dwfl_error.c
++++ elfutils-0.164/libdwfl/dwfl_error.c
+@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
+ const char *
+ dwfl_errmsg (int error)
+ {
++  static __thread char s[64] = "";
+   if (error == 0 || error == -1)
+     {
+       int last_error = global_error;
+@@ -154,7 +155,8 @@ dwfl_errmsg (int error)
+   switch (error &~ 0xffff)
+     {
+     case OTHER_ERROR (ERRNO):
+-      return strerror_r (error & 0xffff, "bad", 0);
++      strerror_r (error & 0xffff, s, sizeof(s));
++      return s;
+     case OTHER_ERROR (LIBELF):
+       return elf_errmsg (error & 0xffff);
+     case OTHER_ERROR (LIBDW):
+Index: elfutils-0.164/libdwfl/dwfl_module_getdwarf.c
+===================================================================
+--- elfutils-0.164.orig/libdwfl/dwfl_module_getdwarf.c
++++ elfutils-0.164/libdwfl/dwfl_module_getdwarf.c
+@@ -31,6 +31,7 @@
+ #include <fcntl.h>
+ #include <string.h>
+ #include <unistd.h>
++#include "system.h"
+ #include "../libdw/libdwP.h"	/* DWARF_E_* values are here.  */
+ #include "../libelf/libelfP.h"
+ 
+Index: elfutils-0.164/libdwfl/find-debuginfo.c
+===================================================================
+--- elfutils-0.164.orig/libdwfl/find-debuginfo.c
++++ elfutils-0.164/libdwfl/find-debuginfo.c
+@@ -372,7 +372,7 @@ dwfl_standard_find_debuginfo (Dwfl_Modul
+       /* If FILE_NAME is a symlink, the debug file might be associated
+ 	 with the symlink target name instead.  */
+ 
+-      char *canon = canonicalize_file_name (file_name);
++      char *canon = realpath (file_name, NULL);
+       if (canon != NULL && strcmp (file_name, canon))
+ 	fd = find_debuginfo_in_path (mod, canon,
+ 				     debuglink_file, debuglink_crc,
+Index: elfutils-0.164/libdwfl/libdwfl_crc32_file.c
+===================================================================
+--- elfutils-0.164.orig/libdwfl/libdwfl_crc32_file.c
++++ elfutils-0.164/libdwfl/libdwfl_crc32_file.c
+@@ -31,6 +31,16 @@
+ 
+ #define crc32_file attribute_hidden __libdwfl_crc32_file
+ #define crc32 __libdwfl_crc32
++
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++  (__extension__							      \
++    ({ long int __result;						      \
++       do __result = (long int) (expression);				      \
++       while (__result == -1L && errno == EINTR);			      \
++       __result; }))
++#endif
++
+ #define LIB_SYSTEM_H	1
+ #include <libdwflP.h>
+ #include "../lib/crc32_file.c"
+Index: elfutils-0.164/libdwfl/linux-kernel-modules.c
+===================================================================
+--- elfutils-0.164.orig/libdwfl/linux-kernel-modules.c
++++ elfutils-0.164/libdwfl/linux-kernel-modules.c
+@@ -34,6 +34,7 @@
+ #include <config.h>
+ 
+ #include "libdwflP.h"
++#include "system.h"
+ #include <inttypes.h>
+ #include <errno.h>
+ #include <stdio.h>
+Index: elfutils-0.164/libebl/eblopenbackend.c
+===================================================================
+--- elfutils-0.164.orig/libebl/eblopenbackend.c
++++ elfutils-0.164/libebl/eblopenbackend.c
+@@ -32,7 +32,7 @@
+ 
+ #include <assert.h>
+ #include <dlfcn.h>
+-#include <error.h>
++#include <err.h>
+ #include <libelfP.h>
+ #include <dwarf.h>
+ #include <stdlib.h>
+Index: elfutils-0.164/libebl/eblwstrtab.c
+===================================================================
+--- elfutils-0.164.orig/libebl/eblwstrtab.c
++++ elfutils-0.164/libebl/eblwstrtab.c
+@@ -305,7 +305,7 @@ copystrings (struct Ebl_WStrent *nodep,
+ 
+   /* Process the current node.  */
+   nodep->offset = *offsetp;
+-  *freep = wmempcpy (*freep, nodep->string, nodep->len);
++  *freep = wmemcpy (*freep, nodep->string, nodep->len) + nodep->len;
+   *offsetp += nodep->len * sizeof (wchar_t);
+ 
+   for (subs = nodep->next; subs != NULL; subs = subs->next)
+Index: elfutils-0.164/libelf/elf.h
+===================================================================
+--- elfutils-0.164.orig/libelf/elf.h
++++ elfutils-0.164/libelf/elf.h
+@@ -21,7 +21,9 @@
+ 
+ #include <features.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /* Standard ELF types.  */
+ 
+@@ -3552,7 +3554,8 @@ enum
+ 
+ #define R_TILEGX_NUM		130
+ 
+-
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif	/* elf.h */
+Index: elfutils-0.164/libelf/libelf.h
+===================================================================
+--- elfutils-0.164.orig/libelf/libelf.h
++++ elfutils-0.164/libelf/libelf.h
+@@ -29,6 +29,7 @@
+ #ifndef _LIBELF_H
+ #define _LIBELF_H 1
+ 
++#include <fcntl.h>
+ #include <stdint.h>
+ #include <sys/types.h>
+ 
+Index: elfutils-0.164/libelf/libelfP.h
+===================================================================
+--- elfutils-0.164.orig/libelf/libelfP.h
++++ elfutils-0.164/libelf/libelfP.h
+@@ -36,6 +36,7 @@
+ 
+ #include <ar.h>
+ #include <gelf.h>
++#include <libelf.h>
+ 
+ #include <errno.h>
+ #include <stdint.h>
+Index: elfutils-0.164/src/addr2line.c
+===================================================================
+--- elfutils-0.164.orig/src/addr2line.c
++++ elfutils-0.164/src/addr2line.c
+@@ -23,7 +23,7 @@
+ #include <argp.h>
+ #include <assert.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <inttypes.h>
+ #include <libdwfl.h>
+Index: elfutils-0.164/src/ar.c
+===================================================================
+--- elfutils-0.164.orig/src/ar.c
++++ elfutils-0.164/src/ar.c
+@@ -22,7 +22,7 @@
+ 
+ #include <argp.h>
+ #include <assert.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <libintl.h>
+Index: elfutils-0.164/src/arlib.c
+===================================================================
+--- elfutils-0.164.orig/src/arlib.c
++++ elfutils-0.164/src/arlib.c
+@@ -21,7 +21,7 @@
+ #endif
+ 
+ #include <assert.h>
+-#include <error.h>
++#include <err.h>
+ #include <gelf.h>
+ #include <libintl.h>
+ #include <stdio.h>
+Index: elfutils-0.164/src/arlib2.c
+===================================================================
+--- elfutils-0.164.orig/src/arlib2.c
++++ elfutils-0.164/src/arlib2.c
+@@ -20,7 +20,7 @@
+ # include <config.h>
+ #endif
+ 
+-#include <error.h>
++#include <err.h>
+ #include <libintl.h>
+ #include <limits.h>
+ #include <string.h>
+Index: elfutils-0.164/src/elfcmp.c
+===================================================================
+--- elfutils-0.164.orig/src/elfcmp.c
++++ elfutils-0.164/src/elfcmp.c
+@@ -23,7 +23,7 @@
+ #include <argp.h>
+ #include <assert.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <locale.h>
+ #include <libintl.h>
+Index: elfutils-0.164/src/elflint.c
+===================================================================
+--- elfutils-0.164.orig/src/elflint.c
++++ elfutils-0.164/src/elflint.c
+@@ -24,7 +24,7 @@
+ #include <assert.h>
+ #include <byteswap.h>
+ #include <endian.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <inttypes.h>
+Index: elfutils-0.164/src/findtextrel.c
+===================================================================
+--- elfutils-0.164.orig/src/findtextrel.c
++++ elfutils-0.164/src/findtextrel.c
+@@ -23,7 +23,7 @@
+ #include <argp.h>
+ #include <assert.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <libdw.h>
+Index: elfutils-0.164/src/i386_ld.c
+===================================================================
+--- elfutils-0.164.orig/src/i386_ld.c
++++ elfutils-0.164/src/i386_ld.c
+@@ -20,7 +20,7 @@
+ #endif
+ 
+ #include <assert.h>
+-#include <error.h>
++#include <err.h>
+ #include <libintl.h>
+ #include <stdlib.h>
+ #include <string.h>
+Index: elfutils-0.164/src/ld.c
+===================================================================
+--- elfutils-0.164.orig/src/ld.c
++++ elfutils-0.164/src/ld.c
+@@ -21,7 +21,7 @@
+ 
+ #include <argp.h>
+ #include <assert.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <libelf.h>
+ #include <libintl.h>
+Index: elfutils-0.164/src/ldgeneric.c
+===================================================================
+--- elfutils-0.164.orig/src/ldgeneric.c
++++ elfutils-0.164/src/ldgeneric.c
+@@ -23,7 +23,7 @@
+ #include <ctype.h>
+ #include <dlfcn.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <fnmatch.h>
+ #include <gelf.h>
+Index: elfutils-0.164/src/ldlex.c
+===================================================================
+--- elfutils-0.164.orig/src/ldlex.c
++++ elfutils-0.164/src/ldlex.c
+@@ -1099,7 +1099,7 @@ char *ldtext;
+ #include <assert.h>
+ #include <ctype.h>
+ #include <elf.h>
+-#include <error.h>
++#include <err.h>
+ #include <inttypes.h>
+ #include <libintl.h>
+ #include <stdbool.h>
+Index: elfutils-0.164/src/ldscript.c
+===================================================================
+--- elfutils-0.164.orig/src/ldscript.c
++++ elfutils-0.164/src/ldscript.c
+@@ -95,7 +95,7 @@
+ #endif
+ 
+ #include <assert.h>
+-#include <error.h>
++#include <err.h>
+ #include <libintl.h>
+ #include <stdbool.h>
+ #include <stdint.h>
+Index: elfutils-0.164/src/nm.c
+===================================================================
+--- elfutils-0.164.orig/src/nm.c
++++ elfutils-0.164/src/nm.c
+@@ -26,7 +26,7 @@
+ #include <ctype.h>
+ #include <dwarf.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <inttypes.h>
+Index: elfutils-0.164/src/objdump.c
+===================================================================
+--- elfutils-0.164.orig/src/objdump.c
++++ elfutils-0.164/src/objdump.c
+@@ -21,7 +21,7 @@
+ #endif
+ 
+ #include <argp.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <inttypes.h>
+ #include <libintl.h>
+Index: elfutils-0.164/src/ranlib.c
+===================================================================
+--- elfutils-0.164.orig/src/ranlib.c
++++ elfutils-0.164/src/ranlib.c
+@@ -24,7 +24,7 @@
+ #include <argp.h>
+ #include <assert.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <libintl.h>
+Index: elfutils-0.164/src/readelf.c
+===================================================================
+--- elfutils-0.164.orig/src/readelf.c
++++ elfutils-0.164/src/readelf.c
+@@ -25,7 +25,7 @@
+ #include <ctype.h>
+ #include <dwarf.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <inttypes.h>
+Index: elfutils-0.164/src/size.c
+===================================================================
+--- elfutils-0.164.orig/src/size.c
++++ elfutils-0.164/src/size.c
+@@ -21,7 +21,7 @@
+ #endif
+ 
+ #include <argp.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <inttypes.h>
+Index: elfutils-0.164/src/stack.c
+===================================================================
+--- elfutils-0.164.orig/src/stack.c
++++ elfutils-0.164/src/stack.c
+@@ -18,7 +18,7 @@
+ #include <config.h>
+ #include <assert.h>
+ #include <argp.h>
+-#include <error.h>
++#include <err.h>
+ #include <stdlib.h>
+ #include <inttypes.h>
+ #include <stdio.h>
+Index: elfutils-0.164/src/strings.c
+===================================================================
+--- elfutils-0.164.orig/src/strings.c
++++ elfutils-0.164/src/strings.c
+@@ -25,7 +25,7 @@
+ #include <ctype.h>
+ #include <endian.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <inttypes.h>
+Index: elfutils-0.164/src/strip.c
+===================================================================
+--- elfutils-0.164.orig/src/strip.c
++++ elfutils-0.164/src/strip.c
+@@ -24,7 +24,7 @@
+ #include <assert.h>
+ #include <byteswap.h>
+ #include <endian.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <libelf.h>
+Index: elfutils-0.164/src/unstrip.c
+===================================================================
+--- elfutils-0.164.orig/src/unstrip.c
++++ elfutils-0.164/src/unstrip.c
+@@ -31,7 +31,7 @@
+ #include <argp.h>
+ #include <assert.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <fnmatch.h>
+ #include <libintl.h>
+Index: elfutils-0.164/tests/addrscopes.c
+===================================================================
+--- elfutils-0.164.orig/tests/addrscopes.c
++++ elfutils-0.164/tests/addrscopes.c
+@@ -25,7 +25,7 @@
+ #include <stdio_ext.h>
+ #include <locale.h>
+ #include <stdlib.h>
+-#include <error.h>
++#include <err.h>
+ #include <string.h>
+ 
+ 
+Index: elfutils-0.164/tests/allregs.c
+===================================================================
+--- elfutils-0.164.orig/tests/allregs.c
++++ elfutils-0.164/tests/allregs.c
+@@ -21,7 +21,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <error.h>
++#include <err.h>
+ #include <locale.h>
+ #include <argp.h>
+ #include <assert.h>
+Index: elfutils-0.164/tests/backtrace-data.c
+===================================================================
+--- elfutils-0.164.orig/tests/backtrace-data.c
++++ elfutils-0.164/tests/backtrace-data.c
+@@ -27,7 +27,7 @@
+ #include <dirent.h>
+ #include <stdlib.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <unistd.h>
+ #include <dwarf.h>
+ #if defined(__x86_64__) && defined(__linux__)
+Index: elfutils-0.164/tests/backtrace-dwarf.c
+===================================================================
+--- elfutils-0.164.orig/tests/backtrace-dwarf.c
++++ elfutils-0.164/tests/backtrace-dwarf.c
+@@ -22,7 +22,7 @@
+ #include <stdio_ext.h>
+ #include <locale.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <unistd.h>
+ #include <sys/ptrace.h>
+ #include <sys/types.h>
+Index: elfutils-0.164/tests/backtrace.c
+===================================================================
+--- elfutils-0.164.orig/tests/backtrace.c
++++ elfutils-0.164/tests/backtrace.c
+@@ -24,7 +24,7 @@
+ #include <dirent.h>
+ #include <stdlib.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <unistd.h>
+ #include <dwarf.h>
+ #ifdef __linux__
+Index: elfutils-0.164/tests/buildid.c
+===================================================================
+--- elfutils-0.164.orig/tests/buildid.c
++++ elfutils-0.164/tests/buildid.c
+@@ -23,7 +23,7 @@
+ #include ELFUTILS_HEADER(elf)
+ #include ELFUTILS_HEADER(dwelf)
+ #include <stdio.h>
+-#include <error.h>
++#include <err.h>
+ #include <string.h>
+ #include <stdlib.h>
+ #include <sys/types.h>
+Index: elfutils-0.164/tests/debugaltlink.c
+===================================================================
+--- elfutils-0.164.orig/tests/debugaltlink.c
++++ elfutils-0.164/tests/debugaltlink.c
+@@ -23,7 +23,7 @@
+ #include ELFUTILS_HEADER(dw)
+ #include ELFUTILS_HEADER(dwelf)
+ #include <stdio.h>
+-#include <error.h>
++#include <err.h>
+ #include <string.h>
+ #include <stdlib.h>
+ #include <sys/types.h>
+Index: elfutils-0.164/tests/debuglink.c
+===================================================================
+--- elfutils-0.164.orig/tests/debuglink.c
++++ elfutils-0.164/tests/debuglink.c
+@@ -21,7 +21,7 @@
+ #include <errno.h>
+ #include ELFUTILS_HEADER(dwelf)
+ #include <stdio.h>
+-#include <error.h>
++#include <err.h>
+ #include <string.h>
+ #include <stdlib.h>
+ #include <sys/types.h>
+Index: elfutils-0.164/tests/deleted.c
+===================================================================
+--- elfutils-0.164.orig/tests/deleted.c
++++ elfutils-0.164/tests/deleted.c
+@@ -21,7 +21,7 @@
+ #include <unistd.h>
+ #include <assert.h>
+ #include <stdio.h>
+-#include <error.h>
++#include <err.h>
+ #include <errno.h>
+ #ifdef __linux__
+ #include <sys/prctl.h>
+Index: elfutils-0.164/tests/dwfl-addr-sect.c
+===================================================================
+--- elfutils-0.164.orig/tests/dwfl-addr-sect.c
++++ elfutils-0.164/tests/dwfl-addr-sect.c
+@@ -23,7 +23,7 @@
+ #include <stdio_ext.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <error.h>
++#include <err.h>
+ #include <locale.h>
+ #include <argp.h>
+ #include ELFUTILS_HEADER(dwfl)
+Index: elfutils-0.164/tests/dwfl-bug-addr-overflow.c
+===================================================================
+--- elfutils-0.164.orig/tests/dwfl-bug-addr-overflow.c
++++ elfutils-0.164/tests/dwfl-bug-addr-overflow.c
+@@ -20,7 +20,7 @@
+ #include <inttypes.h>
+ #include <stdio.h>
+ #include <stdio_ext.h>
+-#include <error.h>
++#include <err.h>
+ #include <locale.h>
+ #include ELFUTILS_HEADER(dwfl)
+ 
+Index: elfutils-0.164/tests/dwfl-bug-fd-leak.c
+===================================================================
+--- elfutils-0.164.orig/tests/dwfl-bug-fd-leak.c
++++ elfutils-0.164/tests/dwfl-bug-fd-leak.c
+@@ -24,7 +24,7 @@
+ #include <dirent.h>
+ #include <stdlib.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <unistd.h>
+ #include <dwarf.h>
+ #include <sys/resource.h>
+Index: elfutils-0.164/tests/dwfl-bug-getmodules.c
+===================================================================
+--- elfutils-0.164.orig/tests/dwfl-bug-getmodules.c
++++ elfutils-0.164/tests/dwfl-bug-getmodules.c
+@@ -18,7 +18,7 @@
+ #include <config.h>
+ #include ELFUTILS_HEADER(dwfl)
+ 
+-#include <error.h>
++#include <err.h>
+ 
+ static const Dwfl_Callbacks callbacks =
+   {
+Index: elfutils-0.164/tests/dwfl-report-elf-align.c
+===================================================================
+--- elfutils-0.164.orig/tests/dwfl-report-elf-align.c
++++ elfutils-0.164/tests/dwfl-report-elf-align.c
+@@ -20,7 +20,7 @@
+ #include <inttypes.h>
+ #include <stdio.h>
+ #include <stdio_ext.h>
+-#include <error.h>
++#include <err.h>
+ #include <locale.h>
+ #include <string.h>
+ #include <stdlib.h>
+Index: elfutils-0.164/tests/dwfllines.c
+===================================================================
+--- elfutils-0.164.orig/tests/dwfllines.c
++++ elfutils-0.164/tests/dwfllines.c
+@@ -27,7 +27,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <error.h>
++#include <err.h>
+ 
+ int
+ main (int argc, char *argv[])
+Index: elfutils-0.164/tests/dwflmodtest.c
+===================================================================
+--- elfutils-0.164.orig/tests/dwflmodtest.c
++++ elfutils-0.164/tests/dwflmodtest.c
+@@ -23,7 +23,7 @@
+ #include <stdio_ext.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <error.h>
++#include <err.h>
+ #include <locale.h>
+ #include <argp.h>
+ #include ELFUTILS_HEADER(dwfl)
+Index: elfutils-0.164/tests/dwflsyms.c
+===================================================================
+--- elfutils-0.164.orig/tests/dwflsyms.c
++++ elfutils-0.164/tests/dwflsyms.c
+@@ -25,7 +25,7 @@
+ #include <stdio.h>
+ #include <stdio_ext.h>
+ #include <stdlib.h>
+-#include <error.h>
++#include <err.h>
+ #include <string.h>
+ 
+ static const char *
+Index: elfutils-0.164/tests/early-offscn.c
+===================================================================
+--- elfutils-0.164.orig/tests/early-offscn.c
++++ elfutils-0.164/tests/early-offscn.c
+@@ -19,7 +19,7 @@
+ #endif
+ 
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <stdio.h>
+Index: elfutils-0.164/tests/ecp.c
+===================================================================
+--- elfutils-0.164.orig/tests/ecp.c
++++ elfutils-0.164/tests/ecp.c
+@@ -20,7 +20,7 @@
+ #endif
+ 
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <stdlib.h>
+Index: elfutils-0.164/tests/find-prologues.c
+===================================================================
+--- elfutils-0.164.orig/tests/find-prologues.c
++++ elfutils-0.164/tests/find-prologues.c
+@@ -25,7 +25,7 @@
+ #include <stdio_ext.h>
+ #include <locale.h>
+ #include <stdlib.h>
+-#include <error.h>
++#include <err.h>
+ #include <string.h>
+ #include <fnmatch.h>
+ 
+Index: elfutils-0.164/tests/funcretval.c
+===================================================================
+--- elfutils-0.164.orig/tests/funcretval.c
++++ elfutils-0.164/tests/funcretval.c
+@@ -25,7 +25,7 @@
+ #include <stdio_ext.h>
+ #include <locale.h>
+ #include <stdlib.h>
+-#include <error.h>
++#include <err.h>
+ #include <string.h>
+ #include <fnmatch.h>
+ 
+Index: elfutils-0.164/tests/funcscopes.c
+===================================================================
+--- elfutils-0.164.orig/tests/funcscopes.c
++++ elfutils-0.164/tests/funcscopes.c
+@@ -25,7 +25,7 @@
+ #include <stdio_ext.h>
+ #include <locale.h>
+ #include <stdlib.h>
+-#include <error.h>
++#include <err.h>
+ #include <string.h>
+ #include <fnmatch.h>
+ 
+Index: elfutils-0.164/tests/getsrc_die.c
+===================================================================
+--- elfutils-0.164.orig/tests/getsrc_die.c
++++ elfutils-0.164/tests/getsrc_die.c
+@@ -19,7 +19,7 @@
+ #endif
+ 
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <inttypes.h>
+ #include <libelf.h>
+Index: elfutils-0.164/tests/line2addr.c
+===================================================================
+--- elfutils-0.164.orig/tests/line2addr.c
++++ elfutils-0.164/tests/line2addr.c
+@@ -26,7 +26,7 @@
+ #include <locale.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <error.h>
++#include <err.h>
+ 
+ 
+ static void
+Index: elfutils-0.164/tests/low_high_pc.c
+===================================================================
+--- elfutils-0.164.orig/tests/low_high_pc.c
++++ elfutils-0.164/tests/low_high_pc.c
+@@ -25,7 +25,7 @@
+ #include <stdio_ext.h>
+ #include <locale.h>
+ #include <stdlib.h>
+-#include <error.h>
++#include <err.h>
+ #include <string.h>
+ #include <fnmatch.h>
+ 
+Index: elfutils-0.164/tests/md5-sha1-test.c
+===================================================================
+--- elfutils-0.164.orig/tests/md5-sha1-test.c
++++ elfutils-0.164/tests/md5-sha1-test.c
+@@ -19,7 +19,7 @@
+ #endif
+ 
+ #include <string.h>
+-#include <error.h>
++#include <err.h>
+ 
+ #include "md5.h"
+ #include "sha1.h"
+Index: elfutils-0.164/tests/rdwrmmap.c
+===================================================================
+--- elfutils-0.164.orig/tests/rdwrmmap.c
++++ elfutils-0.164/tests/rdwrmmap.c
+@@ -19,7 +19,7 @@
+ #endif
+ 
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <stdio.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+Index: elfutils-0.164/tests/saridx.c
+===================================================================
+--- elfutils-0.164.orig/tests/saridx.c
++++ elfutils-0.164/tests/saridx.c
+@@ -17,7 +17,7 @@
+ 
+ #include <config.h>
+ 
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <stdio.h>
+Index: elfutils-0.164/tests/sectiondump.c
+===================================================================
+--- elfutils-0.164.orig/tests/sectiondump.c
++++ elfutils-0.164/tests/sectiondump.c
+@@ -18,7 +18,7 @@
+ #include <config.h>
+ 
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <inttypes.h>
+Index: elfutils-0.164/tests/varlocs.c
+===================================================================
+--- elfutils-0.164.orig/tests/varlocs.c
++++ elfutils-0.164/tests/varlocs.c
+@@ -25,7 +25,7 @@
+ #include <dwarf.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+-#include <error.h>
++#include <err.h>
+ #include <string.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+Index: elfutils-0.164/tests/vdsosyms.c
+===================================================================
+--- elfutils-0.164.orig/tests/vdsosyms.c
++++ elfutils-0.164/tests/vdsosyms.c
+@@ -18,7 +18,7 @@
+ #include <config.h>
+ #include <assert.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <inttypes.h>
+ #include <stdio.h>
+ #include <string.h>
+Index: elfutils-0.164/libelf/elf_getarsym.c
+===================================================================
+--- elfutils-0.164.orig/libelf/elf_getarsym.c
++++ elfutils-0.164/libelf/elf_getarsym.c
+@@ -302,7 +302,7 @@ elf_getarsym (Elf *elf, size_t *ptr)
+ 		arsym[cnt].as_off = (*u32)[cnt];
+ 
+ 	      arsym[cnt].as_hash = _dl_elf_hash (str_data);
+-	      str_data = rawmemchr (str_data, '\0') + 1;
++	      str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
+ 	    }
+ 
+ 	  /* At the end a special entry.  */
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.164/aarch64_uio.patch b/meta/recipes-devtools/elfutils/elfutils-0.164/aarch64_uio.patch
new file mode 100644
index 0000000..38dc57b
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.164/aarch64_uio.patch
@@ -0,0 +1,47 @@
+Fix build on aarch64/musl
+
+Errors
+
+invalid operands to binary & (have 'long double' and 'unsigned int')
+
+error: redefinition
+ of 'struct iovec'
+ struct iovec { void *iov_base; size_t iov_len; };
+        ^
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Index: elfutils-0.163/backends/aarch64_initreg.c
+===================================================================
+--- elfutils-0.163.orig/backends/aarch64_initreg.c
++++ elfutils-0.163/backends/aarch64_initreg.c
+@@ -33,7 +33,7 @@
+ #include "system.h"
+ #include <assert.h>
+ #ifdef __aarch64__
+-# include <linux/uio.h>
++# include <sys/uio.h>
+ # include <sys/user.h>
+ # include <sys/ptrace.h>
+ /* Deal with old glibc defining user_pt_regs instead of user_regs_struct.  */
+@@ -82,7 +82,7 @@ aarch64_set_initial_registers_tid (pid_t
+ 
+   Dwarf_Word dwarf_fregs[32];
+   for (int r = 0; r < 32; r++)
+-    dwarf_fregs[r] = fregs.vregs[r] & 0xFFFFFFFF;
++    dwarf_fregs[r] = (unsigned int)fregs.vregs[r] & 0xFFFFFFFF;
+ 
+   if (! setfunc (64, 32, dwarf_fregs, arg))
+     return false;
+Index: elfutils-0.163/backends/arm_initreg.c
+===================================================================
+--- elfutils-0.163.orig/backends/arm_initreg.c
++++ elfutils-0.163/backends/arm_initreg.c
+@@ -37,7 +37,7 @@
+ #endif
+ 
+ #ifdef __aarch64__
+-# include <linux/uio.h>
++# include <sys/uio.h>
+ # include <sys/user.h>
+ # include <sys/ptrace.h>
+ /* Deal with old glibc defining user_pt_regs instead of user_regs_struct.  */
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.164/shadow.patch b/meta/recipes-devtools/elfutils/elfutils-0.164/shadow.patch
new file mode 100644
index 0000000..d31961f
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.164/shadow.patch
@@ -0,0 +1,23 @@
+Fix control path where we have str as uninitialized string
+
+| /home/ubuntu/work/oe/openembedded-core/build/tmp-musl/work/i586-oe-linux-musl/elfutils/0.164-r0/elfutils-0.164/libcpu/i386_disasm.c: In function 'i386_disasm':
+| /home/ubuntu/work/oe/openembedded-core/build/tmp-musl/work/i586-oe-linux-musl/elfutils/0.164-r0/elfutils-0.164/libcpu/i386_disasm.c:310:5: error: 'str' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+|      memcpy (buf + bufcnt, _str, _len);           \
+|      ^
+| /home/ubuntu/work/oe/openembedded-core/build/tmp-musl/work/i586-oe-linux-musl/elfutils/0.164-r0/elfutils-0.164/libcpu/i386_disasm.c:709:17: note: 'str' was declared here
+|      const char *str;
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+Index: elfutils-0.164/libcpu/i386_disasm.c
+===================================================================
+--- elfutils-0.164.orig/libcpu/i386_disasm.c
++++ elfutils-0.164/libcpu/i386_disasm.c
+@@ -821,6 +821,7 @@ i386_disasm (const uint8_t **startp, con
+ 			    }
+ 
+ 			default:
++			  str = "";
+ 			  assert (! "INVALID not handled");
+ 			}
+ 		    }
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.164/uclibc-support.patch b/meta/recipes-devtools/elfutils/elfutils-0.164/uclibc-support.patch
new file mode 100644
index 0000000..966b70f
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.164/uclibc-support.patch
@@ -0,0 +1,129 @@
+From 3daec2dd11a04955f95e8f65a48820103d84dbec Mon Sep 17 00:00:00 2001
+From: Junling Zheng <zhengjunling@huawei.com>
+Date: Thu, 9 Apr 2015 12:12:49 +0000
+Subject: [PATCH] uclibc support for elfutils 0.161
+
+on uclibc systems libintl and libuargp are separate from libc.
+so they need to be specified on commandline when we use proxy-libintl
+then libintl is a static archive so it should be listed last since
+elfutils does not respect disable-nls we need to link in libintl
+
+We add a new option --enable-uclibc which will be used to control
+the uclibc specific configurations during build.
+
+Upstream-Status: Inappropriate [uclibc specific]
+
+Signed-off-by: Khem Raj <raj.khem>
+Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
+[Junling Zheng:
+ - adjust context
+]
+---
+ configure.ac       | 8 ++++++++
+ libcpu/Makefile.am | 4 ++++
+ libdw/Makefile.am  | 7 ++++++-
+ libelf/Makefile.am | 5 +++++
+ 4 files changed, 23 insertions(+), 1 deletion(-)
+
+Index: elfutils-0.164/configure.ac
+===================================================================
+--- elfutils-0.164.orig/configure.ac
++++ elfutils-0.164/configure.ac
+@@ -66,6 +66,14 @@ AS_IF([test "$use_locks" = yes],
+ 
+ AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
+ 
++AC_ARG_ENABLE([uclibc],
++AS_HELP_STRING([--enable-uclibc], [Use uclibc for system libraries]),
++use_uclibc=yes, use_uclibc=no)
++AM_CONDITIONAL(USE_UCLIBC, test "$use_uclibc" = yes)
++AS_IF([test "$use_uclibc" = yes], [AC_DEFINE(USE_UCLIBC)])
++
++AH_TEMPLATE([USE_UCLIBC], [Defined if uclibc libraries are used.])
++
+ AC_PROG_CC
+ AC_PROG_RANLIB
+ AC_PROG_YACC
+@@ -291,18 +299,13 @@ AC_LINK_IFELSE(
+ )
+ 
+ dnl If our libc doesn't provide argp, then test for libargp
+-if test "$libc_has_argp" = "false" ; then
+-	AC_MSG_WARN("libc does not have argp")
+-	AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])
+-
+-	if test "$have_argp" = "false"; then
+-		AC_MSG_ERROR("no libargp found")
+-	else
+-		argp_LDADD="-largp"
+-	fi
+-else
+-	argp_LDADD=""
+-fi
++AS_IF([test "x$libc_has_argp" = "xfalse"],
++	[AC_MSG_WARN("libc does not have argp")
++	AC_CHECK_LIB([argp], [argp_parse], [have_argp="true" argp_LDADD="-largp"], [have_argp="false"])], [argp_LDADD=""])
++
++AS_IF([test "x$libc_has_argp" = "xfalse" -a "x$have_argp" = "xfalse"],
++	AC_CHECK_LIB([uargp], [argp_parse], [have_uargp="true" argp_LDADD="-luargp"], [have_uargp="false"])], [argp_LDADD=""])
++
+ AC_SUBST([argp_LDADD])
+ 
+ dnl The directories with content.
+Index: elfutils-0.164/libcpu/Makefile.am
+===================================================================
+--- elfutils-0.164.orig/libcpu/Makefile.am
++++ elfutils-0.164/libcpu/Makefile.am
+@@ -80,6 +80,10 @@ i386_parse_CFLAGS = -DNMNES="`wc -l < i3
+ i386_lex.o: i386_parse.h
+ i386_gendis_LDADD = $(libeu) -lm
+ 
++if USE_UCLIBC
++i386_gendis_LDADD += -lintl
++endif
++
+ i386_parse.h: i386_parse.c ;
+ 
+ EXTRA_DIST = defs/i386
+Index: elfutils-0.164/libdw/Makefile.am
+===================================================================
+--- elfutils-0.164.orig/libdw/Makefile.am
++++ elfutils-0.164/libdw/Makefile.am
+@@ -102,6 +102,11 @@ endif
+ libdw_pic_a_SOURCES =
+ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
+ 
++libdw_so_LDLIBS =
++if USE_UCLIBC
++libdw_so_LDLIBS += -lintl
++endif
++
+ libdw_so_SOURCES =
+ libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
+ 	  ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
+@@ -112,7 +117,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l
+ 		-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
+ 		-Wl,--version-script,$<,--no-undefined \
+ 		-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+-		-ldl $(argp_LDADD) $(zip_LIBS)
++		-ldl $(argp_LDADD) $(zip_LIBS) $(libdw_so_LDLIBS)
+ 	@$(textrel_check)
+ 	$(AM_V_at)ln -fs $@ $@.$(VERSION)
+ 
+Index: elfutils-0.164/libelf/Makefile.am
+===================================================================
+--- elfutils-0.164.orig/libelf/Makefile.am
++++ elfutils-0.164/libelf/Makefile.am
+@@ -93,7 +93,12 @@ libelf_a_SOURCES = elf_version.c elf_has
+ libelf_pic_a_SOURCES =
+ am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
+ 
++
+ libelf_so_LDLIBS =
++if USE_UCLIBC
++libelf_so_LDLIBS += -lintl
++endif
++
+ if USE_LOCKS
+ libelf_so_LDLIBS += -lpthread
+ endif
diff --git a/meta/recipes-devtools/elfutils/elfutils/mempcpy.patch b/meta/recipes-devtools/elfutils/elfutils/mempcpy.patch
deleted file mode 100644
index 24e31fa..0000000
--- a/meta/recipes-devtools/elfutils/elfutils/mempcpy.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-
-uclibc does not export __mempcpy like glibc so we alias it here.
-This patch may make sense for upstream but elfutils uses more
-glibc specific features like obstack_printf which are missing in
-uclibc they need to be fixed along to make it work all the way
-
-Upstream-Status: Inappropriate[Elfutils uses more glibc specific features]
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Index: elfutils-0.148/libelf/elf_begin.c
-===================================================================
---- elfutils-0.148.orig/libelf/elf_begin.c
-+++ elfutils-0.148/libelf/elf_begin.c
-@@ -68,6 +68,9 @@
- #include "libelfP.h"
- #include "common.h"
- 
-+#ifdef __UCLIBC__
-+#define __mempcpy mempcpy
-+#endif
- 
- /* Create descriptor for archive in memory.  */
- static inline Elf *
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.148.bb b/meta/recipes-devtools/elfutils/elfutils_0.148.bb
index 0d8490d..ff53257 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.148.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.148.bb
@@ -27,7 +27,6 @@ SRC_URI += "\
         file://elf_additions.diff \
         file://elfutils-fsize.patch \
         file://remove-unused.patch \
-        file://mempcpy.patch \
         file://fix_for_gcc-4.7.patch \
         file://dso-link-change.patch \
         file://nm-Fix-size-passed-to-snprintf-for-invalid-sh_name-case.patch \
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.164.bb b/meta/recipes-devtools/elfutils/elfutils_0.164.bb
index c27635d..4964c05 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.164.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.164.bb
@@ -4,6 +4,7 @@ SECTION = "base"
 LICENSE = "(GPLv3 & Elfutils-Exception)"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 DEPENDS = "libtool bzip2 zlib virtual/libintl"
+DEPENDS_append_libc-musl = " argp-standalone fts "
 
 SRC_URI = "https://fedorahosted.org/releases/e/l/elfutils/${PV}/${BP}.tar.bz2"
 
@@ -11,13 +12,14 @@ SRC_URI[md5sum] = "2e4536c1c48034f188a80789a59114d8"
 SRC_URI[sha256sum] = "9683c025928a12d06b7fe812928aa6235249e22d197d086f7084606a48165900"
 
 SRC_URI += "\
-        file://mempcpy.patch \
         file://dso-link-change.patch \
         file://Fix_elf_cvt_gunhash.patch \
         file://fixheadercheck.patch \
         file://0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch \
         file://0001-remove-the-unneed-checking.patch \
         file://0001-fix-a-stack-usage-warning.patch \
+        file://aarch64_uio.patch \
+        file://shadow.patch \
 "
 
 # pick the patch from debian
@@ -33,10 +35,9 @@ SRC_URI += "\
         file://0001-Ignore-differences-between-mips-machine-identifiers.patch \
         file://0002-Add-support-for-mips64-abis-in-mips_retval.c.patch \
         file://0003-Add-mips-n64-relocation-format-hack.patch \
+        file://uclibc-support.patch \
 "
-
-# Only apply when building uclibc based target recipe
-SRC_URI_append_libc-uclibc = " file://uclibc-support-for-elfutils-0.161.patch"
+SRC_URI_append_libc-musl = " file://0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch "
 
 # The buildsystem wants to generate 2 .h files from source using a binary it just built,
 # which can not pass the cross compiling, so let's work around it by adding 2 .h files
@@ -50,7 +51,7 @@ EXTRA_OECONF_append_libc-uclibc = " --enable-uclibc"
 
 do_install_append() {
 	if [ "${TARGET_ARCH}" != "x86_64" ] && [ -z `echo "${TARGET_ARCH}"|grep 'i.86'` ];then
-		rm ${D}${bindir}/eu-objdump
+		rm -f ${D}${bindir}/eu-objdump
 	fi
 }
 
@@ -62,6 +63,8 @@ EXTRA_OEMAKE_libc-uclibc = "-C libelf"
 EXTRA_OEMAKE_class-native = ""
 EXTRA_OEMAKE_class-nativesdk = ""
 
+ALLOW_EMPTY_${PN}_libc-musl = "1"
+
 BBCLASSEXTEND = "native nativesdk"
 
 # Package utilities separately
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 15/73] systemd: Update and fix build with uclibc
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (13 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 14/73] elfutils: Fix build with uclibc/musl Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-22 12:34   ` Burton, Ross
  2016-01-17 11:35 ` [PATCH 16/73] packagegroup-self-hosted.bb: Move glibc-gconv-ibm850 to glibc only case Khem Raj
                   ` (58 subsequent siblings)
  73 siblings, 1 reply; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../systemd/0001-define-exp10-if-missing.patch     |  4 +-
 ...r-getty-to-agetty-in-console-setup-system.patch |  4 +-
 ...pper-instead-of-looking-for-relative-opti.patch | 61 ++++++++++++++++++++++
 ...v-when-secure-versions-are-not-available.patch} | 21 ++++----
 ...c-Change-the-default-device-timeout-to-2.patch} |  4 +-
 ...-install-dependency-links-at-install-tim.patch} |  6 +--
 ...eck-for-additional-features-that-uclibc-.patch} | 12 ++---
 ...n-Use-execvpe-only-when-libc-supports-it.patch} |  4 +-
 ...unimplemented-_SC_PHYS_PAGES-system-conf.patch} |  4 +-
 ...010-implment-systemd-sysv-install-for-OE.patch} |  4 +-
 ...es-Build-conditionally-when-HAVE_MYHOSTN.patch} |  6 +--
 ...patch => 0012-rules-whitelist-hd-devices.patch} |  4 +-
 ...or-add-support-for-executing-scripts-und.patch} |  4 +-
 ...-Make-root-s-home-directory-configurable.patch} | 14 ++---
 ...015-systemd-user-avoid-using-system-auth.patch} |  4 +-
 ...vert-rules-remove-firmware-loading-rules.patch} |  4 +-
 ...remove-userspace-firmware-loading-suppor.patch} | 16 +++---
 ...sing.h-for-getting-secure_getenv-definiti.patch | 25 +++++++++
 ...il-don-t-fail-if-libc-doesn-t-support-IDN.patch | 34 ++++++++++++
 meta/recipes-core/systemd/systemd_228.bb           | 46 ++++++++--------
 20 files changed, 201 insertions(+), 80 deletions(-)
 create mode 100644 meta/recipes-core/systemd/systemd/0003-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch
 rename meta/recipes-core/systemd/systemd/{0003-Use-getenv-when-secure-versions-are-not-available.patch => 0004-Use-getenv-when-secure-versions-are-not-available.patch} (56%)
 rename meta/recipes-core/systemd/systemd/{0004-core-device.c-Change-the-default-device-timeout-to-2.patch => 0005-core-device.c-Change-the-default-device-timeout-to-2.patch} (88%)
 rename meta/recipes-core/systemd/systemd/{0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch => 0006-binfmt-Don-t-install-dependency-links-at-install-tim.patch} (92%)
 rename meta/recipes-core/systemd/systemd/{0006-configure-Check-for-additional-features-that-uclibc-.patch => 0007-configure-Check-for-additional-features-that-uclibc-.patch} (72%)
 rename meta/recipes-core/systemd/systemd/{0007-nspawn-Use-execvpe-only-when-libc-supports-it.patch => 0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch} (89%)
 rename meta/recipes-core/systemd/systemd/{0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch => 0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch} (90%)
 rename meta/recipes-core/systemd/systemd/{0009-implment-systemd-sysv-install-for-OE.patch => 0010-implment-systemd-sysv-install-for-OE.patch} (91%)
 rename meta/recipes-core/systemd/systemd/{0010-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch => 0011-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch} (83%)
 rename meta/recipes-core/systemd/systemd/{0011-rules-whitelist-hd-devices.patch => 0012-rules-whitelist-hd-devices.patch} (91%)
 rename meta/recipes-core/systemd/systemd/{0012-sysv-generator-add-support-for-executing-scripts-und.patch => 0013-sysv-generator-add-support-for-executing-scripts-und.patch} (98%)
 rename meta/recipes-core/systemd/systemd/{0013-Make-root-s-home-directory-configurable.patch => 0014-Make-root-s-home-directory-configurable.patch} (95%)
 rename meta/recipes-core/systemd/systemd/{0014-systemd-user-avoid-using-system-auth.patch => 0015-systemd-user-avoid-using-system-auth.patch} (87%)
 rename meta/recipes-core/systemd/systemd/{0015-Revert-rules-remove-firmware-loading-rules.patch => 0016-Revert-rules-remove-firmware-loading-rules.patch} (84%)
 rename meta/recipes-core/systemd/systemd/{0016-Revert-udev-remove-userspace-firmware-loading-suppor.patch => 0017-Revert-udev-remove-userspace-firmware-loading-suppor.patch} (96%)
 create mode 100644 meta/recipes-core/systemd/systemd/0018-include-missing.h-for-getting-secure_getenv-definiti.patch
 create mode 100644 meta/recipes-core/systemd/systemd/0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch

diff --git a/meta/recipes-core/systemd/systemd/0001-define-exp10-if-missing.patch b/meta/recipes-core/systemd/systemd/0001-define-exp10-if-missing.patch
index 8bb775f..2822169 100644
--- a/meta/recipes-core/systemd/systemd/0001-define-exp10-if-missing.patch
+++ b/meta/recipes-core/systemd/systemd/0001-define-exp10-if-missing.patch
@@ -1,7 +1,7 @@
-From ddad25c809846e08ea39bef49cc668f95d53304a Mon Sep 17 00:00:00 2001
+From 9c89ac1ecb76d25511c146e1b641a7d5237c4be0 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 14 Dec 2015 00:42:49 +0000
-Subject: [PATCH 01/16] define exp10 if missing
+Subject: [PATCH 01/37] define exp10 if missing
 
 Inspired by: http://peter.korsgaard.com/patches/alsa-utils/alsamixer-fix-build-on-uClibc-exp10.patch
 
diff --git a/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch b/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch
index 55ff0ce..451193e 100644
--- a/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch
+++ b/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch
@@ -1,7 +1,7 @@
-From bfb6562cdbec73d03765ce707e9e0cac138fd223 Mon Sep 17 00:00:00 2001
+From 32409e584db04c9f7c2cadd39b8ccb580db5c83c Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 20 Feb 2015 05:29:15 +0000
-Subject: [PATCH 02/16] units: Prefer getty to agetty in console setup systemd
+Subject: [PATCH 02/37] units: Prefer getty to agetty in console setup systemd
  units
 
 Upstream-Status: Inappropriate [configuration specific]
diff --git a/meta/recipes-core/systemd/systemd/0003-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch b/meta/recipes-core/systemd/systemd/0003-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch
new file mode 100644
index 0000000..4ac9321
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0003-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch
@@ -0,0 +1,61 @@
+From 123b979f36d2db8900e602ea8053c2372cecdd26 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 20 Dec 2015 04:20:28 +0000
+Subject: [PATCH 03/37] use lnr wrapper instead of looking for --relative
+ option for ln
+
+Upstream-Status: Inappropriate [OE-Specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile.am  | 6 +++---
+ configure.ac | 2 --
+ 2 files changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 00a92e3..f332b79 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -251,7 +251,7 @@ define move-to-rootlibdir
+ 		$(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
+ 		so_img_name=$$(readlink $(DESTDIR)$(libdir)/$$libname) && \
+ 		rm -f $(DESTDIR)$(libdir)/$$libname && \
+-		$(LN_S) --relative -f $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \
++		lnr $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \
+ 		mv $(DESTDIR)$(libdir)/$$libname.* $(DESTDIR)$(rootlibdir); \
+ 	fi
+ endef
+@@ -325,7 +325,7 @@ define install-relative-aliases
+ 	while [ -n "$$1" ]; do \
+ 		$(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \
+ 		rm -f $(DESTDIR)$$dir/$$2 && \
+-		$(LN_S) --relative $(DESTDIR)$$1 $(DESTDIR)$$dir/$$2 && \
++		lnr $(DESTDIR)$$1 $(DESTDIR)$$dir/$$2 && \
+ 		shift 2 || exit $$?; \
+ 	done
+ endef
+@@ -2806,7 +2806,7 @@ systemd_dbus1_generator_LDADD = \
+ dbus1-generator-install-hook:
+ 	$(AM_V_at)$(MKDIR_P) $(DESTDIR)$(usergeneratordir)
+ 	$(AM_V_RM)rm -f $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
+-	$(AM_V_LN)$(LN_S) --relative -f $(DESTDIR)$(systemgeneratordir)/systemd-dbus1-generator $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
++	$(AM_V_LN)lnr $(DESTDIR)$(systemgeneratordir)/systemd-dbus1-generator $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
+ 
+ dbus1-generator-uninstall-hook:
+ 	rm -f $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
+diff --git a/configure.ac b/configure.ac
+index 3128ca8..f7aa12a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -110,8 +110,6 @@ AC_PATH_PROG([SULOGIN], [sulogin], [/usr/sbin/sulogin], [$PATH:/usr/sbin:/sbin])
+ AC_PATH_PROG([MOUNT_PATH], [mount], [/usr/bin/mount], [$PATH:/usr/sbin:/sbin])
+ AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], [$PATH:/usr/sbin:/sbin])
+ 
+-AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't support --relative ***])])
+-
+ M4_DEFINES=
+ 
+ AC_CHECK_TOOL(OBJCOPY, objcopy)
+-- 
+2.6.4
+
diff --git a/meta/recipes-core/systemd/systemd/0003-Use-getenv-when-secure-versions-are-not-available.patch b/meta/recipes-core/systemd/systemd/0004-Use-getenv-when-secure-versions-are-not-available.patch
similarity index 56%
rename from meta/recipes-core/systemd/systemd/0003-Use-getenv-when-secure-versions-are-not-available.patch
rename to meta/recipes-core/systemd/systemd/0004-Use-getenv-when-secure-versions-are-not-available.patch
index cbf69d1..ad898b8 100644
--- a/meta/recipes-core/systemd/systemd/0003-Use-getenv-when-secure-versions-are-not-available.patch
+++ b/meta/recipes-core/systemd/systemd/0004-Use-getenv-when-secure-versions-are-not-available.patch
@@ -1,7 +1,7 @@
-From 9e79bb4bea758f25803e9f7ff2c5835ac4204230 Mon Sep 17 00:00:00 2001
+From 3d1fb8d7c0a8d4b2f256eab86905fe569d41065d Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 12 Sep 2015 19:10:04 +0000
-Subject: [PATCH 03/16] Use getenv when secure versions are not available
+Subject: [PATCH 04/37] Use getenv when secure versions are not available
 
 musl doesnt implement secure version, so we default
 to it if configure does not detect a secure imeplementation
@@ -9,30 +9,27 @@ to it if configure does not detect a secure imeplementation
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 Upstream-Status: Denied
 ---
- src/basic/missing.h | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
+ src/basic/missing.h | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
 
 diff --git a/src/basic/missing.h b/src/basic/missing.h
-index 09a233b..3c37466 100644
+index 09a233b..ab6ff8d 100644
 --- a/src/basic/missing.h
 +++ b/src/basic/missing.h
-@@ -582,13 +582,14 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
+@@ -582,12 +582,11 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
          return syscall(__NR_name_to_handle_at, fd, name, handle, mnt_id, flags);
  }
  #endif
 -
--#ifndef HAVE_SECURE_GETENV
-+#ifdef HAVE_SECURE_GETENV
+ #ifndef HAVE_SECURE_GETENV
  #  ifdef HAVE___SECURE_GETENV
  #    define secure_getenv __secure_getenv
  #  else
- #    error "neither secure_getenv nor __secure_getenv are available"
+-#    error "neither secure_getenv nor __secure_getenv are available"
++#    define secure_getenv getenv
  #  endif
-+#else
-+#  define secure_getenv getenv
  #endif
  
- #ifndef CIFS_MAGIC_NUMBER
 -- 
 2.6.4
 
diff --git a/meta/recipes-core/systemd/systemd/0004-core-device.c-Change-the-default-device-timeout-to-2.patch b/meta/recipes-core/systemd/systemd/0005-core-device.c-Change-the-default-device-timeout-to-2.patch
similarity index 88%
rename from meta/recipes-core/systemd/systemd/0004-core-device.c-Change-the-default-device-timeout-to-2.patch
rename to meta/recipes-core/systemd/systemd/0005-core-device.c-Change-the-default-device-timeout-to-2.patch
index 74629fc..0414b0c 100644
--- a/meta/recipes-core/systemd/systemd/0004-core-device.c-Change-the-default-device-timeout-to-2.patch
+++ b/meta/recipes-core/systemd/systemd/0005-core-device.c-Change-the-default-device-timeout-to-2.patch
@@ -1,7 +1,7 @@
-From ef867afd27e8fed558e82430759d8d2c7efb6608 Mon Sep 17 00:00:00 2001
+From 118be6eb12746750018c5068ab63003ef63525db Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 14 Dec 2015 04:09:19 +0000
-Subject: [PATCH 04/16] core/device.c: Change the default device timeout to 240
+Subject: [PATCH 05/37] core/device.c: Change the default device timeout to 240
  sec.
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
diff --git a/meta/recipes-core/systemd/systemd/0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0006-binfmt-Don-t-install-dependency-links-at-install-tim.patch
similarity index 92%
rename from meta/recipes-core/systemd/systemd/0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch
rename to meta/recipes-core/systemd/systemd/0006-binfmt-Don-t-install-dependency-links-at-install-tim.patch
index 0b75fac..a5e790f 100644
--- a/meta/recipes-core/systemd/systemd/0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0006-binfmt-Don-t-install-dependency-links-at-install-tim.patch
@@ -1,7 +1,7 @@
-From 319873d22a6b1225ae41aa38bc976e723326ba20 Mon Sep 17 00:00:00 2001
+From dad101dfad17312581ba25b09be84c1dc9b72041 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 20 Feb 2015 05:03:44 +0000
-Subject: [PATCH 05/16] binfmt: Don't install dependency links at install time
+Subject: [PATCH 06/37] binfmt: Don't install dependency links at install time
  for the binfmt services
 
 use [Install] blocks so that they get created when the service is enabled
@@ -24,7 +24,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  3 files changed, 8 insertions(+), 4 deletions(-)
 
 diff --git a/Makefile.am b/Makefile.am
-index 00a92e3..4c1143a 100644
+index f332b79..c62d459 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -4455,10 +4455,6 @@ INSTALL_DIRS += \
diff --git a/meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch b/meta/recipes-core/systemd/systemd/0007-configure-Check-for-additional-features-that-uclibc-.patch
similarity index 72%
rename from meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch
rename to meta/recipes-core/systemd/systemd/0007-configure-Check-for-additional-features-that-uclibc-.patch
index a2c40b5..a2d97b7 100644
--- a/meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch
+++ b/meta/recipes-core/systemd/systemd/0007-configure-Check-for-additional-features-that-uclibc-.patch
@@ -1,7 +1,7 @@
-From d1fe5d2dd38cdef984296f453c65ccaebb71d1a9 Mon Sep 17 00:00:00 2001
+From 4425894feddbbaedfa1fd7776d40b42feb871a74 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 20 Feb 2015 05:05:45 +0000
-Subject: [PATCH 06/16] configure: Check for additional features that uclibc
+Subject: [PATCH 07/37] configure: Check for additional features that uclibc
  doesnt support
 
 This helps in supporting uclibc which does not have all features that
@@ -15,12 +15,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 18 insertions(+)
 
 diff --git a/configure.ac b/configure.ac
-index 3128ca8..49f73a4 100644
+index f7aa12a..0f75cb2 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -112,6 +112,24 @@ AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], [$PATH:/usr/sbin:/sbin]
- 
- AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't support --relative ***])])
+@@ -110,6 +110,24 @@ AC_PATH_PROG([SULOGIN], [sulogin], [/usr/sbin/sulogin], [$PATH:/usr/sbin:/sbin])
+ AC_PATH_PROG([MOUNT_PATH], [mount], [/usr/bin/mount], [$PATH:/usr/sbin:/sbin])
+ AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], [$PATH:/usr/sbin:/sbin])
  
 +# check for few functions not implemented in uClibc
 +
diff --git a/meta/recipes-core/systemd/systemd/0007-nspawn-Use-execvpe-only-when-libc-supports-it.patch b/meta/recipes-core/systemd/systemd/0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch
similarity index 89%
rename from meta/recipes-core/systemd/systemd/0007-nspawn-Use-execvpe-only-when-libc-supports-it.patch
rename to meta/recipes-core/systemd/systemd/0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch
index 85d3907..72d2f14 100644
--- a/meta/recipes-core/systemd/systemd/0007-nspawn-Use-execvpe-only-when-libc-supports-it.patch
+++ b/meta/recipes-core/systemd/systemd/0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch
@@ -1,7 +1,7 @@
-From 529e7e2f7f6a5dc0e4527ff5c2237b19ece2f112 Mon Sep 17 00:00:00 2001
+From 75e4d779c9681a61777ac6eb4571e7a7434fe13c Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 20 Feb 2015 05:10:37 +0000
-Subject: [PATCH 07/16] nspawn: Use execvpe only when libc supports it
+Subject: [PATCH 08/37] nspawn: Use execvpe only when libc supports it
 
 Upstream-Status: Denied [no desire for uclibc support]
 
diff --git a/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch b/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
similarity index 90%
rename from meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
rename to meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
index 8d71ecb..3a1ee2a 100644
--- a/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
+++ b/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
@@ -1,7 +1,7 @@
-From 83944758dc0703afea81f3c7aa0ad926bc5df757 Mon Sep 17 00:00:00 2001
+From abdd9c23e0d17fa97ee8148770481a2877f9b60a Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 14 Dec 2015 00:47:53 +0000
-Subject: [PATCH 08/16] util: bypass unimplemented _SC_PHYS_PAGES system
+Subject: [PATCH 09/37] util: bypass unimplemented _SC_PHYS_PAGES system
  configuration API on uclibc
 
 Upstream-Status: Inappropriate [uclibc-specific]
diff --git a/meta/recipes-core/systemd/systemd/0009-implment-systemd-sysv-install-for-OE.patch b/meta/recipes-core/systemd/systemd/0010-implment-systemd-sysv-install-for-OE.patch
similarity index 91%
rename from meta/recipes-core/systemd/systemd/0009-implment-systemd-sysv-install-for-OE.patch
rename to meta/recipes-core/systemd/systemd/0010-implment-systemd-sysv-install-for-OE.patch
index a139684..0ef642b 100644
--- a/meta/recipes-core/systemd/systemd/0009-implment-systemd-sysv-install-for-OE.patch
+++ b/meta/recipes-core/systemd/systemd/0010-implment-systemd-sysv-install-for-OE.patch
@@ -1,7 +1,7 @@
-From 81c3d92b5bc5786cbd93b1e5ed82884e8caf2254 Mon Sep 17 00:00:00 2001
+From dc37aa73dd37625bf1c516a85263cda7dc24de1f Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 5 Sep 2015 06:31:47 +0000
-Subject: [PATCH 09/16] implment systemd-sysv-install for OE
+Subject: [PATCH 10/37] implment systemd-sysv-install for OE
 
 Use update-rc.d for enabling/disabling and status command
 to check the status of the sysv service
diff --git a/meta/recipes-core/systemd/systemd/0010-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch b/meta/recipes-core/systemd/systemd/0011-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch
similarity index 83%
rename from meta/recipes-core/systemd/systemd/0010-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch
rename to meta/recipes-core/systemd/systemd/0011-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch
index 8cec071..87d1d74 100644
--- a/meta/recipes-core/systemd/systemd/0010-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch
+++ b/meta/recipes-core/systemd/systemd/0011-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch
@@ -1,7 +1,7 @@
-From d4b7f9b771a538c2356c4c77461f3b4790043556 Mon Sep 17 00:00:00 2001
+From ea87f3675829724158f3b14aa712e7a56e1f2202 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 14 Dec 2015 00:50:01 +0000
-Subject: [PATCH 10/16] nss-mymachines: Build conditionally when
+Subject: [PATCH 11/37] nss-mymachines: Build conditionally when
  HAVE_MYHOSTNAME is set
 
 Fixes build failures when building with --disable-myhostname
@@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 2 insertions(+)
 
 diff --git a/Makefile.am b/Makefile.am
-index 4c1143a..cf559be 100644
+index c62d459..c74cb43 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -4961,6 +4961,7 @@ SYSTEM_UNIT_ALIASES += \
diff --git a/meta/recipes-core/systemd/systemd/0011-rules-whitelist-hd-devices.patch b/meta/recipes-core/systemd/systemd/0012-rules-whitelist-hd-devices.patch
similarity index 91%
rename from meta/recipes-core/systemd/systemd/0011-rules-whitelist-hd-devices.patch
rename to meta/recipes-core/systemd/systemd/0012-rules-whitelist-hd-devices.patch
index 03fdbff..e63cceb 100644
--- a/meta/recipes-core/systemd/systemd/0011-rules-whitelist-hd-devices.patch
+++ b/meta/recipes-core/systemd/systemd/0012-rules-whitelist-hd-devices.patch
@@ -1,7 +1,7 @@
-From ae6c9dcb00919e1dd2793fd1b82125d123f69a90 Mon Sep 17 00:00:00 2001
+From 346ff06084ba4f9a8b91717df3388d90bc8f0876 Mon Sep 17 00:00:00 2001
 From: Patrick Ohly <patrick.ohly@intel.com>
 Date: Wed, 16 Sep 2015 13:55:58 +0200
-Subject: [PATCH 11/16] rules: whitelist hd* devices
+Subject: [PATCH 12/37] rules: whitelist hd* devices
 
 qemu by default emulates IDE and the linux-yocto kernel(s) use
 CONFIG_IDE instead of the more modern libsata, so disks appear as
diff --git a/meta/recipes-core/systemd/systemd/0012-sysv-generator-add-support-for-executing-scripts-und.patch b/meta/recipes-core/systemd/systemd/0013-sysv-generator-add-support-for-executing-scripts-und.patch
similarity index 98%
rename from meta/recipes-core/systemd/systemd/0012-sysv-generator-add-support-for-executing-scripts-und.patch
rename to meta/recipes-core/systemd/systemd/0013-sysv-generator-add-support-for-executing-scripts-und.patch
index 82feff0..476ed05 100644
--- a/meta/recipes-core/systemd/systemd/0012-sysv-generator-add-support-for-executing-scripts-und.patch
+++ b/meta/recipes-core/systemd/systemd/0013-sysv-generator-add-support-for-executing-scripts-und.patch
@@ -1,7 +1,7 @@
-From 9e6c907ff1f17deb96c66a607653db4c7da34289 Mon Sep 17 00:00:00 2001
+From 0049d2c4f21c22191e023a8eb8e9157783f26ab5 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 14 Dec 2015 05:09:53 +0000
-Subject: [PATCH 12/16] sysv-generator: add support for executing scripts under
+Subject: [PATCH 13/37] sysv-generator: add support for executing scripts under
  /etc/rcS.d/
 
 To be compatible, all services translated from scripts under /etc/rcS.d would
diff --git a/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch
similarity index 95%
rename from meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch
rename to meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch
index ea0b3e2..a0c796a 100644
--- a/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch
+++ b/meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch
@@ -1,7 +1,7 @@
-From 1ba00ff6ed3f0626892f57cdd8d9788692c7bf14 Mon Sep 17 00:00:00 2001
+From 197215f360821b1f892ec31145dd7cd1bf66810a Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 14 Dec 2015 05:18:20 +0000
-Subject: [PATCH 13/16] Make root's home directory configurable
+Subject: [PATCH 14/37] Make root's home directory configurable
 
 OpenEmbedded has a configurable home directory for root. Allow
 systemd to be built using its idea of what root's home directory
@@ -26,7 +26,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  8 files changed, 20 insertions(+), 11 deletions(-)
 
 diff --git a/Makefile.am b/Makefile.am
-index cf559be..a511c3d 100644
+index c74cb43..2cc61ac 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -210,6 +210,7 @@ AM_CPPFLAGS = \
@@ -46,10 +46,10 @@ index cf559be..a511c3d 100644
         '|SYSTEMCTL=$(rootbindir)/systemctl|' \
         '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \
 diff --git a/configure.ac b/configure.ac
-index 49f73a4..a3e639d 100644
+index 0f75cb2..20a921e 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -1434,6 +1434,11 @@ AC_ARG_WITH([rootlibdir],
+@@ -1432,6 +1432,11 @@ AC_ARG_WITH([rootlibdir],
          [with_rootlibdir=${libdir}])
  AX_NORMALIZE_PATH([with_rootlibdir])
  
@@ -61,7 +61,7 @@ index 49f73a4..a3e639d 100644
  AC_ARG_WITH([pamlibdir],
          AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
          [],
-@@ -1517,6 +1522,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir])
+@@ -1515,6 +1520,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir])
  AC_SUBST([pamconfdir], [$with_pamconfdir])
  AC_SUBST([rootprefix], [$with_rootprefix])
  AC_SUBST([rootlibdir], [$with_rootlibdir])
@@ -69,7 +69,7 @@ index 49f73a4..a3e639d 100644
  
  AC_CONFIG_FILES([
          Makefile
-@@ -1606,6 +1612,7 @@ AC_MSG_RESULT([
+@@ -1604,6 +1610,7 @@ AC_MSG_RESULT([
          includedir:              ${includedir}
          lib dir:                 ${libdir}
          rootlib dir:             ${with_rootlibdir}
diff --git a/meta/recipes-core/systemd/systemd/0014-systemd-user-avoid-using-system-auth.patch b/meta/recipes-core/systemd/systemd/0015-systemd-user-avoid-using-system-auth.patch
similarity index 87%
rename from meta/recipes-core/systemd/systemd/0014-systemd-user-avoid-using-system-auth.patch
rename to meta/recipes-core/systemd/systemd/0015-systemd-user-avoid-using-system-auth.patch
index 11be097..cae93e3 100644
--- a/meta/recipes-core/systemd/systemd/0014-systemd-user-avoid-using-system-auth.patch
+++ b/meta/recipes-core/systemd/systemd/0015-systemd-user-avoid-using-system-auth.patch
@@ -1,7 +1,7 @@
-From 548a8d5d456c531444498b3ce8cec3f3dd374cf8 Mon Sep 17 00:00:00 2001
+From 86d38ea2128332975342175a8349e3919a6b2ab5 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 20 Feb 2015 05:26:25 +0000
-Subject: [PATCH 14/16] systemd-user: avoid using system-auth
+Subject: [PATCH 15/37] systemd-user: avoid using system-auth
 
 In OE, we don't provide system-auth, instead, we use common-* files.
 So modify systemd-user file to use common-* files.
diff --git a/meta/recipes-core/systemd/systemd/0015-Revert-rules-remove-firmware-loading-rules.patch b/meta/recipes-core/systemd/systemd/0016-Revert-rules-remove-firmware-loading-rules.patch
similarity index 84%
rename from meta/recipes-core/systemd/systemd/0015-Revert-rules-remove-firmware-loading-rules.patch
rename to meta/recipes-core/systemd/systemd/0016-Revert-rules-remove-firmware-loading-rules.patch
index 7cc3922..5fccc1d 100644
--- a/meta/recipes-core/systemd/systemd/0015-Revert-rules-remove-firmware-loading-rules.patch
+++ b/meta/recipes-core/systemd/systemd/0016-Revert-rules-remove-firmware-loading-rules.patch
@@ -1,7 +1,7 @@
-From 6b2b8d20f884bd5a3d928175e422023f6c9d056b Mon Sep 17 00:00:00 2001
+From 2ca57f968c29a26d67e3a7a3bc3217ac1f886b55 Mon Sep 17 00:00:00 2001
 From: Jonathan Liu <net147@gmail.com>
 Date: Thu, 19 Mar 2015 15:01:29 +1100
-Subject: [PATCH 15/16] Revert "rules: remove firmware loading rules"
+Subject: [PATCH 16/37] Revert "rules: remove firmware loading rules"
 
 This reverts commit 70e7d754ddb356fb1a2942b262f8cee9650e2a19.
 Userspace firmware loading support is needed for Linux < 3.7.
diff --git a/meta/recipes-core/systemd/systemd/0016-Revert-udev-remove-userspace-firmware-loading-suppor.patch b/meta/recipes-core/systemd/systemd/0017-Revert-udev-remove-userspace-firmware-loading-suppor.patch
similarity index 96%
rename from meta/recipes-core/systemd/systemd/0016-Revert-udev-remove-userspace-firmware-loading-suppor.patch
rename to meta/recipes-core/systemd/systemd/0017-Revert-udev-remove-userspace-firmware-loading-suppor.patch
index 6e5a8fb..93b4fa3 100644
--- a/meta/recipes-core/systemd/systemd/0016-Revert-udev-remove-userspace-firmware-loading-suppor.patch
+++ b/meta/recipes-core/systemd/systemd/0017-Revert-udev-remove-userspace-firmware-loading-suppor.patch
@@ -1,7 +1,7 @@
-From d3661ec7fb4557c47f001986cbb8a684b8dbae4a Mon Sep 17 00:00:00 2001
+From 6dba4a34e1685eacf1524704e5bcfe290864ee17 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 14 Dec 2015 05:33:32 +0000
-Subject: [PATCH 16/16] Revert "udev: remove userspace firmware loading
+Subject: [PATCH 17/37] Revert "udev: remove userspace firmware loading
  support"
 
 This reverts commit be2ea723b1d023b3d385d3b791ee4607cbfb20ca.
@@ -15,16 +15,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  Makefile.am                      |  12 +++
  README                           |   6 +-
  TODO                             |   1 +
- configure.ac                     |  25 +++++++
+ configure.ac                     |  22 ++++++
  src/udev/udev-builtin-firmware.c | 154 +++++++++++++++++++++++++++++++++++++++
  src/udev/udev-builtin.c          |   3 +
  src/udev/udev.h                  |   6 ++
  src/udev/udevd.c                 |  13 ++++
- 8 files changed, 217 insertions(+), 3 deletions(-)
+ 8 files changed, 214 insertions(+), 3 deletions(-)
  create mode 100644 src/udev/udev-builtin-firmware.c
 
 diff --git a/Makefile.am b/Makefile.am
-index a511c3d..6181e55 100644
+index 2cc61ac..db9d204 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -3650,6 +3650,18 @@ libudev_core_la_LIBADD = \
@@ -81,10 +81,10 @@ index 369805f..ce97674 100644
    - kill scsi_id
    - add trigger --subsystem-match=usb/usb_device device
 diff --git a/configure.ac b/configure.ac
-index a3e639d..00736f5 100644
+index 20a921e..1bde875 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -1317,6 +1317,25 @@ AC_ARG_ENABLE(hwdb, [AC_HELP_STRING([--disable-hwdb], [disable hardware database
+@@ -1315,6 +1315,25 @@ AC_ARG_ENABLE(hwdb, [AC_HELP_STRING([--disable-hwdb], [disable hardware database
  AM_CONDITIONAL(ENABLE_HWDB, [test x$enable_hwdb = xyes])
  
  # ------------------------------------------------------------------------------
@@ -110,7 +110,7 @@ index a3e639d..00736f5 100644
  have_manpages=no
  AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-manpages], [disable manpages]))
  AS_IF([test "x$enable_manpages" != xno], [
-@@ -1616,6 +1635,9 @@ AC_MSG_RESULT([
+@@ -1614,6 +1633,9 @@ AC_MSG_RESULT([
          SysV init scripts:       ${SYSTEM_SYSVINIT_PATH}
          SysV rc?.d directories:  ${SYSTEM_SYSVRCND_PATH}
          Build Python:            ${PYTHON}
diff --git a/meta/recipes-core/systemd/systemd/0018-include-missing.h-for-getting-secure_getenv-definiti.patch b/meta/recipes-core/systemd/systemd/0018-include-missing.h-for-getting-secure_getenv-definiti.patch
new file mode 100644
index 0000000..7e9132c
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0018-include-missing.h-for-getting-secure_getenv-definiti.patch
@@ -0,0 +1,25 @@
+From a2bfd7e43780eccc5a1100f51604a513e050d460 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 15 Dec 2015 22:51:55 +0000
+Subject: [PATCH 18/37] include missing.h for getting secure_getenv definition
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/basic/user-util.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/basic/user-util.c b/src/basic/user-util.c
+index c3d0ec3..e0755e7 100644
+--- a/src/basic/user-util.c
++++ b/src/basic/user-util.c
+@@ -40,6 +40,7 @@
+ #include "path-util.h"
+ #include "string-util.h"
+ #include "user-util.h"
++#include "missing.h"
+ 
+ bool uid_is_valid(uid_t uid) {
+ 
+-- 
+2.6.4
+
diff --git a/meta/recipes-core/systemd/systemd/0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch b/meta/recipes-core/systemd/systemd/0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch
new file mode 100644
index 0000000..e92b668
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch
@@ -0,0 +1,34 @@
+From 41626df8d8e159cc958d483f7059f94583ab0795 Mon Sep 17 00:00:00 2001
+From: Emil Renner Berthing <systemd@esmil.dk>
+Date: Sat, 12 Sep 2015 19:56:52 +0000
+Subject: [PATCH 19/37] socket-util: don't fail if libc doesn't support IDN
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/basic/socket-util.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
+index be144e1..45538da 100644
+--- a/src/basic/socket-util.c
++++ b/src/basic/socket-util.c
+@@ -46,6 +46,15 @@
+ #include "string-util.h"
+ #include "user-util.h"
+ #include "util.h"
++/* Don't fail if the standard library
++ * doesn't support IDN */
++#ifndef NI_IDN
++#define NI_IDN 0
++#endif
++
++#ifndef NI_IDN_USE_STD3_ASCII_RULES
++#define NI_IDN_USE_STD3_ASCII_RULES 0
++#endif
+ 
+ int socket_address_parse(SocketAddress *a, const char *s) {
+         char *e, *n;
+-- 
+2.6.4
+
diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb
index aa2e846..0c6fbde 100644
--- a/meta/recipes-core/systemd/systemd_228.bb
+++ b/meta/recipes-core/systemd/systemd_228.bb
@@ -24,34 +24,37 @@ SECTION = "base/shell"
 
 inherit useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext
 
-SRCREV = "dd050decb6ad131ebdeabb71c4f9ecb4733269c0"
+SRCREV = "720e593603dbfc2d2b2a7b9f6e911ad7f09c61b2"
 
 PV = "228+git${SRCPV}"
 
 SRC_URI = "git://github.com/systemd/systemd.git;protocol=git \
-           file://0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
-           file://0006-configure-Check-for-additional-features-that-uclibc-.patch \
-           file://0007-nspawn-Use-execvpe-only-when-libc-supports-it.patch \
-           file://0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch \
-           file://0009-implment-systemd-sysv-install-for-OE.patch \
-           file://0010-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch \
-           file://0011-rules-whitelist-hd-devices.patch \
-           file://0012-sysv-generator-add-support-for-executing-scripts-und.patch \
-           file://0013-Make-root-s-home-directory-configurable.patch \
-           file://0014-systemd-user-avoid-using-system-auth.patch \
-           file://0015-Revert-rules-remove-firmware-loading-rules.patch \
-           file://0016-Revert-udev-remove-userspace-firmware-loading-suppor.patch \
+           file://0003-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch \
+           file://0004-Use-getenv-when-secure-versions-are-not-available.patch \
+           file://0006-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
+           file://0007-configure-Check-for-additional-features-that-uclibc-.patch \
+           file://0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch \
+           file://0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch \
+           file://0010-implment-systemd-sysv-install-for-OE.patch \
+           file://0011-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch \
+           file://0012-rules-whitelist-hd-devices.patch \
+           file://0013-sysv-generator-add-support-for-executing-scripts-und.patch \
+           file://0014-Make-root-s-home-directory-configurable.patch \
+           file://0015-systemd-user-avoid-using-system-auth.patch \
+           file://0016-Revert-rules-remove-firmware-loading-rules.patch \
+           file://0017-Revert-udev-remove-userspace-firmware-loading-suppor.patch \
+           file://0018-include-missing.h-for-getting-secure_getenv-definiti.patch \
+           file://0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch \
            file://touchscreen.rules \
            file://00-create-volatile.conf \
            file://init \
            file://run-ptest \
           "
 SRC_URI_append_libc-uclibc = "\
-            file://0001-define-exp10-if-missing.patch \
-            file://0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch \
-            file://0003-Use-getenv-when-secure-versions-are-not-available.patch \
-           "
-SRC_URI_append_qemuall = " file://0004-core-device.c-Change-the-default-device-timeout-to-2.patch "
+           file://0001-define-exp10-if-missing.patch \
+           file://0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch \
+          "
+SRC_URI_append_qemuall = " file://0005-core-device.c-Change-the-default-device-timeout-to-2.patch "
 
 S = "${WORKDIR}/git"
 
@@ -131,6 +134,10 @@ EXTRA_OECONF = " --with-rootprefix=${rootprefix} \
 # uclibc does not have NSS
 EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname --disable-sysusers"
 
+EXTRA_OECONF_append_libc-musl = "\
+            --disable-selinux --disable-smack --disable-myhostname \
+            --disable-sysusers \
+           "
 # per the systemd README, define VALGRIND=1 to run under valgrind
 CFLAGS .= "${@bb.utils.contains('PACKAGECONFIG', 'valgrind', ' -DVALGRIND=1', '', d)}"
 
@@ -147,9 +154,6 @@ do_configure_prepend() {
 	else
 		cp -r ${S}/units ${S}/units.pre_sed
 	fi
-	sed -i '/ln --relative --help/d' ${S}/configure.ac
-	sed -i -e 's:\$(LN_S) --relative -f:lnr:g' ${S}/Makefile.am
-	sed -i -e 's:\$(LN_S) --relative:lnr:g' ${S}/Makefile.am
 }
 
 do_install() {
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 16/73] packagegroup-self-hosted.bb: Move glibc-gconv-ibm850 to glibc only case
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (14 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 15/73] systemd: Update and fix build with uclibc Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 17/73] guile: Fix build with uclibc Khem Raj
                   ` (57 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

This package is not provided by non-glibc libcs therefore add it only
when libc is glibc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/packagegroups/packagegroup-self-hosted.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb b/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
index d38be26..bb8371e 100644
--- a/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
@@ -67,7 +67,6 @@ RDEPENDS_packagegroup-self-hosted-sdk = "\
     cpp \
     cpp-symlinks \
     distcc \
-    glibc-gconv-ibm850 \
     file \
     findutils \
     g++ \
@@ -93,6 +92,7 @@ RDEPENDS_packagegroup-self-hosted-sdk = "\
     "
 # glibc-utils: for rpcgen
 RDEPENDS_packagegroup-self-hosted-sdk_append_libc-glibc = "\
+    glibc-gconv-ibm850 \
     glibc-utils \
     "
 RDEPENDS_packagegroup-self-hosted-debug = " \
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 17/73] guile: Fix build with uclibc
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (15 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 16/73] packagegroup-self-hosted.bb: Move glibc-gconv-ibm850 to glibc only case Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 18/73] gnutls: Link with libuargp on uclibc Khem Raj
                   ` (56 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../guile/files/remove_strcase_l_funcs.patch       | 38 ++++++++++++++++++++++
 meta/recipes-devtools/guile/guile_2.0.11.bb        |  3 +-
 2 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/guile/files/remove_strcase_l_funcs.patch

diff --git a/meta/recipes-devtools/guile/files/remove_strcase_l_funcs.patch b/meta/recipes-devtools/guile/files/remove_strcase_l_funcs.patch
new file mode 100644
index 0000000..e7a06fe
--- /dev/null
+++ b/meta/recipes-devtools/guile/files/remove_strcase_l_funcs.patch
@@ -0,0 +1,38 @@
+These unused functions cause build failures with uclibc since they reference __uclibc_locale_struct
+and this is exposed by uclibc API headers only if C locales are built, but for OE we build full locale
+support
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+Index: guile-2.0.11/libguile/i18n.c
+===================================================================
+--- guile-2.0.11.orig/libguile/i18n.c
++++ guile-2.0.11/libguile/i18n.c
+@@ -851,27 +851,6 @@ str_downcase (register char *dst, regist
+   *dst = '\0';
+ }
+ 
+-#ifdef USE_GNU_LOCALE_API
+-static inline void
+-str_upcase_l (register char *dst, register const char *src,
+-	      scm_t_locale locale)
+-{
+-  for (; *src != '\0'; src++, dst++)
+-    *dst = toupper_l (*src, locale);
+-  *dst = '\0';
+-}
+-
+-static inline void
+-str_downcase_l (register char *dst, register const char *src,
+-		scm_t_locale locale)
+-{
+-  for (; *src != '\0'; src++, dst++)
+-    *dst = tolower_l (*src, locale);
+-  *dst = '\0';
+-}
+-#endif
+-
+-
+ SCM_DEFINE (scm_string_locale_lt, "string-locale<?", 2, 1, 0,
+ 	    (SCM s1, SCM s2, SCM locale),
+ 	    "Compare strings @var{s1} and @var{s2} in a locale-dependent way."
diff --git a/meta/recipes-devtools/guile/guile_2.0.11.bb b/meta/recipes-devtools/guile/guile_2.0.11.bb
index fa45008..413c81d 100644
--- a/meta/recipes-devtools/guile/guile_2.0.11.bb
+++ b/meta/recipes-devtools/guile/guile_2.0.11.bb
@@ -23,6 +23,7 @@ SRC_URI = "${GNU_MIRROR}/guile/guile-${PV}.tar.xz \
            file://workaround-ice-ssa-corruption.patch \
            file://libguile-Makefile.am-hook.patch \
            file://libguile-VM-ASM_MUL-for-ARM-Add-earlyclobber.patch \
+           file://remove_strcase_l_funcs.patch \
            "
 
 #           file://debian/0001-Change-guile-to-guile-X.Y-for-info-pages.patch
@@ -50,7 +51,7 @@ EXTRA_OECONF += "${@['--without-libltdl-prefix --without-libgmp-prefix --without
 EXTRA_OECONF_append_class-target = " --with-libunistring-prefix=${STAGING_LIBDIR} \
                                      --with-libgmp-prefix=${STAGING_LIBDIR} \
                                      --with-libltdl-prefix=${STAGING_LIBDIR}"
-
+EXTRA_OECONF_append_libc-uclibc = " guile_cv_use_csqrt=no "
 do_configure_prepend() {
 	mkdir -p po
 }
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 18/73] gnutls: Link with libuargp on uclibc
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (16 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 17/73] guile: Fix build with uclibc Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 19/73] mtools: Fix build with uclibc Khem Raj
                   ` (55 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

uclibc has its own implementation for libargp

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-support/gnutls/gnutls.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-support/gnutls/gnutls.inc b/meta/recipes-support/gnutls/gnutls.inc
index 5bcfc9c..90597db 100644
--- a/meta/recipes-support/gnutls/gnutls.inc
+++ b/meta/recipes-support/gnutls/gnutls.inc
@@ -1,7 +1,7 @@
 SUMMARY = "GNU Transport Layer Security Library"
 HOMEPAGE = "http://www.gnu.org/software/gnutls/"
 BUGTRACKER = "https://savannah.gnu.org/support/?group=gnutls"
-DEPENDS = "nettle libidn"
+DEPENDS = "nettle libidn virtual/libiconv"
 DEPENDS_append_libc-musl = " argp-standalone "
 
 LICENSE = "GPLv3+ & LGPLv2.1+"
@@ -30,6 +30,7 @@ EXTRA_OECONF="--disable-rpath \
               --enable-openssl-compatibility \
               "
 LDFLAGS_append_libc-musl = " -largp "
+LDFLAGS_append_libc-uclibc = " -luargp "
 
 do_configure_prepend() {
 	for dir in . lib; do
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 19/73] mtools: Fix build with uclibc
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (17 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 18/73] gnutls: Link with libuargp on uclibc Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-18  7:17   ` Roman Khimov
  2016-01-17 11:35 ` [PATCH 20/73] parted: " Khem Raj
                   ` (54 subsequent siblings)
  73 siblings, 1 reply; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

unlike glibc, uclibc does not have internal APIs implemented for
libiconv, so it needs to depend upon libiconv

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/mtools/mtools_4.0.18.bb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-devtools/mtools/mtools_4.0.18.bb b/meta/recipes-devtools/mtools/mtools_4.0.18.bb
index bc9b79c..479fd32 100644
--- a/meta/recipes-devtools/mtools/mtools_4.0.18.bb
+++ b/meta/recipes-devtools/mtools/mtools_4.0.18.bb
@@ -5,6 +5,7 @@ SECTION = "optional"
 LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
+DEPENDS += "virtual/libiconv"
 
 RDEPENDS_${PN}_libc-glibc = "glibc-gconv-ibm850"
 RRECOMMENDS_${PN}_libc-glibc = "\
@@ -35,6 +36,8 @@ inherit autotools texinfo
 
 EXTRA_OECONF = "--without-x"
 
+LDFLAGS_append_libc-uclibc = " -liconv "
+
 BBCLASSEXTEND = "native nativesdk"
 
 PACKAGECONFIG ??= ""
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 20/73] parted: Fix build with uclibc
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (18 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 19/73] mtools: Fix build with uclibc Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 21/73] net-tools: Link with libintl on uclibc Khem Raj
                   ` (53 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

unlike glibc, uclibc does not have internal APIs implemented for
libiconv, so it needs to depend upon libiconv

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-extended/parted/parted_3.2.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-extended/parted/parted_3.2.bb b/meta/recipes-extended/parted/parted_3.2.bb
index ff8ae09..30c00c8 100644
--- a/meta/recipes-extended/parted/parted_3.2.bb
+++ b/meta/recipes-extended/parted/parted_3.2.bb
@@ -3,7 +3,7 @@ HOMEPAGE = "http://www.gnu.org/software/parted/parted.html"
 LICENSE = "GPLv3+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=2f31b266d3440dd7ee50f92cf67d8e6c"
 SECTION = "console/tools"
-DEPENDS = "ncurses readline util-linux"
+DEPENDS = "ncurses readline util-linux virtual/libiconv"
 PR = "r1"
 
 SRC_URI = "${GNU_MIRROR}/parted/parted-${PV}.tar.xz \
@@ -21,6 +21,7 @@ SRC_URI[md5sum] = "0247b6a7b314f8edeb618159fa95f9cb"
 SRC_URI[sha256sum] = "858b589c22297cacdf437f3baff6f04b333087521ab274f7ab677cb8c6bb78e4"
 
 EXTRA_OECONF = "--disable-device-mapper"
+LDFLAGS_append_libc-uclibc = " -liconv "
 
 inherit autotools pkgconfig gettext texinfo ptest
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 21/73] net-tools: Link with libintl on uclibc
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (19 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 20/73] parted: " Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 22/73] libdrm: Upgrade 2.4.65 -> 2.4.66 Khem Raj
                   ` (52 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

libintl is needed explicitly on linker cmdline on uclibc since the APIs
are not in libc itelf.

Fix build on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../net-tools/net-tools/musl-fixes.patch           | 100 +++++++++++++++++++++
 .../net-tools/net-tools_1.60-26.bb                 |   3 +-
 2 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/net-tools/net-tools/musl-fixes.patch

diff --git a/meta/recipes-extended/net-tools/net-tools/musl-fixes.patch b/meta/recipes-extended/net-tools/net-tools/musl-fixes.patch
new file mode 100644
index 0000000..f694d59
--- /dev/null
+++ b/meta/recipes-extended/net-tools/net-tools/musl-fixes.patch
@@ -0,0 +1,100 @@
+Adjust headers for non-glibc cases
+especially exposed by musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+Index: net-tools-1.60/lib/inet6_gr.c
+===================================================================
+--- net-tools-1.60.orig/lib/inet6_gr.c
++++ net-tools-1.60/lib/inet6_gr.c
+@@ -23,7 +23,7 @@
+ #include <string.h>
+ #include <stdio.h>
+ #include <unistd.h>
+-#ifndef __GLIBC__
++#ifdef HAVE_IPV6_ROUTE_H
+ #include <netinet6/ipv6_route.h>	/* glibc doesn't have this */
+ #endif
+ #include "version.h"
+Index: net-tools-1.60/lib/inet6_sr.c
+===================================================================
+--- net-tools-1.60.orig/lib/inet6_sr.c
++++ net-tools-1.60/lib/inet6_sr.c
+@@ -23,10 +23,10 @@
+ #include <string.h>
+ #include <stdio.h>
+ #include <unistd.h>
+-#ifdef __GLIBC__
+-#include <net/route.h>
+-#else
++#ifdef HAVE_IPV6_ROUTE_H
+ #include <netinet6/ipv6_route.h>	/* glibc does not have this */
++#else
++#include <net/route.h>
+ #endif
+ #include "version.h"
+ #include "net-support.h"
+Index: net-tools-1.60/lib/inet_sr.c
+===================================================================
+--- net-tools-1.60.orig/lib/inet_sr.c
++++ net-tools-1.60/lib/inet_sr.c
+@@ -26,6 +26,7 @@
+ #include <string.h>
+ #include <stdio.h>
+ #include <unistd.h>
++#include <asm-generic/param.h>
+ #include "version.h"
+ #include "net-support.h"
+ #include "pathnames.h"
+Index: net-tools-1.60/lib/util-ank.c
+===================================================================
+--- net-tools-1.60.orig/lib/util-ank.c
++++ net-tools-1.60/lib/util-ank.c
+@@ -14,6 +14,7 @@
+  * Rani Assaf <rani@magic.metawire.com> 980929:	resolve addresses
+  */
+ 
++#include <limits.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+Index: net-tools-1.60/mii-tool.c
+===================================================================
+--- net-tools-1.60.orig/mii-tool.c
++++ net-tools-1.60/mii-tool.c
+@@ -47,10 +47,6 @@ static char Version[] = "$Id: mii-tool.c
+ #include <net/if.h>
+ #include <linux/sockios.h>
+ 
+-#ifndef __GLIBC__
+-#include <linux/if_arp.h>
+-#include <linux/if_ether.h>
+-#endif
+ #include "mii.h"
+ #include "version.h"
+ 
+Index: net-tools-1.60/netstat.c
+===================================================================
+--- net-tools-1.60.orig/netstat.c
++++ net-tools-1.60/netstat.c
+@@ -87,6 +87,7 @@
+ #include <dirent.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <asm-generic/param.h>
+ 
+ #include "net-support.h"
+ #include "pathnames.h"
+Index: net-tools-1.60/slattach.c
+===================================================================
+--- net-tools-1.60.orig/slattach.c
++++ net-tools-1.60/slattach.c
+@@ -44,6 +44,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <getopt.h>
++#include <termios.h>
+ #include <linux/if_slip.h>
+ 
+ #if defined(__GLIBC__)
diff --git a/meta/recipes-extended/net-tools/net-tools_1.60-26.bb b/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
index 923d048..79c7291 100644
--- a/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
+++ b/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
@@ -11,6 +11,7 @@ SRC_URI = "http://snapshot.debian.org/archive/debian/20050312T000000Z/pool/main/
            file://net-tools-config.h \
            file://net-tools-config.make \
            file://ifconfig-interface-0-del-IP-will-remove-the-aliased-.patch \
+           file://musl-fixes.patch \
 	   "
 
 # for this package we're mostly interested in tracking debian patches,
@@ -30,7 +31,7 @@ SRC_URI[patch.sha256sum] = "aeeeafaff68866a446f01bb639d4e0146a60af34dcd20e31a3e4
 UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/n/net-tools/"
 
 inherit gettext
-
+LDFLAGS_append_libc-uclibc = " -lintl "
 # The Makefile is lame, no parallel build
 PARALLEL_MAKE = ""
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 22/73] libdrm: Upgrade 2.4.65 -> 2.4.66
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (20 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 21/73] net-tools: Link with libintl on uclibc Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-18 15:40   ` Burton, Ross
  2016-01-17 11:35 ` [PATCH 23/73] directfb: Fix build with musl Khem Raj
                   ` (51 subsequent siblings)
  73 siblings, 1 reply; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

Fix test build failures

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...tests-kms-steal-crtc-Include-sys-select.h.patch | 33 ++++++++++++++++++++++
 .../recipes-graphics/drm/libdrm/installtests.patch | 24 +++++-----------
 .../drm/{libdrm_2.4.65.bb => libdrm_2.4.66.bb}     |  8 ++++--
 3 files changed, 45 insertions(+), 20 deletions(-)
 create mode 100644 meta/recipes-graphics/drm/libdrm/0001-tests-kms-steal-crtc-Include-sys-select.h.patch
 rename meta/recipes-graphics/drm/{libdrm_2.4.65.bb => libdrm_2.4.66.bb} (86%)

diff --git a/meta/recipes-graphics/drm/libdrm/0001-tests-kms-steal-crtc-Include-sys-select.h.patch b/meta/recipes-graphics/drm/libdrm/0001-tests-kms-steal-crtc-Include-sys-select.h.patch
new file mode 100644
index 0000000..c18228e
--- /dev/null
+++ b/meta/recipes-graphics/drm/libdrm/0001-tests-kms-steal-crtc-Include-sys-select.h.patch
@@ -0,0 +1,33 @@
+From 46fb5516fb0ab17bcf46a0306a11e8966bb36e14 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 29 Dec 2015 22:17:21 +0000
+Subject: [PATCH] tests/kms-steal-crtc: Include sys/select.h
+
+Fixes errors e.g.
+
+error: implicit declaration of function 'select'
+
+and missing definitions of FD_* defines
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ tests/kms/kms-steal-crtc.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tests/kms/kms-steal-crtc.c b/tests/kms/kms-steal-crtc.c
+index 2f7f327..24d70ab 100644
+--- a/tests/kms/kms-steal-crtc.c
++++ b/tests/kms/kms-steal-crtc.c
+@@ -31,6 +31,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <sys/select.h>
+ 
+ #include <drm_fourcc.h>
+ 
+-- 
+2.6.4
+
diff --git a/meta/recipes-graphics/drm/libdrm/installtests.patch b/meta/recipes-graphics/drm/libdrm/installtests.patch
index f460ef5..30e0a61 100644
--- a/meta/recipes-graphics/drm/libdrm/installtests.patch
+++ b/meta/recipes-graphics/drm/libdrm/installtests.patch
@@ -4,22 +4,12 @@ Upstream-Status: Inappropriate [configuration]
 
 Signed-off-by: Yu Ke <ke.yu@intel.com>
 
-Index: libdrm-2.4.65/tests/Makefile.am
+Index: libdrm-2.4.66/tests/Makefile.am
 ===================================================================
---- libdrm-2.4.65.orig/tests/Makefile.am
-+++ libdrm-2.4.65/tests/Makefile.am
-@@ -29,9 +29,11 @@ AM_CFLAGS = \
- 
- LDADD = $(top_builddir)/libdrm.la
- 
--check_PROGRAMS = \
--	dristat \
--	drmstat
-+bin_PROGRAMS = \
-+        dristat \
-+        drmstat
-+ 
-+check_PROGRAMS =
- 
- dristat_LDADD = -lm
+--- libdrm-2.4.66.orig/tests/Makefile.am
++++ libdrm-2.4.66/tests/Makefile.am
+@@ -73,3 +73,4 @@ TESTS +=					\
+ endif
  
+ check_PROGRAMS += $(TESTS)
++bin_PROGRAMS = $(check_PROGRAMS)
diff --git a/meta/recipes-graphics/drm/libdrm_2.4.65.bb b/meta/recipes-graphics/drm/libdrm_2.4.66.bb
similarity index 86%
rename from meta/recipes-graphics/drm/libdrm_2.4.65.bb
rename to meta/recipes-graphics/drm/libdrm_2.4.66.bb
index e5ed260..214dccc 100644
--- a/meta/recipes-graphics/drm/libdrm_2.4.65.bb
+++ b/meta/recipes-graphics/drm/libdrm_2.4.66.bb
@@ -11,10 +11,12 @@ PROVIDES = "drm"
 DEPENDS = "libpthread-stubs udev libpciaccess"
 
 SRC_URI = "http://dri.freedesktop.org/libdrm/${BP}.tar.bz2 \
-           file://installtests.patch "
+           file://installtests.patch \
+           file://0001-tests-kms-steal-crtc-Include-sys-select.h.patch \
+          "
 
-SRC_URI[md5sum] = "de49916e5f8aef4eba55223c79709b05"
-SRC_URI[sha256sum] = "71960ac8bde7d710992b1bc8879935e8300a870c36bd06f22412d0447e3d96c4"
+SRC_URI[md5sum] = "c6809c48538d6e5999588832045ff014"
+SRC_URI[sha256sum] = "79cb8e988749794edfb2d777b298d5292eff353bbbb71ed813589e61d2bc2d76"
 
 inherit autotools pkgconfig
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 23/73] directfb: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (21 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 22/73] libdrm: Upgrade 2.4.65 -> 2.4.66 Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 24/73] gzip: " Khem Raj
                   ` (50 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

compar_fn_t, sigval_t and non-posix recursive mutexes
are not available in musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-graphics/directfb/directfb.inc        |   3 +
 .../directfb/directfb/compar_fn_t.patch            |  62 +++++++++++
 .../directfb/directfb/union-sigval.patch           |  19 ++++
 .../directfb/use-PTHREAD_MUTEX_RECURSIVE.patch     | 116 +++++++++++++++++++++
 4 files changed, 200 insertions(+)
 create mode 100644 meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
 create mode 100644 meta/recipes-graphics/directfb/directfb/union-sigval.patch
 create mode 100644 meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch

diff --git a/meta/recipes-graphics/directfb/directfb.inc b/meta/recipes-graphics/directfb/directfb.inc
index 603aba3..be39b83 100644
--- a/meta/recipes-graphics/directfb/directfb.inc
+++ b/meta/recipes-graphics/directfb/directfb.inc
@@ -16,6 +16,9 @@ SRC_URI = "http://www.directfb.org/downloads/Core/DirectFB-1.7/DirectFB-${PV}.ta
            file://fusion.patch \
            file://bashism.patch \
            file://0001-gfx-direct-Aboid-usng-VLAs-and-printf-formats.patch \
+           file://compar_fn_t.patch \
+           file://union-sigval.patch \
+           file://use-PTHREAD_MUTEX_RECURSIVE.patch \
           "
 
 S = "${WORKDIR}/DirectFB-${PV}"
diff --git a/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch b/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
new file mode 100644
index 0000000..ee4d900
--- /dev/null
+++ b/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
@@ -0,0 +1,62 @@
+test for __compar_fn_t and if not defined by libc then define it
+help make directfb compile with musl
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: DirectFB-1.7.7/configure.in
+===================================================================
+--- DirectFB-1.7.7.orig/configure.in
++++ DirectFB-1.7.7/configure.in
+@@ -112,6 +112,17 @@ AC_CHECK_SIZEOF(long)
+ AC_CHECK_SIZEOF(long long)
+ AC_CHECK_FUNCS(fork)
+ 
++AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [
++    AC_TRY_COMPILE(
++        [#include <stdlib.h>],
++        [void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }],
++        ccache_cv_COMPAR_FN_T=yes,
++        ccache_cv_COMPAR_FN_T=no)])
++if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then
++   AC_DEFINE(HAVE_COMPAR_FN_T, 1,
++             Define to 1 if you have the `__compar_fn_t' typedef.)
++fi
++
+ AC_PATH_PROGS(PERL, perl5 perl)
+ 
+ AC_PATH_PROG(MAN2HTML, man2html, no)
+Index: DirectFB-1.7.7/inputdrivers/lirc/lirc.c
+===================================================================
+--- DirectFB-1.7.7.orig/inputdrivers/lirc/lirc.c
++++ DirectFB-1.7.7/inputdrivers/lirc/lirc.c
+@@ -59,6 +59,11 @@
+ 
+ #include <core/input_driver.h>
+ 
++#if HAVE_COMPAR_FN_T
++#define COMPAR_FN_T __compar_fn_t
++#else
++typedef int (*COMPAR_FN_T)(const void *, const void *);
++#endif
+ 
+ DFB_INPUT_DRIVER( lirc )
+ 
+@@ -97,7 +102,7 @@ static DFBInputDeviceKeySymbol lirc_pars
+           qsort ( keynames,
+                   D_ARRAY_SIZE( keynames ),
+                   sizeof(keynames[0]),
+-                  (__compar_fn_t) keynames_sort_compare );
++                  (COMPAR_FN_T) keynames_sort_compare );
+           keynames_sorted = true;
+      }
+ 
+@@ -124,7 +129,7 @@ static DFBInputDeviceKeySymbol lirc_pars
+                symbol_name = bsearch( name, keynames,
+                                       D_ARRAY_SIZE( keynames ),
+                                       sizeof(keynames[0]),
+-                                      (__compar_fn_t) keynames_compare );
++                                      (COMPAR_FN_T) keynames_compare );
+                if (symbol_name)
+                     return symbol_name->symbol;
+                break;
diff --git a/meta/recipes-graphics/directfb/directfb/union-sigval.patch b/meta/recipes-graphics/directfb/directfb/union-sigval.patch
new file mode 100644
index 0000000..29f45c7
--- /dev/null
+++ b/meta/recipes-graphics/directfb/directfb/union-sigval.patch
@@ -0,0 +1,19 @@
+This patch is taken from gentoo musl overlay
+sigval_t is glibc only construct, we use a union of sigval
+which pretty much is same effect as sigval_t
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+diff -Naur DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/system.c DirectFB-1.7.6/lib/direct/os/linux/glibc/system.c
+--- DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/system.c	2014-07-15 02:54:58.000000000 -0400
++++ DirectFB-1.7.6/lib/direct/os/linux/glibc/system.c	2015-07-18 16:55:35.077989166 -0400
+@@ -111,7 +111,7 @@
+ void
+ direct_trap( const char *domain, int sig )
+ {
+-     sigval_t val;
++     union sigval val;
+ 
+      if (direct_config->delay_trap_ms) {
+           D_LOG( Direct_Trap, VERBOSE, "NOT RAISING signal %d from %s, waiting for %dms... attach gdb --pid=%d\n", sig, domain, direct_config->delay_trap_ms, getpid() );
diff --git a/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch b/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
new file mode 100644
index 0000000..ac48f68
--- /dev/null
+++ b/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
@@ -0,0 +1,116 @@
+Remove use of DIRECT_RECURSIVE_MUTEX_INITIALIZER its not portable
+use portable way to initialize recursive mutex using pthread_once() and direct_recursive_mutex_init()
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Index: DirectFB-1.7.7/lib/direct/os/linux/glibc/mutex.h
+===================================================================
+--- DirectFB-1.7.7.orig/lib/direct/os/linux/glibc/mutex.h
++++ DirectFB-1.7.7/lib/direct/os/linux/glibc/mutex.h
+@@ -46,7 +46,6 @@ struct __D_DirectMutex {
+ /**********************************************************************************************************************/
+ 
+ #define DIRECT_MUTEX_INITIALIZER(name)            { PTHREAD_MUTEX_INITIALIZER }
+-#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name)  { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP }
+ 
+ #endif
+ 
+Index: DirectFB-1.7.7/lib/direct/trace.c
+===================================================================
+--- DirectFB-1.7.7.orig/lib/direct/trace.c
++++ DirectFB-1.7.7/lib/direct/trace.c
+@@ -89,8 +89,15 @@ struct __D_DirectTraceBuffer {
+ /**************************************************************************************************/
+ 
+ static DirectLink  *buffers;
+-static DirectMutex  buffers_lock = DIRECT_RECURSIVE_MUTEX_INITIALIZER(buffers_lock);
+ 
++static pthread_once_t buffers_lock_init_once = PTHREAD_ONCE_INIT;
++static DirectMutex buffers_lock;
++
++static void
++buffers_lock_init( void )
++{
++     direct_recursive_mutex_init(&buffers_lock);
++}
+ /**************************************************************************************************/
+ 
+ __dfb_no_instrument_function__
+@@ -113,6 +120,7 @@ get_trace_buffer( void )
+ 
+           D_MAGIC_SET( buffer, DirectTraceBuffer );
+ 
++          pthread_once(&buffers_lock_init_once, buffers_lock_init);
+           direct_mutex_lock( &buffers_lock );
+           direct_list_append( &buffers, &buffer->link );
+           direct_mutex_unlock( &buffers_lock );
+@@ -138,8 +146,14 @@ typedef struct {
+ } SymbolTable;
+ 
+ static DirectLink  *tables      = NULL;
+-static DirectMutex  tables_lock = DIRECT_RECURSIVE_MUTEX_INITIALIZER(tables_lock);
++static pthread_once_t tables_lock_init_once = PTHREAD_ONCE_INIT;
++static DirectMutex tables_lock;
+ 
++static void
++tables_lock_init( void )
++{
++     direct_recursive_mutex_init(&tabless_lock);
++}
+ 
+ __dfb_no_instrument_function__
+ static void
+@@ -370,6 +384,7 @@ direct_trace_lookup_symbol( const char *
+      Symbol      *symbol;
+      SymbolTable *table;
+ 
++     pthread_once(&tables_lock_init_once, tables_lock_init);
+      direct_mutex_lock( &tables_lock );
+ 
+      table = find_table( filename );
+@@ -514,6 +529,7 @@ direct_trace_print_stacks()
+      DirectTraceBuffer *b;
+      DirectTraceBuffer *buffer = get_trace_buffer();
+ 
++     pthread_once(&buffers_lock_init_once, buffers_lock_init);
+      direct_mutex_lock( &buffers_lock );
+ 
+      if (buffer && buffer->level)
+@@ -611,6 +627,7 @@ direct_trace_free_buffer( DirectTraceBuf
+      D_MAGIC_ASSERT( buffer, DirectTraceBuffer );
+ 
+      if (buffer->thread) {
++          pthread_once(&buffers_lock_init_once, buffers_lock_init);
+           direct_mutex_lock( &buffers_lock );
+           direct_list_remove( &buffers, &buffer->link );
+           direct_mutex_unlock( &buffers_lock );
+Index: DirectFB-1.7.7/src/directfb.c
+===================================================================
+--- DirectFB-1.7.7.orig/src/directfb.c
++++ DirectFB-1.7.7/src/directfb.c
+@@ -99,6 +99,15 @@ const unsigned int directfb_micro_versio
+ const unsigned int directfb_binary_age    = DIRECTFB_BINARY_AGE;
+ const unsigned int directfb_interface_age = DIRECTFB_INTERFACE_AGE;
+ 
++static pthread_once_t lock_init_once = PTHREAD_ONCE_INIT;
++static DirectMutex lock;
++
++static void
++lock_init( void )
++{
++     direct_recursive_mutex_init(&lock);
++}
++
+ const char *
+ DirectFBCheckVersion( unsigned int required_major,
+                       unsigned int required_minor,
+@@ -215,8 +224,7 @@ DirectFBCreate( IDirectFB **interface_pt
+      if (dfb_config->remote.host)
+           return CreateRemote( dfb_config->remote.host, dfb_config->remote.port, interface_ptr );
+ 
+-     static DirectMutex lock = DIRECT_RECURSIVE_MUTEX_INITIALIZER(lock);
+-
++     pthread_once(&lock_init_once, lock_init);
+      direct_mutex_lock( &lock );
+ 
+      if (!dfb_config->no_singleton && idirectfb_singleton) {
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 24/73] gzip: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (22 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 23/73] directfb: Fix build with musl Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 25/73] watchdog: " Khem Raj
                   ` (49 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

gzip 1.6 uses an older version of gnulib when cross compiling it treats
fseeko as broken since it cant do runtime checks for it during configure
this only shows up on musl since for glibc since it has special check
for gnu c library, so we aid the system by telling it that fflush on
stdin works well with musl

Use NO_ASM to avoid textrels

Delete charset.alias for musl which is again another issue in gnulib not
knowing musl platform

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-extended/gzip/gzip.inc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta/recipes-extended/gzip/gzip.inc b/meta/recipes-extended/gzip/gzip.inc
index 58e5e0c..6e81883 100644
--- a/meta/recipes-extended/gzip/gzip.inc
+++ b/meta/recipes-extended/gzip/gzip.inc
@@ -6,8 +6,10 @@ SECTION = "console/utils"
 # change to GPLv3+ in 2007/07. Previous GPLv2 version is 1.3.12
 
 inherit autotools texinfo
+export DEFS="NO_ASM"
 
 EXTRA_OEMAKE_class-target = "GREP=${base_bindir}/grep"
+EXTRA_OECONF_append_libc-musl = " gl_cv_func_fflush_stdin=yes "
 
 do_install_append () {
 	if [ "${base_bindir}" != "${bindir}" ]; then
@@ -20,6 +22,11 @@ do_install_append () {
 	fi
 }
 
+do_install_append_libc-musl () {
+	rm ${D}${libdir}/charset.alias
+	rmdir ${D}${libdir}
+}
+
 inherit update-alternatives
 
 ALTERNATIVE_PRIORITY = "100"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 25/73] watchdog: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (23 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 24/73] gzip: " Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:35 ` [PATCH 26/73] xinetd: " Khem Raj
                   ` (48 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

This patch is generic but is found during compiling watchdog with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...d-issues-found-with-non-glibc-C-libraries.patch | 99 ++++++++++++++++++++++
 meta/recipes-extended/watchdog/watchdog_5.14.bb    |  8 +-
 2 files changed, 106 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch

diff --git a/meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch b/meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch
new file mode 100644
index 0000000..8afed5c
--- /dev/null
+++ b/meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch
@@ -0,0 +1,99 @@
+From 83ec34df357218a1c9cfc13a23d3367d333652c3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 30 Dec 2015 01:01:15 +0000
+Subject: [PATCH] Fix build issues found with non glibc C libraries
+
+Add time.h for getting time_t definition
+limits.h for PATH_MAX
+linux/param.h for EXEC_PAGESIZE
+Replace deprecated MNTTAB with _PATH_MNTTAB
+include ext2_mnt.h for MNTOPT_USRQUOTA and MNTOPT_GRPQUOTA and
+MNTTYPE_EXT2
+Include sys/types.h for u_char definition
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+
+Upstream-Status: Submitted
+
+ include/extern.h | 1 +
+ src/configfile.c | 1 +
+ src/memory.c     | 3 +++
+ src/net.c        | 1 +
+ src/shutdown.c   | 3 ++-
+ 5 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/include/extern.h b/include/extern.h
+index 21db11b..04b16bc 100644
+--- a/include/extern.h
++++ b/include/extern.h
+@@ -3,6 +3,7 @@
+ 
+ #include <netinet/in.h>
+ #include <stdio.h>
++#include <time.h>
+ 
+ #include "logmessage.h"
+ #include "xmalloc.h"
+diff --git a/src/configfile.c b/src/configfile.c
+index be5d7b3..7c1d1dd 100644
+--- a/src/configfile.c
++++ b/src/configfile.c
+@@ -16,6 +16,7 @@
+ #include <errno.h>
+ #include <string.h>
+ #include <dirent.h>
++#include <limits.h>
+ #include <sys/stat.h>
+ 
+ #include "extern.h"
+diff --git a/src/memory.c b/src/memory.c
+index e9607e4..b5e08aa 100644
+--- a/src/memory.c
++++ b/src/memory.c
+@@ -21,6 +21,9 @@
+ #include <sys/stat.h>
+ #include <sys/param.h>
+ #include <sys/mman.h>
++#ifdef __linux__
++#include <linux/param.h>
++#endif
+ 
+ #include "extern.h"
+ #include "watch_err.h"
+diff --git a/src/net.c b/src/net.c
+index 21823ae..8930caf 100644
+--- a/src/net.c
++++ b/src/net.c
+@@ -17,6 +17,7 @@
+ #include <string.h>
+ #include <unistd.h>		/* for gethostname() etc */
+ #include <netdb.h>		/* for gethostbyname() */
++#include <sys/types.h>
+ #include <sys/param.h>	/* for MAXHOSTNAMELEN */
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+diff --git a/src/shutdown.c b/src/shutdown.c
+index 74aafa5..46b99cf 100644
+--- a/src/shutdown.c
++++ b/src/shutdown.c
+@@ -25,6 +25,7 @@
+ 
+ #include "watch_err.h"
+ #include "extern.h"
++#include "ext2_mnt.h"
+ 
+ #if defined __GLIBC__
+ #include "ext2_mnt.h"
+@@ -123,7 +124,7 @@ static void mnt_off()
+ 	FILE *fp;
+ 	struct mntent *mnt;
+ 
+-	fp = setmntent(MNTTAB, "r");
++	fp = setmntent(_PATH_MNTTAB, "r");
+ 	/* in some rare cases fp might be NULL so be careful */
+ 	while (fp != NULL && ((mnt = getmntent(fp)) != (struct mntent *)0)) {
+ 		/* First check if swap */
+-- 
+2.6.4
+
diff --git a/meta/recipes-extended/watchdog/watchdog_5.14.bb b/meta/recipes-extended/watchdog/watchdog_5.14.bb
index 9cb89d5..fc717bc 100644
--- a/meta/recipes-extended/watchdog/watchdog_5.14.bb
+++ b/meta/recipes-extended/watchdog/watchdog_5.14.bb
@@ -12,7 +12,9 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/watchdog/watchdog-${PV}.tar.gz \
            file://fixsepbuild.patch \
 	   file://fix-ping-failure.patch \
 	   file://watchdog-init.patch \
-	   file://watchdog-conf.patch"
+	   file://watchdog-conf.patch \
+	   file://0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch \
+"
 
 SRC_URI[md5sum] = "5b2dba0c593942f4acc100bca0d560c4"
 SRC_URI[sha256sum] = "620b2f49e9879f2e85c73d4c1f422f9101e6b38e824fea2414befd8bb6866ad1"
@@ -23,6 +25,10 @@ UPSTREAM_CHECK_REGEX = "/watchdog/(?P<pver>(\d+[\.\-_]*)+)/"
 inherit autotools
 inherit update-rc.d
 
+DEPENDS_append_libc-musl = " libtirpc "
+CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc "
+LDFLAGS_append_libc-musl = " -ltirpc "
+
 INITSCRIPT_NAME = "watchdog.sh"
 INITSCRIPT_PARAMS = "start 15 1 2 3 4 5 . stop 85 0 6 ."
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 26/73] xinetd: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (24 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 25/73] watchdog: " Khem Raj
@ 2016-01-17 11:35 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 27/73] dpkg: Add musleabi to known architectures Khem Raj
                   ` (47 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:35 UTC (permalink / raw)
  To: openembedded-core

musl relies on external rpc implemetation (libtirpc)
and exposed a bug in configury when checking for rlim_t

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...se-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch | 100 +++++++++++++++++++++
 meta/recipes-extended/xinetd/xinetd_2.3.15.bb      |   5 ++
 2 files changed, 105 insertions(+)
 create mode 100644 meta/recipes-extended/xinetd/xinetd/0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch

diff --git a/meta/recipes-extended/xinetd/xinetd/0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch b/meta/recipes-extended/xinetd/xinetd/0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch
new file mode 100644
index 0000000..3c1b2f6
--- /dev/null
+++ b/meta/recipes-extended/xinetd/xinetd/0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch
@@ -0,0 +1,100 @@
+From e8b0ffc7ea04cc71dba97a38e1a134aaf2285c2d Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 30 Dec 2015 07:14:50 +0000
+Subject: [PATCH] configure: Use HAVE_SYS_RESOURCE_H to guard sys/resource.h
+ inclusion
+
+HAVE_RLIM_T check will not let sys/resource.h to be checked and
+rlim_t is defined in sys/resource.h so the check would fail.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ aclocal.m4 |  2 +-
+ configure  | 14 +++++++-------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/aclocal.m4 b/aclocal.m4
+index 6e6f32c..70e7076 100644
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -11,7 +11,7 @@ AC_CACHE_VAL(xinetd_cv_type_$1,
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+diff --git a/configure b/configure
+index b507d38..bec56ea 100755
+--- a/configure
++++ b/configure
+@@ -7640,7 +7640,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7686,7 +7686,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7732,7 +7732,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7778,7 +7778,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7824,7 +7824,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7870,7 +7870,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7916,7 +7916,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+-- 
+2.6.4
+
diff --git a/meta/recipes-extended/xinetd/xinetd_2.3.15.bb b/meta/recipes-extended/xinetd/xinetd_2.3.15.bb
index 652fe91..6bfaabe 100644
--- a/meta/recipes-extended/xinetd/xinetd_2.3.15.bb
+++ b/meta/recipes-extended/xinetd/xinetd_2.3.15.bb
@@ -7,6 +7,7 @@ LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=8ad8615198542444f84d28a6cf226dd8"
 
 DEPENDS = ""
+DEPENDS_append_libc-musl = " libtirpc "
 PR = "r2"
 
 # Blacklist a bogus tag in upstream check
@@ -20,6 +21,7 @@ SRC_URI = "git://github.com/xinetd-org/xinetd.git;protocol=https \
       file://Disable-services-from-inetd.conf-if-a-service-with-t.patch \
       file://xinetd-should-be-able-to-listen-on-IPv6-even-in-ine.patch \
       file://xinetd-CVE-2013-4342.patch \
+      file://0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch \
       file://xinetd.service \
       "
 
@@ -39,6 +41,9 @@ EXTRA_OECONF="--disable-nls"
 PACKAGECONFIG ??= "tcp-wrappers"
 PACKAGECONFIG[tcp-wrappers] = "--with-libwrap,,tcp-wrappers"
 
+CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc "
+LDFLAGS_append_libc-musl = " -ltirpc "
+
 do_configure() {
 	# Looks like configure.in is broken, so we are skipping
 	# rebuilding configure and are just using the shipped one
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 27/73] dpkg: Add musleabi to known architectures
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (25 preceding siblings ...)
  2016-01-17 11:35 ` [PATCH 26/73] xinetd: " Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 28/73] puzzles: Zero'ise structs before use Khem Raj
                   ` (46 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Remove a glibc specific patch to be applied only for native version,
this is a dpkg-native specific patch needed for Centos 5.8, this patch
should be redone to be glibc independent for it to be applied to all
types of dpkg recipes

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...0006-add-musleabi-to-known-target-tripets.patch | 42 ++++++++++++++++++++++
 meta/recipes-devtools/dpkg/dpkg_1.18.2.bb          |  3 +-
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/dpkg/dpkg/0006-add-musleabi-to-known-target-tripets.patch

diff --git a/meta/recipes-devtools/dpkg/dpkg/0006-add-musleabi-to-known-target-tripets.patch b/meta/recipes-devtools/dpkg/dpkg/0006-add-musleabi-to-known-target-tripets.patch
new file mode 100644
index 0000000..a6b0088
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/0006-add-musleabi-to-known-target-tripets.patch
@@ -0,0 +1,42 @@
+From f8910022dc3ec622272f168cd0022dbdf6dff93a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 30 Dec 2015 23:05:41 +0000
+Subject: [PATCH] add musleabi to known target tripets
+
+helps compiling dpkg for musl/arm-softfloat
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ ostable      | 1 +
+ triplettable | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/ostable b/ostable
+index 3bb6819..d0ffdc7 100644
+--- a/ostable
++++ b/ostable
+@@ -15,6 +15,7 @@
+ uclibceabi-linux	linux-uclibceabi	linux[^-]*-uclibceabi
+ uclibc-linux		linux-uclibc		linux[^-]*-uclibc
+ musleabihf-linux	linux-musleabihf	linux[^-]*-musleabihf
++musleabi-linux		linux-musleabi		linux[^-]*-musleabi
+ musl-linux		linux-musl		linux[^-]*-musl
+ gnueabihf-linux		linux-gnueabihf		linux[^-]*-gnueabihf
+ gnueabi-linux		linux-gnueabi		linux[^-]*-gnueabi
+diff --git a/triplettable b/triplettable
+index 1213584..70d24c1 100644
+--- a/triplettable
++++ b/triplettable
+@@ -6,6 +6,7 @@
+ uclibceabi-linux-arm	uclibc-linux-armel
+ uclibc-linux-<cpu>	uclibc-linux-<cpu>
+ musleabihf-linux-arm	musl-linux-armhf
++musleabi-linux-arm	musl-linux-armel
+ musl-linux-<cpu>	musl-linux-<cpu>
+ gnueabihf-linux-arm	armhf
+ gnueabi-linux-arm	armel
+-- 
+2.6.4
+
diff --git a/meta/recipes-devtools/dpkg/dpkg_1.18.2.bb b/meta/recipes-devtools/dpkg/dpkg_1.18.2.bb
index 4c3fa4f..dd1109b 100644
--- a/meta/recipes-devtools/dpkg/dpkg_1.18.2.bb
+++ b/meta/recipes-devtools/dpkg/dpkg_1.18.2.bb
@@ -1,17 +1,18 @@
 require dpkg.inc
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
 
+SRC_URI_append_class-native =" file://glibc2.5-sync_file_range.patch "
 SRC_URI += "file://noman.patch \
             file://remove-tar-no-timestamp.patch \
             file://fix-abs-redefine.patch \
             file://arch_pm.patch \
             file://dpkg-configure.service \
-            file://glibc2.5-sync_file_range.patch \
             file://add_armeb_triplet_entry.patch \
 	    file://0002-Adapt-to-linux-wrs-kernel-version-which-has-characte.patch \
 	    file://0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch \
 	    file://0004-The-lutimes-function-doesn-t-work-properly-for-all-s.patch \
 	    file://0005-dpkg-compiler.m4-remove-Wvla.patch \
+	    file://0006-add-musleabi-to-known-target-tripets.patch \
            "
 
 SRC_URI[md5sum] = "63b9d869081ec49adeef6c5ff62d6576"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 28/73] puzzles: Zero'ise structs before use
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (26 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 27/73] dpkg: Add musleabi to known architectures Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 29/73] apt: Add support for building for musl targets Khem Raj
                   ` (45 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Fixes build failures with musl where gcc5 flags it used before
initialized.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...mpiler-errors-about-uninitialized-use-of-.patch | 32 ++++++++++++++++++++++
 meta/recipes-sato/puzzles/puzzles_git.bb           |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 meta/recipes-sato/puzzles/files/0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch

diff --git a/meta/recipes-sato/puzzles/files/0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch b/meta/recipes-sato/puzzles/files/0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch
new file mode 100644
index 0000000..0b971c4
--- /dev/null
+++ b/meta/recipes-sato/puzzles/files/0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch
@@ -0,0 +1,32 @@
+From 78d6d1706c21ad467520075ff7a8bf15cfbd68b3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 30 Dec 2015 22:13:16 +0000
+Subject: [PATCH] rect: Fix compiler errors about uninitialized use of
+ variables
+
+error: 'r2.x' may be used uninitialized in this function
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ rect.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/rect.c b/rect.c
+index 55667c0..fa3a786 100644
+--- a/rect.c
++++ b/rect.c
+@@ -1317,7 +1317,8 @@ static char *new_game_desc(const game_params *params_in, random_state *rs,
+                     if (ndirs > 0) {
+                         int which, dir;
+                         struct rect r1, r2;
+-
++                        memset(&r1, 0, sizeof(struct rect));
++                        memset(&r2, 0, sizeof(struct rect));
+                         which = random_upto(rs, ndirs);
+                         dir = dirs[which];
+ 
+-- 
+2.6.4
+
diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb
index 1e3bac7..9c8170c 100644
--- a/meta/recipes-sato/puzzles/puzzles_git.bb
+++ b/meta/recipes-sato/puzzles/puzzles_git.bb
@@ -12,6 +12,7 @@ LIC_FILES_CHKSUM = "file://LICENCE;md5=33bcd4bce8f3c197f2aefbdbd2d299bc"
 SRC_URI = "git://git.tartarus.org/simon/puzzles.git \
            file://fix-compiling-failure-with-option-g-O.patch \
            file://0001-Use-labs-instead-of-abs.patch \
+           file://0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch \
 "
 SRCREV = "346584bf6e38232be8773c24fd7dedcbd7b3d9ed"
 PE = "1"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 29/73] apt: Add support for building for musl targets
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (27 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 28/73] puzzles: Zero'ise structs before use Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 30/73] libunwind: backtrace APIs are glibc specific Khem Raj
                   ` (44 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Turn bzip2 support into a PACKAGECONFIG
zlibs is a must have and therefore add it to DEPENDS will make the build
consistent

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/apt/apt.inc                  |  1 +
 ....mak-musl-based-systems-can-generate-shar.patch | 29 ++++++++++++++++++++++
 meta/recipes-devtools/apt/apt_1.0.10.1.bb          |  3 ++-
 3 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/apt/apt/0001-environment.mak-musl-based-systems-can-generate-shar.patch

diff --git a/meta/recipes-devtools/apt/apt.inc b/meta/recipes-devtools/apt/apt.inc
index 312c6a9..78ef5a7 100644
--- a/meta/recipes-devtools/apt/apt.inc
+++ b/meta/recipes-devtools/apt/apt.inc
@@ -11,6 +11,7 @@ SRC_URI = "http://snapshot.debian.org/archive/debian/20150805T094928Z/pool/main/
            file://nodoc.patch \
            file://disable-configure-in-makefile.patch \
            file://disable-test.patch \
+           file://0001-environment.mak-musl-based-systems-can-generate-shar.patch \
            "
 SRC_URI[md5sum] = "6505c4297b338adb2087ce87bbc4a276"
 SRC_URI[sha256sum] = "3fb1de9598363c416591d49e3c285458e095b035e6c06d5b944a54e15fc9b543"
diff --git a/meta/recipes-devtools/apt/apt/0001-environment.mak-musl-based-systems-can-generate-shar.patch b/meta/recipes-devtools/apt/apt/0001-environment.mak-musl-based-systems-can-generate-shar.patch
new file mode 100644
index 0000000..042372b
--- /dev/null
+++ b/meta/recipes-devtools/apt/apt/0001-environment.mak-musl-based-systems-can-generate-shar.patch
@@ -0,0 +1,29 @@
+From 2f8aa21ace375c18977ed908b291c80a210a93c6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 08:06:12 +0000
+Subject: [PATCH] environment.mak: musl based systems can generate shared
+ objects too
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ buildlib/environment.mak.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/buildlib/environment.mak.in b/buildlib/environment.mak.in
+index b0a8d9d..3a52344 100644
+--- a/buildlib/environment.mak.in
++++ b/buildlib/environment.mak.in
+@@ -68,7 +68,7 @@ NEED_SOCKLEN_T_DEFINE = @NEED_SOCKLEN_T_DEFINE@
+ 
+ # Shared library things
+ HOST_OS = @host_os@
+-ifneq ($(words $(filter gnu% linux-gnu% kfreebsd-gnu% %-gnu,$(HOST_OS))),0)
++ifneq ($(words $(filter gnu% linux-gnu% kfreebsd-gnu% %-gnu linux-musl%,$(HOST_OS))),0)
+    SONAME_MAGIC=-Wl,-soname -Wl,
+    LFLAGS_SO=
+ else
+-- 
+2.6.4
+
diff --git a/meta/recipes-devtools/apt/apt_1.0.10.1.bb b/meta/recipes-devtools/apt/apt_1.0.10.1.bb
index bf77e2a..85c0d56 100644
--- a/meta/recipes-devtools/apt/apt_1.0.10.1.bb
+++ b/meta/recipes-devtools/apt/apt_1.0.10.1.bb
@@ -1,4 +1,4 @@
-DEPENDS = "curl db"
+DEPENDS = "curl db zlib"
 RDEPENDS_${PN} = "dpkg bash debianutils"
 require apt.inc
 
@@ -6,6 +6,7 @@ require apt-package.inc
 
 PACKAGECONFIG ??= "lzma"
 PACKAGECONFIG[lzma] = "ac_cv_lib_lzma_lzma_easy_encoder=yes,ac_cv_lib_lzma_lzma_easy_encoder=no,xz"
+PACKAGECONFIG[bz2] = "ac_cv_lib_bz2_BZ2_bzopen=yes,ac_cv_lib_bz2_BZ2_bzopen=no,bzip2"
 
 FILES_${PN} += "${bindir}/apt-key"
 apt-manpages += "doc/apt-key.8"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 30/73] libunwind: backtrace APIs are glibc specific
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (28 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 29/73] apt: Add support for building for musl targets Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 31/73] babeltrace: Add missing header for MAXNAMLEN define Khem Raj
                   ` (43 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Make backtrace() API's use conditional on glibc
this helps make libunwind compile on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...-backtrace-Use-only-with-glibc-and-uclibc.patch | 45 ++++++++++++++++++++++
 meta/recipes-support/libunwind/libunwind_1.1.bb    |  1 +
 2 files changed, 46 insertions(+)
 create mode 100644 meta/recipes-support/libunwind/libunwind-1.1/0001-backtrace-Use-only-with-glibc-and-uclibc.patch

diff --git a/meta/recipes-support/libunwind/libunwind-1.1/0001-backtrace-Use-only-with-glibc-and-uclibc.patch b/meta/recipes-support/libunwind/libunwind-1.1/0001-backtrace-Use-only-with-glibc-and-uclibc.patch
new file mode 100644
index 0000000..9aed419
--- /dev/null
+++ b/meta/recipes-support/libunwind/libunwind-1.1/0001-backtrace-Use-only-with-glibc-and-uclibc.patch
@@ -0,0 +1,45 @@
+From 04437142399662b576bd55a85485c6dcc14d0812 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 06:44:07 +0000
+Subject: [PATCH] backtrace: Use only with glibc and uclibc
+
+backtrace API is glibc specific not linux specific
+so make it behave so.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ tests/test-coredump-unwind.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c
+index 5254708..8767b42 100644
+--- a/tests/test-coredump-unwind.c
++++ b/tests/test-coredump-unwind.c
+@@ -57,7 +57,9 @@
+ #include <grp.h>
+ 
+ /* For SIGSEGV handler code */
++#ifdef __GLIBC__
+ #include <execinfo.h>
++#endif
+ #include <sys/ucontext.h>
+ 
+ #include <libunwind-coredump.h>
+@@ -238,11 +240,11 @@ void handle_sigsegv(int sig, siginfo_t *info, void *ucontext)
+ 			ip);
+ 
+   {
++#ifdef __GLIBC__
+     /* glibc extension */
+     void *array[50];
+     int size;
+     size = backtrace(array, 50);
+-#ifdef __linux__
+     backtrace_symbols_fd(array, size, 2);
+ #endif
+   }
+-- 
+2.6.4
+
diff --git a/meta/recipes-support/libunwind/libunwind_1.1.bb b/meta/recipes-support/libunwind/libunwind_1.1.bb
index aa62bcc..7df9f5e 100644
--- a/meta/recipes-support/libunwind/libunwind_1.1.bb
+++ b/meta/recipes-support/libunwind/libunwind_1.1.bb
@@ -7,6 +7,7 @@ SRC_URI += "\
     file://Link-libunwind-to-libgcc_s-rather-than-libgcc.patch \
     file://0001-Invalid-dwarf-opcodes-can-cause-references-beyond-th.patch \
     file://Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch \
+    file://0001-backtrace-Use-only-with-glibc-and-uclibc.patch \
 "
 
 SRC_URI[md5sum] = "fb4ea2f6fbbe45bf032cd36e586883ce"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 31/73] babeltrace: Add missing header for MAXNAMLEN define
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (29 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 30/73] libunwind: backtrace APIs are glibc specific Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 32/73] sysklogd: untangle header inclusion maze Khem Raj
                   ` (42 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Fix bug exposed on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...Include-sys-param.h-for-MAXNAMLEN-definti.patch | 29 ++++++++++++++++++++++
 meta/recipes-kernel/lttng/babeltrace_1.3.1.bb      |  5 ++--
 2 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-kernel/lttng/babeltrace/0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch

diff --git a/meta/recipes-kernel/lttng/babeltrace/0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch b/meta/recipes-kernel/lttng/babeltrace/0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch
new file mode 100644
index 0000000..eb16cd1
--- /dev/null
+++ b/meta/recipes-kernel/lttng/babeltrace/0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch
@@ -0,0 +1,29 @@
+From 8331b87845cafdda40e59a682f2ca8120ed0c472 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 08:17:40 +0000
+Subject: [PATCH] lttng-live: Include sys/param.h for MAXNAMLEN defintion
+
+exposed on musl based systems
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: pending
+
+ formats/lttng-live/lttng-live.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/formats/lttng-live/lttng-live.h b/formats/lttng-live/lttng-live.h
+index 4ab641d..808ed2b 100644
+--- a/formats/lttng-live/lttng-live.h
++++ b/formats/lttng-live/lttng-live.h
+@@ -25,6 +25,7 @@
+  */
+ 
+ #include <stdint.h>
++#include <sys/param.h>
+ #include "lttng-viewer-abi.h"
+ 
+ #define LTTNG_DEFAULT_NETWORK_VIEWER_PORT	5344
+-- 
+2.6.4
+
diff --git a/meta/recipes-kernel/lttng/babeltrace_1.3.1.bb b/meta/recipes-kernel/lttng/babeltrace_1.3.1.bb
index 36345e3..1766026 100644
--- a/meta/recipes-kernel/lttng/babeltrace_1.3.1.bb
+++ b/meta/recipes-kernel/lttng/babeltrace_1.3.1.bb
@@ -6,14 +6,15 @@ BUGTRACKER = "https://bugs.lttng.org/projects/babeltrace"
 LICENSE = "MIT & GPLv2"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=76ba15dd76a248e1dd526bca0e2125fa"
 
-inherit autotools pkgconfig
-
 DEPENDS = "glib-2.0 util-linux popt bison-native flex-native"
 
+inherit autotools pkgconfig
+
 SRCREV = "6e2b9096c77138593097335b9b27202d98918089"
 
 SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-1.3 \
            file://0001-Fix-invalid-pointer-free-with-trace-collection.patch \
+           file://0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch \
 "
 
 S = "${WORKDIR}/git"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 32/73] sysklogd: untangle header inclusion maze
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (30 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 31/73] babeltrace: Add missing header for MAXNAMLEN define Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 33/73] console-tools: Include sys/types.h for u_char and u_short defs Khem Raj
                   ` (41 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

wait is not union per posix it is int
remove assumption about glibc is linux

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../sysklogd/files/0001-Fix-build-with-musl.patch  | 132 +++++++++++++++++++++
 meta/recipes-extended/sysklogd/sysklogd.inc        |   1 +
 2 files changed, 133 insertions(+)
 create mode 100644 meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch

diff --git a/meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch b/meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch
new file mode 100644
index 0000000..9567946
--- /dev/null
+++ b/meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch
@@ -0,0 +1,132 @@
+From f0af5bcfd753691652eac35efbcb208c933253f1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 31 Aug 2015 05:11:53 +0000
+Subject: [PATCH] Fix build with musl
+
+Explicitly include fcntl.h since with glibc is comes in as indirect
+include but not with musl
+
+linux/time.h inclusion is not required on musl so using !__GLIBC__ is
+not right for musl here
+
+wait type is glibc specific
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ klogd.c    | 10 +---------
+ ksym_mod.c |  5 +----
+ pidfile.c  |  1 +
+ syslog.c   |  3 ++-
+ syslogd.c  |  4 +---
+ 5 files changed, 6 insertions(+), 17 deletions(-)
+
+diff --git a/klogd.c b/klogd.c
+index 6cc80ed..9219671 100644
+--- a/klogd.c
++++ b/klogd.c
+@@ -260,11 +260,8 @@
+ #include <unistd.h>
+ #include <signal.h>
+ #include <errno.h>
+-#include <sys/fcntl.h>
++#include <fcntl.h>
+ #include <sys/stat.h>
+-#if !defined(__GLIBC__)
+-#include <linux/time.h>
+-#endif /* __GLIBC__ */
+ #include <stdarg.h>
+ #include <paths.h>
+ #include <stdlib.h>
+@@ -277,13 +274,8 @@
+ 
+ #define __LIBRARY__
+ #include <linux/unistd.h>
+-#if !defined(__GLIBC__)
+-# define __NR_ksyslog __NR_syslog
+-_syscall3(int,ksyslog,int, type, char *, buf, int, len);
+-#else
+ #include <sys/klog.h>
+ #define ksyslog klogctl
+-#endif
+ 
+ #define LOG_BUFFER_SIZE 4096
+ #define LOG_LINE_LENGTH 1000
+diff --git a/ksym_mod.c b/ksym_mod.c
+index 68cd6b6..6e26da1 100644
+--- a/ksym_mod.c
++++ b/ksym_mod.c
+@@ -113,12 +113,9 @@
+ #include <unistd.h>
+ #include <signal.h>
+ #include <errno.h>
+-#include <sys/fcntl.h>
++#include <fcntl.h>
+ #include <sys/stat.h>
+ #include "module.h"
+-#if !defined(__GLIBC__)
+-#include <linux/time.h>
+-#endif /* __GLIBC__ */
+ #include <stdarg.h>
+ #include <paths.h>
+ #include <linux/version.h>
+diff --git a/pidfile.c b/pidfile.c
+index e0959a0..6daa2e0 100644
+--- a/pidfile.c
++++ b/pidfile.c
+@@ -31,6 +31,7 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <signal.h>
++#include <fcntl.h>
+ 
+ /* read_pid
+  *
+diff --git a/syslog.c b/syslog.c
+index bdb3ff2..ef7b34e 100644
+--- a/syslog.c
++++ b/syslog.c
+@@ -55,7 +55,7 @@ static char sccsid[] = "@(#)syslog.c	5.28 (Berkeley) 6/27/90";
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/file.h>
+-#include <sys/signal.h>
++//#include <sys/signal.h>
+ #include <sys/syslog.h>
+ #if 0
+ #include "syslog.h"
+@@ -72,6 +72,7 @@ static char sccsid[] = "@(#)syslog.c	5.28 (Berkeley) 6/27/90";
+ #include <stdarg.h>
+ #include <paths.h>
+ #include <stdio.h>
++#include <fcntl.h>
+ 
+ #define	_PATH_LOGNAME	"/dev/log"
+ 
+diff --git a/syslogd.c b/syslogd.c
+index ea73ea5..1ca0595 100644
+--- a/syslogd.c
++++ b/syslogd.c
+@@ -818,9 +818,7 @@ void doexit(int sig);
+ void init();
+ void cfline(char *line, register struct filed *f);
+ int decode(char *name, struct code *codetab);
+-#if defined(__GLIBC__)
+ #define dprintf mydprintf
+-#endif /* __GLIBC__ */
+ static void dprintf(char *, ...);
+ static void allocate_log(void);
+ void sighup_handler();
+@@ -2094,7 +2092,7 @@ void reapchild()
+ 	(void) signal(SIGCHLD, reapchild);	/* reset signal handler -ASP */
+ 	wait ((int *)0);
+ #else
+-	union wait status;
++	int status;
+ 
+ 	while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0)
+ 		;
+-- 
+2.5.1
+
diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc b/meta/recipes-extended/sysklogd/sysklogd.inc
index 85b3cdc..f789c54 100644
--- a/meta/recipes-extended/sysklogd/sysklogd.inc
+++ b/meta/recipes-extended/sysklogd/sysklogd.inc
@@ -15,6 +15,7 @@ inherit update-rc.d update-alternatives
 
 SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \
            file://no-strip-install.patch \
+           file://0001-Fix-build-with-musl.patch \
            file://sysklogd \
            file://syslog.conf \
            "
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 33/73] console-tools: Include sys/types.h for u_char and u_short defs
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (31 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 32/73] sysklogd: untangle header inclusion maze Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 34/73] webkitgtk: Fix build with clang/musl Khem Raj
                   ` (40 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...clude-sys-types.h-for-u_char-and-u_short-.patch | 44 ++++++++++++++++++++++
 .../console-tools/console-tools_0.3.2.bb           |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 meta/recipes-core/console-tools/console-tools-0.3.2/0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch

diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch b/meta/recipes-core/console-tools/console-tools-0.3.2/0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch
new file mode 100644
index 0000000..64b5b04
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch
@@ -0,0 +1,44 @@
+From 0fd5dda51d68e1ec2a87e27b5ed0dff3503b4681 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 08:12:38 +0000
+Subject: [PATCH] kbdtools: Include sys/types.h for u_char and u_short
+ definition
+
+on musl this gets exposed since sys/types.h is not
+included via some other indirect inclusion as is the case with glibc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ kbdtools/dumpkeys.c | 1 +
+ kbdtools/loadkeys.y | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/kbdtools/dumpkeys.c b/kbdtools/dumpkeys.c
+index 6159d49..c19fb21 100644
+--- a/kbdtools/dumpkeys.c
++++ b/kbdtools/dumpkeys.c
+@@ -26,6 +26,7 @@
+ #include <errno.h>
+ #include <sysexits.h>
+ #include <sys/ioctl.h>
++#include <sys/types.h>
+ #include <linux/types.h>
+ #include <linux/kd.h>
+ #include <linux/keyboard.h>
+diff --git a/kbdtools/loadkeys.y b/kbdtools/loadkeys.y
+index b6a8e01..4468f77 100644
+--- a/kbdtools/loadkeys.y
++++ b/kbdtools/loadkeys.y
+@@ -71,6 +71,7 @@
+ #include <linux/kd.h>
+ #include <linux/keyboard.h>
+ #include <sys/ioctl.h>
++#include <sys/types.h>
+ #include <ctype.h>
+ #include <sysexits.h>
+ #include <signal.h>
+-- 
+2.6.4
+
diff --git a/meta/recipes-core/console-tools/console-tools_0.3.2.bb b/meta/recipes-core/console-tools/console-tools_0.3.2.bb
index 7e14b31..d14d683 100644
--- a/meta/recipes-core/console-tools/console-tools_0.3.2.bb
+++ b/meta/recipes-core/console-tools/console-tools_0.3.2.bb
@@ -14,6 +14,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/lct/console-tools-${PV}.tar.gz \
            file://nodocs.patch \
            file://fix-libconsole-linking.patch \
            file://no-dep-on-libfl.patch \
+           file://0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch \
            file://lcmessage.m4 \
            file://Makevars"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 34/73] webkitgtk: Fix build with clang/musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (32 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 33/73] console-tools: Include sys/types.h for u_char and u_short defs Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 35/73] rt-tests: Fix build with non-gcc compilers Khem Raj
                   ` (39 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

backtrace is glibc only feature on linux so check for glibc before using
it
Clangs clear_cache has different signature than gcc provided builtin
make it compatible for both

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...nable-backtrace-on-linux-when-using-glibc.patch | 39 ++++++++++++++
 ...x-build-with-non-glibc-libraries-on-linux.patch | 61 ++++++++++++++++++++++
 meta/recipes-sato/webkit/webkitgtk/clang.patch     | 25 +++++++++
 meta/recipes-sato/webkit/webkitgtk_2.10.4.bb       |  3 ++
 4 files changed, 128 insertions(+)
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/clang.patch

diff --git a/meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch b/meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
new file mode 100644
index 0000000..d7e4ef6
--- /dev/null
+++ b/meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
@@ -0,0 +1,39 @@
+From 0b68ad206d2d90df78d91cad4da19152084014cf Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 16 Sep 2015 05:15:04 +0000
+Subject: [PATCH] Enable backtrace on linux when using glibc
+
+We dont have backtrace() implemented on non-glibc libc's on linux
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Accepted
+
+ Source/WTF/wtf/Assertions.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Source/WTF/wtf/Assertions.cpp b/Source/WTF/wtf/Assertions.cpp
+index 191d53f..a4d86b5 100644
+--- a/Source/WTF/wtf/Assertions.cpp
++++ b/Source/WTF/wtf/Assertions.cpp
+@@ -68,7 +68,7 @@
+ #include <unistd.h>
+ #endif
+ 
+-#if OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))
++#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__))
+ #include <cxxabi.h>
+ #include <dlfcn.h>
+ #include <execinfo.h>
+@@ -225,7 +225,7 @@ void WTFReportArgumentAssertionFailure(const char* file, int line, const char* f
+ 
+ void WTFGetBacktrace(void** stack, int* size)
+ {
+-#if OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))
++#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__))
+     *size = backtrace(stack, *size);
+ #elif OS(WINDOWS)
+     // The CaptureStackBackTrace function is available in XP, but it is not defined
+-- 
+2.5.2
+
diff --git a/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch b/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch
new file mode 100644
index 0000000..77ebf37
--- /dev/null
+++ b/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch
@@ -0,0 +1,61 @@
+From 30e2ef302a329850ba55c7c458c98cbf396186ec Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 21:47:34 +0000
+Subject: [PATCH] Fix build with non-glibc libraries on linux
+
+qualify isnan() calls with std namespace
+malloc_trim is glibc specific API so guard it with __GLIBC__
+let ctype be used on non-glibc ( musl ) C library
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Accepted
+
+ Source/JavaScriptCore/runtime/Options.cpp                    | 2 +-
+ Source/WTF/wtf/DisallowCType.h                               | 2 +-
+ Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp | 2 ++
+ 3 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/Source/JavaScriptCore/runtime/Options.cpp b/Source/JavaScriptCore/runtime/Options.cpp
+index fe830b4..c49aade 100644
+--- a/Source/JavaScriptCore/runtime/Options.cpp
++++ b/Source/JavaScriptCore/runtime/Options.cpp
+@@ -610,7 +610,7 @@ bool Option::operator==(const Option& other) const
+     case Options::Type::unsignedType:
+         return m_entry.unsignedVal == other.m_entry.unsignedVal;
+     case Options::Type::doubleType:
+-        return (m_entry.doubleVal == other.m_entry.doubleVal) || (isnan(m_entry.doubleVal) && isnan(other.m_entry.doubleVal));
++        return (m_entry.doubleVal == other.m_entry.doubleVal) || (std::isnan(m_entry.doubleVal) && std::isnan(other.m_entry.doubleVal));
+     case Options::Type::int32Type:
+         return m_entry.int32Val == other.m_entry.int32Val;
+     case Options::Type::optionRangeType:
+diff --git a/Source/WTF/wtf/DisallowCType.h b/Source/WTF/wtf/DisallowCType.h
+index d85e767..dc6bcab 100644
+--- a/Source/WTF/wtf/DisallowCType.h
++++ b/Source/WTF/wtf/DisallowCType.h
+@@ -40,7 +40,7 @@
+ // are used from wx headers. On GTK+ for Mac many GTK+ files include <libintl.h>
+ // or <glib/gi18n-lib.h>, which in turn include <xlocale/_ctype.h> which uses
+ // isacii(). 
+-#if !(OS(DARWIN) && PLATFORM(GTK)) && !PLATFORM(EFL) && !defined(_LIBCPP_VERSION)
++#if !(OS(DARWIN) && PLATFORM(GTK)) && !PLATFORM(EFL) && !defined(_LIBCPP_VERSION) && defined(__GLIBC__)
+ 
+ #include <ctype.h>
+ 
+diff --git a/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp b/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp
+index ea61909..1495642 100644
+--- a/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp
++++ b/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp
+@@ -202,7 +202,9 @@ void MemoryPressureHandler::respondToMemoryPressure(Critical critical, Synchrono
+ void MemoryPressureHandler::platformReleaseMemory(Critical)
+ {
+     ReliefLogger log("Run malloc_trim");
++#ifdef __GLIBC__
+     malloc_trim(0);
++#endif
+ }
+ 
+ void MemoryPressureHandler::ReliefLogger::platformLog()
+-- 
+2.6.4
+
diff --git a/meta/recipes-sato/webkit/webkitgtk/clang.patch b/meta/recipes-sato/webkit/webkitgtk/clang.patch
new file mode 100644
index 0000000..e526713
--- /dev/null
+++ b/meta/recipes-sato/webkit/webkitgtk/clang.patch
@@ -0,0 +1,25 @@
+Clang's builtin for clear_cache accepts char* and errors out when using void*,
+using char* work on both gcc and clang since char* is auto-converted to void* in gcc case
+
+Source/JavaScriptCore/assembler/ARM64Assembler.h:2857:33: error: cannot initialize a parameter of type 'char *' with an rvalue of type 'void *'
+        __builtin___clear_cache(reinterpret_cast<void*>(begin), reinterpret_cast<void*>(end));
+                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1 error generated.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Accepted
+
+Index: webkitgtk-2.8.5/Source/JavaScriptCore/assembler/ARM64Assembler.h
+===================================================================
+--- webkitgtk-2.8.5.orig/Source/JavaScriptCore/assembler/ARM64Assembler.h
++++ webkitgtk-2.8.5/Source/JavaScriptCore/assembler/ARM64Assembler.h
+@@ -2854,7 +2854,7 @@ public:
+ #if OS(LINUX) && COMPILER(GCC)
+     static inline void linuxPageFlush(uintptr_t begin, uintptr_t end)
+     {
+-        __builtin___clear_cache(reinterpret_cast<void*>(begin), reinterpret_cast<void*>(end));
++        __builtin___clear_cache(reinterpret_cast<char*>(begin), reinterpret_cast<char*>(end));
+     }
+ #endif
+ 
diff --git a/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb b/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb
index 4d5aeb4..098bbbb 100644
--- a/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb
+++ b/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb
@@ -12,6 +12,9 @@ LIC_FILES_CHKSUM = "file://Source/JavaScriptCore/COPYING.LIB;md5=d0c6d6397a5d842
 
 SRC_URI = "\
   http://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \
+  file://clang.patch \
+  file://0001-Enable-backtrace-on-linux-when-using-glibc.patch \
+  file://0001-Fix-build-with-non-glibc-libraries-on-linux.patch \
   "
 SRC_URI[md5sum] = "fb010031c6f61c3a1a00793b112badb5"
 SRC_URI[sha256sum] = "dbf8260da5cac0c74de2d3cce1fe7c519da3cd816a2c769cb6c6d56addd2f055"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 35/73] rt-tests: Fix build with non-gcc compilers
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (33 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 34/73] webkitgtk: Fix build with clang/musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 36/73] tar: Fix build for musl based targets Khem Raj
                   ` (38 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Makery hard sets CC to be some form of gcc, make it set only if CC
variable is absent in environment.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...t-CC-AR-variable-only-if-it-doesn-t-have-.patch | 30 ++++++++++++++++++++++
 meta/recipes-rt/rt-tests/rt-tests_0.96.bb          |  3 ++-
 2 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-rt/rt-tests/files/0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch

diff --git a/meta/recipes-rt/rt-tests/files/0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch b/meta/recipes-rt/rt-tests/files/0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch
new file mode 100644
index 0000000..00fcc7d
--- /dev/null
+++ b/meta/recipes-rt/rt-tests/files/0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch
@@ -0,0 +1,30 @@
+From 9640dde4241e1314b8e8ea35b0c8dab0b30ae51f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 3 Jan 2016 10:50:56 -0800
+Subject: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
+
+This helps it compile with clang or any other compilers besides gcc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 1e4b7d1..2c2d396 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 0.96
+-CC=$(CROSS_COMPILE)gcc
+-AR=$(CROSS_COMPILE)ar
++CC?=$(CROSS_COMPILE)gcc
++AR?=$(CROSS_COMPILE)ar
+ 
+ OBJDIR = bld
+ 
+-- 
+2.6.4
+
diff --git a/meta/recipes-rt/rt-tests/rt-tests_0.96.bb b/meta/recipes-rt/rt-tests/rt-tests_0.96.bb
index 7d70392..2f96fea 100644
--- a/meta/recipes-rt/rt-tests/rt-tests_0.96.bb
+++ b/meta/recipes-rt/rt-tests/rt-tests_0.96.bb
@@ -10,7 +10,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
 require rt-tests.inc
 inherit ptest
 
-SRC_URI += "file://run-ptest \
+SRC_URI += "file://0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch \
+            file://run-ptest \
             file://rt_bmark.py \
            "
 # Do not install hwlatdetect
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 36/73] tar: Fix build for musl based targets
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (34 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 35/73] rt-tests: Fix build with non-gcc compilers Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 37/73] pax: Fix build with musl Khem Raj
                   ` (37 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

It only considered linux-gnu hosts when cross compiling
here we add linux-musl to the mix as well

Fixes errors e.g.

1.28-r0/tar-1.28/src/tar.c:1351:5: error: 'SAVEDIR_SORT_INODE'
undeclared here (not in a function)
|      SAVEDIR_SORT_INODE
|      ^

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-extended/tar/tar/musl_dirent.patch | 19 +++++++++++++++++++
 meta/recipes-extended/tar/tar_1.28.bb           |  6 ++++++
 2 files changed, 25 insertions(+)
 create mode 100644 meta/recipes-extended/tar/tar/musl_dirent.patch

diff --git a/meta/recipes-extended/tar/tar/musl_dirent.patch b/meta/recipes-extended/tar/tar/musl_dirent.patch
new file mode 100644
index 0000000..b0dc16c
--- /dev/null
+++ b/meta/recipes-extended/tar/tar/musl_dirent.patch
@@ -0,0 +1,19 @@
+musl has valid d_ino implementation
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+Index: tar-1.28/m4/d-ino.m4
+===================================================================
+--- tar-1.28.orig/m4/d-ino.m4
++++ tar-1.28/m4/d-ino.m4
+@@ -40,7 +40,8 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_
+            [gl_cv_struct_dirent_d_ino=no],
+            [case "$host_os" in
+                            # Guess yes on glibc systems with Linux kernel.
+-              linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;;
++              linux*-gnu*|linux*-musl*)
++                           gl_cv_struct_dirent_d_ino="guessing yes" ;;
+                            # If we don't know, assume the worst.
+               *)           gl_cv_struct_dirent_d_ino="guessing no" ;;
+             esac
diff --git a/meta/recipes-extended/tar/tar_1.28.bb b/meta/recipes-extended/tar/tar_1.28.bb
index 8816000..518e622 100644
--- a/meta/recipes-extended/tar/tar_1.28.bb
+++ b/meta/recipes-extended/tar/tar_1.28.bb
@@ -7,6 +7,12 @@ LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
 SRC_URI += "file://remove-gets.patch \
+            file://musl_dirent.patch \
            "
 SRC_URI[md5sum] = "8f32b2bc1ed7ddf4cf4e4a39711341b0"
 SRC_URI[sha256sum] = "60e4bfe0602fef34cd908d91cf638e17eeb09394d7b98c2487217dc4d3147562"
+
+do_install_append_libc-musl() {
+	rm -f ${D}${libdir}/charset.alias
+	rmdir ${D}${libdir}
+}
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 37/73] pax: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (35 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 36/73] tar: Fix build for musl based targets Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 38/73] iputils: Use member based initialization for mrghdr struct Khem Raj
                   ` (36 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

There are several BSD specific assumptions
and some GNU specific ones.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../pax/pax/0001-Fix-build-with-musl.patch         | 1287 ++++++++++++++++++++
 .../pax/0001-use-strtoll-instead-of-strtoq.patch   |   33 +
 meta/recipes-extended/pax/pax_3.4.bb               |   10 +
 3 files changed, 1330 insertions(+)
 create mode 100644 meta/recipes-extended/pax/pax/0001-Fix-build-with-musl.patch
 create mode 100644 meta/recipes-extended/pax/pax/0001-use-strtoll-instead-of-strtoq.patch

diff --git a/meta/recipes-extended/pax/pax/0001-Fix-build-with-musl.patch b/meta/recipes-extended/pax/pax/0001-Fix-build-with-musl.patch
new file mode 100644
index 0000000..61bf2de
--- /dev/null
+++ b/meta/recipes-extended/pax/pax/0001-Fix-build-with-musl.patch
@@ -0,0 +1,1287 @@
+From 47c4db8d37248d968fac7ee4a71ca64398890723 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 6 Jan 2016 11:57:21 -0800
+Subject: [PATCH] Fix build with musl
+
+Remove BSDisms
+Remove fts, and link to libfts thats provided externally
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Inappropriate[musl specific]
+
+ lib/Makefile.am |    4 +-
+ lib/fts.c       | 1025 -------------------------------------------------------
+ lib/fts.h       |  131 -------
+ lib/vis.h       |   13 +-
+ src/Makefile.am |    2 +-
+ src/extern.h    |    2 -
+ src/file_subs.c |    2 +-
+ src/tables.c    |    2 +-
+ 8 files changed, 14 insertions(+), 1167 deletions(-)
+ delete mode 100644 lib/fts.c
+ delete mode 100644 lib/fts.h
+
+diff --git a/lib/Makefile.am b/lib/Makefile.am
+index 56d0859..7f5045a 100644
+--- a/lib/Makefile.am
++++ b/lib/Makefile.am
+@@ -8,8 +8,8 @@ AUTOMAKE_OPTIONS = 1.7 gnits
+ CLEANFILES = *~
+ 
+ noinst_LIBRARIES = libbsdfunc.a
+-noinst_HEADERS = vis.h bsdfunc.h fts.h
++noinst_HEADERS = vis.h bsdfunc.h
+ 
+ AM_CFLAGS = @EXTRA_CFLAGS@
+ 
+-libbsdfunc_a_SOURCES = vis.c strlcpy.c strmode.c fts.c
++libbsdfunc_a_SOURCES = vis.c strlcpy.c strmode.c
+diff --git a/lib/fts.c b/lib/fts.c
+deleted file mode 100644
+index 45e90ca..0000000
+--- a/lib/fts.c
++++ /dev/null
+@@ -1,1025 +0,0 @@
+-/*-
+- * Copyright (c) 1990, 1993, 1994
+- *      The Regents of the University of California.  All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 4. Neither the name of the University nor the names of its contributors
+- *    may be used to endorse or promote products derived from this software
+- *    without specific prior written permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+- * SUCH DAMAGE.
+- */
+-
+-#ifdef HAVE_CONFIG_H
+-#include <config.h>
+-#endif
+-
+-#include <sys/stat.h>
+-#include <fcntl.h>
+-#include <dirent.h>
+-#include <errno.h>
+-#include <fts.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <unistd.h>
+-
+-/* Largest alignment size needed, minus one.
+-   Usually long double is the worst case.  */
+-#ifndef ALIGNBYTES
+-#define ALIGNBYTES	(__alignof__ (long double) - 1)
+-#endif
+-/* Align P to that size.  */
+-#ifndef ALIGN
+-#define	ALIGN(p)	(((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES)
+-#endif
+-
+-
+-static FTSENT	*fts_alloc (FTS *, const char *, int);
+-static FTSENT	*fts_build (FTS *, int);
+-static void	 fts_lfree (FTSENT *);
+-static void	 fts_load (FTS *, FTSENT *);
+-static size_t	 fts_maxarglen (char * const *);
+-static void	 fts_padjust (FTS *, FTSENT *);
+-static int	 fts_palloc (FTS *, size_t);
+-static FTSENT	*fts_sort (FTS *, FTSENT *, int);
+-static u_short	 fts_stat (FTS *, FTSENT *, int);
+-static int      fts_safe_changedir (FTS *, FTSENT *, int, const char *);
+-
+-#ifndef MAX
+-#define MAX(a, b)	(a > b ? a : b)
+-#endif
+-
+-#define	ISDOT(a)	(a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
+-
+-#define CLR(opt)	(sp->fts_options &= ~(opt))
+-#define	ISSET(opt)	(sp->fts_options & (opt))
+-#define	SET(opt)	(sp->fts_options |= (opt))
+-
+-#define	FCHDIR(sp, fd)	(!ISSET(FTS_NOCHDIR) && fchdir(fd))
+-
+-#define	BREAD		3		/* fts_read */
+-
+-FTS *
+-fts_open(argv, koptions, compar)
+-	char * const *argv;
+-	register int koptions;
+-	int (*compar) (const FTSENT **, const FTSENT **);
+-{
+-	register FTS *sp;
+-	register FTSENT *p, *root;
+-	register int nitems;
+-	FTSENT *parent, *tmp;
+-	int len;
+-
+-tmp = NULL;	/* stop compiler whinging */
+-	/* Options check. */
+-	if (koptions & ~FTS_OPTIONMASK) {
+-		errno = EINVAL;
+-		return (NULL);
+-	}
+-
+-	/* Allocate/initialize the stream */
+-	if ((sp = malloc((u_int)sizeof(FTS))) == NULL)
+-		return (NULL);
+-	memset(sp, 0, sizeof(FTS));
+-	sp->fts_compar = (int (*) (const void *, const void *)) compar;
+-	sp->fts_options = koptions;
+-
+-	/* Logical walks turn on NOCHDIR; symbolic links are too hard. */
+-	if (ISSET(FTS_LOGICAL))
+-		SET(FTS_NOCHDIR);
+-
+-	/*
+-	 * Start out with 1K of path space, and enough, in any case,
+-	 * to hold the user's paths.
+-	 */
+-#ifndef MAXPATHLEN
+-#define MAXPATHLEN 1024
+-#endif
+-	if (fts_palloc(sp, MAX(fts_maxarglen(argv), MAXPATHLEN)))
+-		goto mem1;
+-
+-	/* Allocate/initialize root's parent. */
+-	if ((parent = fts_alloc(sp, "", 0)) == NULL)
+-		goto mem2;
+-	parent->fts_level = FTS_ROOTPARENTLEVEL;
+-
+-	/* Allocate/initialize root(s). */
+-	for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) {
+-		/* Don't allow zero-length paths. */
+-		if ((len = strlen(*argv)) == 0) {
+-			errno = ENOENT;
+-			goto mem3;
+-		}
+-
+-		p = fts_alloc(sp, *argv, len);
+-		p->fts_level = FTS_ROOTLEVEL;
+-		p->fts_parent = parent;
+-		p->fts_accpath = p->fts_name;
+-		p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW));
+-
+-		/* Command-line "." and ".." are real directories. */
+-		if (p->fts_info == FTS_DOT)
+-			p->fts_info = FTS_D;
+-
+-		/*
+-		 * If comparison routine supplied, traverse in sorted
+-		 * order; otherwise traverse in the order specified.
+-		 */
+-		if (compar) {
+-			p->fts_link = root;
+-			root = p;
+-		} else {
+-			p->fts_link = NULL;
+-			if (root == NULL)
+-				tmp = root = p;
+-			else {
+-				tmp->fts_link = p;
+-				tmp = p;
+-			}
+-		}
+-	}
+-	if (compar && nitems > 1)
+-		root = fts_sort(sp, root, nitems);
+-
+-	/*
+-	 * Allocate a dummy pointer and make fts_read think that we've just
+-	 * finished the node before the root(s); set p->fts_info to FTS_INIT
+-	 * so that everything about the "current" node is ignored.
+-	 */
+-	if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
+-		goto mem3;
+-	sp->fts_cur->fts_link = root;
+-	sp->fts_cur->fts_info = FTS_INIT;
+-
+-	/*
+-	 * If using chdir(2), grab a file descriptor pointing to dot to ensure
+-	 * that we can get back here; this could be avoided for some paths,
+-	 * but almost certainly not worth the effort.  Slashes, symbolic links,
+-	 * and ".." are all fairly nasty problems.  Note, if we can't get the
+-	 * descriptor we run anyway, just more slowly.
+-	 */
+-	if (!ISSET(FTS_NOCHDIR)
+-	    && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)
+-		SET(FTS_NOCHDIR);
+-
+-	return (sp);
+-
+-mem3:	fts_lfree(root);
+-	free(parent);
+-mem2:	free(sp->fts_path);
+-mem1:	free(sp);
+-	return (NULL);
+-}
+-
+-static void
+-fts_load(sp, p)
+-	FTS *sp;
+-	register FTSENT *p;
+-{
+-	register int len;
+-	register char *cp;
+-
+-	/*
+-	 * Load the stream structure for the next traversal.  Since we don't
+-	 * actually enter the directory until after the preorder visit, set
+-	 * the fts_accpath field specially so the chdir gets done to the right
+-	 * place and the user can access the first node.  From fts_open it's
+-	 * known that the path will fit.
+-	 */
+-	len = p->fts_pathlen = p->fts_namelen;
+-	memmove(sp->fts_path, p->fts_name, len + 1);
+-	if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) {
+-		len = strlen(++cp);
+-		memmove(p->fts_name, cp, len + 1);
+-		p->fts_namelen = len;
+-	}
+-	p->fts_accpath = p->fts_path = sp->fts_path;
+-	sp->fts_dev = p->fts_dev;
+-}
+-
+-int
+-fts_close(sp)
+-	FTS *sp;
+-{
+-	register FTSENT *freep, *p;
+-	int saved_errno;
+-
+-	/*
+-	 * This still works if we haven't read anything -- the dummy structure
+-	 * points to the root list, so we step through to the end of the root
+-	 * list which has a valid parent pointer.
+-	 */
+-	if (sp->fts_cur) {
+-		for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
+-			freep = p;
+-			p = p->fts_link != NULL ? p->fts_link : p->fts_parent;
+-			free(freep);
+-		}
+-		free(p);
+-	}
+-
+-	/* Free up child linked list, sort array, path buffer. */
+-	if (sp->fts_child)
+-		fts_lfree(sp->fts_child);
+-	if (sp->fts_array)
+-		free(sp->fts_array);
+-	free(sp->fts_path);
+-
+-	/* Return to original directory, save errno if necessary. */
+-	if (!ISSET(FTS_NOCHDIR)) {
+-		saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
+-		(void)close(sp->fts_rfd);
+-
+-		/* Set errno and return. */
+-		if (saved_errno != 0) {
+-			/* Free up the stream pointer. */
+-			free(sp);
+-			errno = saved_errno;
+-			return (-1);
+-		}
+-	}
+-
+-	/* Free up the stream pointer. */
+-	free(sp);
+-	return (0);
+-}
+-
+-/*
+- * Special case of "/" at the end of the path so that slashes aren't
+- * appended which would cause paths to be written as "....//foo".
+- */
+-#define	NAPPEND(p)							\
+-	(p->fts_path[p->fts_pathlen - 1] == '/'				\
+-	    ? p->fts_pathlen - 1 : p->fts_pathlen)
+-
+-FTSENT *
+-fts_read(sp)
+-	register FTS *sp;
+-{
+-	register FTSENT *p, *tmp;
+-	register int instr;
+-	register char *t;
+-	int saved_errno;
+-
+-	/* If finished or unrecoverable error, return NULL. */
+-	if (sp->fts_cur == NULL || ISSET(FTS_STOP))
+-		return (NULL);
+-
+-	/* Set current node pointer. */
+-	p = sp->fts_cur;
+-
+-	/* Save and zero out user instructions. */
+-	instr = p->fts_instr;
+-	p->fts_instr = FTS_NOINSTR;
+-
+-	/* Any type of file may be re-visited; re-stat and re-turn. */
+-	if (instr == FTS_AGAIN) {
+-		p->fts_info = fts_stat(sp, p, 0);
+-		return (p);
+-	}
+-
+-	/*
+-	 * Following a symlink -- SLNONE test allows application to see
+-	 * SLNONE and recover.  If indirecting through a symlink, have
+-	 * keep a pointer to current location.  If unable to get that
+-	 * pointer, follow fails.
+-	 */
+-	if (instr == FTS_FOLLOW &&
+-	    (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
+-		p->fts_info = fts_stat(sp, p, 1);
+-		if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
+-			if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
+-				p->fts_errno = errno;
+-				p->fts_info = FTS_ERR;
+-			} else
+-				p->fts_flags |= FTS_SYMFOLLOW;
+-		}
+-		return (p);
+-	}
+-
+-	/* Directory in pre-order. */
+-	if (p->fts_info == FTS_D) {
+-		/* If skipped or crossed mount point, do post-order visit. */
+-		if (instr == FTS_SKIP ||
+-		    (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) {
+-			if (p->fts_flags & FTS_SYMFOLLOW)
+-				(void)close(p->fts_symfd);
+-			if (sp->fts_child) {
+-				fts_lfree(sp->fts_child);
+-				sp->fts_child = NULL;
+-			}
+-			p->fts_info = FTS_DP;
+-			return (p);
+-		}
+-
+-		/* Rebuild if only read the names and now traversing. */
+-		if (sp->fts_child != NULL && ISSET(FTS_NAMEONLY)) {
+-			CLR(FTS_NAMEONLY);
+-			fts_lfree(sp->fts_child);
+-			sp->fts_child = NULL;
+-		}
+-
+-		/*
+-		 * Cd to the subdirectory.
+-		 *
+-		 * If have already read and now fail to chdir, whack the list
+-		 * to make the names come out right, and set the parent errno
+-		 * so the application will eventually get an error condition.
+-		 * Set the FTS_DONTCHDIR flag so that when we logically change
+-		 * directories back to the parent we don't do a chdir.
+-		 *
+-		 * If haven't read do so.  If the read fails, fts_build sets
+-		 * FTS_STOP or the fts_info field of the node.
+-		 */
+-		if (sp->fts_child != NULL) {
+-			if (fts_safe_changedir(sp, p, -1, p->fts_accpath)) {
+-				p->fts_errno = errno;
+-				p->fts_flags |= FTS_DONTCHDIR;
+-				for (p = sp->fts_child; p != NULL;
+-				     p = p->fts_link)
+-					p->fts_accpath =
+-					    p->fts_parent->fts_accpath;
+-			}
+-		} else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
+-			if (ISSET(FTS_STOP))
+-				return (NULL);
+-			return (p);
+-		}
+-		p = sp->fts_child;
+-		sp->fts_child = NULL;
+-		goto name;
+-	}
+-
+-	/* Move to the next node on this level. */
+-next:	tmp = p;
+-	if ((p = p->fts_link) != NULL) {
+-		free(tmp);
+-
+-		/*
+-		 * If reached the top, return to the original directory (or
+-		 * the root of the tree), and load the paths for the next root.
+-		 */
+-		if (p->fts_level == FTS_ROOTLEVEL) {
+-			if (FCHDIR(sp, sp->fts_rfd)) {
+-				SET(FTS_STOP);
+-				return (NULL);
+-			}
+-			fts_load(sp, p);
+-			return (sp->fts_cur = p);
+-		}
+-
+-		/*
+-		 * User may have called fts_set on the node.  If skipped,
+-		 * ignore.  If followed, get a file descriptor so we can
+-		 * get back if necessary.
+-		 */
+-		if (p->fts_instr == FTS_SKIP)
+-			goto next;
+-		if (p->fts_instr == FTS_FOLLOW) {
+-			p->fts_info = fts_stat(sp, p, 1);
+-			if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
+-				if ((p->fts_symfd =
+-				    open(".", O_RDONLY, 0)) < 0) {
+-					p->fts_errno = errno;
+-					p->fts_info = FTS_ERR;
+-				} else
+-					p->fts_flags |= FTS_SYMFOLLOW;
+-			}
+-			p->fts_instr = FTS_NOINSTR;
+-		}
+-
+-name:		t = sp->fts_path + NAPPEND(p->fts_parent);
+-		*t++ = '/';
+-		memmove(t, p->fts_name, p->fts_namelen + 1);
+-		return (sp->fts_cur = p);
+-	}
+-
+-	/* Move up to the parent node. */
+-	p = tmp->fts_parent;
+-	free(tmp);
+-
+-	if (p->fts_level == FTS_ROOTPARENTLEVEL) {
+-		/*
+-		 * Done; free everything up and set errno to 0 so the user
+-		 * can distinguish between error and EOF.
+-		 */
+-		free(p);
+-		errno = 0;
+-		return (sp->fts_cur = NULL);
+-	}
+-
+-	/* NUL terminate the pathname. */
+-	sp->fts_path[p->fts_pathlen] = '\0';
+-
+-	/*
+-	 * Return to the parent directory.  If at a root node or came through
+-	 * a symlink, go back through the file descriptor.  Otherwise, cd up
+-	 * one directory.
+-	 */
+-	if (p->fts_level == FTS_ROOTLEVEL) {
+-		if (FCHDIR(sp, sp->fts_rfd)) {
+-			SET(FTS_STOP);
+-			return (NULL);
+-		}
+-	} else if (p->fts_flags & FTS_SYMFOLLOW) {
+-		if (FCHDIR(sp, p->fts_symfd)) {
+-			saved_errno = errno;
+-			(void)close(p->fts_symfd);
+-			errno = saved_errno;
+-			SET(FTS_STOP);
+-			return (NULL);
+-		}
+-		(void)close(p->fts_symfd);
+-	} else if (!(p->fts_flags & FTS_DONTCHDIR) &&
+-		   fts_safe_changedir(sp, p->fts_parent, -1, "..")) {
+-		SET(FTS_STOP);
+-		return (NULL);
+-	}
+-	p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
+-	return (sp->fts_cur = p);
+-}
+-
+-/*
+- * Fts_set takes the stream as an argument although it's not used in this
+- * implementation; it would be necessary if anyone wanted to add global
+- * semantics to fts using fts_set.  An error return is allowed for similar
+- * reasons.
+- */
+-/* ARGSUSED */
+-int
+-fts_set(sp, p, instr)
+-	FTS __attribute__((__unused__)) *sp;
+-	FTSENT *p;
+-	int instr;
+-{
+-sp = NULL;	/* stop compiler whinging */
+-	if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
+-	    instr != FTS_NOINSTR && instr != FTS_SKIP) {
+-		errno = EINVAL;
+-		return (1);
+-	}
+-	p->fts_instr = instr;
+-	return (0);
+-}
+-
+-/*
+- * This is the tricky part -- do not casually change *anything* in here.  The
+- * idea is to build the linked list of entries that are used by fts_children
+- * and fts_read.  There are lots of special cases.
+- *
+- * The real slowdown in walking the tree is the stat calls.  If FTS_NOSTAT is
+- * set and it's a physical walk (so that symbolic links can't be directories),
+- * we can do things quickly.  First, if it's a 4.4BSD file system, the type
+- * of the file is in the directory entry.  Otherwise, we assume that the number
+- * of subdirectories in a node is equal to the number of links to the parent.
+- * The former skips all stat calls.  The latter skips stat calls in any leaf
+- * directories and for any files after the subdirectories in the directory have
+- * been found, cutting the stat calls by about 2/3.
+- */
+-static FTSENT *
+-fts_build(sp, type)
+-	register FTS *sp;
+-	int type;
+-{
+-	register struct dirent *dp;
+-	register FTSENT *p, *head;
+-	register int nitems;
+-	FTSENT *cur, *tail;
+-	DIR *dirp;
+-	void *oldaddr;
+-	int cderrno, descend, len, level, nlinks, saved_errno,
+-	    nostat, doadjust;
+-	size_t maxlen;
+-	char *cp;
+-
+-	/* Set current node pointer. */
+-	cur = sp->fts_cur;
+-
+-	/*
+-	 * Open the directory for reading.  If this fails, we're done.
+-	 * If being called from fts_read, set the fts_info field.
+-	 */
+-       if ((dirp = opendir(cur->fts_accpath)) == NULL) {
+-		if (type == BREAD) {
+-			cur->fts_info = FTS_DNR;
+-			cur->fts_errno = errno;
+-		}
+-		return (NULL);
+-	}
+-
+-	/*
+-	 * Nlinks is the number of possible entries of type directory in the
+-	 * directory if we're cheating on stat calls, 0 if we're not doing
+-	 * any stat calls at all, -1 if we're doing stats on everything.
+-	 */
+-	nlinks = -1;
+-	nostat = 0;
+-
+-	/*
+-	 * If we're going to need to stat anything or we want to descend
+-	 * and stay in the directory, chdir.  If this fails we keep going,
+-	 * but set a flag so we don't chdir after the post-order visit.
+-	 * We won't be able to stat anything, but we can still return the
+-	 * names themselves.  Note, that since fts_read won't be able to
+-	 * chdir into the directory, it will have to return different path
+-	 * names than before, i.e. "a/b" instead of "b".  Since the node
+-	 * has already been visited in pre-order, have to wait until the
+-	 * post-order visit to return the error.  There is a special case
+-	 * here, if there was nothing to stat then it's not an error to
+-	 * not be able to stat.  This is all fairly nasty.  If a program
+-	 * needed sorted entries or stat information, they had better be
+-	 * checking FTS_NS on the returned nodes.
+-	 */
+-	cderrno = 0;
+-	if (nlinks || type == BREAD) {
+-		if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) {
+-			if (nlinks && type == BREAD)
+-				cur->fts_errno = errno;
+-			cur->fts_flags |= FTS_DONTCHDIR;
+-			descend = 0;
+-			cderrno = errno;
+-			(void)closedir(dirp);
+-			dirp = NULL;
+-		} else
+-			descend = 1;
+-	} else
+-		descend = 0;
+-
+-	/*
+-	 * Figure out the max file name length that can be stored in the
+-	 * current path -- the inner loop allocates more path as necessary.
+-	 * We really wouldn't have to do the maxlen calculations here, we
+-	 * could do them in fts_read before returning the path, but it's a
+-	 * lot easier here since the length is part of the dirent structure.
+-	 *
+-	 * If not changing directories set a pointer so that can just append
+-	 * each new name into the path.
+-	 */
+-	len = NAPPEND(cur);
+-	if (ISSET(FTS_NOCHDIR)) {
+-		cp = sp->fts_path + len;
+-		*cp++ = '/';
+-	} else {
+-		/* GCC, you're too verbose. */
+-		cp = NULL;
+-	}
+-	len++;
+-	maxlen = sp->fts_pathlen - len;
+-
+-	level = cur->fts_level + 1;
+-
+-	/* Read the directory, attaching each entry to the `link' pointer. */
+-	doadjust = 0;
+-	for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) {
+-		if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
+-			continue;
+-
+-		if ((p = fts_alloc(sp, dp->d_name, (int)_D_EXACT_NAMLEN (dp))) == NULL)
+-			goto mem1;
+-		if (_D_EXACT_NAMLEN (dp) >= maxlen) {/* include space for NUL */
+-			oldaddr = sp->fts_path;
+-			if (fts_palloc(sp, _D_EXACT_NAMLEN (dp) + len + 1)) {
+-				/*
+-				 * No more memory for path or structures.  Save
+-				 * errno, free up the current structure and the
+-				 * structures already allocated.
+-				 */
+-mem1:				saved_errno = errno;
+-				if (p)
+-					free(p);
+-				fts_lfree(head);
+-				(void)closedir(dirp);
+-				cur->fts_info = FTS_ERR;
+-				SET(FTS_STOP);
+-				errno = saved_errno;
+-				return (NULL);
+-			}
+-			/* Did realloc() change the pointer? */
+-			if (oldaddr != sp->fts_path) {
+-				doadjust = 1;
+-				if (ISSET(FTS_NOCHDIR))
+-					cp = sp->fts_path + len;
+-			}
+-			maxlen = sp->fts_pathlen - len;
+-		}
+-
+-		if (len + _D_EXACT_NAMLEN (dp) >= 0x10000) {
+-			/*
+-			 * In an FTSENT, fts_pathlen is a u_short so it is
+-			 * possible to wraparound here.  If we do, free up
+-			 * the current structure and the structures already
+-			 * allocated, then error out with ENAMETOOLONG.
+-			 */
+-			free(p);
+-			fts_lfree(head);
+-			(void)closedir(dirp);
+-			cur->fts_info = FTS_ERR;
+-			SET(FTS_STOP);
+-			errno = ENAMETOOLONG;
+-			return (NULL);
+-		}
+-		p->fts_level = level;
+-		p->fts_parent = sp->fts_cur;
+-		p->fts_pathlen = len + _D_EXACT_NAMLEN (dp);
+-
+-#if defined FTS_WHITEOUT && 0
+-		if (dp->d_type == DT_WHT)
+-			p->fts_flags |= FTS_ISW;
+-#endif
+-
+-		if (cderrno) {
+-			if (nlinks) {
+-				p->fts_info = FTS_NS;
+-				p->fts_errno = cderrno;
+-			} else
+-				p->fts_info = FTS_NSOK;
+-			p->fts_accpath = cur->fts_accpath;
+-		} else if (nlinks == 0
+-#if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE
+-			   || (nostat &&
+-			       dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
+-#endif
+-		    ) {
+-			p->fts_accpath =
+-			    ISSET(FTS_NOCHDIR) ? p->fts_path : p->fts_name;
+-			p->fts_info = FTS_NSOK;
+-		} else {
+-			/* Build a file name for fts_stat to stat. */
+-			if (ISSET(FTS_NOCHDIR)) {
+-				p->fts_accpath = p->fts_path;
+-				memmove(cp, p->fts_name, p->fts_namelen + 1);
+-			} else
+-				p->fts_accpath = p->fts_name;
+-			/* Stat it. */
+-			p->fts_info = fts_stat(sp, p, 0);
+-
+-			/* Decrement link count if applicable. */
+-			if (nlinks > 0 && (p->fts_info == FTS_D ||
+-			    p->fts_info == FTS_DC || p->fts_info == FTS_DOT))
+-				--nlinks;
+-		}
+-
+-		/* We walk in directory order so "ls -f" doesn't get upset. */
+-		p->fts_link = NULL;
+-		if (head == NULL)
+-			head = tail = p;
+-		else {
+-			tail->fts_link = p;
+-			tail = p;
+-		}
+-		++nitems;
+-	}
+-	if (dirp)
+-		(void)closedir(dirp);
+-
+-	/*
+-	 * If realloc() changed the address of the path, adjust the
+-	 * addresses for the rest of the tree and the dir list.
+-	 */
+-	if (doadjust)
+-		fts_padjust(sp, head);
+-
+-	/*
+-	 * If not changing directories, reset the path back to original
+-	 * state.
+-	 */
+-	if (ISSET(FTS_NOCHDIR)) {
+-		if (len == sp->fts_pathlen || nitems == 0)
+-			--cp;
+-		*cp = '\0';
+-	}
+-
+-	/*
+-	 * If descended after called from fts_children or after called from
+-	 * fts_read and nothing found, get back.  At the root level we use
+-	 * the saved fd; if one of fts_open()'s arguments is a relative path
+-	 * to an empty directory, we wind up here with no other way back.  If
+-	 * can't get back, we're done.
+-	 */
+-	if (descend && nitems == 0 &&
+-	    (cur->fts_level == FTS_ROOTLEVEL ?
+-	     FCHDIR(sp, sp->fts_rfd) :
+-	     fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
+-		cur->fts_info = FTS_ERR;
+-		SET(FTS_STOP);
+-		return (NULL);
+-	}
+-
+-	/* If didn't find anything, return NULL. */
+-	if (!nitems) {
+-		if (type == BREAD)
+-			cur->fts_info = FTS_DP;
+-		return (NULL);
+-	}
+-
+-	/* Sort the entries. */
+-	if (sp->fts_compar && nitems > 1)
+-		head = fts_sort(sp, head, nitems);
+-	return (head);
+-}
+-
+-static u_short
+-fts_stat(sp, p, follow)
+-	FTS *sp;
+-	register FTSENT *p;
+-	int follow;
+-{
+-	register FTSENT *t;
+-	register dev_t dev;
+-	register ino_t ino;
+-	struct stat *sbp;
+-	int saved_errno;
+-
+-	/* If user needs stat info, stat buffer already allocated. */
+-	sbp = p->fts_statp;
+-
+-#if defined FTS_WHITEOUT && 0
+-	/* check for whiteout */
+-	if (p->fts_flags & FTS_ISW) {
+-		if (sbp != &sb) {
+-			memset(sbp, '\0', sizeof (*sbp));
+-			sbp->st_mode = S_IFWHT;
+-		}
+-		return (FTS_W);
+-       }
+-#endif
+-
+-	/*
+-	 * If doing a logical walk, or application requested FTS_FOLLOW, do
+-	 * a stat(2).  If that fails, check for a non-existent symlink.  If
+-	 * fail, set the errno from the stat call.
+-	 */
+-	if (ISSET(FTS_LOGICAL) || follow) {
+-		if (stat(p->fts_accpath, sbp)) {
+-			saved_errno = errno;
+-			if (!lstat(p->fts_accpath, sbp)) {
+-				errno = 0;
+-				return (FTS_SLNONE);
+-			}
+-			p->fts_errno = saved_errno;
+-			goto err;
+-		}
+-	} else if (lstat(p->fts_accpath, sbp)) {
+-		p->fts_errno = errno;
+-err:		memset(sbp, 0, sizeof(struct stat));
+-		return (FTS_NS);
+-	}
+-
+-	if (S_ISDIR(sbp->st_mode)) {
+-		/*
+-		 * Set the device/inode.  Used to find cycles and check for
+-		 * crossing mount points.  Also remember the link count, used
+-		 * in fts_build to limit the number of stat calls.  It is
+-		 * understood that these fields are only referenced if fts_info
+-		 * is set to FTS_D.
+-		 */
+-		dev = p->fts_dev = sbp->st_dev;
+-		ino = p->fts_ino = sbp->st_ino;
+-		p->fts_nlink = sbp->st_nlink;
+-
+-		if (ISDOT(p->fts_name))
+-			return (FTS_DOT);
+-
+-		/*
+-		 * Cycle detection is done by brute force when the directory
+-		 * is first encountered.  If the tree gets deep enough or the
+-		 * number of symbolic links to directories is high enough,
+-		 * something faster might be worthwhile.
+-		 */
+-		for (t = p->fts_parent;
+-		    t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
+-			if (ino == t->fts_ino && dev == t->fts_dev) {
+-				p->fts_cycle = t;
+-				return (FTS_DC);
+-			}
+-		return (FTS_D);
+-	}
+-	if (S_ISLNK(sbp->st_mode))
+-		return (FTS_SL);
+-	if (S_ISREG(sbp->st_mode))
+-		return (FTS_F);
+-	return (FTS_DEFAULT);
+-}
+-
+-static FTSENT *
+-fts_sort(sp, head, nitems)
+-	FTS *sp;
+-	FTSENT *head;
+-	register int nitems;
+-{
+-	register FTSENT **ap, *p;
+-
+-	/*
+-	 * Construct an array of pointers to the structures and call qsort(3).
+-	 * Reassemble the array in the order returned by qsort.  If unable to
+-	 * sort for memory reasons, return the directory entries in their
+-	 * current order.  Allocate enough space for the current needs plus
+-	 * 40 so don't realloc one entry at a time.
+-	 */
+-	if (nitems > sp->fts_nitems) {
+-		struct _ftsent **a;
+-
+-		sp->fts_nitems = nitems + 40;
+-		if ((a = realloc(sp->fts_array,
+- 		    (size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) {
+-			free(sp->fts_array);
+-			sp->fts_array = NULL;
+-			sp->fts_nitems = 0;
+-			return (head);
+-		}
+-		sp->fts_array = a;
+-	}
+-	for (ap = sp->fts_array, p = head; p; p = p->fts_link)
+-		*ap++ = p;
+-	qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);
+-	for (head = *(ap = sp->fts_array); --nitems; ++ap)
+-		ap[0]->fts_link = ap[1];
+-	ap[0]->fts_link = NULL;
+-	return (head);
+-}
+-
+-static FTSENT *
+-fts_alloc(sp, name, namelen)
+-	FTS *sp;
+-	const char *name;
+-	register int namelen;
+-{
+-	register FTSENT *p;
+-	size_t len;
+-
+-	/*
+-	 * The file name is a variable length array and no stat structure is
+-	 * necessary if the user has set the nostat bit.  Allocate the FTSENT
+-	 * structure, the file name and the stat structure in one chunk, but
+-	 * be careful that the stat structure is reasonably aligned.  Since the
+-	 * fts_name field is declared to be of size 1, the fts_name pointer is
+-	 * namelen + 2 before the first possible address of the stat structure.
+-	 */
+-	len = sizeof(FTSENT) + namelen;
+-	len += sizeof(struct stat) + ALIGNBYTES;
+-	if ((p = malloc(len)) == NULL)
+-		return (NULL);
+-
+-	/* Copy the name and guarantee NUL termination. */
+-	memmove(p->fts_name, name, namelen);
+-	p->fts_name[namelen] = '\0';
+-
+-	p->fts_statp = (struct stat *)ALIGN(p->fts_name + namelen + 2);
+-	p->fts_namelen = namelen;
+-	p->fts_path = sp->fts_path;
+-	p->fts_errno = 0;
+-	p->fts_flags = 0;
+-	p->fts_instr = FTS_NOINSTR;
+-	p->fts_number = 0;
+-	p->fts_pointer = NULL;
+-	return (p);
+-}
+-
+-static void
+-fts_lfree(head)
+-	register FTSENT *head;
+-{
+-	register FTSENT *p;
+-
+-	/* Free a linked list of structures. */
+-	while ((p = head)) {
+-		head = head->fts_link;
+-		free(p);
+-	}
+-}
+-
+-/*
+- * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
+- * Most systems will allow creation of paths much longer than MAXPATHLEN, even
+- * though the kernel won't resolve them.  Add the size (not just what's needed)
+- * plus 256 bytes so don't realloc the path 2 bytes at a time.
+- */
+-static int
+-fts_palloc(sp, more)
+-	FTS *sp;
+-	size_t more;
+-{
+-	char *p;
+-
+-	sp->fts_pathlen += more + 256;
+-	/*
+-	 * Check for possible wraparound.  In an FTS, fts_pathlen is
+-	 * a signed int but in an FTSENT it is an unsigned short.
+-	 * We limit fts_pathlen to USHRT_MAX to be safe in both cases.
+-	 */
+-	if (sp->fts_pathlen < 0 || sp->fts_pathlen >= 0x10000) {
+-		if (sp->fts_path) {
+-			free(sp->fts_path);
+-			sp->fts_path = NULL;
+-		}
+-		sp->fts_path = NULL;
+-		errno = ENAMETOOLONG;
+-		return (1);
+-	}
+-	p = realloc(sp->fts_path, sp->fts_pathlen);
+-	if (p == NULL) {
+-		free(sp->fts_path);
+-		sp->fts_path = NULL;
+-		return 1;
+-	}
+-	sp->fts_path = p;
+-	return 0;
+-}
+-
+-/*
+- * When the path is realloc'd, have to fix all of the pointers in structures
+- * already returned.
+- */
+-static void
+-fts_padjust(sp, head)
+-	FTS *sp;
+-	FTSENT *head;
+-{
+-	FTSENT *p;
+-	char *addr = sp->fts_path;
+-
+-#define	ADJUST(p) do {							\
+-	if ((p)->fts_accpath != (p)->fts_name) {			\
+-		(p)->fts_accpath =					\
+-		    (char *)addr + ((p)->fts_accpath - (p)->fts_path);	\
+-	}								\
+-	(p)->fts_path = addr;						\
+-} while (0)
+-	/* Adjust the current set of children. */
+-	for (p = sp->fts_child; p; p = p->fts_link)
+-		ADJUST(p);
+-
+-	/* Adjust the rest of the tree, including the current level. */
+-	for (p = head; p->fts_level >= FTS_ROOTLEVEL;) {
+-		ADJUST(p);
+-		p = p->fts_link ? p->fts_link : p->fts_parent;
+-	}
+-}
+-
+-static size_t
+-fts_maxarglen(argv)
+-	char * const *argv;
+-{
+-	size_t len, max;
+-
+-	for (max = 0; *argv; ++argv)
+-		if ((len = strlen(*argv)) > max)
+-			max = len;
+-	return (max + 1);
+-}
+-
+-/*
+- * Change to dir specified by fd or p->fts_accpath without getting
+- * tricked by someone changing the world out from underneath us.
+- * Assumes p->fts_dev and p->fts_ino are filled in.
+- */
+-static int
+-fts_safe_changedir(sp, p, fd, path)
+-	FTS *sp;
+-	FTSENT *p;
+-	int fd;
+-	const char *path;
+-{
+-	int ret, oerrno, newfd;
+-	struct stat sb;
+-
+-	newfd = fd;
+-	if (ISSET(FTS_NOCHDIR))
+-		return (0);
+-	if (fd < 0 && (newfd = open(path, O_RDONLY, 0)) < 0)
+-		return (-1);
+-	if (fstat(newfd, &sb)) {
+-		ret = -1;
+-		goto bail;
+-	}
+-	if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) {
+-		errno = ENOENT;		/* disinformation */
+-		ret = -1;
+-		goto bail;
+-	}
+-	ret = fchdir(newfd);
+-bail:
+-	oerrno = errno;
+-	if (fd < 0)
+-		(void)close(newfd);
+-	errno = oerrno;
+-	return (ret);
+-}
+diff --git a/lib/fts.h b/lib/fts.h
+deleted file mode 100644
+index 58846b9..0000000
+--- a/lib/fts.h
++++ /dev/null
+@@ -1,131 +0,0 @@
+-/*
+- * Copyright (c) 1989, 1993
+- *	The Regents of the University of California.  All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 4. Neither the name of the University nor the names of its contributors
+- *    may be used to endorse or promote products derived from this software
+- *    without specific prior written permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+- * SUCH DAMAGE.
+- *
+- *	@(#)fts.h	8.3 (Berkeley) 8/14/94
+- */
+-
+-#ifndef	_FTS_H
+-#define	_FTS_H 1
+-
+-#include <features.h>
+-#include <sys/types.h>
+-
+-typedef struct {
+-	struct _ftsent *fts_cur;	/* current node */
+-	struct _ftsent *fts_child;	/* linked list of children */
+-	struct _ftsent **fts_array;	/* sort array */
+-	dev_t fts_dev;			/* starting device # */
+-	char *fts_path;			/* path for this descent */
+-	int fts_rfd;			/* fd for root */
+-	int fts_pathlen;		/* sizeof(path) */
+-	int fts_nitems;			/* elements in the sort array */
+-	int (*fts_compar) (const void *, const void *); /* compare fn */
+-
+-#define	FTS_COMFOLLOW	0x0001		/* follow command line symlinks */
+-#define	FTS_LOGICAL	0x0002		/* logical walk */
+-#define	FTS_NOCHDIR	0x0004		/* don't change directories */
+-#define	FTS_NOSTAT	0x0008		/* don't get stat info */
+-#define	FTS_PHYSICAL	0x0010		/* physical walk */
+-#define	FTS_SEEDOT	0x0020		/* return dot and dot-dot */
+-#define	FTS_XDEV	0x0040		/* don't cross devices */
+-#define FTS_WHITEOUT	0x0080		/* return whiteout information */
+-#define	FTS_OPTIONMASK	0x00ff		/* valid user option mask */
+-
+-#define	FTS_NAMEONLY	0x0100		/* (private) child names only */
+-#define	FTS_STOP	0x0200		/* (private) unrecoverable error */
+-	int fts_options;		/* fts_open options, global flags */
+-} FTS;
+-
+-typedef struct _ftsent {
+-	struct _ftsent *fts_cycle;	/* cycle node */
+-	struct _ftsent *fts_parent;	/* parent directory */
+-	struct _ftsent *fts_link;	/* next file in directory */
+-	long fts_number;	        /* local numeric value */
+-	void *fts_pointer;	        /* local address value */
+-	char *fts_accpath;		/* access path */
+-	char *fts_path;			/* root path */
+-	int fts_errno;			/* errno for this node */
+-	int fts_symfd;			/* fd for symlink */
+-	u_short fts_pathlen;		/* strlen(fts_path) */
+-	u_short fts_namelen;		/* strlen(fts_name) */
+-
+-	ino_t fts_ino;			/* inode */
+-	dev_t fts_dev;			/* device */
+-	nlink_t fts_nlink;		/* link count */
+-
+-#define	FTS_ROOTPARENTLEVEL	-1
+-#define	FTS_ROOTLEVEL		 0
+-	short fts_level;		/* depth (-1 to N) */
+-
+-#define	FTS_D		 1		/* preorder directory */
+-#define	FTS_DC		 2		/* directory that causes cycles */
+-#define	FTS_DEFAULT	 3		/* none of the above */
+-#define	FTS_DNR		 4		/* unreadable directory */
+-#define	FTS_DOT		 5		/* dot or dot-dot */
+-#define	FTS_DP		 6		/* postorder directory */
+-#define	FTS_ERR		 7		/* error; errno is set */
+-#define	FTS_F		 8		/* regular file */
+-#define	FTS_INIT	 9		/* initialized only */
+-#define	FTS_NS		10		/* stat(2) failed */
+-#define	FTS_NSOK	11		/* no stat(2) requested */
+-#define	FTS_SL		12		/* symbolic link */
+-#define	FTS_SLNONE	13		/* symbolic link without target */
+-#define FTS_W		14		/* whiteout object */
+-	u_short fts_info;		/* user flags for FTSENT structure */
+-
+-#define	FTS_DONTCHDIR	 0x01		/* don't chdir .. to the parent */
+-#define	FTS_SYMFOLLOW	 0x02		/* followed a symlink to get here */
+-	u_short fts_flags;		/* private flags for FTSENT structure */
+-
+-#define	FTS_AGAIN	 1		/* read node again */
+-#define	FTS_FOLLOW	 2		/* follow symbolic link */
+-#define	FTS_NOINSTR	 3		/* no instructions */
+-#define	FTS_SKIP	 4		/* discard node */
+-	u_short fts_instr;		/* fts_set() instructions */
+-
+-	struct stat *fts_statp;		/* stat(2) information */
+-	char fts_name[1];		/* file name */
+-} FTSENT;
+-
+-__BEGIN_DECLS
+-
+-#define fts_children pax_fts_children
+-#define fts_close pax_fts_close
+-#define fts_open pax_fts_open
+-#define fts_read pax_fts_read
+-#define fts_set pax_fts_set
+-
+-FTSENT	*fts_children (FTS *, int);
+-int	 fts_close (FTS *);
+-FTS	*fts_open (char * const *, int,
+-		   int (*)(const FTSENT **, const FTSENT **));
+-FTSENT	*fts_read (FTS *);
+-int	 fts_set (FTS *, FTSENT *, int) __THROW;
+-__END_DECLS
+-
+-#endif /* fts.h */
+diff --git a/lib/vis.h b/lib/vis.h
+index d34d342..71fa5f4 100644
+--- a/lib/vis.h
++++ b/lib/vis.h
+@@ -73,14 +73,19 @@
+  */
+ #define	UNVIS_END	1	/* no more characters */
+ 
+-#include <sys/cdefs.h>
++#ifndef __P
++#define __P(x) x
++#endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ char	*vis __P((char *, int, int, int));
+ int	strvis __P((char *, const char *, int));
+ int	strvisx __P((char *, const char *, size_t, int));
+ int	strunvis __P((char *, const char *));
+ int	unvis __P((char *, char, int *, int));
+-__END_DECLS
+-
++#ifdef __cplusplus
++}
++#endif
+ #endif /* !_VIS_H_ */
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 5ef52a3..227cdef 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -22,4 +22,4 @@ pax_SOURCES = ar_io.c ar_subs.c buf_subs.c cache.c cpio.c\
+ 	file_subs.c ftree.c gen_subs.c getoldopt.c options.c\
+ 	pat_rep.c pax.c sel_subs.c tables.c tar.c tty_subs.c
+ 
+-pax_LDADD = $(top_builddir)/lib/libbsdfunc.a
++pax_LDADD = $(top_builddir)/lib/libbsdfunc.a -lfts
+diff --git a/src/extern.h b/src/extern.h
+index 361fa81..3ed365d 100644
+--- a/src/extern.h
++++ b/src/extern.h
+@@ -37,8 +37,6 @@
+  * External references from each source file
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ /*
+  * ar_io.c
+  */
+diff --git a/src/file_subs.c b/src/file_subs.c
+index 5590ff1..15bc339 100644
+--- a/src/file_subs.c
++++ b/src/file_subs.c
+@@ -52,7 +52,7 @@
+ #include "extern.h"
+ 
+ static int
+-mk_link __P((register char *,register struct stat *,register char *, int));
++mk_link (register char *,register struct stat *,register char *, int);
+ 
+ /*
+  * routines that deal with file operations such as: creating, removing;
+diff --git a/src/tables.c b/src/tables.c
+index 2275bf7..8fddca4 100644
+--- a/src/tables.c
++++ b/src/tables.c
+@@ -39,7 +39,7 @@
+ #include <sys/time.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+-#include <sys/fcntl.h>
++#include <fcntl.h>
+ #include <stdio.h>
+ #include <string.h>
+ #include <unistd.h>
+-- 
+2.6.4
+
diff --git a/meta/recipes-extended/pax/pax/0001-use-strtoll-instead-of-strtoq.patch b/meta/recipes-extended/pax/pax/0001-use-strtoll-instead-of-strtoq.patch
new file mode 100644
index 0000000..58ac9ce
--- /dev/null
+++ b/meta/recipes-extended/pax/pax/0001-use-strtoll-instead-of-strtoq.patch
@@ -0,0 +1,33 @@
+From b1f50320332c9c90fa33ab136ef0ec2d12cda461 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 6 Jan 2016 12:30:52 -0800
+Subject: [PATCH] use strtoll instead of strtoq
+
+Use LLONG_MAX instead of LONG_LONG_MAX
+LONG_LONG_MAX is GNU specific
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ src/options.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/options.c b/src/options.c
+index da8b4cf..c663b4e 100644
+--- a/src/options.c
++++ b/src/options.c
+@@ -1547,8 +1547,8 @@ str_offt (char *val)
+ 
+ #if (SIZEOF_LONG == 4 && SIZEOF_OFF_T == 8) \
+     || (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64)
+-  num = strtoq (val, &expr, 0);
+-  if ((num == LONG_LONG_MAX) || (num <= 0) || (expr == val))
++  num = strtoll (val, &expr, 0);
++  if ((num == LLONG_MAX) || (num <= 0) || (expr == val))
+ #else
+   num = strtol (val, &expr, 0);
+   if ((num == LONG_MAX) || (num <= 0) || (expr == val))
+-- 
+2.6.4
+
diff --git a/meta/recipes-extended/pax/pax_3.4.bb b/meta/recipes-extended/pax/pax_3.4.bb
index ad04871..cee52e3 100644
--- a/meta/recipes-extended/pax/pax_3.4.bb
+++ b/meta/recipes-extended/pax/pax_3.4.bb
@@ -12,11 +12,21 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=4b0b674dfdc56daa3832d4069b820ea0 \
 SECTION = "base"
 PR = "r2"
 
+DEPENDS_append_libc-musl = " fts "
+
 SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/${BPN}/${BP}.tar.bz2/fbd9023b590b45ac3ade95870702a0d6/${BP}.tar.bz2 \
 	file://fix_for_compile_with_gcc-4.6.0.patch \
 	file://pax-3.4_fix_for_x32.patch"
 
+SRC_URI_append_libc-musl = " file://0001-Fix-build-with-musl.patch \
+                             file://0001-use-strtoll-instead-of-strtoq.patch \
+                           "
+
 SRC_URI[md5sum] = "fbd9023b590b45ac3ade95870702a0d6"
 SRC_URI[sha256sum] = "ac3c06048e02828077cf7757d3d142241429238893b91d529af29a2e8cc5623b"
 
+# see https://lists.yoctoproject.org/pipermail/poky/2013-December/009435.html
+# We should ideally drop ac_cv_sizeof_off_t from site files but until then
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', 'ac_cv_sizeof_off_t=8', '', d)}"
+
 inherit autotools
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 38/73] iputils: Use member based initialization for mrghdr struct
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (36 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 37/73] pax: Fix build with musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 39/73] libuser: Fix build when secure getenv is not there Khem Raj
                   ` (35 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Fix build with musl

uclibc and glibc dont agree on structure of the struct, musl rightly
adds padding elements, so when doing anonymous initialization struct
elements gets wrongly mapped on 64bit arches

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../files/0001-Fix-header-inclusion-for-musl.patch | 92 ++++++++++++++++++++++
 .../0001-Intialize-struct-elements-by-name.patch   | 52 ++++++++++++
 meta/recipes-extended/iputils/iputils_s20151218.bb |  2 +
 3 files changed, 146 insertions(+)
 create mode 100644 meta/recipes-extended/iputils/files/0001-Fix-header-inclusion-for-musl.patch
 create mode 100644 meta/recipes-extended/iputils/files/0001-Intialize-struct-elements-by-name.patch

diff --git a/meta/recipes-extended/iputils/files/0001-Fix-header-inclusion-for-musl.patch b/meta/recipes-extended/iputils/files/0001-Fix-header-inclusion-for-musl.patch
new file mode 100644
index 0000000..20ef07e
--- /dev/null
+++ b/meta/recipes-extended/iputils/files/0001-Fix-header-inclusion-for-musl.patch
@@ -0,0 +1,92 @@
+From be0bb81d72fea4d20da74f4f2236aa145684f332 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 6 Jan 2016 14:14:22 -0800
+Subject: [PATCH] Fix header inclusion for musl
+
+Fix errors e.g.
+
+In file included from tracepath.c:17:0:
+/usr/include/linux/errqueue.h:33:18:
+error: array type has incomplete element type 'struct timespec'
+  struct timespec ts[3];
+                  ^
+tracepath.c: In function 'main':
+tracepath.c:329:16: error: 'INT_MAX' undeclared (first use in this
+function)
+      overhead, INT_MAX);
+                ^
+tracepath.c:329:16: note: each undeclared identifier is reported only
+once for each function it appears in
+Makefile:131: recipe for target 'tracepath.o' failed
+make: *** [tracepath.o] Error 1
+
+ping_common.c: In function 'main_loop':
+ping_common.c:756:15: error: 'HZ' undeclared (first use in this
+function)
+    if (1000 % HZ == 0 ? next <= 1000 / HZ : (next < INT_MAX / HZ &&
+next * HZ <= 1000)) {
+
+protocols/timed.h is not needed and is absent in musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ clockdiff.c   | 1 -
+ ping_common.c | 1 +
+ tracepath.c   | 2 ++
+ tracepath6.c  | 1 +
+ 4 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/clockdiff.c b/clockdiff.c
+index 7c1ea1b..1d6341e 100644
+--- a/clockdiff.c
++++ b/clockdiff.c
+@@ -14,7 +14,6 @@
+ #include <netinet/ip.h>
+ #include <netinet/ip_icmp.h>
+ #define TSPTYPES
+-#include <protocols/timed.h>
+ #include <fcntl.h>
+ #include <netdb.h>
+ #include <arpa/inet.h>
+diff --git a/ping_common.c b/ping_common.c
+index 7f82851..3ce699d 100644
+--- a/ping_common.c
++++ b/ping_common.c
+@@ -2,6 +2,7 @@
+ #include <ctype.h>
+ #include <sched.h>
+ #include <math.h>
++#include <asm-generic/param.h>
+ 
+ int options;
+ 
+diff --git a/tracepath.c b/tracepath.c
+index 89e6d16..c9d6ddd 100644
+--- a/tracepath.c
++++ b/tracepath.c
+@@ -12,6 +12,8 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#include <limits.h>
++#include <time.h>
+ #include <sys/socket.h>
+ #include <linux/types.h>
+ #include <linux/errqueue.h>
+diff --git a/tracepath6.c b/tracepath6.c
+index 126fadf..9d5745c 100644
+--- a/tracepath6.c
++++ b/tracepath6.c
+@@ -12,6 +12,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#include <limits.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netinet/icmp6.h>
+-- 
+2.6.4
+
diff --git a/meta/recipes-extended/iputils/files/0001-Intialize-struct-elements-by-name.patch b/meta/recipes-extended/iputils/files/0001-Intialize-struct-elements-by-name.patch
new file mode 100644
index 0000000..6da01dc
--- /dev/null
+++ b/meta/recipes-extended/iputils/files/0001-Intialize-struct-elements-by-name.patch
@@ -0,0 +1,52 @@
+From 000629f74908a2a95f6104444c77ad93cf40d62d Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jan 2016 08:50:50 +0000
+Subject: [PATCH] Intialize struct elements by name
+
+makes it portable across glibc and musl
+
+Fixes errors
+
+| ping.c: In function 'send_probe':
+| ping.c:735:19: warning: initialization makes integer from pointer
+without a cast [-Wint-conversion]
+|           &iov, 1, &cmsg, 0, 0 };
+|                    ^
+| ping.c:735:19: note: (near initialization for 'm.__pad1')
+| ping.c:735:19: error: initializer element is not computable at load
+time
+| ping.c:735:19: note: (near initialization for 'm.__pad1')
+| make: *** [ping.o] Error 1
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ ping.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/ping.c b/ping.c
+index 4989760..e67f381 100644
+--- a/ping.c
++++ b/ping.c
+@@ -731,8 +731,15 @@ int send_probe()
+ 
+ 	do {
+ 		static struct iovec iov = {outpack, 0};
+-		static struct msghdr m = { &whereto, sizeof(whereto),
+-						   &iov, 1, &cmsg, 0, 0 };
++		static struct msghdr m = {
++			.msg_name = &whereto,
++			.msg_namelen = sizeof(whereto),
++			.msg_iov = &iov,
++			.msg_iovlen = 1,
++			.msg_control = &cmsg,
++			.msg_controllen = 0,
++			.msg_flags= 0,
++		};
+ 		m.msg_controllen = cmsg_len;
+ 		iov.iov_len = cc;
+ 
+-- 
+2.7.0
+
diff --git a/meta/recipes-extended/iputils/iputils_s20151218.bb b/meta/recipes-extended/iputils/iputils_s20151218.bb
index 4c3523d..62c3c81 100644
--- a/meta/recipes-extended/iputils/iputils_s20151218.bb
+++ b/meta/recipes-extended/iputils/iputils_s20151218.bb
@@ -18,6 +18,8 @@ SRC_URI = "http://www.skbuff.net/iputils/${BPN}-${PV}.tar.bz2 \
            file://debian/use_gethostbyname2.diff \
            file://debian/targets.diff \
            file://nsgmls-path-fix.patch \
+           file://0001-Fix-header-inclusion-for-musl.patch \
+           file://0001-Intialize-struct-elements-by-name.patch \
           "
 
 SRC_URI[md5sum] = "8aaa7395f27dff9f57ae016d4bc753ce"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 39/73] libuser: Fix build when secure getenv is not there
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (37 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 38/73] iputils: Use member based initialization for mrghdr struct Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 40/73] iproute2: Fix build with musl Khem Raj
                   ` (34 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Fixes build on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../libuser/libuser/0001-Check-for-issetugid.patch | 62 ++++++++++++++++++++++
 .../libuser/0002-remove-unused-execinfo.h.patch    | 27 ++++++++++
 meta/recipes-extended/libuser/libuser_0.62.bb      |  4 +-
 3 files changed, 92 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch
 create mode 100644 meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch

diff --git a/meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch b/meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch
new file mode 100644
index 0000000..79756b9
--- /dev/null
+++ b/meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch
@@ -0,0 +1,62 @@
+From d0537cb7f2dc5877700ad78dfd191515379d4edc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 7 Jan 2016 02:22:51 +0000
+Subject: [PATCH 1/2] Check for issetugid()
+
+If secure version of getenv is not there then we can use
+issetugid() as aid to call getenv()
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ configure.ac |  1 +
+ lib/config.c | 12 +++++++++++-
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 1ded1a2..ee19e1f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -125,6 +125,7 @@ AC_TYPE_OFF_T
+ AC_TYPE_SIZE_T
+ 
+ AC_CHECK_FUNCS([__secure_getenv secure_getenv])
++AC_CHECK_FUNCS([issetugid])
+ 
+ # Modify CFLAGS after all tests are run (some of them could fail because
+ # of the -Werror).
+diff --git a/lib/config.c b/lib/config.c
+index 29e7120..30f9daf 100644
+--- a/lib/config.c
++++ b/lib/config.c
+@@ -44,8 +44,10 @@
+ #  define safe_getenv(string) secure_getenv(string)
+ #elif defined(HAVE___SECURE_GETENV)
+ #  define safe_getenv(string) __secure_getenv(string)
++#elif defined(HAVE_ISSETUGID)
++#  define safe_getenv(string) safe_getenv_issetugid(string)
+ #else
+-#  error Neither secure_getenv not __secure_getenv are available
++#  error None of secure_getenv, __secure_getenv, or issetugid is available
+ #endif
+ 
+ struct config_config {
+@@ -59,6 +61,14 @@ struct config_key {
+ 	GList *values;
+ };
+ 
++static const char*
++safe_getenv_issetugid(const char* name)
++{
++	if (issetugid ())
++		return 0;
++	return getenv (name);
++}
++
+ /* Compare two section names */
+ static int
+ compare_section_names(gconstpointer a, gconstpointer b)
+-- 
+2.7.0
+
diff --git a/meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch b/meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch
new file mode 100644
index 0000000..4bc0219
--- /dev/null
+++ b/meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch
@@ -0,0 +1,27 @@
+From 4b2f81f307ffeac12956e5c16e894e5ebb937ea5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 7 Jan 2016 02:26:00 +0000
+Subject: [PATCH 2/2] remove unused execinfo.h
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ lib/error.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/lib/error.c b/lib/error.c
+index a5ec30a..443e601 100644
+--- a/lib/error.c
++++ b/lib/error.c
+@@ -18,7 +18,6 @@
+ #include <config.h>
+ #include <sys/types.h>
+ #include <errno.h>
+-#include <execinfo.h>
+ #include <libintl.h>
+ #include <stdarg.h>
+ #include <stdlib.h>
+-- 
+2.7.0
+
diff --git a/meta/recipes-extended/libuser/libuser_0.62.bb b/meta/recipes-extended/libuser/libuser_0.62.bb
index 4caa8a1..2d5bd35 100644
--- a/meta/recipes-extended/libuser/libuser_0.62.bb
+++ b/meta/recipes-extended/libuser/libuser_0.62.bb
@@ -12,7 +12,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \
 SECTION = "base"
 
 SRC_URI = "https://fedorahosted.org/releases/l/i/libuser/libuser-${PV}.tar.xz \
-           "
+           file://0001-Check-for-issetugid.patch \
+           file://0002-remove-unused-execinfo.h.patch \
+          "
 
 SRC_URI[md5sum] = "63e5e5c551e99dc5302b40b80bd6d4f2"
 SRC_URI[sha256sum] = "a58ff4fabb01a25043b142185a33eeea961109dd60d4b40b6a9df4fa3cace20b"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 00/73] musl fixes part 3 & 4 combined
@ 2016-01-17 11:36 Khem Raj
  2016-01-17 11:35 ` [PATCH 01/73] powertop: Include right headers for timval struct Khem Raj
                   ` (73 more replies)
  0 siblings, 74 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core


This patchset rebases the last pull request on top of latest master
since lot of recipes went in and the patches wont apply straight

core-image-weston/core-image-sato/core-image-full-cmdline build for
all qemu machines work well.

No regressions seen on glibc based world builds

Here are some of world build results for qemu (musl)

http://errors.yoctoproject.org/Errors/Build/11636/
http://errors.yoctoproject.org/Errors/Build/11637/
http://errors.yoctoproject.org/Errors/Build/11638/

more to follow as the run finishes

One patch is for upgrading uclibc to 1.0.11

The following changes since commit b3b679d5be86f73d1a06c7230cb00872f0a407b5:

  openssh: update to 7.1p2 (2016-01-15 15:44:51 +0000)

are available in the git repository at:

  git://github.com/kraj/openembedded-core kraj/musl-fixes
  https://github.com/kraj/openembedded-core/tree/kraj/musl-fixes

Khem Raj (72):
  powertop: Include right headers for timval struct
  blktrace: Include <sys/types.h for dev_t
  ppp: Fix build with musl
  tcp-wrappers: Fix build with musl
  fts: Add recipe
  connman: include config.h for HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR
  libcgroup: Add dependency on fts when building on musl
  linux-libc-headers: Port patches for linux-headers for musl
  xserver-xorg: Fix build with musl
  gdk-pixbuf: Fix latent build  issue exposed by musl
  argp-standalone: Add recipe
  gnutls: Link with libargp on musl and depend on argp-standalone
  util-linux: Fix ptest builds on musl
  elfutils: Fix build with uclibc/musl
  systemd: Update and fix build with uclibc
  packagegroup-self-hosted.bb: Move glibc-gconv-ibm850 to glibc only
    case
  guile: Fix build with uclibc
  gnutls: Link with libuargp on uclibc
  mtools: Fix build with uclibc
  parted: Fix build with uclibc
  net-tools: Link with libintl on uclibc
  libdrm: Upgrade 2.4.65 -> 2.4.66
  directfb: Fix build with musl
  gzip: Fix build with musl
  watchdog: Fix build with musl
  xinetd: Fix build with musl
  dpkg: Add musleabi to known architectures
  puzzles: Zero'ise structs before use
  apt: Add support for building for musl targets
  libunwind: backtrace APIs are glibc specific
  babeltrace: Add missing header for MAXNAMLEN define
  sysklogd: untangle header inclusion maze
  console-tools: Include sys/types.h for u_char and u_short defs
  webkitgtk: Fix build with clang/musl
  rt-tests: Fix build with non-gcc compilers
  tar: Fix build for musl based targets
  pax: Fix build with musl
  iputils: Use member based initialization for mrghdr struct
  libuser: Fix build when secure getenv is not there
  iproute2: Fix build with musl
  irda-utils: Fix header inclusions
  nspr: Drop older glibc code
  chkconfig: Avoid using caddr_t
  tcf-agent: Implement canonicalize_file_name() for musl as well
  bsd-headers,musl: Add recipe for bsd missing features
  nfs-utils: Disable tcp-wrappers for musl
  portmap: Point to tirpc headers and libraries on musl
  systemd: Skip parsing on musl based targets
  libsolv: Update to 0.6.17+
  db: Use cross libtool
  kexec-tools: Define _GNU_SOURCE for getting loff_t definition
  pcmciautils: Fix parallel build and include sys/types.h
  btrfs-tools: Disable backtrace on musl
  apmd: Fix build with musl
  nss: Undefine HAVE_SYS_CDEFS_H
  dosfstools: Correct cross-compile CFLAGS and fix build with musl
  fts: Fix linker hash-style option
  musl: Create ld.so as a relative symlink
  bsd-headers: Package cdefs.h
  guile: Fix build with musl
  unfs3: Depend on libtirpc when building on musl
  uclibc: Update to 1.0.11
  acpid: Fix build on musl
  grub: Backport fix for largefile detection/use
  console-tools: Fix header inclusion when not using glibc
  gpgme: Define __error_t_defined on musl
  mdadm: Fix build with musl
  eglinfo: Fix build on raspberrypi
  puzzles: Silence warning on arm with clang
  binutils: Fix gold linking errors due to unresolved R_ARM_MOVW_ABS_NC
  syslinux: Set LD to avoid using build host ld
  glib-2.0: Fix locale location on musl

Ross Burton (1):
  oprofile: fix build with musl

 meta/recipes-bsp/acpid/acpid.inc                   |    2 +
 ...1-Define-isfdtype-if-libc-doesn-t-have-it.patch |   62 +
 ...-config.h-from-builddir-instead-of-srcdir.patch |   51 +
 meta/recipes-bsp/apmd/apmd/wexitcode.patch         |   26 +
 meta/recipes-bsp/apmd/apmd_3.2.2-15.bb             |    1 +
 ...ct-_llseek-code-and-require-long-filesyst.patch |   80 +
 meta/recipes-bsp/grub/grub-efi_2.00.bb             |    2 +
 ...-mfpmath-sse-as-well-when-SSE-is-disabled.patch |   46 +
 ...1-grub.d-10_linux.in-add-oe-s-kernel-name.patch |   56 +
 meta/recipes-bsp/grub/grub2.inc                    |    1 +
 meta/recipes-bsp/grub/grub_2.00.bb                 |    2 +
 meta/recipes-bsp/grub/grub_git.bb                  |   13 +-
 .../0001-fix-a-parallel-building-issue.patch       |   18 +-
 .../pcmciautils-018/lex_sys_types.patch            |   21 +
 meta/recipes-bsp/pcmciautils/pcmciautils_018.bb    |    1 +
 .../0003-Fix-header-inclusions-for-musl.patch      |   79 +-
 .../iproute2/iproute2/iproute2-4.3.0-musl.patch    |   97 +
 .../iproute2/iproute2_4.3.0.bb                     |    1 +
 .../irda-utils/irda-utils-0.9.18/musl.patch        |   29 +
 .../irda-utils/irda-utils_0.9.18.bb                |    1 +
 .../nfs-utils/nfs-utils_1.3.3.bb                   |    1 +
 meta/recipes-connectivity/portmap/portmap_6.0.bb   |    4 +
 .../ppp/ppp/0001-Fix-build-with-musl.patch         |  163 +
 meta/recipes-connectivity/ppp/ppp_2.4.7.bb         |    3 +
 meta/recipes-core/bsd-headers/bsd-headers.bb       |   27 +
 .../bsd-headers/bsd-headers/sys-cdefs.h            |   26 +
 .../bsd-headers/bsd-headers/sys-queue.h            |  846 +++
 .../bsd-headers/bsd-headers/sys-tree.h             |  761 +++
 .../0001-Cover-the-else-with-__GLIBC__.patch       |   51 +
 ...clude-sys-types.h-for-u_char-and-u_short-.patch |   44 +
 .../console-tools/console-tools_0.3.2.bb           |    4 +
 meta/recipes-core/fts/fts.bb                       |   45 +
 .../fts/fts/fts-header-correctness.patch           |   25 +
 meta/recipes-core/fts/fts/fts-uclibc.patch         |   50 +
 meta/recipes-core/fts/fts/gcc5.patch               | 1368 +++++
 meta/recipes-core/fts/fts/remove_cdefs.patch       |   69 +
 meta/recipes-core/fts/fts/stdint.patch             |   15 +
 ...{uclibc.patch => uclibc_musl_translation.patch} |   20 +-
 meta/recipes-core/glib-2.0/glib-2.0_2.46.1.bb      |    2 +-
 meta/recipes-core/glib-2.0/glib.inc                |    4 +
 .../libcgroup/libcgroup/musl-decls-compat.patch    |  235 +
 meta/recipes-core/libcgroup/libcgroup_0.41.bb      |    4 +
 ...dynamic-linker-a-relative-symlink-to-libc.patch |   34 +
 meta/recipes-core/musl/musl_git.bb                 |    4 +-
 .../packagegroups/packagegroup-self-hosted.bb      |    2 +-
 .../systemd/0001-define-exp10-if-missing.patch     |    4 +-
 ...r-getty-to-agetty-in-console-setup-system.patch |    4 +-
 ...pper-instead-of-looking-for-relative-opti.patch |   61 +
 ...v-when-secure-versions-are-not-available.patch} |   21 +-
 ...c-Change-the-default-device-timeout-to-2.patch} |    4 +-
 ...-install-dependency-links-at-install-tim.patch} |    6 +-
 ...eck-for-additional-features-that-uclibc-.patch} |   12 +-
 ...n-Use-execvpe-only-when-libc-supports-it.patch} |    4 +-
 ...unimplemented-_SC_PHYS_PAGES-system-conf.patch} |    4 +-
 ...010-implment-systemd-sysv-install-for-OE.patch} |    4 +-
 ...es-Build-conditionally-when-HAVE_MYHOSTN.patch} |    6 +-
 ...patch => 0012-rules-whitelist-hd-devices.patch} |    4 +-
 ...or-add-support-for-executing-scripts-und.patch} |    4 +-
 ...-Make-root-s-home-directory-configurable.patch} |   14 +-
 ...015-systemd-user-avoid-using-system-auth.patch} |    4 +-
 ...vert-rules-remove-firmware-loading-rules.patch} |    4 +-
 ...remove-userspace-firmware-loading-suppor.patch} |   16 +-
 ...sing.h-for-getting-secure_getenv-definiti.patch |   25 +
 ...il-don-t-fail-if-libc-doesn-t-support-IDN.patch |   34 +
 meta/recipes-core/systemd/systemd_228.bb           |   50 +-
 meta/recipes-core/uclibc/uclibc-git.inc            |    5 +-
 .../uclibc-git/0003-Add-argp-implementation.patch  | 5811 --------------------
 .../util-linux/uuid-test-error-api.patch           |   92 +
 meta/recipes-core/util-linux/util-linux_2.27.1.bb  |    1 +
 meta/recipes-devtools/apt/apt.inc                  |    1 +
 ....mak-musl-based-systems-can-generate-shar.patch |   29 +
 meta/recipes-devtools/apt/apt_1.0.10.1.bb          |    3 +-
 meta/recipes-devtools/binutils/binutils-2.25.1.inc |    1 +
 ...h-adds-IFUNC-support-for-arm-gold-backend.patch | 1004 ++++
 ...001-btrfs-corrupt-blocks-Include-limits.h.patch |   34 +
 .../btrfs-tools/btrfs-tools_4.3.1.bb               |    3 +
 .../0001-mkfs.fat-fix-incorrect-int-type.patch     |   46 +
 .../dosfstools/dosfstools/largefile.patch          |   19 +
 .../dosfstools/dosfstools_3.0.28.bb                |    7 +-
 ...0006-add-musleabi-to-known-target-tripets.patch |   42 +
 meta/recipes-devtools/dpkg/dpkg_1.18.2.bb          |    3 +-
 ...de-alternatives-for-glibc-assumptions-hel.patch | 1161 ++++
 .../elfutils/elfutils-0.164/aarch64_uio.patch      |   47 +
 .../elfutils/elfutils-0.164/shadow.patch           |   23 +
 .../elfutils/elfutils-0.164/uclibc-support.patch   |  129 +
 .../elfutils/elfutils/mempcpy.patch                |   24 -
 meta/recipes-devtools/elfutils/elfutils_0.148.bb   |    1 -
 meta/recipes-devtools/elfutils/elfutils_0.164.bb   |   13 +-
 ...guile-Check-for-strtol_l-during-configure.patch |   56 +
 .../guile/files/remove_strcase_l_funcs.patch       |   38 +
 meta/recipes-devtools/guile/guile_2.0.11.bb        |   13 +
 meta/recipes-devtools/mtools/mtools_4.0.18.bb      |    3 +
 meta/recipes-devtools/syslinux/syslinux_6.03.bb    |    4 +-
 ...nonicalize_file_name-is-specific-to-glibc.patch |   46 +
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb   |    1 +
 meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb   |    8 +-
 .../chkconfig/chkconfig/replace_caddr_t.patch      |   33 +
 .../recipes-extended/chkconfig/chkconfig_1.3.58.bb |    4 +-
 meta/recipes-extended/gzip/gzip.inc                |    7 +
 .../files/0001-Fix-header-inclusion-for-musl.patch |   92 +
 .../0001-Intialize-struct-elements-by-name.patch   |   52 +
 meta/recipes-extended/iputils/iputils_s20151218.bb |    2 +
 meta/recipes-extended/libsolv/libsolv_git.bb       |    4 +-
 .../libuser/libuser/0001-Check-for-issetugid.patch |   62 +
 .../libuser/0002-remove-unused-execinfo.h.patch    |   27 +
 meta/recipes-extended/libuser/libuser_0.62.bb      |    4 +-
 .../0001-Define-_POSIX_C_SOURCE-if-undefined.patch |   59 +
 meta/recipes-extended/mdadm/mdadm_3.3.4.bb         |    2 +-
 .../net-tools/net-tools/musl-fixes.patch           |  100 +
 .../net-tools/net-tools_1.60-26.bb                 |    3 +-
 meta/recipes-extended/parted/parted_3.2.bb         |    3 +-
 .../pax/pax/0001-Fix-build-with-musl.patch         | 1287 +++++
 .../pax/0001-use-strtoll-instead-of-strtoq.patch   |   33 +
 meta/recipes-extended/pax/pax_3.4.bb               |   10 +
 .../sysklogd/files/0001-Fix-build-with-musl.patch  |  132 +
 meta/recipes-extended/sysklogd/sysklogd.inc        |    1 +
 meta/recipes-extended/tar/tar/musl_dirent.patch    |   19 +
 meta/recipes-extended/tar/tar_1.28.bb              |    6 +
 .../tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch |   31 +
 .../tcp-wrappers/tcp-wrappers_7.6.bb               |    4 +
 ...d-issues-found-with-non-glibc-C-libraries.patch |   99 +
 meta/recipes-extended/watchdog/watchdog_5.14.bb    |    8 +-
 ...se-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch |  100 +
 meta/recipes-extended/xinetd/xinetd_2.3.15.bb      |    5 +
 .../gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch      |   63 +
 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb |    1 +
 meta/recipes-graphics/directfb/directfb.inc        |    3 +
 .../directfb/directfb/compar_fn_t.patch            |   62 +
 .../directfb/directfb/union-sigval.patch           |   19 +
 .../directfb/use-PTHREAD_MUTEX_RECURSIVE.patch     |  116 +
 ...tests-kms-steal-crtc-Include-sys-select.h.patch |   33 +
 .../recipes-graphics/drm/libdrm/installtests.patch |   24 +-
 .../drm/{libdrm_2.4.65.bb => libdrm_2.4.66.bb}     |    8 +-
 meta/recipes-graphics/eglinfo/eglinfo.inc          |    4 +-
 ...GING_INCDIR-to-searchpath-for-egl-headers.patch |   34 +
 .../xserver-xorg/musl-arm-inb-outb.patch           |   18 +
 .../xorg-xserver/xserver-xorg_1.18.0.bb            |    4 +-
 ...-include-sys-types.h-for-dev_t-definition.patch |   30 +
 meta/recipes-kernel/blktrace/blktrace_git.bb       |    4 +-
 .../0001-vmcore-dmesg-Define-_GNU_SOURCE.patch     |   31 +
 meta/recipes-kernel/kexec/kexec-tools_2.0.11.bb    |    1 +
 ...mpat.h-fix-some-issues-arising-from-in6.h.patch |   82 +
 ...t.h-prevent-redefinition-of-struct-ethhdr.patch |   59 +
 ...remove-inclusion-of-sysinfo.h-in-kernel.h.patch |   32 +
 .../linux-libc-headers/linux-libc-headers_4.1.bb   |    5 +
 ...Include-sys-param.h-for-MAXNAMLEN-definti.patch |   29 +
 meta/recipes-kernel/lttng/babeltrace_1.3.1.bb      |    5 +-
 meta/recipes-kernel/oprofile/oprofile.inc          |    2 +
 meta/recipes-kernel/oprofile/oprofile/musl.patch   |   46 +
 ...0001-include-rquired-headers-for-typedefs.patch |   47 +
 meta/recipes-kernel/powertop/powertop_2.8.bb       |    4 +-
 ...t-CC-AR-variable-only-if-it-doesn-t-have-.patch |   30 +
 meta/recipes-rt/rt-tests/rt-tests_0.96.bb          |    3 +-
 ...1-palisade-Fix-warnings-with-clang-on-arm.patch |   72 +
 ...mpiler-errors-about-uninitialized-use-of-.patch |   32 +
 meta/recipes-sato/puzzles/puzzles_git.bb           |    2 +
 ...nable-backtrace-on-linux-when-using-glibc.patch |   39 +
 ...x-build-with-non-glibc-libraries-on-linux.patch |   61 +
 meta/recipes-sato/webkit/webkitgtk/clang.patch     |   25 +
 meta/recipes-sato/webkit/webkitgtk_2.10.4.bb       |    3 +
 .../argp-standalone/argp-standalone_1.3.bb         |   28 +
 .../files/0001-throw-in-funcdef.patch              |   84 +
 .../argp-standalone/files/0002-isprint.patch       |   51 +
 meta/recipes-support/db/db_5.3.28.bb               |    1 +
 meta/recipes-support/db/db_6.0.30.bb               |    1 +
 meta/recipes-support/gnutls/gnutls.inc             |    5 +-
 meta/recipes-support/gpgme/gpgme_1.5.4.bb          |    1 +
 ...-backtrace-Use-only-with-glibc-and-uclibc.patch |   45 +
 meta/recipes-support/libunwind/libunwind_1.1.bb    |    1 +
 ...001-Remove-the-check-for-LINUX-glibc-case.patch |   35 +
 meta/recipes-support/nspr/nspr_4.11.bb             |    9 +
 meta/recipes-support/nss/nss_3.19.2.bb             |    4 +
 172 files changed, 10817 insertions(+), 6019 deletions(-)
 create mode 100644 meta/recipes-bsp/acpid/acpid/0001-Define-isfdtype-if-libc-doesn-t-have-it.patch
 create mode 100644 meta/recipes-bsp/acpid/acpid/0001-Use-config.h-from-builddir-instead-of-srcdir.patch
 create mode 100644 meta/recipes-bsp/apmd/apmd/wexitcode.patch
 create mode 100644 meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch
 create mode 100644 meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch
 create mode 100644 meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch
 create mode 100644 meta/recipes-bsp/pcmciautils/pcmciautils-018/lex_sys_types.patch
 create mode 100644 meta/recipes-connectivity/iproute2/iproute2/iproute2-4.3.0-musl.patch
 create mode 100644 meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/musl.patch
 create mode 100644 meta/recipes-connectivity/ppp/ppp/0001-Fix-build-with-musl.patch
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers.bb
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-cdefs.h
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-queue.h
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-tree.h
 create mode 100644 meta/recipes-core/console-tools/console-tools-0.3.2/0001-Cover-the-else-with-__GLIBC__.patch
 create mode 100644 meta/recipes-core/console-tools/console-tools-0.3.2/0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch
 create mode 100644 meta/recipes-core/fts/fts.bb
 create mode 100644 meta/recipes-core/fts/fts/fts-header-correctness.patch
 create mode 100644 meta/recipes-core/fts/fts/fts-uclibc.patch
 create mode 100644 meta/recipes-core/fts/fts/gcc5.patch
 create mode 100644 meta/recipes-core/fts/fts/remove_cdefs.patch
 create mode 100644 meta/recipes-core/fts/fts/stdint.patch
 rename meta/recipes-core/glib-2.0/glib-2.0/{uclibc.patch => uclibc_musl_translation.patch} (51%)
 create mode 100644 meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch
 create mode 100644 meta/recipes-core/musl/files/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
 create mode 100644 meta/recipes-core/systemd/systemd/0003-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch
 rename meta/recipes-core/systemd/systemd/{0003-Use-getenv-when-secure-versions-are-not-available.patch => 0004-Use-getenv-when-secure-versions-are-not-available.patch} (56%)
 rename meta/recipes-core/systemd/systemd/{0004-core-device.c-Change-the-default-device-timeout-to-2.patch => 0005-core-device.c-Change-the-default-device-timeout-to-2.patch} (88%)
 rename meta/recipes-core/systemd/systemd/{0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch => 0006-binfmt-Don-t-install-dependency-links-at-install-tim.patch} (92%)
 rename meta/recipes-core/systemd/systemd/{0006-configure-Check-for-additional-features-that-uclibc-.patch => 0007-configure-Check-for-additional-features-that-uclibc-.patch} (72%)
 rename meta/recipes-core/systemd/systemd/{0007-nspawn-Use-execvpe-only-when-libc-supports-it.patch => 0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch} (89%)
 rename meta/recipes-core/systemd/systemd/{0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch => 0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch} (90%)
 rename meta/recipes-core/systemd/systemd/{0009-implment-systemd-sysv-install-for-OE.patch => 0010-implment-systemd-sysv-install-for-OE.patch} (91%)
 rename meta/recipes-core/systemd/systemd/{0010-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch => 0011-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch} (83%)
 rename meta/recipes-core/systemd/systemd/{0011-rules-whitelist-hd-devices.patch => 0012-rules-whitelist-hd-devices.patch} (91%)
 rename meta/recipes-core/systemd/systemd/{0012-sysv-generator-add-support-for-executing-scripts-und.patch => 0013-sysv-generator-add-support-for-executing-scripts-und.patch} (98%)
 rename meta/recipes-core/systemd/systemd/{0013-Make-root-s-home-directory-configurable.patch => 0014-Make-root-s-home-directory-configurable.patch} (95%)
 rename meta/recipes-core/systemd/systemd/{0014-systemd-user-avoid-using-system-auth.patch => 0015-systemd-user-avoid-using-system-auth.patch} (87%)
 rename meta/recipes-core/systemd/systemd/{0015-Revert-rules-remove-firmware-loading-rules.patch => 0016-Revert-rules-remove-firmware-loading-rules.patch} (84%)
 rename meta/recipes-core/systemd/systemd/{0016-Revert-udev-remove-userspace-firmware-loading-suppor.patch => 0017-Revert-udev-remove-userspace-firmware-loading-suppor.patch} (96%)
 create mode 100644 meta/recipes-core/systemd/systemd/0018-include-missing.h-for-getting-secure_getenv-definiti.patch
 create mode 100644 meta/recipes-core/systemd/systemd/0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch
 delete mode 100644 meta/recipes-core/uclibc/uclibc-git/0003-Add-argp-implementation.patch
 create mode 100644 meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch
 create mode 100644 meta/recipes-devtools/apt/apt/0001-environment.mak-musl-based-systems-can-generate-shar.patch
 create mode 100644 meta/recipes-devtools/binutils/binutils/0016-This-patch-adds-IFUNC-support-for-arm-gold-backend.patch
 create mode 100644 meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-corrupt-blocks-Include-limits.h.patch
 create mode 100644 meta/recipes-devtools/dosfstools/dosfstools/0001-mkfs.fat-fix-incorrect-int-type.patch
 create mode 100644 meta/recipes-devtools/dosfstools/dosfstools/largefile.patch
 create mode 100644 meta/recipes-devtools/dpkg/dpkg/0006-add-musleabi-to-known-target-tripets.patch
 create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
 create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/aarch64_uio.patch
 create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/shadow.patch
 create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/uclibc-support.patch
 delete mode 100644 meta/recipes-devtools/elfutils/elfutils/mempcpy.patch
 create mode 100644 meta/recipes-devtools/guile/files/0001-libguile-Check-for-strtol_l-during-configure.patch
 create mode 100644 meta/recipes-devtools/guile/files/remove_strcase_l_funcs.patch
 create mode 100644 meta/recipes-devtools/tcf-agent/tcf-agent/0001-canonicalize_file_name-is-specific-to-glibc.patch
 create mode 100644 meta/recipes-extended/chkconfig/chkconfig/replace_caddr_t.patch
 create mode 100644 meta/recipes-extended/iputils/files/0001-Fix-header-inclusion-for-musl.patch
 create mode 100644 meta/recipes-extended/iputils/files/0001-Intialize-struct-elements-by-name.patch
 create mode 100644 meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch
 create mode 100644 meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch
 create mode 100644 meta/recipes-extended/mdadm/files/0001-Define-_POSIX_C_SOURCE-if-undefined.patch
 create mode 100644 meta/recipes-extended/net-tools/net-tools/musl-fixes.patch
 create mode 100644 meta/recipes-extended/pax/pax/0001-Fix-build-with-musl.patch
 create mode 100644 meta/recipes-extended/pax/pax/0001-use-strtoll-instead-of-strtoq.patch
 create mode 100644 meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch
 create mode 100644 meta/recipes-extended/tar/tar/musl_dirent.patch
 create mode 100644 meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch
 create mode 100644 meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch
 create mode 100644 meta/recipes-extended/xinetd/xinetd/0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch
 create mode 100644 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch
 create mode 100644 meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
 create mode 100644 meta/recipes-graphics/directfb/directfb/union-sigval.patch
 create mode 100644 meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
 create mode 100644 meta/recipes-graphics/drm/libdrm/0001-tests-kms-steal-crtc-Include-sys-select.h.patch
 rename meta/recipes-graphics/drm/{libdrm_2.4.65.bb => libdrm_2.4.66.bb} (86%)
 create mode 100644 meta/recipes-graphics/eglinfo/files/0001-Add-STAGING_INCDIR-to-searchpath-for-egl-headers.patch
 create mode 100644 meta/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch
 create mode 100644 meta/recipes-kernel/blktrace/blktrace/0001-include-sys-types.h-for-dev_t-definition.patch
 create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0001-vmcore-dmesg-Define-_GNU_SOURCE.patch
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch
 create mode 100644 meta/recipes-kernel/lttng/babeltrace/0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch
 create mode 100644 meta/recipes-kernel/oprofile/oprofile/musl.patch
 create mode 100644 meta/recipes-kernel/powertop/powertop/0001-include-rquired-headers-for-typedefs.patch
 create mode 100644 meta/recipes-rt/rt-tests/files/0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch
 create mode 100644 meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch
 create mode 100644 meta/recipes-sato/puzzles/files/0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/clang.patch
 create mode 100644 meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
 create mode 100644 meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch
 create mode 100644 meta/recipes-support/argp-standalone/files/0002-isprint.patch
 create mode 100644 meta/recipes-support/libunwind/libunwind-1.1/0001-backtrace-Use-only-with-glibc-and-uclibc.patch
 create mode 100644 meta/recipes-support/nspr/nspr/0001-Remove-the-check-for-LINUX-glibc-case.patch

-- 
2.7.0



^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 40/73] iproute2: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (38 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 39/73] libuser: Fix build when secure getenv is not there Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 41/73] irda-utils: Fix header inclusions Khem Raj
                   ` (33 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../iproute2/iproute2/iproute2-4.3.0-musl.patch    | 97 ++++++++++++++++++++++
 .../iproute2/iproute2_4.3.0.bb                     |  1 +
 2 files changed, 98 insertions(+)
 create mode 100644 meta/recipes-connectivity/iproute2/iproute2/iproute2-4.3.0-musl.patch

diff --git a/meta/recipes-connectivity/iproute2/iproute2/iproute2-4.3.0-musl.patch b/meta/recipes-connectivity/iproute2/iproute2/iproute2-4.3.0-musl.patch
new file mode 100644
index 0000000..1b415a5
--- /dev/null
+++ b/meta/recipes-connectivity/iproute2/iproute2/iproute2-4.3.0-musl.patch
@@ -0,0 +1,97 @@
+From 48596709d8ab59727b79a5c6db33ebb251c36543 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Thu, 19 Nov 2015 17:44:25 +0100
+Subject: [PATCH] Avoid in6_addr redefinition
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Due to both <netinet/in.h> and <linux/in6.h> being included, the
+in6_addr is being redefined: once from the C library headers and once
+from the kernel headers. This causes some build failures with for
+example the musl C library:
+
+In file included from ../include/linux/xfrm.h:4:0,
+                 from xfrm.h:29,
+                 from ipxfrm.c:39:
+../include/linux/in6.h:32:8: error: redefinition of ‘struct in6_addr’
+ struct in6_addr {
+        ^
+In file included from .../output/host/usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netdb.h:9:0,
+                 from ipxfrm.c:34:
+.../output/host/usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:24:8: note: originally defined here
+ struct in6_addr
+        ^
+
+In order to fix this, use just the C library header <netinet/in.h>.
+
+Original patch taken from
+http://git.alpinelinux.org/cgit/aports/tree/main/iproute2/musl-fixes.patch.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+Upstream-Status: Pending
+
+ include/libiptc/ipt_kernel_headers.h | 2 --
+ include/linux/if_bridge.h            | 1 -
+ include/linux/netfilter.h            | 2 --
+ include/linux/xfrm.h                 | 1 -
+ 4 files changed, 6 deletions(-)
+
+diff --git a/include/libiptc/ipt_kernel_headers.h b/include/libiptc/ipt_kernel_headers.h
+index 7e87828..9566be5 100644
+--- a/include/libiptc/ipt_kernel_headers.h
++++ b/include/libiptc/ipt_kernel_headers.h
+@@ -15,12 +15,10 @@
+ #else /* libc5 */
+ #include <sys/socket.h>
+ #include <linux/ip.h>
+-#include <linux/in.h>
+ #include <linux/if.h>
+ #include <linux/icmp.h>
+ #include <linux/tcp.h>
+ #include <linux/udp.h>
+ #include <linux/types.h>
+-#include <linux/in6.h>
+ #endif
+ #endif
+diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
+index ee197a3..f823aa4 100644
+--- a/include/linux/if_bridge.h
++++ b/include/linux/if_bridge.h
+@@ -15,7 +15,6 @@
+ 
+ #include <linux/types.h>
+ #include <linux/if_ether.h>
+-#include <linux/in6.h>
+ 
+ #define SYSFS_BRIDGE_ATTR	"bridge"
+ #define SYSFS_BRIDGE_FDB	"brforward"
+diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
+index b71b4c9..3e4e6ae 100644
+--- a/include/linux/netfilter.h
++++ b/include/linux/netfilter.h
+@@ -4,8 +4,6 @@
+ #include <linux/types.h>
+ 
+ #include <linux/sysctl.h>
+-#include <linux/in.h>
+-#include <linux/in6.h>
+ 
+ /* Responses from hook functions. */
+ #define NF_DROP 0
+diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
+index b8f5451..a9761a5 100644
+--- a/include/linux/xfrm.h
++++ b/include/linux/xfrm.h
+@@ -1,7 +1,6 @@
+ #ifndef _LINUX_XFRM_H
+ #define _LINUX_XFRM_H
+ 
+-#include <linux/in6.h>
+ #include <linux/types.h>
+ 
+ /* All of the structures in this file may not change size as they are
+-- 
+2.6.3
+
diff --git a/meta/recipes-connectivity/iproute2/iproute2_4.3.0.bb b/meta/recipes-connectivity/iproute2/iproute2_4.3.0.bb
index 0b3d896..60f0a8d 100644
--- a/meta/recipes-connectivity/iproute2/iproute2_4.3.0.bb
+++ b/meta/recipes-connectivity/iproute2/iproute2_4.3.0.bb
@@ -3,6 +3,7 @@ require iproute2.inc
 SRC_URI = "${KERNELORG_MIRROR}/linux/utils/net/${BPN}/${BP}.tar.xz \
            file://configure-cross.patch \
            file://0001-iproute2-de-bash-scripts.patch \
+           file://iproute2-4.3.0-musl.patch \
           "
 SRC_URI[md5sum] = "1a2bbb80cfc7ab3f3e987e18b3207c2f"
 SRC_URI[sha256sum] = "f03b1188dd6c039512424de82ff7a8f3b446680bd4e908ff42a7b9b137422995"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 41/73] irda-utils: Fix header inclusions
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (39 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 40/73] iproute2: Fix build with musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 42/73] nspr: Drop older glibc code Khem Raj
                   ` (32 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Helps compile with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../irda-utils/irda-utils-0.9.18/musl.patch        | 29 ++++++++++++++++++++++
 .../irda-utils/irda-utils_0.9.18.bb                |  1 +
 2 files changed, 30 insertions(+)
 create mode 100644 meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/musl.patch

diff --git a/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/musl.patch b/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/musl.patch
new file mode 100644
index 0000000..97eb975
--- /dev/null
+++ b/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/musl.patch
@@ -0,0 +1,29 @@
+Replace use of <net/if_packet.h> with <linux/if_packet.h>.
+
+kernel headers <linux/if_packet.h> already provides the
+needed definitions, moreover not all libc implementations
+provide if_packet.h e.g. musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+Index: irda-utils-0.9.18/irdaping/irdaping.c
+===================================================================
+--- irda-utils-0.9.18.orig/irdaping/irdaping.c
++++ irda-utils-0.9.18/irdaping/irdaping.c
+@@ -33,7 +33,6 @@
+ #include <sys/socket.h>
+ #include <sys/ioctl.h>
+ #include <net/if.h>		/* For struct ifreq */
+-#include <net/if_packet.h>	/* For struct sockaddr_pkt */
+ #include <net/if_arp.h>		/* For ARPHRD_IRDA */
+ #include <netinet/if_ether.h>	/* For ETH_P_ALL */
+ #include <netinet/in.h>		/* For htons */
+@@ -46,6 +45,7 @@
+ #include <asm/byteorder.h>	/* __cpu_to_le32 and co. */
+ 
+ #include <linux/types.h>	/* For __u8 and co. */
++#include <linux/if_packet.h>	/* For struct sockaddr_pkt */
+ #include <irda.h>
+ 
+ #ifndef AF_IRDA
diff --git a/meta/recipes-connectivity/irda-utils/irda-utils_0.9.18.bb b/meta/recipes-connectivity/irda-utils/irda-utils_0.9.18.bb
index bd2f815..11b2ee9 100644
--- a/meta/recipes-connectivity/irda-utils/irda-utils_0.9.18.bb
+++ b/meta/recipes-connectivity/irda-utils/irda-utils_0.9.18.bb
@@ -13,6 +13,7 @@ LIC_FILES_CHKSUM = "file://irdadump/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/irda/irda-utils-${PV}.tar.gz \
            file://ldflags.patch \
+           file://musl.patch \
            file://init"
 
 SRC_URI[md5sum] = "84dc12aa4c3f61fccb8d8919bf4079bb"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 42/73] nspr: Drop older glibc code
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (40 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 41/73] irda-utils: Fix header inclusions Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 43/73] chkconfig: Avoid using caddr_t Khem Raj
                   ` (31 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

This was not only getting included for libc5 but also for not-glibc libc
implementations e.g. musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...001-Remove-the-check-for-LINUX-glibc-case.patch | 35 ++++++++++++++++++++++
 meta/recipes-support/nspr/nspr_4.11.bb             |  9 ++++++
 2 files changed, 44 insertions(+)
 create mode 100644 meta/recipes-support/nspr/nspr/0001-Remove-the-check-for-LINUX-glibc-case.patch

diff --git a/meta/recipes-support/nspr/nspr/0001-Remove-the-check-for-LINUX-glibc-case.patch b/meta/recipes-support/nspr/nspr/0001-Remove-the-check-for-LINUX-glibc-case.patch
new file mode 100644
index 0000000..5b17355
--- /dev/null
+++ b/meta/recipes-support/nspr/nspr/0001-Remove-the-check-for-LINUX-glibc-case.patch
@@ -0,0 +1,35 @@
+From 9b9c95e0390395c7e9ad24a882deb87a50846059 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 8 Aug 2015 17:10:34 -0700
+Subject: [PATCH] Remove the check for LINUX == glibc case
+
+Here it does not consider the case where musl can be an options it does
+consider the bionic case with !defined(ANDROID) but musl does not define
+and musl'ism defines like that
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ pr/src/misc/prnetdb.c | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c
+index b86248f..dc83a56 100644
+--- a/pr/src/misc/prnetdb.c
++++ b/pr/src/misc/prnetdb.c
+@@ -61,10 +61,7 @@ PRLock *_pr_dnsLock = NULL;
+ #define _PR_HAVE_GETPROTO_R_POINTER
+ #endif
+ 
+-#if defined(SOLARIS) || (defined(BSDI) && defined(_REENTRANT)) \
+-	|| (defined(LINUX) && defined(_REENTRANT) \
+-        && !(defined(__GLIBC__) && __GLIBC__ >= 2) \
+-        && !defined(ANDROID))
++#if defined(SOLARIS) || (defined(BSDI) && defined(_REENTRANT))
+ #define _PR_HAVE_GETPROTO_R
+ #define _PR_HAVE_GETPROTO_R_POINTER
+ #endif
+-- 
+2.1.4
+
diff --git a/meta/recipes-support/nspr/nspr_4.11.bb b/meta/recipes-support/nspr/nspr_4.11.bb
index 3048641..3dabcb6 100644
--- a/meta/recipes-support/nspr/nspr_4.11.bb
+++ b/meta/recipes-support/nspr/nspr_4.11.bb
@@ -13,6 +13,15 @@ SRC_URI = "http://ftp.mozilla.org/pub/nspr/releases/v${PV}/src/nspr-${PV}.tar.gz
 
 SRC_URI += "file://nspr.pc.in"
 
+CACHED_CONFIGUREVARS_append_libc-musl = " CFLAGS='${CFLAGS} -D_PR_POLL_AVAILABLE \
+                                          -D_PR_HAVE_OFF64_T -D_PR_INET6 -D_PR_HAVE_INET_NTOP \
+                                          -D_PR_HAVE_GETHOSTBYNAME2 -D_PR_HAVE_GETADDRINFO \
+                                          -D_PR_INET6_PROBE'"
+
+SRC_URI_append_libc-musl = "\
+        file://0001-Remove-the-check-for-LINUX-glibc-case.patch \
+        "
+
 UPSTREAM_CHECK_URI = "http://ftp.mozilla.org/pub/nspr/releases/"
 UPSTREAM_CHECK_REGEX = "v(?P<pver>\d+(\.\d+)+)/"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 43/73] chkconfig: Avoid using caddr_t
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (41 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 42/73] nspr: Drop older glibc code Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 44/73] tcf-agent: Implement canonicalize_file_name() for musl as well Khem Raj
                   ` (30 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../chkconfig/chkconfig/replace_caddr_t.patch      | 33 ++++++++++++++++++++++
 .../recipes-extended/chkconfig/chkconfig_1.3.58.bb |  4 ++-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/chkconfig/chkconfig/replace_caddr_t.patch

diff --git a/meta/recipes-extended/chkconfig/chkconfig/replace_caddr_t.patch b/meta/recipes-extended/chkconfig/chkconfig/replace_caddr_t.patch
new file mode 100644
index 0000000..96d1938
--- /dev/null
+++ b/meta/recipes-extended/chkconfig/chkconfig/replace_caddr_t.patch
@@ -0,0 +1,33 @@
+caddr_t is a legacy BSD type which was rejected by the POSIX standard.
+Use void * instead.
+
+sys/unitstd.h is not needed and moreover its not available on all C library
+implementations e.g. musl
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Index: chkconfig-1.3.58/alternatives.c
+===================================================================
+--- chkconfig-1.3.58.orig/alternatives.c
++++ chkconfig-1.3.58/alternatives.c
+@@ -22,7 +22,6 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <sys/stat.h>
+-#include <sys/unistd.h>
+ #include <unistd.h>
+ 
+ #define	FLAGS_TEST	(1 << 0)
+Index: chkconfig-1.3.58/leveldb.c
+===================================================================
+--- chkconfig-1.3.58.orig/leveldb.c
++++ chkconfig-1.3.58/leveldb.c
+@@ -442,7 +442,7 @@ int parseServiceInfo(int fd, char * name
+     fstat(fd, &sb);
+ 
+     bufstart = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
+-    if (bufstart == ((caddr_t) -1)) {
++    if (bufstart == ((void*) -1)) {
+ 	close(fd);
+ 	return -1;
+     }
diff --git a/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb b/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb
index 488847a..e839026 100644
--- a/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb
+++ b/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb
@@ -16,7 +16,9 @@ PROVIDES += "virtual/update-alternatives"
 
 PR = "r7"
 
-SRC_URI = "http://fedorahosted.org/releases/c/h/chkconfig/${BPN}-${PV}.tar.bz2"
+SRC_URI = "http://fedorahosted.org/releases/c/h/chkconfig/${BPN}-${PV}.tar.bz2 \
+           file://replace_caddr_t.patch \
+          "
 
 SRC_URI[md5sum] = "c2039ca67f2749fe0c06ef7c6f8ee246"
 SRC_URI[sha256sum] = "18b497d25b2cada955c72810e45fcad8280d105f17cf45e2970f18271211de68"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 44/73] tcf-agent: Implement canonicalize_file_name() for musl as well
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (42 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 43/73] chkconfig: Avoid using caddr_t Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 45/73] bsd-headers, musl: Add recipe for bsd missing features Khem Raj
                   ` (29 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...nonicalize_file_name-is-specific-to-glibc.patch | 46 ++++++++++++++++++++++
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb   |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 meta/recipes-devtools/tcf-agent/tcf-agent/0001-canonicalize_file_name-is-specific-to-glibc.patch

diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent/0001-canonicalize_file_name-is-specific-to-glibc.patch b/meta/recipes-devtools/tcf-agent/tcf-agent/0001-canonicalize_file_name-is-specific-to-glibc.patch
new file mode 100644
index 0000000..5f93c46
--- /dev/null
+++ b/meta/recipes-devtools/tcf-agent/tcf-agent/0001-canonicalize_file_name-is-specific-to-glibc.patch
@@ -0,0 +1,46 @@
+From 23a3759b74d081b3b2849b0d37a0e5219f37813e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 7 Jan 2016 22:37:48 +0000
+Subject: [PATCH] canonicalize_file_name is specific to glibc
+
+When on Linux and not using glibc then we need to define
+canonicalize_file_name() API, therefore add a check for finding out if
+its not glibc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ agent/tcf/framework/mdep.c | 2 +-
+ agent/tcf/framework/mdep.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/agent/tcf/framework/mdep.c b/agent/tcf/framework/mdep.c
+index 2b52ca8..7d09655 100644
+--- a/agent/tcf/framework/mdep.c
++++ b/agent/tcf/framework/mdep.c
+@@ -1042,7 +1042,7 @@ char * canonicalize_file_name(const char * path) {
+     return strdup(res);
+ }
+ 
+-#elif defined(__UCLIBC__)
++#elif defined(__UCLIBC__) || !defined(__GLIBC__)
+ 
+ char * canonicalize_file_name(const char * path) {
+     return realpath(path, NULL);
+diff --git a/agent/tcf/framework/mdep.h b/agent/tcf/framework/mdep.h
+index 1e718a2..187c399 100644
+--- a/agent/tcf/framework/mdep.h
++++ b/agent/tcf/framework/mdep.h
+@@ -276,7 +276,7 @@ extern int loc_clock_gettime(int, struct timespec *);
+ 
+ #define O_BINARY 0
+ 
+-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || !defined(__GLIBC__)
+ #  define O_LARGEFILE 0
+ extern char ** environ;
+ extern char * canonicalize_file_name(const char * path);
+-- 
+2.7.0
+
diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
index fff81a5..ab2fcd7 100644
--- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
+++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
@@ -12,6 +12,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
 SRC_URI = "git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git;branch=1.3_mars_bugfix \
            file://fix_ranlib.patch \
            file://ldflags.patch \
+           file://0001-canonicalize_file_name-is-specific-to-glibc.patch;striplevel=2 \
            file://tcf-agent.init \
            file://tcf-agent.service \
           "
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 45/73] bsd-headers, musl: Add recipe for bsd missing features
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (43 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 44/73] tcf-agent: Implement canonicalize_file_name() for musl as well Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 46/73] nfs-utils: Disable tcp-wrappers for musl Khem Raj
                   ` (28 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

let musl depend on these headers so they are staged along with libc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/bsd-headers/bsd-headers.bb       |  25 +
 .../bsd-headers/bsd-headers/sys-queue.h            | 846 +++++++++++++++++++++
 .../bsd-headers/bsd-headers/sys-tree.h             | 761 ++++++++++++++++++
 meta/recipes-core/musl/musl_git.bb                 |   1 +
 4 files changed, 1633 insertions(+)
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers.bb
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-queue.h
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-tree.h

diff --git a/meta/recipes-core/bsd-headers/bsd-headers.bb b/meta/recipes-core/bsd-headers/bsd-headers.bb
new file mode 100644
index 0000000..ae659ab
--- /dev/null
+++ b/meta/recipes-core/bsd-headers/bsd-headers.bb
@@ -0,0 +1,25 @@
+# Copyright (C) 2016 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "bsd compatible headers"
+LICENSE = "BSD-3-Clause && BSD-2-Clause"
+SECTION = "devel"
+
+SRC_URI = "file://sys-queue.h \
+           file://sys-tree.h \
+          "
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+S = "${WORKDIR}"
+
+do_install() {
+	install -Dm 0644 ${S}/sys-queue.h ${D}${includedir}/sys/queue.h
+	install -Dm 0644 ${S}/sys-tree.h ${D}${includedir}/sys/tree.h
+}
+#
+# We will skip parsing for non-musl systems
+#
+COMPATIBLE_HOST = ".*-musl.*"
diff --git a/meta/recipes-core/bsd-headers/bsd-headers/sys-queue.h b/meta/recipes-core/bsd-headers/bsd-headers/sys-queue.h
new file mode 100644
index 0000000..99d01a5
--- /dev/null
+++ b/meta/recipes-core/bsd-headers/bsd-headers/sys-queue.h
@@ -0,0 +1,846 @@
+/*	$NetBSD: queue.h,v 1.68 2014/11/19 08:10:01 uebayasi Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)queue.h	8.5 (Berkeley) 8/20/94
+ */
+
+#ifndef	_SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+/*
+ * This file defines five types of data structures: singly-linked lists,
+ * lists, simple queues, tail queues, and circular queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The
+ * elements are singly linked for minimum space and pointer manipulation
+ * overhead at the expense of O(n) removal for arbitrary elements. New
+ * elements can be added to the list after an existing element or at the
+ * head of the list.  Elements being removed from the head of the list
+ * should use the explicit macro for this purpose for optimum
+ * efficiency. A singly-linked list may only be traversed in the forward
+ * direction.  Singly-linked lists are ideal for applications with large
+ * datasets and few or no removals or for implementing a LIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A simple queue is headed by a pair of pointers, one the head of the
+ * list and the other to the tail of the list. The elements are singly
+ * linked to save space, so elements can only be removed from the
+ * head of the list. New elements can be added to the list after
+ * an existing element, at the head of the list, or at the end of the
+ * list. A simple queue may only be traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * A circle queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the list.
+ * A circle queue may be traversed in either direction, but has a more
+ * complex end of list detection.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ */
+
+/*
+ * Include the definition of NULL only on NetBSD because sys/null.h
+ * is not available elsewhere.  This conditional makes the header
+ * portable and it can simply be dropped verbatim into any system.
+ * The caveat is that on other systems some other header
+ * must provide NULL before the macros can be used.
+ */
+#ifdef __NetBSD__
+#include <sys/null.h>
+#endif
+
+#if defined(QUEUEDEBUG)
+# if defined(_KERNEL)
+#  define QUEUEDEBUG_ABORT(...) panic(__VA_ARGS__)
+# else
+#  include <err.h>
+#  define QUEUEDEBUG_ABORT(...) err(1, __VA_ARGS__)
+# endif
+#endif
+
+/*
+ * Singly-linked List definitions.
+ */
+#define	SLIST_HEAD(name, type)						\
+struct name {								\
+	struct type *slh_first;	/* first element */			\
+}
+
+#define	SLIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	SLIST_ENTRY(type)						\
+struct {								\
+	struct type *sle_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked List access methods.
+ */
+#define	SLIST_FIRST(head)	((head)->slh_first)
+#define	SLIST_END(head)		NULL
+#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
+#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
+
+#define	SLIST_FOREACH(var, head, field)					\
+	for((var) = (head)->slh_first;					\
+	    (var) != SLIST_END(head);					\
+	    (var) = (var)->field.sle_next)
+
+#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = SLIST_FIRST((head));				\
+	    (var) != SLIST_END(head) &&					\
+	    ((tvar) = SLIST_NEXT((var), field), 1);			\
+	    (var) = (tvar))
+
+/*
+ * Singly-linked List functions.
+ */
+#define	SLIST_INIT(head) do {						\
+	(head)->slh_first = SLIST_END(head);				\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
+	(elm)->field.sle_next = (slistelm)->field.sle_next;		\
+	(slistelm)->field.sle_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
+	(elm)->field.sle_next = (head)->slh_first;			\
+	(head)->slh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE_AFTER(slistelm, field) do {			\
+	(slistelm)->field.sle_next =					\
+	    SLIST_NEXT(SLIST_NEXT((slistelm), field), field);		\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE_HEAD(head, field) do {				\
+	(head)->slh_first = (head)->slh_first->field.sle_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE(head, elm, type, field) do {			\
+	if ((head)->slh_first == (elm)) {				\
+		SLIST_REMOVE_HEAD((head), field);			\
+	}								\
+	else {								\
+		struct type *curelm = (head)->slh_first;		\
+		while(curelm->field.sle_next != (elm))			\
+			curelm = curelm->field.sle_next;		\
+		curelm->field.sle_next =				\
+		    curelm->field.sle_next->field.sle_next;		\
+	}								\
+} while (/*CONSTCOND*/0)
+
+
+/*
+ * List definitions.
+ */
+#define	LIST_HEAD(name, type)						\
+struct name {								\
+	struct type *lh_first;	/* first element */			\
+}
+
+#define	LIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	LIST_ENTRY(type)						\
+struct {								\
+	struct type *le_next;	/* next element */			\
+	struct type **le_prev;	/* address of previous next element */	\
+}
+
+/*
+ * List access methods.
+ */
+#define	LIST_FIRST(head)		((head)->lh_first)
+#define	LIST_END(head)			NULL
+#define	LIST_EMPTY(head)		((head)->lh_first == LIST_END(head))
+#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
+
+#define	LIST_FOREACH(var, head, field)					\
+	for ((var) = ((head)->lh_first);				\
+	    (var) != LIST_END(head);					\
+	    (var) = ((var)->field.le_next))
+
+#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = LIST_FIRST((head));				\
+	    (var) != LIST_END(head) &&					\
+	    ((tvar) = LIST_NEXT((var), field), 1);			\
+	    (var) = (tvar))
+
+#define	LIST_MOVE(head1, head2) do {					\
+	LIST_INIT((head2));						\
+	if (!LIST_EMPTY((head1))) {					\
+		(head2)->lh_first = (head1)->lh_first;			\
+		LIST_INIT((head1));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+/*
+ * List functions.
+ */
+#if defined(QUEUEDEBUG)
+#define	QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)			\
+	if ((head)->lh_first &&						\
+	    (head)->lh_first->field.le_prev != &(head)->lh_first)	\
+		QUEUEDEBUG_ABORT("LIST_INSERT_HEAD %p %s:%d", (head),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_LIST_OP(elm, field)					\
+	if ((elm)->field.le_next &&					\
+	    (elm)->field.le_next->field.le_prev !=			\
+	    &(elm)->field.le_next)					\
+		QUEUEDEBUG_ABORT("LIST_* forw %p %s:%d", (elm),		\
+		    __FILE__, __LINE__);				\
+	if (*(elm)->field.le_prev != (elm))				\
+		QUEUEDEBUG_ABORT("LIST_* back %p %s:%d", (elm),		\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_LIST_POSTREMOVE(elm, field)				\
+	(elm)->field.le_next = (void *)1L;				\
+	(elm)->field.le_prev = (void *)1L;
+#else
+#define	QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)
+#define	QUEUEDEBUG_LIST_OP(elm, field)
+#define	QUEUEDEBUG_LIST_POSTREMOVE(elm, field)
+#endif
+
+#define	LIST_INIT(head) do {						\
+	(head)->lh_first = LIST_END(head);				\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
+	QUEUEDEBUG_LIST_OP((listelm), field)				\
+	if (((elm)->field.le_next = (listelm)->field.le_next) != 	\
+	    LIST_END(head))						\
+		(listelm)->field.le_next->field.le_prev =		\
+		    &(elm)->field.le_next;				\
+	(listelm)->field.le_next = (elm);				\
+	(elm)->field.le_prev = &(listelm)->field.le_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	QUEUEDEBUG_LIST_OP((listelm), field)				\
+	(elm)->field.le_prev = (listelm)->field.le_prev;		\
+	(elm)->field.le_next = (listelm);				\
+	*(listelm)->field.le_prev = (elm);				\
+	(listelm)->field.le_prev = &(elm)->field.le_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_HEAD(head, elm, field) do {				\
+	QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field)		\
+	if (((elm)->field.le_next = (head)->lh_first) != LIST_END(head))\
+		(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
+	(head)->lh_first = (elm);					\
+	(elm)->field.le_prev = &(head)->lh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_REMOVE(elm, field) do {					\
+	QUEUEDEBUG_LIST_OP((elm), field)				\
+	if ((elm)->field.le_next != NULL)				\
+		(elm)->field.le_next->field.le_prev = 			\
+		    (elm)->field.le_prev;				\
+	*(elm)->field.le_prev = (elm)->field.le_next;			\
+	QUEUEDEBUG_LIST_POSTREMOVE((elm), field)			\
+} while (/*CONSTCOND*/0)
+
+#define LIST_REPLACE(elm, elm2, field) do {				\
+	if (((elm2)->field.le_next = (elm)->field.le_next) != NULL)	\
+		(elm2)->field.le_next->field.le_prev =			\
+		    &(elm2)->field.le_next;				\
+	(elm2)->field.le_prev = (elm)->field.le_prev;			\
+	*(elm2)->field.le_prev = (elm2);				\
+	QUEUEDEBUG_LIST_POSTREMOVE((elm), field)			\
+} while (/*CONSTCOND*/0)
+
+/*
+ * Simple queue definitions.
+ */
+#define	SIMPLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *sqh_first;	/* first element */			\
+	struct type **sqh_last;	/* addr of last next element */		\
+}
+
+#define	SIMPLEQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).sqh_first }
+
+#define	SIMPLEQ_ENTRY(type)						\
+struct {								\
+	struct type *sqe_next;	/* next element */			\
+}
+
+/*
+ * Simple queue access methods.
+ */
+#define	SIMPLEQ_FIRST(head)		((head)->sqh_first)
+#define	SIMPLEQ_END(head)		NULL
+#define	SIMPLEQ_EMPTY(head)		((head)->sqh_first == SIMPLEQ_END(head))
+#define	SIMPLEQ_NEXT(elm, field)	((elm)->field.sqe_next)
+
+#define	SIMPLEQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->sqh_first);				\
+	    (var) != SIMPLEQ_END(head);					\
+	    (var) = ((var)->field.sqe_next))
+
+#define	SIMPLEQ_FOREACH_SAFE(var, head, field, next)			\
+	for ((var) = ((head)->sqh_first);				\
+	    (var) != SIMPLEQ_END(head) &&				\
+	    ((next = ((var)->field.sqe_next)), 1);			\
+	    (var) = (next))
+
+/*
+ * Simple queue functions.
+ */
+#define	SIMPLEQ_INIT(head) do {						\
+	(head)->sqh_first = NULL;					\
+	(head)->sqh_last = &(head)->sqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.sqe_next = (head)->sqh_first) == NULL)	\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(head)->sqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.sqe_next = NULL;					\
+	*(head)->sqh_last = (elm);					\
+	(head)->sqh_last = &(elm)->field.sqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(listelm)->field.sqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_REMOVE_HEAD(head, field) do {				\
+	if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
+		(head)->sqh_last = &(head)->sqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_REMOVE_AFTER(head, elm, field) do {			\
+	if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
+	    == NULL)							\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_REMOVE(head, elm, type, field) do {			\
+	if ((head)->sqh_first == (elm)) {				\
+		SIMPLEQ_REMOVE_HEAD((head), field);			\
+	} else {							\
+		struct type *curelm = (head)->sqh_first;		\
+		while (curelm->field.sqe_next != (elm))			\
+			curelm = curelm->field.sqe_next;		\
+		if ((curelm->field.sqe_next =				\
+			curelm->field.sqe_next->field.sqe_next) == NULL) \
+			    (head)->sqh_last = &(curelm)->field.sqe_next; \
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_CONCAT(head1, head2) do {				\
+	if (!SIMPLEQ_EMPTY((head2))) {					\
+		*(head1)->sqh_last = (head2)->sqh_first;		\
+		(head1)->sqh_last = (head2)->sqh_last;		\
+		SIMPLEQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_LAST(head, type, field)					\
+	(SIMPLEQ_EMPTY((head)) ?						\
+		NULL :							\
+	        ((struct type *)(void *)				\
+		((char *)((head)->sqh_last) - offsetof(struct type, field))))
+
+/*
+ * Tail queue definitions.
+ */
+#define	_TAILQ_HEAD(name, type, qual)					\
+struct name {								\
+	qual type *tqh_first;		/* first element */		\
+	qual type *qual *tqh_last;	/* addr of last next element */	\
+}
+#define TAILQ_HEAD(name, type)	_TAILQ_HEAD(name, struct type,)
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ TAILQ_END(head), &(head).tqh_first }
+
+#define	_TAILQ_ENTRY(type, qual)					\
+struct {								\
+	qual type *tqe_next;		/* next element */		\
+	qual type *qual *tqe_prev;	/* address of previous next element */\
+}
+#define TAILQ_ENTRY(type)	_TAILQ_ENTRY(struct type,)
+
+/*
+ * Tail queue access methods.
+ */
+#define	TAILQ_FIRST(head)		((head)->tqh_first)
+#define	TAILQ_END(head)			(NULL)
+#define	TAILQ_NEXT(elm, field)		((elm)->field.tqe_next)
+#define	TAILQ_LAST(head, headname) \
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+#define	TAILQ_PREV(elm, headname, field) \
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+#define	TAILQ_EMPTY(head)		(TAILQ_FIRST(head) == TAILQ_END(head))
+
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = ((head)->tqh_first);				\
+	    (var) != TAILQ_END(head);					\
+	    (var) = ((var)->field.tqe_next))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, next)			\
+	for ((var) = ((head)->tqh_first);				\
+	    (var) != TAILQ_END(head) &&					\
+	    ((next) = TAILQ_NEXT(var, field), 1); (var) = (next))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));\
+	    (var) != TAILQ_END(head);					\
+	    (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) != TAILQ_END(head) && 				\
+	    ((prev) = TAILQ_PREV((var), headname, field), 1); (var) = (prev))
+
+/*
+ * Tail queue functions.
+ */
+#if defined(QUEUEDEBUG)
+#define	QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)			\
+	if ((head)->tqh_first &&					\
+	    (head)->tqh_first->field.tqe_prev != &(head)->tqh_first)	\
+		QUEUEDEBUG_ABORT("TAILQ_INSERT_HEAD %p %s:%d", (head),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)			\
+	if (*(head)->tqh_last != NULL)					\
+		QUEUEDEBUG_ABORT("TAILQ_INSERT_TAIL %p %s:%d", (head),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_OP(elm, field)					\
+	if ((elm)->field.tqe_next &&					\
+	    (elm)->field.tqe_next->field.tqe_prev !=			\
+	    &(elm)->field.tqe_next)					\
+		QUEUEDEBUG_ABORT("TAILQ_* forw %p %s:%d", (elm),	\
+		    __FILE__, __LINE__);				\
+	if (*(elm)->field.tqe_prev != (elm))				\
+		QUEUEDEBUG_ABORT("TAILQ_* back %p %s:%d", (elm),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)			\
+	if ((elm)->field.tqe_next == NULL &&				\
+	    (head)->tqh_last != &(elm)->field.tqe_next)			\
+		QUEUEDEBUG_ABORT("TAILQ_PREREMOVE head %p elm %p %s:%d",\
+		    (head), (elm), __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)				\
+	(elm)->field.tqe_next = (void *)1L;				\
+	(elm)->field.tqe_prev = (void *)1L;
+#else
+#define	QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)
+#define	QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)
+#define	QUEUEDEBUG_TAILQ_OP(elm, field)
+#define	QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)
+#define	QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)
+#endif
+
+#define	TAILQ_INIT(head) do {						\
+	(head)->tqh_first = TAILQ_END(head);				\
+	(head)->tqh_last = &(head)->tqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field)		\
+	if (((elm)->field.tqe_next = (head)->tqh_first) != TAILQ_END(head))\
+		(head)->tqh_first->field.tqe_prev =			\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(head)->tqh_first = (elm);					\
+	(elm)->field.tqe_prev = &(head)->tqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field)		\
+	(elm)->field.tqe_next = TAILQ_END(head);			\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &(elm)->field.tqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QUEUEDEBUG_TAILQ_OP((listelm), field)				\
+	if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != 	\
+	    TAILQ_END(head))						\
+		(elm)->field.tqe_next->field.tqe_prev = 		\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(listelm)->field.tqe_next = (elm);				\
+	(elm)->field.tqe_prev = &(listelm)->field.tqe_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QUEUEDEBUG_TAILQ_OP((listelm), field)				\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	(elm)->field.tqe_next = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &(elm)->field.tqe_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field)		\
+	QUEUEDEBUG_TAILQ_OP((elm), field)				\
+	if (((elm)->field.tqe_next) != TAILQ_END(head))			\
+		(elm)->field.tqe_next->field.tqe_prev = 		\
+		    (elm)->field.tqe_prev;				\
+	else								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+	*(elm)->field.tqe_prev = (elm)->field.tqe_next;			\
+	QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field);			\
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_REPLACE(head, elm, elm2, field) do {			\
+        if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != 	\
+	    TAILQ_END(head))   						\
+                (elm2)->field.tqe_next->field.tqe_prev =		\
+                    &(elm2)->field.tqe_next;				\
+        else								\
+                (head)->tqh_last = &(elm2)->field.tqe_next;		\
+        (elm2)->field.tqe_prev = (elm)->field.tqe_prev;			\
+        *(elm2)->field.tqe_prev = (elm2);				\
+	QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field);			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+#define	STAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *stqh_first;	/* first element */		\
+	struct type **stqh_last;	/* addr of last next element */	\
+}
+
+#define	STAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).stqh_first }
+
+#define	STAILQ_ENTRY(type)						\
+struct {								\
+	struct type *stqe_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked Tail queue access methods.
+ */
+#define	STAILQ_FIRST(head)	((head)->stqh_first)
+#define	STAILQ_END(head)	NULL
+#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
+#define	STAILQ_EMPTY(head)	(STAILQ_FIRST(head) == STAILQ_END(head))
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+#define	STAILQ_INIT(head) do {						\
+	(head)->stqh_first = NULL;					\
+	(head)->stqh_last = &(head)->stqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.stqe_next = (head)->stqh_first) == NULL)	\
+		(head)->stqh_last = &(elm)->field.stqe_next;		\
+	(head)->stqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.stqe_next = NULL;					\
+	*(head)->stqh_last = (elm);					\
+	(head)->stqh_last = &(elm)->field.stqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+		(head)->stqh_last = &(elm)->field.stqe_next;		\
+	(listelm)->field.stqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_REMOVE_HEAD(head, field) do {				\
+	if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
+		(head)->stqh_last = &(head)->stqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_REMOVE(head, elm, type, field) do {			\
+	if ((head)->stqh_first == (elm)) {				\
+		STAILQ_REMOVE_HEAD((head), field);			\
+	} else {							\
+		struct type *curelm = (head)->stqh_first;		\
+		while (curelm->field.stqe_next != (elm))			\
+			curelm = curelm->field.stqe_next;		\
+		if ((curelm->field.stqe_next =				\
+			curelm->field.stqe_next->field.stqe_next) == NULL) \
+			    (head)->stqh_last = &(curelm)->field.stqe_next; \
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->stqh_first);				\
+		(var);							\
+		(var) = ((var)->field.stqe_next))
+
+#define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = STAILQ_FIRST((head));				\
+	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	STAILQ_CONCAT(head1, head2) do {				\
+	if (!STAILQ_EMPTY((head2))) {					\
+		*(head1)->stqh_last = (head2)->stqh_first;		\
+		(head1)->stqh_last = (head2)->stqh_last;		\
+		STAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_LAST(head, type, field)					\
+	(STAILQ_EMPTY((head)) ?						\
+		NULL :							\
+	        ((struct type *)(void *)				\
+		((char *)((head)->stqh_last) - offsetof(struct type, field))))
+
+
+#ifndef _KERNEL
+/*
+ * Circular queue definitions. Do not use. We still keep the macros
+ * for compatibility but because of pointer aliasing issues their use
+ * is discouraged!
+ */
+
+/*
+ * __launder_type():  We use this ugly hack to work around the the compiler
+ * noticing that two types may not alias each other and elide tests in code.
+ * We hit this in the CIRCLEQ macros when comparing 'struct name *' and
+ * 'struct type *' (see CIRCLEQ_HEAD()).  Modern compilers (such as GCC
+ * 4.8) declare these comparisons as always false, causing the code to
+ * not run as designed.
+ *
+ * This hack is only to be used for comparisons and thus can be fully const.
+ * Do not use for assignment.
+ *
+ * If we ever choose to change the ABI of the CIRCLEQ macros, we could fix
+ * this by changing the head/tail sentinal values, but see the note above
+ * this one.
+ */
+static __inline const void * __launder_type(const void *);
+static __inline const void *
+__launder_type(const void *__x)
+{
+	__asm __volatile("" : "+r" (__x));
+	return __x;
+}
+
+#if defined(QUEUEDEBUG)
+#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)				\
+	if ((head)->cqh_first != CIRCLEQ_ENDC(head) &&			\
+	    (head)->cqh_first->field.cqe_prev != CIRCLEQ_ENDC(head))	\
+		QUEUEDEBUG_ABORT("CIRCLEQ head forw %p %s:%d", (head),	\
+		      __FILE__, __LINE__);				\
+	if ((head)->cqh_last != CIRCLEQ_ENDC(head) &&			\
+	    (head)->cqh_last->field.cqe_next != CIRCLEQ_ENDC(head))	\
+		QUEUEDEBUG_ABORT("CIRCLEQ head back %p %s:%d", (head),	\
+		      __FILE__, __LINE__);
+#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)			\
+	if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) {		\
+		if ((head)->cqh_last != (elm))				\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm last %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	} else {							\
+		if ((elm)->field.cqe_next->field.cqe_prev != (elm))	\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm forw %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	}								\
+	if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) {		\
+		if ((head)->cqh_first != (elm))				\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm first %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	} else {							\
+		if ((elm)->field.cqe_prev->field.cqe_next != (elm))	\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm prev %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	}
+#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)			\
+	(elm)->field.cqe_next = (void *)1L;				\
+	(elm)->field.cqe_prev = (void *)1L;
+#else
+#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)
+#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)
+#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)
+#endif
+
+#define	CIRCLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *cqh_first;		/* first element */		\
+	struct type *cqh_last;		/* last element */		\
+}
+
+#define	CIRCLEQ_HEAD_INITIALIZER(head)					\
+	{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
+
+#define	CIRCLEQ_ENTRY(type)						\
+struct {								\
+	struct type *cqe_next;		/* next element */		\
+	struct type *cqe_prev;		/* previous element */		\
+}
+
+/*
+ * Circular queue functions.
+ */
+#define	CIRCLEQ_INIT(head) do {						\
+	(head)->cqh_first = CIRCLEQ_END(head);				\
+	(head)->cqh_last = CIRCLEQ_END(head);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)		\
+	(elm)->field.cqe_next = (listelm)->field.cqe_next;		\
+	(elm)->field.cqe_prev = (listelm);				\
+	if ((listelm)->field.cqe_next == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(listelm)->field.cqe_next->field.cqe_prev = (elm);	\
+	(listelm)->field.cqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do {		\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)		\
+	(elm)->field.cqe_next = (listelm);				\
+	(elm)->field.cqe_prev = (listelm)->field.cqe_prev;		\
+	if ((listelm)->field.cqe_prev == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(listelm)->field.cqe_prev->field.cqe_next = (elm);	\
+	(listelm)->field.cqe_prev = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_HEAD(head, elm, field) do {			\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	(elm)->field.cqe_next = (head)->cqh_first;			\
+	(elm)->field.cqe_prev = CIRCLEQ_END(head);			\
+	if ((head)->cqh_last == CIRCLEQ_ENDC(head))			\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(head)->cqh_first->field.cqe_prev = (elm);		\
+	(head)->cqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_TAIL(head, elm, field) do {			\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	(elm)->field.cqe_next = CIRCLEQ_END(head);			\
+	(elm)->field.cqe_prev = (head)->cqh_last;			\
+	if ((head)->cqh_first == CIRCLEQ_ENDC(head))			\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(head)->cqh_last->field.cqe_next = (elm);		\
+	(head)->cqh_last = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_REMOVE(head, elm, field) do {				\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field)			\
+	if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_last = (elm)->field.cqe_prev;		\
+	else								\
+		(elm)->field.cqe_next->field.cqe_prev =			\
+		    (elm)->field.cqe_prev;				\
+	if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_first = (elm)->field.cqe_next;		\
+	else								\
+		(elm)->field.cqe_prev->field.cqe_next =			\
+		    (elm)->field.cqe_next;				\
+	QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field)			\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->cqh_first);				\
+		(var) != CIRCLEQ_ENDC(head);				\
+		(var) = ((var)->field.cqe_next))
+
+#define	CIRCLEQ_FOREACH_REVERSE(var, head, field)			\
+	for ((var) = ((head)->cqh_last);				\
+		(var) != CIRCLEQ_ENDC(head);				\
+		(var) = ((var)->field.cqe_prev))
+
+/*
+ * Circular queue access methods.
+ */
+#define	CIRCLEQ_FIRST(head)		((head)->cqh_first)
+#define	CIRCLEQ_LAST(head)		((head)->cqh_last)
+/* For comparisons */
+#define	CIRCLEQ_ENDC(head)		(__launder_type(head))
+/* For assignments */
+#define	CIRCLEQ_END(head)		((void *)(head))
+#define	CIRCLEQ_NEXT(elm, field)	((elm)->field.cqe_next)
+#define	CIRCLEQ_PREV(elm, field)	((elm)->field.cqe_prev)
+#define	CIRCLEQ_EMPTY(head)						\
+    (CIRCLEQ_FIRST(head) == CIRCLEQ_ENDC(head))
+
+#define CIRCLEQ_LOOP_NEXT(head, elm, field)				\
+	(((elm)->field.cqe_next == CIRCLEQ_ENDC(head))			\
+	    ? ((head)->cqh_first)					\
+	    : (elm->field.cqe_next))
+#define CIRCLEQ_LOOP_PREV(head, elm, field)				\
+	(((elm)->field.cqe_prev == CIRCLEQ_ENDC(head))			\
+	    ? ((head)->cqh_last)					\
+	    : (elm->field.cqe_prev))
+#endif /* !_KERNEL */
+
+#endif	/* !_SYS_QUEUE_H_ */
diff --git a/meta/recipes-core/bsd-headers/bsd-headers/sys-tree.h b/meta/recipes-core/bsd-headers/bsd-headers/sys-tree.h
new file mode 100644
index 0000000..eaea56a
--- /dev/null
+++ b/meta/recipes-core/bsd-headers/bsd-headers/sys-tree.h
@@ -0,0 +1,761 @@
+/*	$NetBSD: tree.h,v 1.20 2013/09/14 13:20:45 joerg Exp $	*/
+/*	$OpenBSD: tree.h,v 1.13 2011/07/09 00:19:45 pirofti Exp $	*/
+/*
+ * Copyright 2002 Niels Provos <provos@citi.umich.edu>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_SYS_TREE_H_
+#define	_SYS_TREE_H_
+
+/*
+ * This file defines data structures for different types of trees:
+ * splay trees and red-black trees.
+ *
+ * A splay tree is a self-organizing data structure.  Every operation
+ * on the tree causes a splay to happen.  The splay moves the requested
+ * node to the root of the tree and partly rebalances it.
+ *
+ * This has the benefit that request locality causes faster lookups as
+ * the requested nodes move to the top of the tree.  On the other hand,
+ * every lookup causes memory writes.
+ *
+ * The Balance Theorem bounds the total access time for m operations
+ * and n inserts on an initially empty tree as O((m + n)lg n).  The
+ * amortized cost for a sequence of m accesses to a splay tree is O(lg n);
+ *
+ * A red-black tree is a binary search tree with the node color as an
+ * extra attribute.  It fulfills a set of conditions:
+ *	- every search path from the root to a leaf consists of the
+ *	  same number of black nodes,
+ *	- each red node (except for the root) has a black parent,
+ *	- each leaf node is black.
+ *
+ * Every operation on a red-black tree is bounded as O(lg n).
+ * The maximum height of a red-black tree is 2lg (n+1).
+ */
+
+#define SPLAY_HEAD(name, type)						\
+struct name {								\
+	struct type *sph_root; /* root of the tree */			\
+}
+
+#define SPLAY_INITIALIZER(root)						\
+	{ NULL }
+
+#define SPLAY_INIT(root) do {						\
+	(root)->sph_root = NULL;					\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ENTRY(type)						\
+struct {								\
+	struct type *spe_left; /* left element */			\
+	struct type *spe_right; /* right element */			\
+}
+
+#define SPLAY_LEFT(elm, field)		(elm)->field.spe_left
+#define SPLAY_RIGHT(elm, field)		(elm)->field.spe_right
+#define SPLAY_ROOT(head)		(head)->sph_root
+#define SPLAY_EMPTY(head)		(SPLAY_ROOT(head) == NULL)
+
+/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */
+#define SPLAY_ROTATE_RIGHT(head, tmp, field) do {			\
+	SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field);	\
+	SPLAY_RIGHT(tmp, field) = (head)->sph_root;			\
+	(head)->sph_root = tmp;						\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ROTATE_LEFT(head, tmp, field) do {			\
+	SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field);	\
+	SPLAY_LEFT(tmp, field) = (head)->sph_root;			\
+	(head)->sph_root = tmp;						\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_LINKLEFT(head, tmp, field) do {				\
+	SPLAY_LEFT(tmp, field) = (head)->sph_root;			\
+	tmp = (head)->sph_root;						\
+	(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);		\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_LINKRIGHT(head, tmp, field) do {				\
+	SPLAY_RIGHT(tmp, field) = (head)->sph_root;			\
+	tmp = (head)->sph_root;						\
+	(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);	\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ASSEMBLE(head, node, left, right, field) do {		\
+	SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field);	\
+	SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
+	SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field);	\
+	SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field);	\
+} while (/*CONSTCOND*/ 0)
+
+/* Generates prototypes and inline functions */
+
+#define SPLAY_PROTOTYPE(name, type, field, cmp)				\
+void name##_SPLAY(struct name *, struct type *);			\
+void name##_SPLAY_MINMAX(struct name *, int);				\
+struct type *name##_SPLAY_INSERT(struct name *, struct type *);		\
+struct type *name##_SPLAY_REMOVE(struct name *, struct type *);		\
+									\
+/* Finds the node with the same key as elm */				\
+static __inline struct type *						\
+name##_SPLAY_FIND(struct name *head, struct type *elm)			\
+{									\
+	if (SPLAY_EMPTY(head))						\
+		return(NULL);						\
+	name##_SPLAY(head, elm);					\
+	if ((cmp)(elm, (head)->sph_root) == 0)				\
+		return (head->sph_root);				\
+	return (NULL);							\
+}									\
+									\
+static __inline __unused struct type *					\
+name##_SPLAY_NEXT(struct name *head, struct type *elm)			\
+{									\
+	name##_SPLAY(head, elm);					\
+	if (SPLAY_RIGHT(elm, field) != NULL) {				\
+		elm = SPLAY_RIGHT(elm, field);				\
+		while (SPLAY_LEFT(elm, field) != NULL) {		\
+			elm = SPLAY_LEFT(elm, field);			\
+		}							\
+	} else								\
+		elm = NULL;						\
+	return (elm);							\
+}									\
+									\
+static __unused __inline struct type *					\
+name##_SPLAY_MIN_MAX(struct name *head, int val)			\
+{									\
+	name##_SPLAY_MINMAX(head, val);					\
+        return (SPLAY_ROOT(head));					\
+}
+
+/* Main splay operation.
+ * Moves node close to the key of elm to top
+ */
+#define SPLAY_GENERATE(name, type, field, cmp)				\
+struct type *								\
+name##_SPLAY_INSERT(struct name *head, struct type *elm)		\
+{									\
+    if (SPLAY_EMPTY(head)) {						\
+	    SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL;	\
+    } else {								\
+	    int __comp;							\
+	    name##_SPLAY(head, elm);					\
+	    __comp = (cmp)(elm, (head)->sph_root);			\
+	    if(__comp < 0) {						\
+		    SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\
+		    SPLAY_RIGHT(elm, field) = (head)->sph_root;		\
+		    SPLAY_LEFT((head)->sph_root, field) = NULL;		\
+	    } else if (__comp > 0) {					\
+		    SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\
+		    SPLAY_LEFT(elm, field) = (head)->sph_root;		\
+		    SPLAY_RIGHT((head)->sph_root, field) = NULL;	\
+	    } else							\
+		    return ((head)->sph_root);				\
+    }									\
+    (head)->sph_root = (elm);						\
+    return (NULL);							\
+}									\
+									\
+struct type *								\
+name##_SPLAY_REMOVE(struct name *head, struct type *elm)		\
+{									\
+	struct type *__tmp;						\
+	if (SPLAY_EMPTY(head))						\
+		return (NULL);						\
+	name##_SPLAY(head, elm);					\
+	if ((cmp)(elm, (head)->sph_root) == 0) {			\
+		if (SPLAY_LEFT((head)->sph_root, field) == NULL) {	\
+			(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\
+		} else {						\
+			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
+			(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\
+			name##_SPLAY(head, elm);			\
+			SPLAY_RIGHT((head)->sph_root, field) = __tmp;	\
+		}							\
+		return (elm);						\
+	}								\
+	return (NULL);							\
+}									\
+									\
+void									\
+name##_SPLAY(struct name *head, struct type *elm)			\
+{									\
+	struct type __node, *__left, *__right, *__tmp;			\
+	int __comp;							\
+\
+	SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
+	__left = __right = &__node;					\
+\
+	while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) {		\
+		if (__comp < 0) {					\
+			__tmp = SPLAY_LEFT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if ((cmp)(elm, __tmp) < 0){			\
+				SPLAY_ROTATE_RIGHT(head, __tmp, field);	\
+				if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKLEFT(head, __right, field);		\
+		} else if (__comp > 0) {				\
+			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if ((cmp)(elm, __tmp) > 0){			\
+				SPLAY_ROTATE_LEFT(head, __tmp, field);	\
+				if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKRIGHT(head, __left, field);		\
+		}							\
+	}								\
+	SPLAY_ASSEMBLE(head, &__node, __left, __right, field);		\
+}									\
+									\
+/* Splay with either the minimum or the maximum element			\
+ * Used to find minimum or maximum element in tree.			\
+ */									\
+void name##_SPLAY_MINMAX(struct name *head, int __comp) \
+{									\
+	struct type __node, *__left, *__right, *__tmp;			\
+\
+	SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
+	__left = __right = &__node;					\
+\
+	while (1) {							\
+		if (__comp < 0) {					\
+			__tmp = SPLAY_LEFT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if (__comp < 0){				\
+				SPLAY_ROTATE_RIGHT(head, __tmp, field);	\
+				if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKLEFT(head, __right, field);		\
+		} else if (__comp > 0) {				\
+			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if (__comp > 0) {				\
+				SPLAY_ROTATE_LEFT(head, __tmp, field);	\
+				if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKRIGHT(head, __left, field);		\
+		}							\
+	}								\
+	SPLAY_ASSEMBLE(head, &__node, __left, __right, field);		\
+}
+
+#define SPLAY_NEGINF	-1
+#define SPLAY_INF	1
+
+#define SPLAY_INSERT(name, x, y)	name##_SPLAY_INSERT(x, y)
+#define SPLAY_REMOVE(name, x, y)	name##_SPLAY_REMOVE(x, y)
+#define SPLAY_FIND(name, x, y)		name##_SPLAY_FIND(x, y)
+#define SPLAY_NEXT(name, x, y)		name##_SPLAY_NEXT(x, y)
+#define SPLAY_MIN(name, x)		(SPLAY_EMPTY(x) ? NULL	\
+					: name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF))
+#define SPLAY_MAX(name, x)		(SPLAY_EMPTY(x) ? NULL	\
+					: name##_SPLAY_MIN_MAX(x, SPLAY_INF))
+
+#define SPLAY_FOREACH(x, name, head)					\
+	for ((x) = SPLAY_MIN(name, head);				\
+	     (x) != NULL;						\
+	     (x) = SPLAY_NEXT(name, head, x))
+
+/* Macros that define a red-black tree */
+#define RB_HEAD(name, type)						\
+struct name {								\
+	struct type *rbh_root; /* root of the tree */			\
+}
+
+#define RB_INITIALIZER(root)						\
+	{ NULL }
+
+#define RB_INIT(root) do {						\
+	(root)->rbh_root = NULL;					\
+} while (/*CONSTCOND*/ 0)
+
+#define RB_BLACK	0
+#define RB_RED		1
+#define RB_ENTRY(type)							\
+struct {								\
+	struct type *rbe_left;		/* left element */		\
+	struct type *rbe_right;		/* right element */		\
+	struct type *rbe_parent;	/* parent element */		\
+	int rbe_color;			/* node color */		\
+}
+
+#define RB_LEFT(elm, field)		(elm)->field.rbe_left
+#define RB_RIGHT(elm, field)		(elm)->field.rbe_right
+#define RB_PARENT(elm, field)		(elm)->field.rbe_parent
+#define RB_COLOR(elm, field)		(elm)->field.rbe_color
+#define RB_ROOT(head)			(head)->rbh_root
+#define RB_EMPTY(head)			(RB_ROOT(head) == NULL)
+
+#define RB_SET(elm, parent, field) do {					\
+	RB_PARENT(elm, field) = parent;					\
+	RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL;		\
+	RB_COLOR(elm, field) = RB_RED;					\
+} while (/*CONSTCOND*/ 0)
+
+#define RB_SET_BLACKRED(black, red, field) do {				\
+	RB_COLOR(black, field) = RB_BLACK;				\
+	RB_COLOR(red, field) = RB_RED;					\
+} while (/*CONSTCOND*/ 0)
+
+#ifndef RB_AUGMENT
+#define RB_AUGMENT(x)	do {} while (/*CONSTCOND*/ 0)
+#endif
+
+#define RB_ROTATE_LEFT(head, elm, tmp, field) do {			\
+	(tmp) = RB_RIGHT(elm, field);					\
+	if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) {	\
+		RB_PARENT(RB_LEFT(tmp, field), field) = (elm);		\
+	}								\
+	RB_AUGMENT(elm);						\
+	if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) {	\
+		if ((elm) == RB_LEFT(RB_PARENT(elm, field), field))	\
+			RB_LEFT(RB_PARENT(elm, field), field) = (tmp);	\
+		else							\
+			RB_RIGHT(RB_PARENT(elm, field), field) = (tmp);	\
+	} else								\
+		(head)->rbh_root = (tmp);				\
+	RB_LEFT(tmp, field) = (elm);					\
+	RB_PARENT(elm, field) = (tmp);					\
+	RB_AUGMENT(tmp);						\
+	if ((RB_PARENT(tmp, field)))					\
+		RB_AUGMENT(RB_PARENT(tmp, field));			\
+} while (/*CONSTCOND*/ 0)
+
+#define RB_ROTATE_RIGHT(head, elm, tmp, field) do {			\
+	(tmp) = RB_LEFT(elm, field);					\
+	if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) {	\
+		RB_PARENT(RB_RIGHT(tmp, field), field) = (elm);		\
+	}								\
+	RB_AUGMENT(elm);						\
+	if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) {	\
+		if ((elm) == RB_LEFT(RB_PARENT(elm, field), field))	\
+			RB_LEFT(RB_PARENT(elm, field), field) = (tmp);	\
+		else							\
+			RB_RIGHT(RB_PARENT(elm, field), field) = (tmp);	\
+	} else								\
+		(head)->rbh_root = (tmp);				\
+	RB_RIGHT(tmp, field) = (elm);					\
+	RB_PARENT(elm, field) = (tmp);					\
+	RB_AUGMENT(tmp);						\
+	if ((RB_PARENT(tmp, field)))					\
+		RB_AUGMENT(RB_PARENT(tmp, field));			\
+} while (/*CONSTCOND*/ 0)
+
+/* Generates prototypes and inline functions */
+#define RB_PROTOTYPE(name, type, field, cmp)				\
+	RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
+#define	RB_PROTOTYPE_STATIC(name, type, field, cmp)			\
+	RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
+#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr)		\
+attr void name##_RB_INSERT_COLOR(struct name *, struct type *);		\
+attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
+attr struct type *name##_RB_REMOVE(struct name *, struct type *);	\
+attr struct type *name##_RB_INSERT(struct name *, struct type *);	\
+attr struct type *name##_RB_FIND(struct name *, struct type *);		\
+attr struct type *name##_RB_NFIND(struct name *, struct type *);	\
+attr struct type *name##_RB_NEXT(struct type *);			\
+attr struct type *name##_RB_PREV(struct type *);			\
+attr struct type *name##_RB_MINMAX(struct name *, int);			\
+									\
+
+/* Main rb operation.
+ * Moves node close to the key of elm to top
+ */
+#define	RB_GENERATE(name, type, field, cmp)				\
+	RB_GENERATE_INTERNAL(name, type, field, cmp,)
+#define	RB_GENERATE_STATIC(name, type, field, cmp)			\
+	RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)
+#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr)		\
+attr void								\
+name##_RB_INSERT_COLOR(struct name *head, struct type *elm)		\
+{									\
+	struct type *parent, *gparent, *tmp;				\
+	while ((parent = RB_PARENT(elm, field)) != NULL &&		\
+	    RB_COLOR(parent, field) == RB_RED) {			\
+		gparent = RB_PARENT(parent, field);			\
+		if (parent == RB_LEFT(gparent, field)) {		\
+			tmp = RB_RIGHT(gparent, field);			\
+			if (tmp && RB_COLOR(tmp, field) == RB_RED) {	\
+				RB_COLOR(tmp, field) = RB_BLACK;	\
+				RB_SET_BLACKRED(parent, gparent, field);\
+				elm = gparent;				\
+				continue;				\
+			}						\
+			if (RB_RIGHT(parent, field) == elm) {		\
+				RB_ROTATE_LEFT(head, parent, tmp, field);\
+				tmp = parent;				\
+				parent = elm;				\
+				elm = tmp;				\
+			}						\
+			RB_SET_BLACKRED(parent, gparent, field);	\
+			RB_ROTATE_RIGHT(head, gparent, tmp, field);	\
+		} else {						\
+			tmp = RB_LEFT(gparent, field);			\
+			if (tmp && RB_COLOR(tmp, field) == RB_RED) {	\
+				RB_COLOR(tmp, field) = RB_BLACK;	\
+				RB_SET_BLACKRED(parent, gparent, field);\
+				elm = gparent;				\
+				continue;				\
+			}						\
+			if (RB_LEFT(parent, field) == elm) {		\
+				RB_ROTATE_RIGHT(head, parent, tmp, field);\
+				tmp = parent;				\
+				parent = elm;				\
+				elm = tmp;				\
+			}						\
+			RB_SET_BLACKRED(parent, gparent, field);	\
+			RB_ROTATE_LEFT(head, gparent, tmp, field);	\
+		}							\
+	}								\
+	RB_COLOR(head->rbh_root, field) = RB_BLACK;			\
+}									\
+									\
+attr void								\
+name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \
+{									\
+	struct type *tmp;						\
+	while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) &&	\
+	    elm != RB_ROOT(head)) {					\
+		if (RB_LEFT(parent, field) == elm) {			\
+			tmp = RB_RIGHT(parent, field);			\
+			if (RB_COLOR(tmp, field) == RB_RED) {		\
+				RB_SET_BLACKRED(tmp, parent, field);	\
+				RB_ROTATE_LEFT(head, parent, tmp, field);\
+				tmp = RB_RIGHT(parent, field);		\
+			}						\
+			if ((RB_LEFT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
+			    (RB_RIGHT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
+				RB_COLOR(tmp, field) = RB_RED;		\
+				elm = parent;				\
+				parent = RB_PARENT(elm, field);		\
+			} else {					\
+				if (RB_RIGHT(tmp, field) == NULL ||	\
+				    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\
+					struct type *oleft;		\
+					if ((oleft = RB_LEFT(tmp, field)) \
+					    != NULL)			\
+						RB_COLOR(oleft, field) = RB_BLACK;\
+					RB_COLOR(tmp, field) = RB_RED;	\
+					RB_ROTATE_RIGHT(head, tmp, oleft, field);\
+					tmp = RB_RIGHT(parent, field);	\
+				}					\
+				RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
+				RB_COLOR(parent, field) = RB_BLACK;	\
+				if (RB_RIGHT(tmp, field))		\
+					RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK;\
+				RB_ROTATE_LEFT(head, parent, tmp, field);\
+				elm = RB_ROOT(head);			\
+				break;					\
+			}						\
+		} else {						\
+			tmp = RB_LEFT(parent, field);			\
+			if (RB_COLOR(tmp, field) == RB_RED) {		\
+				RB_SET_BLACKRED(tmp, parent, field);	\
+				RB_ROTATE_RIGHT(head, parent, tmp, field);\
+				tmp = RB_LEFT(parent, field);		\
+			}						\
+			if ((RB_LEFT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
+			    (RB_RIGHT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
+				RB_COLOR(tmp, field) = RB_RED;		\
+				elm = parent;				\
+				parent = RB_PARENT(elm, field);		\
+			} else {					\
+				if (RB_LEFT(tmp, field) == NULL ||	\
+				    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\
+					struct type *oright;		\
+					if ((oright = RB_RIGHT(tmp, field)) \
+					    != NULL)			\
+						RB_COLOR(oright, field) = RB_BLACK;\
+					RB_COLOR(tmp, field) = RB_RED;	\
+					RB_ROTATE_LEFT(head, tmp, oright, field);\
+					tmp = RB_LEFT(parent, field);	\
+				}					\
+				RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
+				RB_COLOR(parent, field) = RB_BLACK;	\
+				if (RB_LEFT(tmp, field))		\
+					RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK;\
+				RB_ROTATE_RIGHT(head, parent, tmp, field);\
+				elm = RB_ROOT(head);			\
+				break;					\
+			}						\
+		}							\
+	}								\
+	if (elm)							\
+		RB_COLOR(elm, field) = RB_BLACK;			\
+}									\
+									\
+attr struct type *							\
+name##_RB_REMOVE(struct name *head, struct type *elm)			\
+{									\
+	struct type *child, *parent, *old = elm;			\
+	int color;							\
+	if (RB_LEFT(elm, field) == NULL)				\
+		child = RB_RIGHT(elm, field);				\
+	else if (RB_RIGHT(elm, field) == NULL)				\
+		child = RB_LEFT(elm, field);				\
+	else {								\
+		struct type *left;					\
+		elm = RB_RIGHT(elm, field);				\
+		while ((left = RB_LEFT(elm, field)) != NULL)		\
+			elm = left;					\
+		child = RB_RIGHT(elm, field);				\
+		parent = RB_PARENT(elm, field);				\
+		color = RB_COLOR(elm, field);				\
+		if (child)						\
+			RB_PARENT(child, field) = parent;		\
+		if (parent) {						\
+			if (RB_LEFT(parent, field) == elm)		\
+				RB_LEFT(parent, field) = child;		\
+			else						\
+				RB_RIGHT(parent, field) = child;	\
+			RB_AUGMENT(parent);				\
+		} else							\
+			RB_ROOT(head) = child;				\
+		if (RB_PARENT(elm, field) == old)			\
+			parent = elm;					\
+		(elm)->field = (old)->field;				\
+		if (RB_PARENT(old, field)) {				\
+			if (RB_LEFT(RB_PARENT(old, field), field) == old)\
+				RB_LEFT(RB_PARENT(old, field), field) = elm;\
+			else						\
+				RB_RIGHT(RB_PARENT(old, field), field) = elm;\
+			RB_AUGMENT(RB_PARENT(old, field));		\
+		} else							\
+			RB_ROOT(head) = elm;				\
+		RB_PARENT(RB_LEFT(old, field), field) = elm;		\
+		if (RB_RIGHT(old, field))				\
+			RB_PARENT(RB_RIGHT(old, field), field) = elm;	\
+		if (parent) {						\
+			left = parent;					\
+			do {						\
+				RB_AUGMENT(left);			\
+			} while ((left = RB_PARENT(left, field)) != NULL); \
+		}							\
+		goto color;						\
+	}								\
+	parent = RB_PARENT(elm, field);					\
+	color = RB_COLOR(elm, field);					\
+	if (child)							\
+		RB_PARENT(child, field) = parent;			\
+	if (parent) {							\
+		if (RB_LEFT(parent, field) == elm)			\
+			RB_LEFT(parent, field) = child;			\
+		else							\
+			RB_RIGHT(parent, field) = child;		\
+		RB_AUGMENT(parent);					\
+	} else								\
+		RB_ROOT(head) = child;					\
+color:									\
+	if (color == RB_BLACK)						\
+		name##_RB_REMOVE_COLOR(head, parent, child);		\
+	return (old);							\
+}									\
+									\
+/* Inserts a node into the RB tree */					\
+attr struct type *							\
+name##_RB_INSERT(struct name *head, struct type *elm)			\
+{									\
+	struct type *tmp;						\
+	struct type *parent = NULL;					\
+	int comp = 0;							\
+	tmp = RB_ROOT(head);						\
+	while (tmp) {							\
+		parent = tmp;						\
+		comp = (cmp)(elm, parent);				\
+		if (comp < 0)						\
+			tmp = RB_LEFT(tmp, field);			\
+		else if (comp > 0)					\
+			tmp = RB_RIGHT(tmp, field);			\
+		else							\
+			return (tmp);					\
+	}								\
+	RB_SET(elm, parent, field);					\
+	if (parent != NULL) {						\
+		if (comp < 0)						\
+			RB_LEFT(parent, field) = elm;			\
+		else							\
+			RB_RIGHT(parent, field) = elm;			\
+		RB_AUGMENT(parent);					\
+	} else								\
+		RB_ROOT(head) = elm;					\
+	name##_RB_INSERT_COLOR(head, elm);				\
+	return (NULL);							\
+}									\
+									\
+/* Finds the node with the same key as elm */				\
+attr struct type *							\
+name##_RB_FIND(struct name *head, struct type *elm)			\
+{									\
+	struct type *tmp = RB_ROOT(head);				\
+	int comp;							\
+	while (tmp) {							\
+		comp = cmp(elm, tmp);					\
+		if (comp < 0)						\
+			tmp = RB_LEFT(tmp, field);			\
+		else if (comp > 0)					\
+			tmp = RB_RIGHT(tmp, field);			\
+		else							\
+			return (tmp);					\
+	}								\
+	return (NULL);							\
+}									\
+									\
+/* Finds the first node greater than or equal to the search key */	\
+attr struct type *							\
+name##_RB_NFIND(struct name *head, struct type *elm)			\
+{									\
+	struct type *tmp = RB_ROOT(head);				\
+	struct type *res = NULL;					\
+	int comp;							\
+	while (tmp) {							\
+		comp = cmp(elm, tmp);					\
+		if (comp < 0) {						\
+			res = tmp;					\
+			tmp = RB_LEFT(tmp, field);			\
+		}							\
+		else if (comp > 0)					\
+			tmp = RB_RIGHT(tmp, field);			\
+		else							\
+			return (tmp);					\
+	}								\
+	return (res);							\
+}									\
+									\
+/* ARGSUSED */								\
+attr struct type *							\
+name##_RB_NEXT(struct type *elm)					\
+{									\
+	if (RB_RIGHT(elm, field)) {					\
+		elm = RB_RIGHT(elm, field);				\
+		while (RB_LEFT(elm, field))				\
+			elm = RB_LEFT(elm, field);			\
+	} else {							\
+		if (RB_PARENT(elm, field) &&				\
+		    (elm == RB_LEFT(RB_PARENT(elm, field), field)))	\
+			elm = RB_PARENT(elm, field);			\
+		else {							\
+			while (RB_PARENT(elm, field) &&			\
+			    (elm == RB_RIGHT(RB_PARENT(elm, field), field)))\
+				elm = RB_PARENT(elm, field);		\
+			elm = RB_PARENT(elm, field);			\
+		}							\
+	}								\
+	return (elm);							\
+}									\
+									\
+/* ARGSUSED */								\
+attr struct type *							\
+name##_RB_PREV(struct type *elm)					\
+{									\
+	if (RB_LEFT(elm, field)) {					\
+		elm = RB_LEFT(elm, field);				\
+		while (RB_RIGHT(elm, field))				\
+			elm = RB_RIGHT(elm, field);			\
+	} else {							\
+		if (RB_PARENT(elm, field) &&				\
+		    (elm == RB_RIGHT(RB_PARENT(elm, field), field)))	\
+			elm = RB_PARENT(elm, field);			\
+		else {							\
+			while (RB_PARENT(elm, field) &&			\
+			    (elm == RB_LEFT(RB_PARENT(elm, field), field)))\
+				elm = RB_PARENT(elm, field);		\
+			elm = RB_PARENT(elm, field);			\
+		}							\
+	}								\
+	return (elm);							\
+}									\
+									\
+attr struct type *							\
+name##_RB_MINMAX(struct name *head, int val)				\
+{									\
+	struct type *tmp = RB_ROOT(head);				\
+	struct type *parent = NULL;					\
+	while (tmp) {							\
+		parent = tmp;						\
+		if (val < 0)						\
+			tmp = RB_LEFT(tmp, field);			\
+		else							\
+			tmp = RB_RIGHT(tmp, field);			\
+	}								\
+	return (parent);						\
+}
+
+#define RB_NEGINF	-1
+#define RB_INF	1
+
+#define RB_INSERT(name, x, y)	name##_RB_INSERT(x, y)
+#define RB_REMOVE(name, x, y)	name##_RB_REMOVE(x, y)
+#define RB_FIND(name, x, y)	name##_RB_FIND(x, y)
+#define RB_NFIND(name, x, y)	name##_RB_NFIND(x, y)
+#define RB_NEXT(name, x, y)	name##_RB_NEXT(y)
+#define RB_PREV(name, x, y)	name##_RB_PREV(y)
+#define RB_MIN(name, x)		name##_RB_MINMAX(x, RB_NEGINF)
+#define RB_MAX(name, x)		name##_RB_MINMAX(x, RB_INF)
+
+#define RB_FOREACH(x, name, head)					\
+	for ((x) = RB_MIN(name, head);					\
+	     (x) != NULL;						\
+	     (x) = name##_RB_NEXT(x))
+
+#define RB_FOREACH_FROM(x, name, y)					\
+	for ((x) = (y);							\
+	    ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);	\
+	     (x) = (y))
+
+#define RB_FOREACH_SAFE(x, name, head, y)				\
+	for ((x) = RB_MIN(name, head);					\
+	    ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);	\
+	     (x) = (y))
+
+#define RB_FOREACH_REVERSE(x, name, head)				\
+	for ((x) = RB_MAX(name, head);					\
+	     (x) != NULL;						\
+	     (x) = name##_RB_PREV(x))
+
+#define RB_FOREACH_REVERSE_FROM(x, name, y)				\
+	for ((x) = (y);							\
+	    ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);	\
+	     (x) = (y))
+
+#define RB_FOREACH_REVERSE_SAFE(x, name, head, y)			\
+	for ((x) = RB_MAX(name, head);					\
+	    ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);	\
+	     (x) = (y))
+
+#endif	/* _SYS_TREE_H_ */
diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
index 051d925..5b94d1f 100644
--- a/meta/recipes-core/musl/musl_git.bb
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -19,6 +19,7 @@ PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc virtual/libiconv
 DEPENDS = "virtual/${TARGET_PREFIX}binutils \
            virtual/${TARGET_PREFIX}gcc-initial \
            libgcc-initial \
+           bsd-headers \
           "
 
 export CROSS_COMPILE="${TARGET_PREFIX}"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 46/73] nfs-utils: Disable tcp-wrappers for musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (44 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 45/73] bsd-headers, musl: Add recipe for bsd missing features Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 47/73] portmap: Point to tirpc headers and libraries on musl Khem Raj
                   ` (27 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Doesnt build with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-connectivity/nfs-utils/nfs-utils_1.3.3.bb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_1.3.3.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.3.3.bb
index 2e0c8b1..ea00656 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils_1.3.3.bb
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.3.3.bb
@@ -64,6 +64,7 @@ EXTRA_OECONF = "--with-statduser=rpcuser \
                "
 
 PACKAGECONFIG ??= "tcp-wrappers"
+PACKAGECONFIG_remove_libc-musl = "tcp-wrappers"
 PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,--without-tcp-wrappers,tcp-wrappers"
 PACKAGECONFIG[nfsidmap] = "--enable-nfsidmap,--disable-nfsidmap,keyutils"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 47/73] portmap: Point to tirpc headers and libraries on musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (45 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 46/73] nfs-utils: Disable tcp-wrappers for musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 48/73] oprofile: fix build with musl Khem Raj
                   ` (26 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-connectivity/portmap/portmap_6.0.bb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/recipes-connectivity/portmap/portmap_6.0.bb b/meta/recipes-connectivity/portmap/portmap_6.0.bb
index e727fe3..999b4a9 100644
--- a/meta/recipes-connectivity/portmap/portmap_6.0.bb
+++ b/meta/recipes-connectivity/portmap/portmap_6.0.bb
@@ -1,5 +1,7 @@
 require portmap.inc
 
+DEPENDS_append_libc-musl = " libtirpc "
+
 PR = "r9"
 
 SRC_URI = "http://www.sourcefiles.org/Networking/Tools/Miscellanenous/portmap-6.0.tgz \
@@ -19,6 +21,8 @@ PACKAGECONFIG[tcp-wrappers] = ",,tcp-wrappers"
 CPPFLAGS += "-DFACILITY=LOG_DAEMON -DENABLE_DNS -DHOSTS_ACCESS"
 CFLAGS += "-Wall -Wstrict-prototypes -fPIC"
 EXTRA_OEMAKE += "'NO_TCP_WRAPPER=${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', '', '1', d)}'"
+CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc "
+LDFLAGS_append_libc-musl = " -ltirpc "
 
 do_install() {
     install -d ${D}${mandir}/man8/ ${D}${base_sbindir} ${D}${sysconfdir}/init.d
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 48/73] oprofile: fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (46 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 47/73] portmap: Point to tirpc headers and libraries on musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 49/73] systemd: Skip parsing on musl based targets Khem Raj
                   ` (25 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

From: Ross Burton <ross.burton@intel.com>

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-kernel/oprofile/oprofile.inc        |  2 ++
 meta/recipes-kernel/oprofile/oprofile/musl.patch | 46 ++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 meta/recipes-kernel/oprofile/oprofile/musl.patch

diff --git a/meta/recipes-kernel/oprofile/oprofile.inc b/meta/recipes-kernel/oprofile/oprofile.inc
index 6ec56e7..faf0e53 100644
--- a/meta/recipes-kernel/oprofile/oprofile.inc
+++ b/meta/recipes-kernel/oprofile/oprofile.inc
@@ -25,6 +25,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \
            file://run-ptest \
            file://root-home-dir.patch"
 
+SRC_URI_append_libc-musl = " file://musl.patch"
+
 inherit autotools pkgconfig ptest
 
 EXTRA_OECONF = "--with-kernel=${STAGING_DIR_HOST}${prefix} --without-x ac_cv_prog_XSLTPROC="
diff --git a/meta/recipes-kernel/oprofile/oprofile/musl.patch b/meta/recipes-kernel/oprofile/oprofile/musl.patch
new file mode 100644
index 0000000..51db408
--- /dev/null
+++ b/meta/recipes-kernel/oprofile/oprofile/musl.patch
@@ -0,0 +1,46 @@
+Fix glibc-isms so that oprofile builds with musl.
+
+Patch taken from openwrt (https://github.com/openwrt-mirror/openwrt/blob/master/package/devel/oprofile/patches/100-musl.patch)
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+--- a/pe_profiling/operf.cpp
++++ b/pe_profiling/operf.cpp
+@@ -857,11 +857,14 @@ static int __delete_old_previous_sample_
+                                 int tflag  __attribute__((unused)),
+                                 struct FTW *ftwbuf __attribute__((unused)))
+ {
++	int err;
++
+ 	if (remove(fpath)) {
++		err = errno;
+ 		perror("sample data removal error");
+-		return FTW_STOP;
++		return err;
+ 	} else {
+-		return FTW_CONTINUE;
++		return 0;
+ 	}
+ }
+ 
+@@ -896,7 +899,7 @@ static void convert_sample_data(void)
+ 		return;
+ 
+ 	if (!operf_options::append) {
+-                int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
++                int flags = FTW_DEPTH;
+ 		errno = 0;
+ 		if (nftw(previous_sampledir.c_str(), __delete_old_previous_sample_data, 32, flags) !=0 &&
+ 				errno != ENOENT) {
+--- a/libop/op_events.c
++++ b/libop/op_events.c
+@@ -83,7 +83,7 @@ static int parse_hex(char const * str)
+ static u64 parse_long_hex(char const * str)
+ {
+ 	u64 value;
+-	if (sscanf(str, "%Lx", &value) != 1)
++	if (sscanf(str, "0x%llx", &value) != 1)
+ 		parse_error("expected long hexadecimal value");
+ 
+ 	fflush(stderr);
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 49/73] systemd: Skip parsing on musl based targets
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (47 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 48/73] oprofile: fix build with musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 50/73] libsolv: Update to 0.6.17+ Khem Raj
                   ` (24 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

systemd on musl doesn't yet work even though we have patches to make it
compile it fails to run, therefore lets skip building it for now

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/systemd/systemd_228.bb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb
index 0c6fbde..16737f9 100644
--- a/meta/recipes-core/systemd/systemd_228.bb
+++ b/meta/recipes-core/systemd/systemd_228.bb
@@ -447,4 +447,8 @@ pkg_prerm_udev-hwdb () {
 python () {
     if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
         raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES")
+
+    import re
+    if re.match('.*musl*', d.getVar('TARGET_OS', True)) != None:
+        raise bb.parse.SkipPackage("Not _yet_ supported on musl based targets")
 }
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 50/73] libsolv: Update to 0.6.17+
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (48 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 49/73] systemd: Skip parsing on musl based targets Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 51/73] db: Use cross libtool Khem Raj
                   ` (23 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-extended/libsolv/libsolv_git.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-extended/libsolv/libsolv_git.bb b/meta/recipes-extended/libsolv/libsolv_git.bb
index 78a2d51..cd7cf77 100644
--- a/meta/recipes-extended/libsolv/libsolv_git.bb
+++ b/meta/recipes-extended/libsolv/libsolv_git.bb
@@ -7,10 +7,10 @@ LIC_FILES_CHKSUM = "file://LICENSE.BSD;md5=62272bd11c97396d4aaf1c41bc11f7d8"
 
 DEPENDS = "expat zlib"
 
-PV = "0.6.14+git${SRCPV}"
+PV = "0.6.17+git${SRCPV}"
 
 SRC_URI = "git://github.com/openSUSE/libsolv.git"
-SRCREV = "b1ea39233f86cd62fbab1964d7497244f6be0087"
+SRCREV = "6ea235973e942436c8815dadddf2c318a8b5ca7d"
 
 S = "${WORKDIR}/git"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 51/73] db: Use cross libtool
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (49 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 50/73] libsolv: Update to 0.6.17+ Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-22 12:41   ` Burton, Ross
  2016-01-17 11:36 ` [PATCH 52/73] kexec-tools: Define _GNU_SOURCE for getting loff_t definition Khem Raj
                   ` (22 subsequent siblings)
  73 siblings, 1 reply; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

db is not reconfigured like usual autotools based components so it
generates its own libtool, and this libtool is not equipped to do cross
builds, e.g. when building using clang on musl, it misdirects linker to
use libstdc++.so from build host instead of target, the reason being it
does not understand sysroot.

Use cross libtool instead to build the target versions

Fixes errors like below

| libtool: link: arm-oe-linux-musleabi-ranlib .libs/libdb-6.0.a
|
/a/builder/mnt/build-oe/tmp-musl/sysroots/x86_64-linux/usr/bin/arm-oe-linux-musleabi/arm-oe-linux-musleabi-ld:
error: /usr/lib/libstdc++.so: incompatible target

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-support/db/db_5.3.28.bb | 1 +
 meta/recipes-support/db/db_6.0.30.bb | 1 +
 2 files changed, 2 insertions(+)

diff --git a/meta/recipes-support/db/db_5.3.28.bb b/meta/recipes-support/db/db_5.3.28.bb
index e8b814e..3dc1da5 100644
--- a/meta/recipes-support/db/db_5.3.28.bb
+++ b/meta/recipes-support/db/db_5.3.28.bb
@@ -76,6 +76,7 @@ MUTEX = ""
 MUTEX_arm = "${ARM_MUTEX}"
 MUTEX_armeb = "${ARM_MUTEX}"
 EXTRA_OECONF += "${MUTEX}"
+EXTRA_OEMAKE_class-target = "LIBTOOL=${STAGING_BINDIR_CROSS}/${HOST_SYS}-libtool"
 
 # Cancel the site stuff - it's set for db3 and destroys the
 # configure.
diff --git a/meta/recipes-support/db/db_6.0.30.bb b/meta/recipes-support/db/db_6.0.30.bb
index db9f0ab..eac84b8 100644
--- a/meta/recipes-support/db/db_6.0.30.bb
+++ b/meta/recipes-support/db/db_6.0.30.bb
@@ -83,6 +83,7 @@ MUTEX = ""
 MUTEX_arm = "${ARM_MUTEX}"
 MUTEX_armeb = "${ARM_MUTEX}"
 EXTRA_OECONF += "${MUTEX}"
+EXTRA_OEMAKE_class-target = "LIBTOOL=${STAGING_BINDIR_CROSS}/${HOST_SYS}-libtool"
 
 # Cancel the site stuff - it's set for db3 and destroys the
 # configure.
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 52/73] kexec-tools: Define _GNU_SOURCE for getting loff_t definition
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (50 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 51/73] db: Use cross libtool Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 53/73] pcmciautils: Fix parallel build and include sys/types.h Khem Raj
                   ` (21 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Fixes errors e.g.

vmcore-dmesg/vmcore-dmesg.c:370:32: error: unknown type name 'loff_t'

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0001-vmcore-dmesg-Define-_GNU_SOURCE.patch     | 31 ++++++++++++++++++++++
 meta/recipes-kernel/kexec/kexec-tools_2.0.11.bb    |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0001-vmcore-dmesg-Define-_GNU_SOURCE.patch

diff --git a/meta/recipes-kernel/kexec/kexec-tools/0001-vmcore-dmesg-Define-_GNU_SOURCE.patch b/meta/recipes-kernel/kexec/kexec-tools/0001-vmcore-dmesg-Define-_GNU_SOURCE.patch
new file mode 100644
index 0000000..90c2f6e
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0001-vmcore-dmesg-Define-_GNU_SOURCE.patch
@@ -0,0 +1,31 @@
+From d811875a41b4628040abaada3da29b7b9592e757 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 9 Jan 2016 17:16:16 -0800
+Subject: [PATCH] vmcore-dmesg: Define _GNU_SOURCE
+
+loff_t is guarded with _GNU_SOURCE on some C library implementations
+e.g. musl since this type is not defined by POSIX. Define _GNU_SOURCE to
+include this define, it should help compiling on musl while nothing
+changes for glibc based systems since there _GNU_SOURCE is already
+defined
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ vmcore-dmesg/vmcore-dmesg.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
+index 0364636..a8f56df 100644
+--- a/vmcore-dmesg/vmcore-dmesg.c
++++ b/vmcore-dmesg/vmcore-dmesg.c
+@@ -1,4 +1,5 @@
+ #define _XOPEN_SOURCE 600
++#define _GNU_SOURCE
+ #define _LARGEFILE_SOURCE 1
+ #define _FILE_OFFSET_BITS 64
+ #include <endian.h>
+-- 
+2.7.0
+
diff --git a/meta/recipes-kernel/kexec/kexec-tools_2.0.11.bb b/meta/recipes-kernel/kexec/kexec-tools_2.0.11.bb
index 7173767..5ea6516 100644
--- a/meta/recipes-kernel/kexec/kexec-tools_2.0.11.bb
+++ b/meta/recipes-kernel/kexec/kexec-tools_2.0.11.bb
@@ -7,6 +7,7 @@ SRC_URI += "file://kexec-tools-Refine-kdump-device_tree-sort.patch \
             file://kexec-x32.patch \
             file://0002-powerpc-change-the-memory-size-limit.patch \
             file://0001-purgatory-Pass-r-directly-to-linker.patch \
+            file://0001-vmcore-dmesg-Define-_GNU_SOURCE.patch \
          "
 
 SRC_URI[md5sum] = "86de066859f289048f1b286af6f03f78"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 53/73] pcmciautils: Fix parallel build and include sys/types.h
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (51 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 52/73] kexec-tools: Define _GNU_SOURCE for getting loff_t definition Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 54/73] btrfs-tools: Disable backtrace on musl Khem Raj
                   ` (20 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

parallel build patch was removing dependencies on .c files mistakenly
just adding src/yacc_config.h to dependencies in existing rule should
have fixed the original build race

include sys/types.h in lex_config.l for getting u_long definition

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0001-fix-a-parallel-building-issue.patch        | 18 +++++++-----------
 .../pcmciautils/pcmciautils-018/lex_sys_types.patch | 21 +++++++++++++++++++++
 meta/recipes-bsp/pcmciautils/pcmciautils_018.bb     |  1 +
 3 files changed, 29 insertions(+), 11 deletions(-)
 create mode 100644 meta/recipes-bsp/pcmciautils/pcmciautils-018/lex_sys_types.patch

diff --git a/meta/recipes-bsp/pcmciautils/pcmciautils-018/0001-fix-a-parallel-building-issue.patch b/meta/recipes-bsp/pcmciautils/pcmciautils-018/0001-fix-a-parallel-building-issue.patch
index 7b01040..3125df4 100644
--- a/meta/recipes-bsp/pcmciautils/pcmciautils-018/0001-fix-a-parallel-building-issue.patch
+++ b/meta/recipes-bsp/pcmciautils/pcmciautils-018/0001-fix-a-parallel-building-issue.patch
@@ -26,20 +26,16 @@ Signed-off-by: Roy Li <rongqing.li@windriver.com>
  Makefile | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
 
-diff --git a/Makefile b/Makefile
-index d45fdc3..4c53bc2 100644
---- a/Makefile
-+++ b/Makefile
-@@ -246,8 +246,7 @@ $(PCMCIA_SOCKET_STARTUP): $(LIBC) src/startup.o src/yacc_config.o src/lex_config
+Index: pcmciautils-018/Makefile
+===================================================================
+--- pcmciautils-018.orig/Makefile
++++ pcmciautils-018/Makefile
+@@ -246,7 +246,7 @@ $(PCMCIA_SOCKET_STARTUP): $(LIBC) src/st
  	$(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) src/startup.o src/yacc_config.o src/lex_config.o $(LIB_OBJS) $(ARCH_LIB_OBJS)
  	$(QUIET) $(STRIPCMD) $@
  
 -yacc_config.o lex_config.o: %.o: %.c
--	$(CC) -c -MD -O -pipe $(CPPFLAGS) $<
-+src/lex_config.o:src/yacc_config.h
++yacc_config.o lex_config.o: %.o: %.c src/yacc_config.h
+ 	$(CC) -c -MD -O -pipe $(CPPFLAGS) $<
  
  debugtools: ccdv $(CBDUMP) $(CISDUMP)
- 
--- 
-1.9.1
-
diff --git a/meta/recipes-bsp/pcmciautils/pcmciautils-018/lex_sys_types.patch b/meta/recipes-bsp/pcmciautils/pcmciautils-018/lex_sys_types.patch
new file mode 100644
index 0000000..d4c2bed
--- /dev/null
+++ b/meta/recipes-bsp/pcmciautils/pcmciautils-018/lex_sys_types.patch
@@ -0,0 +1,21 @@
+Include sys/types.h for u_long definition
+
+Fix errors like
+In file included from src/lex_config.l:34:0:
+src/yacc_config.y:45:5: error: unknown type name 'u_long'
+     u_long num;
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+Index: pcmciautils-018/src/lex_config.l
+===================================================================
+--- pcmciautils-018.orig/src/lex_config.l
++++ pcmciautils-018/src/lex_config.l
+@@ -22,6 +22,7 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <syslog.h>
++#include <sys/types.h>
+ 
+ #ifdef HAS_WORDEXP
+ #include <wordexp.h>
diff --git a/meta/recipes-bsp/pcmciautils/pcmciautils_018.bb b/meta/recipes-bsp/pcmciautils/pcmciautils_018.bb
index 6a1c366..5c34081 100644
--- a/meta/recipes-bsp/pcmciautils/pcmciautils_018.bb
+++ b/meta/recipes-bsp/pcmciautils/pcmciautils_018.bb
@@ -2,6 +2,7 @@ require pcmciautils.inc
 
 SRC_URI += "file://makefile_fix.patch \
             file://0001-fix-a-parallel-building-issue.patch \
+            file://lex_sys_types.patch \
 "
 
 SRC_URI[md5sum] = "5d85669b3440baa4532363da6caaf1b4"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 54/73] btrfs-tools: Disable backtrace on musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (52 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 53/73] pcmciautils: Fix parallel build and include sys/types.h Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-22 12:39   ` Burton, Ross
  2016-01-17 11:36 ` [PATCH 55/73] apmd: Fix build with musl Khem Raj
                   ` (19 subsequent siblings)
  73 siblings, 1 reply; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

musl does not support backtrace APIs
include limit.h for PATH_MAX definition

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...001-btrfs-corrupt-blocks-Include-limits.h.patch | 34 ++++++++++++++++++++++
 .../btrfs-tools/btrfs-tools_4.3.1.bb               |  3 ++
 2 files changed, 37 insertions(+)
 create mode 100644 meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-corrupt-blocks-Include-limits.h.patch

diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-corrupt-blocks-Include-limits.h.patch b/meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-corrupt-blocks-Include-limits.h.patch
new file mode 100644
index 0000000..35bd021
--- /dev/null
+++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-corrupt-blocks-Include-limits.h.patch
@@ -0,0 +1,34 @@
+From 57f55247af39173d10c6332bd147a5169c478628 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 9 Jan 2016 18:58:27 -0800
+Subject: [PATCH] btrfs-corrupt-blocks: Include limits.h
+
+limits.h is needed for PATH_MAX definition
+
+Fixes
+| btrfs-corrupt-block.c: In function 'corrupt_dir_item':
+| btrfs-corrupt-block.c:478:12: error: 'PATH_MAX' undeclared (first use in this function)
+|   char name[PATH_MAX];
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ btrfs-corrupt-block.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c
+index 0b26903..c908b7e 100644
+--- a/btrfs-corrupt-block.c
++++ b/btrfs-corrupt-block.c
+@@ -21,6 +21,7 @@
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <getopt.h>
++#include <limits.h>
+ 
+ #include "kerncompat.h"
+ #include "ctree.h"
+-- 
+2.7.0
+
diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools_4.3.1.bb b/meta/recipes-devtools/btrfs-tools/btrfs-tools_4.3.1.bb
index e6b0132..339668c 100644
--- a/meta/recipes-devtools/btrfs-tools/btrfs-tools_4.3.1.bb
+++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools_4.3.1.bb
@@ -15,11 +15,14 @@ DEPENDS = "util-linux attr e2fsprogs lzo acl"
 SRCREV = "7c3394ed9ef2063a7256d4bc078a485b6f826bc5"
 SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git \
            file://fix-parallel.patch \
+           file://0001-btrfs-corrupt-blocks-Include-limits.h.patch \
 "
 
 inherit autotools-brokensep pkgconfig
 
 EXTRA_OECONF += "--disable-documentation"
+EXTRA_OECONF_append_libc-musl = " --disable-backtrace "
+
 
 do_configure_prepend() {
       sh autogen.sh
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 55/73] apmd: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (53 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 54/73] btrfs-tools: Disable backtrace on musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 56/73] nss: Undefine HAVE_SYS_CDEFS_H Khem Raj
                   ` (18 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Fix error like below
| apmd.c:372:41: error: use of undeclared identifier '__WCOREFLAG'
|                                 status = __W_EXITCODE(0, SIGTERM) | __WCOREFLAG;
|                                                                     ^
| apmd.c:392:41: error: use of undeclared identifier '__WCOREFLAG'
|                                 status = __W_EXITCODE(0, SIGTERM) | __WCOREFLAG;

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-bsp/apmd/apmd/wexitcode.patch | 26 ++++++++++++++++++++++++++
 meta/recipes-bsp/apmd/apmd_3.2.2-15.bb     |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 meta/recipes-bsp/apmd/apmd/wexitcode.patch

diff --git a/meta/recipes-bsp/apmd/apmd/wexitcode.patch b/meta/recipes-bsp/apmd/apmd/wexitcode.patch
new file mode 100644
index 0000000..c5faa85
--- /dev/null
+++ b/meta/recipes-bsp/apmd/apmd/wexitcode.patch
@@ -0,0 +1,26 @@
+Define non-posix W* funcitons
+
+C libraries like musl dont define them
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+Index: apmd-3.2.2.orig/apmd.c
+===================================================================
+--- apmd-3.2.2.orig.orig/apmd.c
++++ apmd-3.2.2.orig/apmd.c
+@@ -55,6 +55,14 @@
+ #define MINIMUM_RATE_CALC_TIME  120
+ #endif
+ 
++#ifndef _POSIX_SOURCE
++
++#define	__WCOREFLAG  0200
++#define __WCOREDUMP(x)  (_W_INT(x) & __WCOREFLAG)
++#define	__W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
++
++#endif
++
+ /*
+  * For the verbosity level feature to be useful,
+  * we rely on the fact that syslog.h assigns adjacent
diff --git a/meta/recipes-bsp/apmd/apmd_3.2.2-15.bb b/meta/recipes-bsp/apmd/apmd_3.2.2-15.bb
index 9492c69..a932375 100644
--- a/meta/recipes-bsp/apmd/apmd_3.2.2-15.bb
+++ b/meta/recipes-bsp/apmd/apmd_3.2.2-15.bb
@@ -13,6 +13,7 @@ SRC_URI = "${DEBIAN_MIRROR}/main/a/apmd/apmd_3.2.2.orig.tar.gz;name=tarball \
            file://legacy.patch \
            file://libtool.patch \
            file://unlinux.patch \
+           file://wexitcode.patch \
            file://init \
            file://default \
            file://apmd_proxy \
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 56/73] nss: Undefine HAVE_SYS_CDEFS_H
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (54 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 55/73] apmd: Fix build with musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 57/73] dosfstools: Correct cross-compile CFLAGS and fix build with musl Khem Raj
                   ` (17 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

nss's build system assumes that cdefs.h is always available on linux
which is not the case with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-support/nss/nss_3.19.2.bb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/recipes-support/nss/nss_3.19.2.bb b/meta/recipes-support/nss/nss_3.19.2.bb
index c51b056..d092b18 100644
--- a/meta/recipes-support/nss/nss_3.19.2.bb
+++ b/meta/recipes-support/nss/nss_3.19.2.bb
@@ -41,6 +41,10 @@ TDS = "${S}/tentative-dist-staging"
 
 TARGET_CC_ARCH += "${LDFLAGS}"
 
+do_configure_prepend_libc-musl () {
+    sed -i -e '/-DHAVE_SYS_CDEFS_H/d' ${S}/nss/lib/dbm/config/config.mk
+}
+
 do_compile_prepend_class-native() {
     export NSPR_INCLUDE_DIR=${STAGING_INCDIR_NATIVE}
     export NSPR_LIB_DIR=${STAGING_LIBDIR_NATIVE}
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 57/73] dosfstools: Correct cross-compile CFLAGS and fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (55 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 56/73] nss: Undefine HAVE_SYS_CDEFS_H Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 58/73] fts: Fix linker hash-style option Khem Raj
                   ` (16 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

enable largefile support if its in DISTRO_FEATURES

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0001-mkfs.fat-fix-incorrect-int-type.patch     | 46 ++++++++++++++++++++++
 .../dosfstools/dosfstools/largefile.patch          | 19 +++++++++
 .../dosfstools/dosfstools_3.0.28.bb                |  7 +++-
 3 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/dosfstools/dosfstools/0001-mkfs.fat-fix-incorrect-int-type.patch
 create mode 100644 meta/recipes-devtools/dosfstools/dosfstools/largefile.patch

diff --git a/meta/recipes-devtools/dosfstools/dosfstools/0001-mkfs.fat-fix-incorrect-int-type.patch b/meta/recipes-devtools/dosfstools/dosfstools/0001-mkfs.fat-fix-incorrect-int-type.patch
new file mode 100644
index 0000000..3497ca5
--- /dev/null
+++ b/meta/recipes-devtools/dosfstools/dosfstools/0001-mkfs.fat-fix-incorrect-int-type.patch
@@ -0,0 +1,46 @@
+From 3b95786af13e28157d889bd90a384ee255f2d91d Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <yann.morin.1998@free.fr>
+Date: Sun, 16 Aug 2015 15:55:43 +0200
+Subject: [PATCH] mkfs.fat: fix incorrect int type
+
+u_int32_t is not a stanard type, while uint32_t is. This fixes builds
+with the musl C library, which only defines so-called "clean" headers;
+build failures are like (back-quotes and elision manually added for
+readability):
+
+    http://autobuild.buildroot.org/results/a09/a0923d7f6d4dbae02eba4c5024bbdae3a52aa85a/build-end.log
+
+    /home/peko/autobuild/instance-1/output/host/usr/bin/x86_64-linux-gcc -D_LARGEFILE_SOURCE \
+        -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -Os  -D_GNU_SOURCE -D_LARGEFILE_SOURCE \
+        -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -c -o mkfs.fat.o src/mkfs.fat.c
+    src/mkfs.fat.c: In function 'main':
+    src/mkfs.fat.c:1415:18: error: 'u_int32_t' undeclared (first use in this function)
+         volume_id = (u_int32_t) ((create_timeval.tv_sec << 20) | create_timeval.tv_usec); [...]
+                      ^
+    src/mkfs.fat.c:1415:18: note: each undeclared identifier is reported only once for each
+    function it appears in
+
+Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
+Signed-off-by: Andreas Bombe <aeb@debian.org>
+---
+Upstream-Status: Backport
+
+ src/mkfs.fat.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/mkfs.fat.c b/src/mkfs.fat.c
+index b38d116..dddbe24 100644
+--- a/src/mkfs.fat.c
++++ b/src/mkfs.fat.c
+@@ -1412,7 +1412,7 @@ int main(int argc, char **argv)
+ 
+     gettimeofday(&create_timeval, NULL);
+     create_time = create_timeval.tv_sec;
+-    volume_id = (u_int32_t) ((create_timeval.tv_sec << 20) | create_timeval.tv_usec);	/* Default volume ID = creation time, fudged for more uniqueness */
++    volume_id = (uint32_t) ((create_timeval.tv_sec << 20) | create_timeval.tv_usec);	/* Default volume ID = creation time, fudged for more uniqueness */
+     check_atari();
+ 
+     printf("mkfs.fat " VERSION " (" VERSION_DATE ")\n");
+-- 
+2.7.0
+
diff --git a/meta/recipes-devtools/dosfstools/dosfstools/largefile.patch b/meta/recipes-devtools/dosfstools/dosfstools/largefile.patch
new file mode 100644
index 0000000..7f7d835
--- /dev/null
+++ b/meta/recipes-devtools/dosfstools/dosfstools/largefile.patch
@@ -0,0 +1,19 @@
+defer setting largefile flags to build makery
+in a cross build we can not do runtime config tests
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate[Cross compile Specific]
+Index: dosfstools-3.0.28/Makefile
+===================================================================
+--- dosfstools-3.0.28.orig/Makefile
++++ dosfstools-3.0.28/Makefile
+@@ -27,8 +27,7 @@ SBINDIR = $(PREFIX)/sbin
+ DOCDIR = $(PREFIX)/share/doc
+ MANDIR = $(PREFIX)/share/man
+ 
+-#OPTFLAGS = -O2 -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+-OPTFLAGS = -O2 -fomit-frame-pointer -D_GNU_SOURCE $(shell getconf LFS_CFLAGS)
++OPTFLAGS = -O2 -fomit-frame-pointer
+ #WARNFLAGS = -Wall -pedantic -std=c99
+ WARNFLAGS = -Wall -Wextra -Wno-sign-compare -Wno-missing-field-initializers -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings
+ DEBUGFLAGS = -g
diff --git a/meta/recipes-devtools/dosfstools/dosfstools_3.0.28.bb b/meta/recipes-devtools/dosfstools/dosfstools_3.0.28.bb
index addcbf6..6fc3e41 100644
--- a/meta/recipes-devtools/dosfstools/dosfstools_3.0.28.bb
+++ b/meta/recipes-devtools/dosfstools/dosfstools_3.0.28.bb
@@ -9,12 +9,17 @@ SECTION = "base"
 LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
-SRC_URI = "https://github.com/dosfstools/dosfstools/releases/download/v3.0.28/dosfstools-3.0.28.tar.xz"
+SRC_URI = "https://github.com/dosfstools/dosfstools/releases/download/v3.0.28/dosfstools-3.0.28.tar.xz \
+           file://largefile.patch \
+           file://0001-mkfs.fat-fix-incorrect-int-type.patch \
+          "
 SRC_URI[md5sum] = "6a047a6c65186b9ebb1853709adb36db"
 SRC_URI[sha256sum] = "ee95913044ecf2719b63ea11212917649709a6e53209a72d622135aaa8517ee2"
 
 UPSTREAM_CHECK_URI = "https://github.com/dosfstools/dosfstools/releases"
 
+CFLAGS += "-D_GNU_SOURCE ${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', '', d)}"
+
 FILES_${PN} = "${base_sbindir}"
 FILES_${PN}-doc = "${mandir} ${docdir}"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 58/73] fts: Fix linker hash-style option
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (56 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 57/73] dosfstools: Correct cross-compile CFLAGS and fix build with musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 59/73] musl: Create ld.so as a relative symlink Khem Raj
                   ` (15 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

pass --hash-style explicitly to linker
and ensure that mips does not use gnu hash style
This inoculates fts when compiler does not pass
hash style option e.g. clang

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/fts/fts.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/fts/fts.bb b/meta/recipes-core/fts/fts.bb
index d8b4ed2..2539e5d 100644
--- a/meta/recipes-core/fts/fts.bb
+++ b/meta/recipes-core/fts/fts.bb
@@ -22,9 +22,15 @@ S = "${WORKDIR}/${BPN}"
 
 do_configure[noexec] = "1"
 
+HASHSTYLE_mips = "sysv"
+HASHSTYLE_mipsel = "sysv"
+HASHSTYLE_mips64 = "sysv"
+HASHSTYLE_mips64el = "sysv"
+HASHSTYLE = "gnu"
+
 VER = "0"
 do_compile () {
-    ${CC} -I${S} -fPIC -shared -o libfts.so.${VER} -Wl,-soname,libfts.so.${VER} ${S}/fts.c
+    ${CC} -I${S} -fPIC -shared -Wl,--hash-style=${HASHSTYLE} -o libfts.so.${VER} -Wl,-soname,libfts.so.${VER} ${S}/fts.c
 }
 
 do_install() {
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 59/73] musl: Create ld.so as a relative symlink
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (57 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 58/73] fts: Fix linker hash-style option Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 60/73] bsd-headers: Package cdefs.h Khem Raj
                   ` (14 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

We have rootfs intercepts which fail on musl because ld.so on musl is an
absolute symlink to /usr/lib/libc.so and then it fails to load when run
with qemu user mode.

Fixes rootfs failures like

WARNING: The postinstall intercept hook 'update_pixbuf_cache' failed
(exit code: 255)! See log for details!
WARNING: The postinstalls for the following packages will be postponed
for first boot: libgdk-pixbuf-2.0-loader-jpeg li
bgdk-pixbuf-2.0-loader-png libgdk-pixbuf-2.0-loader-gif
libgdk-pixbuf-2.0-loader-xpm
WARNING: [log_check] core-image-sato: found a warning message in the
logfile (keyword 'WARNING:'):
[log_check] WARNING: The postinstall intercept hook
'update_pixbuf_cache' failed (exit code: 255)! See log for details!

WARNING: [log_check] core-image-sato: found a warning message in the
logfile (keyword 'WARNING:'):
[log_check] WARNING: The postinstalls for the following packages will be
postponed for first boot: libgdk-pixbuf-2.0-lo
ader-jpeg libgdk-pixbuf-2.0-loader-png libgdk-pixbuf-2.0-loader-gif
libgdk-pixbuf-2.0-loader-xpm

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...dynamic-linker-a-relative-symlink-to-libc.patch | 34 ++++++++++++++++++++++
 meta/recipes-core/musl/musl_git.bb                 |  3 +-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-core/musl/files/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch

diff --git a/meta/recipes-core/musl/files/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch b/meta/recipes-core/musl/files/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
new file mode 100644
index 0000000..5490b1c
--- /dev/null
+++ b/meta/recipes-core/musl/files/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
@@ -0,0 +1,34 @@
+From 94c0b97b62125d8bbc92dce0694e387d5b2ad181 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 10 Jan 2016 12:14:02 -0800
+Subject: [PATCH] Make dynamic linker a relative symlink to libc
+
+absolute symlink into $(libdir) fails to load in a cross build
+environment, especially when executing qemu in usermode to run target
+applications, which cross build systems often do, since not everything
+can be computed during cross builds, qemu in usermode often comes to aid
+in such situations to feed into cross builds.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index b2226fa..0d71f7f 100644
+--- a/Makefile
++++ b/Makefile
+@@ -189,7 +189,7 @@ $(DESTDIR)$(includedir)/%: include/%
+ 	$(INSTALL) -D -m 644 $< $@
+ 
+ $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
+-	$(INSTALL) -D -l $(libdir)/libc.so $@ || true
++	$(INSTALL) -D -l ..$(libdir)/libc.so $@ || true
+ 
+ install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
+ 
+-- 
+2.7.0
+
diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
index 5b94d1f..8970307 100644
--- a/meta/recipes-core/musl/musl_git.bb
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -10,6 +10,7 @@ PV = "1.1.12+git${SRCPV}"
 # mirror is at git://github.com/kraj/musl.git
 
 SRC_URI = "git://git.musl-libc.org/musl \
+           file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \
           "
 
 S = "${WORKDIR}/git"
@@ -49,7 +50,7 @@ do_install() {
 	oe_runmake install DESTDIR='${D}'
 
 	install -d ${D}${bindir}
-	ln -s ${libdir}/libc.so ${D}${bindir}/ldd
+	ln -s ../../${libdir}/libc.so ${D}${bindir}/ldd
 }
 
 RDEPENDS_${PN}-dev = "linux-libc-headers-dev"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 60/73] bsd-headers: Package cdefs.h
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (58 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 59/73] musl: Create ld.so as a relative symlink Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 61/73] guile: Fix build with musl Khem Raj
                   ` (13 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Its used in several packages

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/bsd-headers/bsd-headers.bb       |  2 ++
 .../bsd-headers/bsd-headers/sys-cdefs.h            | 26 ++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-cdefs.h

diff --git a/meta/recipes-core/bsd-headers/bsd-headers.bb b/meta/recipes-core/bsd-headers/bsd-headers.bb
index ae659ab..12a2cca 100644
--- a/meta/recipes-core/bsd-headers/bsd-headers.bb
+++ b/meta/recipes-core/bsd-headers/bsd-headers.bb
@@ -7,6 +7,7 @@ SECTION = "devel"
 
 SRC_URI = "file://sys-queue.h \
            file://sys-tree.h \
+           file://sys-cdefs.h \
           "
 do_configure[noexec] = "1"
 do_compile[noexec] = "1"
@@ -18,6 +19,7 @@ S = "${WORKDIR}"
 do_install() {
 	install -Dm 0644 ${S}/sys-queue.h ${D}${includedir}/sys/queue.h
 	install -Dm 0644 ${S}/sys-tree.h ${D}${includedir}/sys/tree.h
+	install -Dm 0644 ${S}/sys-cdefs.h ${D}${includedir}/sys/cdefs.h
 }
 #
 # We will skip parsing for non-musl systems
diff --git a/meta/recipes-core/bsd-headers/bsd-headers/sys-cdefs.h b/meta/recipes-core/bsd-headers/bsd-headers/sys-cdefs.h
new file mode 100644
index 0000000..209a623
--- /dev/null
+++ b/meta/recipes-core/bsd-headers/bsd-headers/sys-cdefs.h
@@ -0,0 +1,26 @@
+#warning usage of non-standard #include <sys/cdefs.h> is deprecated
+
+#undef __P
+#undef __PMT
+
+#define __P(args)	args
+#define __PMT(args)	args
+
+#define __CONCAT(x,y)	x ## y
+#define __STRING(x)	#x
+
+#ifdef  __cplusplus
+# define __BEGIN_DECLS	extern "C" {
+# define __END_DECLS	}
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
+
+#if defined(__GNUC__) && !defined(__cplusplus)
+# define __THROW	__attribute__ ((__nothrow__))
+# define __NTH(fct)	__attribute__ ((__nothrow__)) fct
+#else
+# define __THROW
+# define __NTH(fct)     fct
+#endif
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 61/73] guile: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (59 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 60/73] bsd-headers: Package cdefs.h Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 62/73] unfs3: Depend on libtirpc when building on musl Khem Raj
                   ` (12 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

strol_l is not available on musl
delete charset.alias as well its not needed

Use internal gc function on musl

We get errors on certain functions not being available in boeheme gc
when built with musl. Therefore use the internal versions
e.g.

Undefined gc_set_finalizer_notifier

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...guile-Check-for-strtol_l-during-configure.patch | 56 ++++++++++++++++++++++
 meta/recipes-devtools/guile/guile_2.0.11.bb        | 12 +++++
 2 files changed, 68 insertions(+)
 create mode 100644 meta/recipes-devtools/guile/files/0001-libguile-Check-for-strtol_l-during-configure.patch

diff --git a/meta/recipes-devtools/guile/files/0001-libguile-Check-for-strtol_l-during-configure.patch b/meta/recipes-devtools/guile/files/0001-libguile-Check-for-strtol_l-during-configure.patch
new file mode 100644
index 0000000..24f073f
--- /dev/null
+++ b/meta/recipes-devtools/guile/files/0001-libguile-Check-for-strtol_l-during-configure.patch
@@ -0,0 +1,56 @@
+From 814d6fb6c1f4a544c8fd37f5a390ba020c2d8c85 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 10 Jan 2016 22:28:17 +0000
+Subject: [PATCH] libguile: Check for strtol_l during configure
+
+strtol_l is a gnu extention which may not be available on other linux
+libc implementations e.g. musl. Therefore check for this funciton and
+conditionalize the use of it.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ configure.ac    | 5 +++--
+ libguile/i18n.c | 2 +-
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 3969929..f8a6a1a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -752,7 +752,8 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
+ #   truncate - not in mingw
+ #   isblank - available as a GNU extension or in C99
+ #   _NSGetEnviron - Darwin specific
+-#   strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
++#   strcoll_l, newlocale, strtol_l - GNU extensions (glibc),
++#                                    also available on Darwin
+ #   fork - unavailable on Windows
+ #   utimensat - posix.1-2008
+ #   sched_getaffinity, sched_setaffinity - GNU extensions (glibc)
+@@ -768,7 +769,7 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid		\
+   getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp	\
+   index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron	\
+   strcoll strcoll_l newlocale utimensat sched_getaffinity		\
+-  sched_setaffinity sendfile])
++  sched_setaffinity sendfile strtol_l])
+ 
+ AM_CONDITIONAL([BUILD_ICE_9_POPEN],
+   [test "x$enable_posix" = "xyes" && test "x$ac_cv_func_fork" = "xyes"])
+diff --git a/libguile/i18n.c b/libguile/i18n.c
+index 97d44b0..9fb6976 100644
+--- a/libguile/i18n.c
++++ b/libguile/i18n.c
+@@ -1352,7 +1352,7 @@ SCM_DEFINE (scm_locale_string_to_integer, "locale-string->integer",
+ 
+   if (c_locale != NULL)
+     {
+-#ifdef USE_GNU_LOCALE_API
++#if defined(USE_GNU_LOCALE_API) && defined(HAVE_STRTOL_L)
+       c_result = strtol_l (c_str, &c_endptr, c_base, c_locale);
+ #else
+       RUN_IN_LOCALE_SECTION (c_locale,
+-- 
+2.7.0
+
diff --git a/meta/recipes-devtools/guile/guile_2.0.11.bb b/meta/recipes-devtools/guile/guile_2.0.11.bb
index 413c81d..6815e25 100644
--- a/meta/recipes-devtools/guile/guile_2.0.11.bb
+++ b/meta/recipes-devtools/guile/guile_2.0.11.bb
@@ -24,6 +24,7 @@ SRC_URI = "${GNU_MIRROR}/guile/guile-${PV}.tar.xz \
            file://libguile-Makefile.am-hook.patch \
            file://libguile-VM-ASM_MUL-for-ARM-Add-earlyclobber.patch \
            file://remove_strcase_l_funcs.patch \
+           file://0001-libguile-Check-for-strtol_l-during-configure.patch \
            "
 
 #           file://debian/0001-Change-guile-to-guile-X.Y-for-info-pages.patch
@@ -52,6 +53,13 @@ EXTRA_OECONF_append_class-target = " --with-libunistring-prefix=${STAGING_LIBDIR
                                      --with-libgmp-prefix=${STAGING_LIBDIR} \
                                      --with-libltdl-prefix=${STAGING_LIBDIR}"
 EXTRA_OECONF_append_libc-uclibc = " guile_cv_use_csqrt=no "
+
+CFLAGS_append_libc-musl = " -DHAVE_GC_SET_FINALIZER_NOTIFIER \
+	                    -DHAVE_GC_GET_HEAP_USAGE_SAFE \
+	                    -DHAVE_GC_GET_FREE_SPACE_DIVISOR \
+	                    -DHAVE_GC_SET_FINALIZE_ON_DEMAND \
+                           "
+
 do_configure_prepend() {
 	mkdir -p po
 }
@@ -77,6 +85,10 @@ do_install_append_class-target() {
 	sed -i -e 's:${STAGING_DIR_TARGET}::g' ${D}${libdir}/pkgconfig/guile-2.0.pc
 }
 
+do_install_append_libc-musl() {
+	rm -f ${D}${libdir}/charset.alias
+}
+
 SYSROOT_PREPROCESS_FUNCS = "guile_cross_config"
 
 guile_cross_config() {
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 62/73] unfs3: Depend on libtirpc when building on musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (60 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 61/73] guile: Fix build with musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 63/73] uclibc: Update to 1.0.11 Khem Raj
                   ` (11 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

needs a rpc implementation

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb b/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb
index 7e9d659..eba1139 100644
--- a/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb
+++ b/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb
@@ -9,11 +9,9 @@ RECIPE_UPSTREAM_DATE = "Oct 08, 2015"
 CHECK_DATE = "Dec 10, 2015"
 
 DEPENDS = "flex-native bison-native flex"
+DEPENDS_append_libc-musl = " libtirpc "
 DEPENDS_append_class-nativesdk += "flex-nativesdk"
 
-SRC_URI[md5sum] = "3687acc4ee992e536472365dd99712a7"
-SRC_URI[sha256sum] = "274b43ada9c6eea1da26eb7010d72889c5278984ba0b50dff4e093057d4d64f8"
-
 MOD_PV = "497"
 S = "${WORKDIR}/trunk"
 SRC_URI = "svn://svn.code.sf.net/p/unfs3/code;module=trunk;rev=${MOD_PV};protocol=http \
@@ -25,10 +23,14 @@ SRC_URI = "svn://svn.code.sf.net/p/unfs3/code;module=trunk;rev=${MOD_PV};protoco
            file://relative_max_socket_path_len.patch \
            file://tcp_no_delay.patch \
           "
+SRC_URI[md5sum] = "3687acc4ee992e536472365dd99712a7"
+SRC_URI[sha256sum] = "274b43ada9c6eea1da26eb7010d72889c5278984ba0b50dff4e093057d4d64f8"
+
 BBCLASSEXTEND = "native nativesdk"
 
 inherit autotools
 EXTRA_OECONF_append_class-native = " --sbindir=${bindir}"
+CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
 
 # Turn off these header detects else the inode search
 # will walk entire file systems and this is a real problem
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 63/73] uclibc: Update to 1.0.11
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (61 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 62/73] unfs3: Depend on libtirpc when building on musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 64/73] acpid: Fix build on musl Khem Raj
                   ` (10 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

changes are here

http://mailman.uclibc-ng.org/pipermail/devel/2016-January/000665.html

Drop upstreamed patch

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/uclibc/uclibc-git.inc            |    5 +-
 .../uclibc-git/0003-Add-argp-implementation.patch  | 5811 --------------------
 2 files changed, 2 insertions(+), 5814 deletions(-)
 delete mode 100644 meta/recipes-core/uclibc/uclibc-git/0003-Add-argp-implementation.patch

diff --git a/meta/recipes-core/uclibc/uclibc-git.inc b/meta/recipes-core/uclibc/uclibc-git.inc
index a5c4b5e..490dfcb 100644
--- a/meta/recipes-core/uclibc/uclibc-git.inc
+++ b/meta/recipes-core/uclibc/uclibc-git.inc
@@ -1,12 +1,11 @@
-SRCREV = "0ad73077c230093ae004829da44418597f330c6a"
+SRCREV = "94493929f674f4410c2743fa3dd82fd37b70c58f"
 
-PV = "1.0.10+git${SRCPV}"
+PV = "1.0.11+git${SRCPV}"
 
 FILESEXTRAPATHS =. "${FILE_DIRNAME}/uclibc-git:"
 
 SRC_URI = "git://uclibc-ng.org/git/uclibc-ng;branch=1.0 \
         file://0001-Disable-lrount_tes-function.patch \
-        file://0003-Add-argp-implementation.patch \
         file://uClibc.machine \
         file://uClibc.distro \
         file://obstack.cfg \
diff --git a/meta/recipes-core/uclibc/uclibc-git/0003-Add-argp-implementation.patch b/meta/recipes-core/uclibc/uclibc-git/0003-Add-argp-implementation.patch
deleted file mode 100644
index ee94483..0000000
--- a/meta/recipes-core/uclibc/uclibc-git/0003-Add-argp-implementation.patch
+++ /dev/null
@@ -1,5811 +0,0 @@
-From eaae816fb22929469aa4cc3402b91b512fc69549 Mon Sep 17 00:00:00 2001
-From: Salvatore Cro <salvatore.cro@st.com>
-Date: Sun, 16 Aug 2015 20:53:37 -0700
-Subject: [PATCH 3/7] Add argp implementation
-
-Argp is an advanced support for parsing unix-style argument vectors.
-In addition to the common getopt interface, it provides automatic
-response
-to `--help' and `--version' options and use of custom parser in
-conjunction
-with argp native option parser, among others.
-Argp support is required by elfutils package and prelink.
-
-In uClibc argp functionalities has been moved from C library to
-libuargp.so
-Further the libc.so linker script contains an AS_NEEDED entry so that
-it doesn't need to link libuargp.so explicitely.
-
-Signed-off-by: Salvatore Cro <salvatore.cro@st.com>
-Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
-Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- Makefile.in                                 |    9 +
- Makerules                                   |    7 +-
- Rules.mak                                   |   13 +
- extra/Configs/Config.in                     |   17 +
- include/argp.h                              |  566 ++++++++
- libc/sysdeps/linux/common/bits/getopt_int.h |  136 ++
- libc/unistd/getopt.c                        |   19 +-
- libuargp/Makefile                           |   14 +
- libuargp/Makefile.in                        |   73 ++
- libuargp/argp-ba.c                          |   26 +
- libuargp/argp-eexst.c                       |   32 +
- libuargp/argp-fmtstream.c                   |  439 +++++++
- libuargp/argp-fmtstream.h                   |  314 +++++
- libuargp/argp-fs-xinl.c                     |   44 +
- libuargp/argp-help.c                        | 1882 +++++++++++++++++++++++++++
- libuargp/argp-parse.c                       |  949 ++++++++++++++
- libuargp/argp-pv.c                          |   25 +
- libuargp/argp-pvh.c                         |   32 +
- libuargp/argp-xinl.c                        |   35 +
- test/argp/Makefile                          |    7 +
- test/argp/Makefile.in                       |   12 +
- test/argp/argp-ex1.c                        |   15 +
- test/argp/argp-ex2.c                        |   45 +
- test/argp/argp-ex3.c                        |  153 +++
- test/argp/argp-ex4.c                        |  167 +++
- test/argp/argp-test.c                       |  209 +++
- test/argp/bug-argp1.c                       |   26 +
- test/argp/tst-argp1.c                       |  118 ++
- test/argp/tst-argp2.c                       |  101 ++
- 29 files changed, 5481 insertions(+), 4 deletions(-)
- create mode 100644 include/argp.h
- create mode 100644 libc/sysdeps/linux/common/bits/getopt_int.h
- create mode 100644 libuargp/Makefile
- create mode 100644 libuargp/Makefile.in
- create mode 100644 libuargp/argp-ba.c
- create mode 100644 libuargp/argp-eexst.c
- create mode 100644 libuargp/argp-fmtstream.c
- create mode 100644 libuargp/argp-fmtstream.h
- create mode 100644 libuargp/argp-fs-xinl.c
- create mode 100644 libuargp/argp-help.c
- create mode 100644 libuargp/argp-parse.c
- create mode 100644 libuargp/argp-pv.c
- create mode 100644 libuargp/argp-pvh.c
- create mode 100644 libuargp/argp-xinl.c
- create mode 100644 test/argp/Makefile
- create mode 100644 test/argp/Makefile.in
- create mode 100644 test/argp/argp-ex1.c
- create mode 100644 test/argp/argp-ex2.c
- create mode 100644 test/argp/argp-ex3.c
- create mode 100644 test/argp/argp-ex4.c
- create mode 100644 test/argp/argp-test.c
- create mode 100644 test/argp/bug-argp1.c
- create mode 100644 test/argp/tst-argp1.c
- create mode 100644 test/argp/tst-argp2.c
-
-diff --git a/Makefile.in b/Makefile.in
-index 04671a4..a450af9 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -39,6 +39,7 @@ include $(top_srcdir)libresolv/Makefile.in
- include $(top_srcdir)libutil/Makefile.in
- include $(top_srcdir)libpthread/Makefile.in
- include $(top_srcdir)librt/Makefile.in
-+include $(top_srcdir)libuargp/Makefile.in
- include $(top_srcdir)libubacktrace/Makefile.in
- 
- # last included to catch all the objects added by others (locales/threads)
-@@ -262,6 +263,7 @@ HEADERS_RM- += sgtty.h
- endif
- HEADERS_RM-$(HAVE_SHARED)                    += dlfcn.h bits/dlfcn.h
- HEADERS_RM-$(PTHREADS_DEBUG_SUPPORT)         += thread_db.h
-+HEADERS_RM-$(UCLIBC_HAS_ARGP)                += argp.h
- HEADERS_RM-$(UCLIBC_HAS_BSD_ERR)             += err.h
- HEADERS_RM-$(UCLIBC_HAS_CRYPT)               += crypt.h
- HEADERS_RM-$(UCLIBC_HAS_EPOLL)               += sys/epoll.h
-@@ -386,6 +388,13 @@ else
- 	-$(INSTALL) -m 755 $(top_builddir)lib/libc.so $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/
- endif
- 	echo "$(UBACKTRACE_ASNEEDED)" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so
-+ifeq ($(UCLIBC_HAS_ARGP),y)
-+# Add the AS_NEEDED entry for libuargp.so
-+	if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_MAJORNAME) ] ; then \
-+		echo "GROUP ( $(UARGP_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \
-+	fi
-+endif
-+
- ifeq ($(UCLIBC_HAS_THREADS),y)
- ifneq ($(LINUXTHREADS_OLD),y)
- ifeq ($(HARDWIRED_ABSPATH),y)
-diff --git a/Makerules b/Makerules
-index d6f7e24..e70050d 100644
---- a/Makerules
-+++ b/Makerules
-@@ -48,6 +48,7 @@ $(eval $(call add_IS_IN_lib,libresolv,$(libresolv-a-y) $(libresolv-so-y)))
- $(eval $(call add_IS_IN_lib,librt,$(librt-a-y) $(librt-so-y)))
- $(eval $(call add_IS_IN_lib,libutil,$(libutil-a-y) $(libutil-so-y)))
- $(eval $(call add_IS_IN_lib,libubacktrace,$(libubacktrace-a-y) $(libubacktrace-so-y)))
-+$(eval $(call add_IS_IN_lib,libuargp,$(libuargp-a-y) $(libuargp-so-y)))
- 
- shared_objs = $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y) \
- 	$(libcrypt-so-y) $(libdl-so-y) \
-@@ -55,12 +56,12 @@ shared_objs = $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y) \
- 	$(libpthread-so-y) $(libpthread-nonshared-y) $(libthread_db-so-y) \
- 	$(libresolv-so-y) $(librt-so-y) \
- 	$(ldso-y) \
--	$(libutil-so-y) $(libubacktrace-so-y)
-+	$(libutil-so-y) $(libubacktrace-so-y) $(libuargp-so-y)
- 
- ar_objs =  $(libc-y) $(libc-static-y) $(libcrypt-a-y) \
- 	$(libdl-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y) \
- 	$(libpthread-a-y) $(libthread_db-a-y) \
--	$(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y)
-+	$(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y) $(libuargp-a-y)
- ifeq ($(DOPIC),y)
- ar_objs := $(ar_objs:.o=.os)
- endif
-@@ -498,7 +499,7 @@ files.dep := $(libc-a-y) $(libc-so-y) $(libc-nonshared-y) \
- 	$(librt-a-y) $(librt-so-y)  $(libresolv-a-y) $(libresolv-so-y) \
- 	$(libcrypt-a-y) $(libcrypt-so-y) $(libutil-a-y) $(libutil-so-y) \
- 	$(libnsl-a-y) $(libnsl-so-y) $(ldso-y) $(libdl-a-y) $(libdl-so-y) \
--	$(libubacktrace-a-y) $(libubacktrace-so-y)
-+	$(libubacktrace-a-y) $(libubacktrace-so-y) $(libuargp-so-y) $(libuargp-a-y)
- .depends.dep := \
- 	$(patsubst %.s,%.s.dep,$(filter %.s,$(files.dep))) \
- 	$(patsubst %.o,%.o.dep,$(filter %.o,$(files.dep))) \
-diff --git a/Rules.mak b/Rules.mak
-index de9ffb3..a2baf58 100644
---- a/Rules.mak
-+++ b/Rules.mak
-@@ -602,6 +602,19 @@ export UBACKTRACE_ASNEEDED:=$(shell $(CC) -Wl,--help 2>/dev/null | grep -q -- --
- else
- export UBACKTRACE_ASNEEDED:=""
- endif
-+ifeq ($(UCLIBC_HAS_ARGP),y)
-+ifeq ($(HARDWIRED_ABSPATH),y)
-+# Only used in installed libc.so linker script
-+UARGP_FULL_NAME := $(subst //,/,$(RUNTIME_PREFIX)$(MULTILIB_DIR)/libuargp.so.$(MAJOR_VERSION))
-+else
-+UARGP_FULL_NAME := libuargp.so.$(MAJOR_VERSION)
-+endif
-+export UARGP_ASNEEDED:=$(shell $(CC) -Wl,--help 2>/dev/null | grep -q -- --as-needed && \
-+	echo "GROUP ( AS_NEEDED ( $(UARGP_FULL_NAME) ) )" || \
-+	echo "GROUP ( $(UARGP_FULL_NAME) )")
-+else
-+export UARGP_ASNEEDED:=""
-+endif
- endif
- 
- # Add a bunch of extra pedantic annoyingly strict checks
-diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
-index 242e45a..b36d4c9 100644
---- a/extra/Configs/Config.in
-+++ b/extra/Configs/Config.in
-@@ -1943,6 +1943,23 @@ config UCLIBC_HAS_GNU_GETSUBOPT
- 	  Answer Y if you want to include getsubopt().
- 
- 	  Most people will answer Y.
-+
-+config UCLIBC_HAS_ARGP
-+       bool "Support argp (as standalone shared object)"
-+       default n
-+       help
-+         Argp is an interface for parsing unix-style argument vectors. Unlike
-+         the common getopt interface, it provides many advanced features in
-+         addition to parsing options, such as automatic output in response to
-+         `--help' and `--version' options.
-+         A library can export an argp option parser, which programs can easily
-+         use in conjunction with their own option parser.
-+         A new shared object "libuargp" is created. The "libc.so" linker script
-+         contains the AS_NEEDED entry for getting the libuargp linked automatically.
-+         Argp support is needed by elfutils libdw.
-+
-+         Most people can safely answer N.
-+
- endmenu
- 
- 
-diff --git a/include/argp.h b/include/argp.h
-new file mode 100644
-index 0000000..9d53728
---- /dev/null
-+++ b/include/argp.h
-@@ -0,0 +1,566 @@
-+/* Hierarchial argument parsing, layered over getopt.
-+   Copyright (C) 1995-1999, 2003, 2004, 2005, 2006, 2007, 2009
-+   Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.
-+
-+   Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
-+*/
-+
-+#ifndef _ARGP_H
-+#define _ARGP_H
-+
-+#include <stdio.h>
-+#include <ctype.h>
-+#include <limits.h>
-+
-+#define __need_error_t
-+#include <errno.h>
-+
-+#ifndef __const
-+# define __const const
-+#endif
-+
-+#ifndef __THROW
-+# define __THROW
-+#endif
-+#ifndef __NTH
-+# define __NTH(fct) fct __THROW
-+#endif
-+
-+#ifndef __attribute__
-+/* This feature is available in gcc versions 2.5 and later.  */
-+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__)
-+#  define __attribute__(Spec) /* empty */
-+# endif
-+/* The __-protected variants of `format' and `printf' attributes
-+   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
-+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__)
-+#  define __format__ format
-+#  define __printf__ printf
-+# endif
-+#endif
-+
-+/* GCC 2.95 and later have "__restrict"; C99 compilers have
-+   "restrict", and "configure" may have defined "restrict".  */
-+#ifndef __restrict
-+# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
-+#  if defined restrict || 199901L <= __STDC_VERSION__
-+#   define __restrict restrict
-+#  else
-+#   define __restrict
-+#  endif
-+# endif
-+#endif
-+
-+#ifndef __error_t_defined
-+typedef int error_t;
-+# define __error_t_defined
-+#endif
-+\f
-+#ifdef  __cplusplus
-+extern "C" {
-+#endif
-+
-+/* A description of a particular option.  A pointer to an array of
-+   these is passed in the OPTIONS field of an argp structure.  Each option
-+   entry can correspond to one long option and/or one short option; more
-+   names for the same option can be added by following an entry in an option
-+   array with options having the OPTION_ALIAS flag set.  */
-+struct argp_option
-+{
-+  /* The long option name.  For more than one name for the same option, you
-+     can use following options with the OPTION_ALIAS flag set.  */
-+  __const char *name;
-+
-+  /* What key is returned for this option.  If > 0 and printable, then it's
-+     also accepted as a short option.  */
-+  int key;
-+
-+  /* If non-NULL, this is the name of the argument associated with this
-+     option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */
-+  __const char *arg;
-+
-+  /* OPTION_ flags.  */
-+  int flags;
-+
-+  /* The doc string for this option.  If both NAME and KEY are 0, This string
-+     will be printed outdented from the normal option column, making it
-+     useful as a group header (it will be the first thing printed in its
-+     group); in this usage, it's conventional to end the string with a `:'.  */
-+  __const char *doc;
-+
-+  /* The group this option is in.  In a long help message, options are sorted
-+     alphabetically within each group, and the groups presented in the order
-+     0, 1, 2, ..., n, -m, ..., -2, -1.  Every entry in an options array with
-+     if this field 0 will inherit the group number of the previous entry, or
-+     zero if it's the first one, unless its a group header (NAME and KEY both
-+     0), in which case, the previous entry + 1 is the default.  Automagic
-+     options such as --help are put into group -1.  */
-+  int group;
-+};
-+
-+/* The argument associated with this option is optional.  */
-+#define OPTION_ARG_OPTIONAL	0x1
-+
-+/* This option isn't displayed in any help messages.  */
-+#define OPTION_HIDDEN	       	0x2
-+
-+/* This option is an alias for the closest previous non-alias option.  This
-+   means that it will be displayed in the same help entry, and will inherit
-+   fields other than NAME and KEY from the aliased option.  */
-+#define OPTION_ALIAS		0x4
-+
-+/* This option isn't actually an option (and so should be ignored by the
-+   actual option parser), but rather an arbitrary piece of documentation that
-+   should be displayed in much the same manner as the options.  If this flag
-+   is set, then the option NAME field is displayed unmodified (e.g., no `--'
-+   prefix is added) at the left-margin (where a *short* option would normally
-+   be displayed), and the documentation string in the normal place.  For
-+   purposes of sorting, any leading whitespace and punctuation is ignored,
-+   except that if the first non-whitespace character is not `-', this entry
-+   is displayed after all options (and OPTION_DOC entries with a leading `-')
-+   in the same group.  */
-+#define OPTION_DOC		0x8
-+
-+/* This option shouldn't be included in `long' usage messages (but is still
-+   included in help messages).  This is mainly intended for options that are
-+   completely documented in an argp's ARGS_DOC field, in which case including
-+   the option in the generic usage list would be redundant.  For instance,
-+   if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to
-+   distinguish these two cases, -x should probably be marked
-+   OPTION_NO_USAGE.  */
-+#define OPTION_NO_USAGE		0x10
-+\f
-+struct argp;			/* fwd declare this type */
-+struct argp_state;		/* " */
-+struct argp_child;		/* " */
-+
-+/* The type of a pointer to an argp parsing function.  */
-+typedef error_t (*argp_parser_t) (int __key, char *__arg,
-+				  struct argp_state *__state);
-+
-+/* What to return for unrecognized keys.  For special ARGP_KEY_ keys, such
-+   returns will simply be ignored.  For user keys, this error will be turned
-+   into EINVAL (if the call to argp_parse is such that errors are propagated
-+   back to the user instead of exiting); returning EINVAL itself would result
-+   in an immediate stop to parsing in *all* cases.  */
-+#define ARGP_ERR_UNKNOWN	E2BIG /* Hurd should never need E2BIG.  XXX */
-+
-+/* Special values for the KEY argument to an argument parsing function.
-+   ARGP_ERR_UNKNOWN should be returned if they aren't understood.
-+
-+   The sequence of keys to a parsing function is either (where each
-+   uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key):
-+
-+       INIT opt... NO_ARGS END SUCCESS  -- No non-option arguments at all
-+   or  INIT (opt | ARG)... END SUCCESS  -- All non-option args parsed
-+   or  INIT (opt | ARG)... SUCCESS      -- Some non-option arg unrecognized
-+
-+   The third case is where every parser returned ARGP_KEY_UNKNOWN for an
-+   argument, in which case parsing stops at that argument (returning the
-+   unparsed arguments to the caller of argp_parse if requested, or stopping
-+   with an error message if not).
-+
-+   If an error occurs (either detected by argp, or because the parsing
-+   function returned an error value), then the parser is called with
-+   ARGP_KEY_ERROR, and no further calls are made.  */
-+
-+/* This is not an option at all, but rather a command line argument.  If a
-+   parser receiving this key returns success, the fact is recorded, and the
-+   ARGP_KEY_NO_ARGS case won't be used.  HOWEVER, if while processing the
-+   argument, a parser function decrements the NEXT field of the state it's
-+   passed, the option won't be considered processed; this is to allow you to
-+   actually modify the argument (perhaps into an option), and have it
-+   processed again.  */
-+#define ARGP_KEY_ARG		0
-+/* There are remaining arguments not parsed by any parser, which may be found
-+   starting at (STATE->argv + STATE->next).  If success is returned, but
-+   STATE->next left untouched, it's assumed that all arguments were consume,
-+   otherwise, the parser should adjust STATE->next to reflect any arguments
-+   consumed.  */
-+#define ARGP_KEY_ARGS		0x1000006
-+/* There are no more command line arguments at all.  */
-+#define ARGP_KEY_END		0x1000001
-+/* Because it's common to want to do some special processing if there aren't
-+   any non-option args, user parsers are called with this key if they didn't
-+   successfully process any non-option arguments.  Called just before
-+   ARGP_KEY_END (where more general validity checks on previously parsed
-+   arguments can take place).  */
-+#define ARGP_KEY_NO_ARGS	0x1000002
-+/* Passed in before any parsing is done.  Afterwards, the values of each
-+   element of the CHILD_INPUT field, if any, in the state structure is
-+   copied to each child's state to be the initial value of the INPUT field.  */
-+#define ARGP_KEY_INIT		0x1000003
-+/* Use after all other keys, including SUCCESS & END.  */
-+#define ARGP_KEY_FINI		0x1000007
-+/* Passed in when parsing has successfully been completed (even if there are
-+   still arguments remaining).  */
-+#define ARGP_KEY_SUCCESS	0x1000004
-+/* Passed in if an error occurs.  */
-+#define ARGP_KEY_ERROR		0x1000005
-+
-+/* An argp structure contains a set of options declarations, a function to
-+   deal with parsing one, documentation string, a possible vector of child
-+   argp's, and perhaps a function to filter help output.  When actually
-+   parsing options, getopt is called with the union of all the argp
-+   structures chained together through their CHILD pointers, with conflicts
-+   being resolved in favor of the first occurrence in the chain.  */
-+struct argp
-+{
-+  /* An array of argp_option structures, terminated by an entry with both
-+     NAME and KEY having a value of 0.  */
-+  __const struct argp_option *options;
-+
-+  /* What to do with an option from this structure.  KEY is the key
-+     associated with the option, and ARG is any associated argument (NULL if
-+     none was supplied).  If KEY isn't understood, ARGP_ERR_UNKNOWN should be
-+     returned.  If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then
-+     parsing is stopped immediately, and that value is returned from
-+     argp_parse().  For special (non-user-supplied) values of KEY, see the
-+     ARGP_KEY_ definitions below.  */
-+  argp_parser_t parser;
-+
-+  /* A string describing what other arguments are wanted by this program.  It
-+     is only used by argp_usage to print the `Usage:' message.  If it
-+     contains newlines, the strings separated by them are considered
-+     alternative usage patterns, and printed on separate lines (lines after
-+     the first are prefix by `  or: ' instead of `Usage:').  */
-+  __const char *args_doc;
-+
-+  /* If non-NULL, a string containing extra text to be printed before and
-+     after the options in a long help message (separated by a vertical tab
-+     `\v' character).  */
-+  __const char *doc;
-+
-+  /* A vector of argp_children structures, terminated by a member with a 0
-+     argp field, pointing to child argps should be parsed with this one.  Any
-+     conflicts are resolved in favor of this argp, or early argps in the
-+     CHILDREN list.  This field is useful if you use libraries that supply
-+     their own argp structure, which you want to use in conjunction with your
-+     own.  */
-+  __const struct argp_child *children;
-+
-+  /* If non-zero, this should be a function to filter the output of help
-+     messages.  KEY is either a key from an option, in which case TEXT is
-+     that option's help text, or a special key from the ARGP_KEY_HELP_
-+     defines, below, describing which other help text TEXT is.  The function
-+     should return either TEXT, if it should be used as-is, a replacement
-+     string, which should be malloced, and will be freed by argp, or NULL,
-+     meaning `print nothing'.  The value for TEXT is *after* any translation
-+     has been done, so if any of the replacement text also needs translation,
-+     that should be done by the filter function.  INPUT is either the input
-+     supplied to argp_parse, or NULL, if argp_help was called directly.  */
-+  char *(*help_filter) (int __key, __const char *__text, void *__input);
-+
-+  /* If non-zero the strings used in the argp library are translated using
-+     the domain described by this string.  Otherwise the currently installed
-+     default domain is used.  */
-+  const char *argp_domain;
-+};
-+
-+/* Possible KEY arguments to a help filter function.  */
-+#define ARGP_KEY_HELP_PRE_DOC	0x2000001 /* Help text preceeding options. */
-+#define ARGP_KEY_HELP_POST_DOC	0x2000002 /* Help text following options. */
-+#define ARGP_KEY_HELP_HEADER	0x2000003 /* Option header string. */
-+#define ARGP_KEY_HELP_EXTRA	0x2000004 /* After all other documentation;
-+					     TEXT is NULL for this key.  */
-+/* Explanatory note emitted when duplicate option arguments have been
-+   suppressed.  */
-+#define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005
-+#define ARGP_KEY_HELP_ARGS_DOC	0x2000006 /* Argument doc string.  */
-+\f
-+/* When an argp has a non-zero CHILDREN field, it should point to a vector of
-+   argp_child structures, each of which describes a subsidiary argp.  */
-+struct argp_child
-+{
-+  /* The child parser.  */
-+  __const struct argp *argp;
-+
-+  /* Flags for this child.  */
-+  int flags;
-+
-+  /* If non-zero, an optional header to be printed in help output before the
-+     child options.  As a side-effect, a non-zero value forces the child
-+     options to be grouped together; to achieve this effect without actually
-+     printing a header string, use a value of "".  */
-+  __const char *header;
-+
-+  /* Where to group the child options relative to the other (`consolidated')
-+     options in the parent argp; the values are the same as the GROUP field
-+     in argp_option structs, but all child-groupings follow parent options at
-+     a particular group level.  If both this field and HEADER are zero, then
-+     they aren't grouped at all, but rather merged with the parent options
-+     (merging the child's grouping levels with the parents).  */
-+  int group;
-+};
-+\f
-+/* Parsing state.  This is provided to parsing functions called by argp,
-+   which may examine and, as noted, modify fields.  */
-+struct argp_state
-+{
-+  /* The top level ARGP being parsed.  */
-+  __const struct argp *root_argp;
-+
-+  /* The argument vector being parsed.  May be modified.  */
-+  int argc;
-+  char **argv;
-+
-+  /* The index in ARGV of the next arg that to be parsed.  May be modified. */
-+  int next;
-+
-+  /* The flags supplied to argp_parse.  May be modified.  */
-+  unsigned flags;
-+
-+  /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the
-+     number of the current arg, starting at zero, and incremented after each
-+     such call returns.  At all other times, this is the number of such
-+     arguments that have been processed.  */
-+  unsigned arg_num;
-+
-+  /* If non-zero, the index in ARGV of the first argument following a special
-+     `--' argument (which prevents anything following being interpreted as an
-+     option).  Only set once argument parsing has proceeded past this point. */
-+  int quoted;
-+
-+  /* An arbitrary pointer passed in from the user.  */
-+  void *input;
-+  /* Values to pass to child parsers.  This vector will be the same length as
-+     the number of children for the current parser.  */
-+  void **child_inputs;
-+
-+  /* For the parser's use.  Initialized to 0.  */
-+  void *hook;
-+
-+  /* The name used when printing messages.  This is initialized to ARGV[0],
-+     or PROGRAM_INVOCATION_NAME if that is unavailable.  */
-+  char *name;
-+
-+  /* Streams used when argp prints something.  */
-+  FILE *err_stream;		/* For errors; initialized to stderr. */
-+  FILE *out_stream;		/* For information; initialized to stdout. */
-+
-+  void *pstate;			/* Private, for use by argp.  */
-+};
-+\f
-+/* Flags for argp_parse (note that the defaults are those that are
-+   convenient for program command line parsing): */
-+
-+/* Don't ignore the first element of ARGV.  Normally (and always unless
-+   ARGP_NO_ERRS is set) the first element of the argument vector is
-+   skipped for option parsing purposes, as it corresponds to the program name
-+   in a command line.  */
-+#define ARGP_PARSE_ARGV0  0x01
-+
-+/* Don't print error messages for unknown options to stderr; unless this flag
-+   is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program
-+   name in the error messages.  This flag implies ARGP_NO_EXIT (on the
-+   assumption that silent exiting upon errors is bad behaviour).  */
-+#define ARGP_NO_ERRS	0x02
-+
-+/* Don't parse any non-option args.  Normally non-option args are parsed by
-+   calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg
-+   as the value.  Since it's impossible to know which parse function wants to
-+   handle it, each one is called in turn, until one returns 0 or an error
-+   other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the
-+   argp_parse returns prematurely (but with a return value of 0).  If all
-+   args have been parsed without error, all parsing functions are called one
-+   last time with a key of ARGP_KEY_END.  This flag needn't normally be set,
-+   as the normal behavior is to stop parsing as soon as some argument can't
-+   be handled.  */
-+#define ARGP_NO_ARGS	0x04
-+
-+/* Parse options and arguments in the same order they occur on the command
-+   line -- normally they're rearranged so that all options come first. */
-+#define ARGP_IN_ORDER	0x08
-+
-+/* Don't provide the standard long option --help, which causes usage and
-+      option help information to be output to stdout, and exit (0) called. */
-+#define ARGP_NO_HELP	0x10
-+
-+/* Don't exit on errors (they may still result in error messages).  */
-+#define ARGP_NO_EXIT	0x20
-+
-+/* Use the gnu getopt `long-only' rules for parsing arguments.  */
-+#define ARGP_LONG_ONLY	0x40
-+
-+/* Turns off any message-printing/exiting options.  */
-+#define ARGP_SILENT    (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP)
-+
-+/* Parse the options strings in ARGC & ARGV according to the options in ARGP.
-+   FLAGS is one of the ARGP_ flags above.  If ARG_INDEX is non-NULL, the
-+   index in ARGV of the first unparsed option is returned in it.  If an
-+   unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser
-+   routine returned a non-zero value, it is returned; otherwise 0 is
-+   returned.  This function may also call exit unless the ARGP_NO_HELP flag
-+   is set.  INPUT is a pointer to a value to be passed in to the parser.  */
-+extern error_t argp_parse (__const struct argp *__restrict __argp,
-+			   int __argc, char **__restrict __argv,
-+			   unsigned __flags, int *__restrict __arg_index,
-+			   void *__restrict __input);
-+\f
-+/* Global variables.  */
-+
-+/* If defined or set by the user program to a non-zero value, then a default
-+   option --version is added (unless the ARGP_NO_HELP flag is used), which
-+   will print this string followed by a newline and exit (unless the
-+   ARGP_NO_EXIT flag is used).  Overridden by ARGP_PROGRAM_VERSION_HOOK.  */
-+extern __const char *argp_program_version;
-+
-+/* If defined or set by the user program to a non-zero value, then a default
-+   option --version is added (unless the ARGP_NO_HELP flag is used), which
-+   calls this function with a stream to print the version to and a pointer to
-+   the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
-+   used).  This variable takes precedent over ARGP_PROGRAM_VERSION.  */
-+extern void (*argp_program_version_hook) (FILE *__restrict __stream,
-+					  struct argp_state *__restrict
-+					  __state);
-+
-+/* If defined or set by the user program, it should point to string that is
-+   the bug-reporting address for the program.  It will be printed by
-+   argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various
-+   standard help messages), embedded in a sentence that says something like
-+   `Report bugs to ADDR.'.  */
-+extern __const char *argp_program_bug_address;
-+
-+/* The exit status that argp will use when exiting due to a parsing error.
-+   If not defined or set by the user program, this defaults to EX_USAGE from
-+   <sysexits.h>.  */
-+extern error_t argp_err_exit_status;
-+\f
-+/* Flags for argp_help.  */
-+#define ARGP_HELP_USAGE		0x01 /* a Usage: message. */
-+#define ARGP_HELP_SHORT_USAGE	0x02 /*  " but don't actually print options. */
-+#define ARGP_HELP_SEE		0x04 /* a `Try ... for more help' message. */
-+#define ARGP_HELP_LONG		0x08 /* a long help message. */
-+#define ARGP_HELP_PRE_DOC	0x10 /* doc string preceding long help.  */
-+#define ARGP_HELP_POST_DOC	0x20 /* doc string following long help.  */
-+#define ARGP_HELP_DOC		(ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC)
-+#define ARGP_HELP_BUG_ADDR	0x40 /* bug report address */
-+#define ARGP_HELP_LONG_ONLY	0x80 /* modify output appropriately to
-+					reflect ARGP_LONG_ONLY mode.  */
-+
-+/* These ARGP_HELP flags are only understood by argp_state_help.  */
-+#define ARGP_HELP_EXIT_ERR	0x100 /* Call exit(1) instead of returning.  */
-+#define ARGP_HELP_EXIT_OK	0x200 /* Call exit(0) instead of returning.  */
-+
-+/* The standard thing to do after a program command line parsing error, if an
-+   error message has already been printed.  */
-+#define ARGP_HELP_STD_ERR \
-+  (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
-+/* The standard thing to do after a program command line parsing error, if no
-+   more specific error message has been printed.  */
-+#define ARGP_HELP_STD_USAGE \
-+  (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
-+/* The standard thing to do in response to a --help option.  */
-+#define ARGP_HELP_STD_HELP \
-+  (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \
-+   | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR)
-+
-+/* Output a usage message for ARGP to STREAM.  FLAGS are from the set
-+   ARGP_HELP_*.  */
-+extern void argp_help (__const struct argp *__restrict __argp,
-+		       FILE *__restrict __stream,
-+		       unsigned __flags, char *__restrict __name);
-+\f
-+/* The following routines are intended to be called from within an argp
-+   parsing routine (thus taking an argp_state structure as the first
-+   argument).  They may or may not print an error message and exit, depending
-+   on the flags in STATE -- in any case, the caller should be prepared for
-+   them *not* to exit, and should return an appropiate error after calling
-+   them.  [argp_usage & argp_error should probably be called argp_state_...,
-+   but they're used often enough that they should be short]  */
-+
-+/* Output, if appropriate, a usage message for STATE to STREAM.  FLAGS are
-+   from the set ARGP_HELP_*.  */
-+extern void argp_state_help (__const struct argp_state *__restrict __state,
-+			     FILE *__restrict __stream,
-+			     unsigned int __flags);
-+/* Possibly output the standard usage message for ARGP to stderr and exit.  */
-+extern void argp_usage (__const struct argp_state *__state);
-+
-+/* If appropriate, print the printf string FMT and following args, preceded
-+   by the program name and `:', to stderr, and followed by a `Try ... --help'
-+   message, then exit (1).  */
-+extern void argp_error (__const struct argp_state *__restrict __state,
-+			__const char *__restrict __fmt, ...)
-+     __attribute__ ((__format__ (__printf__, 2, 3)));
-+/* Similar to the standard gnu error-reporting function error(), but will
-+   respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
-+   to STATE->err_stream.  This is useful for argument parsing code that is
-+   shared between program startup (when exiting is desired) and runtime
-+   option parsing (when typically an error code is returned instead).  The
-+   difference between this function and argp_error is that the latter is for
-+   *parsing errors*, and the former is for other problems that occur during
-+   parsing but don't reflect a (syntactic) problem with the input.  */
-+extern void argp_failure (__const struct argp_state *__restrict __state,
-+			  int __status, int __errnum,
-+			  __const char *__restrict __fmt, ...)
-+     __attribute__ ((__format__ (__printf__, 4, 5)));
-+/* Returns true if the option OPT is a valid short option.  */
-+extern int _option_is_short (__const struct argp_option *__opt) __THROW;
-+extern int __option_is_short (__const struct argp_option *__opt) __THROW;
-+
-+/* Returns true if the option OPT is in fact the last (unused) entry in an
-+   options array.  */
-+extern int _option_is_end (__const struct argp_option *__opt) __THROW;
-+extern int __option_is_end (__const struct argp_option *__opt) __THROW;
-+
-+/* Return the input field for ARGP in the parser corresponding to STATE; used
-+   by the help routines.  */
-+/* We think this should not be exported */
-+extern void *__argp_input (__const struct argp *__restrict __argp,
-+			   __const struct argp_state *__restrict __state)
-+     __THROW;
-+\f
-+#ifdef __USE_EXTERN_INLINES
-+
-+# ifndef ARGP_EI
-+#  define ARGP_EI __extern_inline
-+# endif
-+
-+ARGP_EI void
-+argp_usage (__const struct argp_state *__state)
-+{
-+  argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
-+}
-+
-+ARGP_EI int
-+__NTH (__option_is_short (__const struct argp_option *__opt))
-+{
-+  if (__opt->flags & OPTION_DOC)
-+    return 0;
-+  else
-+    {
-+      int __key = __opt->key;
-+      return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
-+    }
-+}
-+
-+ARGP_EI int
-+__NTH (__option_is_end (__const struct argp_option *__opt))
-+{
-+  return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
-+}
-+#endif /* Use extern inlines.  */
-+
-+#ifdef  __cplusplus
-+}
-+#endif
-+
-+#endif /* argp.h */
-diff --git a/libc/sysdeps/linux/common/bits/getopt_int.h b/libc/sysdeps/linux/common/bits/getopt_int.h
-new file mode 100644
-index 0000000..291edfe
---- /dev/null
-+++ b/libc/sysdeps/linux/common/bits/getopt_int.h
-@@ -0,0 +1,136 @@
-+/* Internal declarations for getopt.
-+   Copyright (C) 1989-1994,1996-1999,2001,2003,2004
-+   Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifndef _GETOPT_INT_H
-+#define _GETOPT_INT_H  1
-+
-+extern int _getopt_internal (int ___argc, char *const *___argv,
-+                            const char *__shortopts,
-+                            const struct option *__longopts, int *__longind,
-+                            int __long_only) attribute_hidden;
-+
-+
-+/* Reentrant versions which can handle parsing multiple argument
-+   vectors at the same time.  */
-+
-+/* For __ordering member */
-+enum {
-+       REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-+};
-+
-+/* Data type for reentrant functions.  */
-+
-+struct _getopt_data
-+{
-+  /* These have exactly the same meaning as the corresponding global
-+     variables, except that they are used for the reentrant
-+     versions of getopt.  */
-+  int optind;
-+  int opterr;
-+  char *optarg;
-+  smalluint optopt; /* we store characters here, a byte is enough */
-+
-+  /* Internal members.  */
-+
-+  /* True if the internal members have been initialized.  */
-+  smallint __initialized;
-+
-+  /* Describe how to deal with options that follow non-option ARGV-elements.
-+
-+     If the caller did not specify anything,
-+     the default is REQUIRE_ORDER if the environment variable
-+     POSIXLY_CORRECT is defined, PERMUTE otherwise.
-+
-+     REQUIRE_ORDER means don't recognize them as options;
-+     stop option processing when the first non-option is seen.
-+     This is what Unix does.
-+     This mode of operation is selected by either setting the environment
-+     variable POSIXLY_CORRECT, or using `+' as the first character
-+     of the list of option characters.
-+
-+     PERMUTE is the default.  We permute the contents of ARGV as we
-+     scan, so that eventually all the non-options are at the end.
-+     This allows options to be given in any order, even with programs
-+     that were not written to expect this.
-+
-+     RETURN_IN_ORDER is an option available to programs that were
-+     written to expect options and other ARGV-elements in any order
-+     and that care about the ordering of the two.  We describe each
-+     non-option ARGV-element as if it were the argument of an option
-+     with character code 1.  Using `-' as the first character of the
-+     list of option characters selects this mode of operation.
-+
-+     The special argument `--' forces an end of option-scanning regardless
-+     of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
-+     `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
-+  smallint __ordering;
-+
-+  /* If the POSIXLY_CORRECT environment variable is set.  */
-+  smallint __posixly_correct;
-+
-+  /* The next char to be scanned in the option-element
-+     in which the last option character we returned was found.
-+     This allows us to pick up the scan where we left off.
-+
-+     If this is zero, or a null string, it means resume the scan
-+     by advancing to the next ARGV-element.  */
-+  char *__nextchar;
-+
-+
-+  /* Handle permutation of arguments.  */
-+
-+  /* Describe the part of ARGV that contains non-options that have
-+     been skipped.  `first_nonopt' is the index in ARGV of the first
-+     of them; `last_nonopt' is the index after the last of them.  */
-+
-+  int __first_nonopt;
-+  int __last_nonopt;
-+
-+#if defined _LIBC && defined USE_NONOPTION_FLAGS
-+  int __nonoption_flags_max_len;
-+  int __nonoption_flags_len;
-+# endif
-+};
-+
-+/* The initializer is necessary to set OPTIND and OPTERR to their
-+   default values and to clear the initialization flag.  */
-+#define _GETOPT_DATA_INITIALIZER       { 1, 1 }
-+
-+#if 0 /* first is static on uClibc, the others not used */
-+extern int _getopt_internal_r (int ___argc, char *const *___argv,
-+                              const char *__shortopts,
-+                              const struct option *__longopts, int *__longind,
-+                              int __long_only, struct _getopt_data *__data);
-+#endif
-+#if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__
-+#ifndef __need_getopt
-+extern int _getopt_long_r (int ___argc, char *const *___argv,
-+                          const char *__shortopts,
-+                          const struct option *__longopts, int *__longind,
-+                          struct _getopt_data *__data);
-+
-+extern int _getopt_long_only_r (int ___argc, char *const *___argv,
-+                               const char *__shortopts,
-+                               const struct option *__longopts,
-+                               int *__longind,
-+                               struct _getopt_data *__data);
-+#endif
-+#endif
-+#endif /* getopt_int.h */
-diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c
-index f63482b..db5e12c 100644
---- a/libc/unistd/getopt.c
-+++ b/libc/unistd/getopt.c
-@@ -105,7 +105,7 @@
-    they can distinguish the relative order of options and other arguments.  */
- 
- #include <getopt.h>
--#include "getopt_int.h"
-+#include <bits/getopt_int.h>
- 
- 
- /* For communication from `getopt' to the caller.
-@@ -1170,6 +1170,15 @@ getopt_long (int argc, char *const *argv, const char *options,
-   return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
- }
- 
-+int
-+_getopt_long_r (int argc, char *const *argv, const char *options,
-+               const struct option *long_options, int *opt_index,
-+               struct _getopt_data *d)
-+{
-+  return _getopt_internal_r (argc, argv, options, long_options, opt_index,
-+                            0, d);
-+}
-+
- /* Like getopt_long, but '-' as well as '--' can indicate a long option.
-    If an option that starts with '-' (not '--') doesn't match a long option,
-    but does match a short option, it is parsed as a short option
-@@ -1183,4 +1192,12 @@ getopt_long_only (int argc, char *const *argv, const char *options,
- }
- #endif /* __UCLIBC_HAS_GETOPT_LONG__ */
- 
-+int
-+_getopt_long_only_r (int argc, char *const *argv, const char *options,
-+                    const struct option *long_options, int *opt_index,
-+                    struct _getopt_data *d)
-+{
-+  return _getopt_internal_r (argc, argv, options, long_options, opt_index, 1, d);
-+}
-+
- #endif	/* Not ELIDE_CODE.  */
-diff --git a/libuargp/Makefile b/libuargp/Makefile
-new file mode 100644
-index 0000000..45acdd9
---- /dev/null
-+++ b/libuargp/Makefile
-@@ -0,0 +1,14 @@
-+# Makefile for uClibc (libuargp)
-+#
-+# Copyright (C) 2010 STMicroelectronics Ltd
-+# Author(s): Filippo Arcidiacono <filippo.arcidiacono at st.com>
-+#
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+#
-+
-+top_srcdir=../
-+top_builddir=../
-+include $(top_builddir)Rules.mak
-+all: libs
-+include Makefile.in
-+include $(top_srcdir)Makerules
-diff --git a/libuargp/Makefile.in b/libuargp/Makefile.in
-new file mode 100644
-index 0000000..1498abb
---- /dev/null
-+++ b/libuargp/Makefile.in
-@@ -0,0 +1,73 @@
-+# Makefile for uClibc (libuargp)
-+#
-+# Copyright (C) 2009, 2010  STMicroelectronics Ltd.
-+# Author(s): Salvatore Cro <salvatore.cro at st.com>
-+#            - First implementation, embedded into libc
-+#            Filippo Arcidiacono <filippo.arcidiacono at st.com>
-+#            - Reworked for stand-alone libuargp implementation
-+
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+#
-+
-+CFLAGS-libuargp := -DNOT_IN_libc -DIS_IN_libuargp $(SSP_ALL_CFLAGS)
-+
-+LDFLAGS-libuargp.so := $(LDFLAGS)
-+
-+LIBS-libuargp.so := $(LIBS)
-+
-+libuargp_FULL_NAME := libuargp-$(VERSION).so
-+
-+libuargp_DIR := $(top_srcdir)libuargp
-+libuargp_OUT := $(top_builddir)libuargp
-+
-+libuargp_SRC-y :=
-+libuargp_SRC-$(UCLIBC_HAS_ARGP) := $(addsuffix .c,$(addprefix argp-, ba \
-+			eexst fmtstream fs-xinl help parse pv pvh xinl))
-+
-+CFLAGS-argp-xinl.c = -fgnu89-inline
-+
-+libuargp_SRC := $(addprefix $(libuargp_DIR)/,$(libuargp_SRC-y))
-+libuargp_OBJ := $(patsubst $(libuargp_DIR)/%.c,$(libuargp_OUT)/%.o,$(libuargp_SRC))
-+
-+libuargp_SRCS := $(libuargp_SRC)
-+libuargp_OBJS := $(libuargp_OBJ)
-+
-+ifeq ($(DOPIC),y)
-+libuargp-a-y := $(libuargp_OBJS:.o=.os)
-+else
-+libuargp-a-y := $(libuargp_OBJS)
-+endif
-+libuargp-so-y := $(libuargp_OBJS:.o=.os)
-+
-+lib-a-$(UCLIBC_HAS_ARGP) += $(top_builddir)lib/libuargp.a
-+lib-so-$(UCLIBC_HAS_ARGP) += $(top_builddir)lib/libuargp.so
-+
-+objclean-y += CLEAN_libuargp
-+
-+ifeq ($(DOMULTI),n)
-+ifeq ($(DOPIC),y)
-+$(top_builddir)lib/libuargp.so: $(top_builddir)lib/libuargp.a $(libc.depend)
-+else
-+$(top_builddir)lib/libuargp.so: $(libuargp_OUT)/libuargp_so.a $(libc.depend)
-+endif
-+	$(call link.so,$(libuargp_FULL_NAME),$(MAJOR_VERSION))
-+else
-+$(top_builddir)lib/libuargp.so: $(libuargp_OUT)/libuargp.oS $(libc.depend)
-+	$(call linkm.so,$(libuargp_FULL_NAME),$(MAJOR_VERSION))
-+endif
-+
-+$(libuargp_OUT)/libuargp_so.a: $(libuargp-so-y)
-+	$(Q)$(RM) $@
-+	$(do_ar)
-+
-+$(libuargp_OUT)/libuargp.oS: $(libuargp_SRCS)
-+	$(Q)$(RM) $@
-+	$(compile-m)
-+
-+$(top_builddir)lib/libuargp.a: $(libuargp-a-y)
-+	$(Q)$(INSTALL) -d $(dir $@)
-+	$(Q)$(RM) $@
-+	$(do_ar)
-+
-+CLEAN_libuargp:
-+	$(do_rm) $(addprefix $(libuargp_OUT)/*., o os oS a)
-diff --git a/libuargp/argp-ba.c b/libuargp/argp-ba.c
-new file mode 100644
-index 0000000..3522b02
---- /dev/null
-+++ b/libuargp/argp-ba.c
-@@ -0,0 +1,26 @@
-+/* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
-+   Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+/* If set by the user program, it should point to string that is the
-+   bug-reporting address for the program.  It will be printed by argp_help if
-+   the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help
-+   messages), embedded in a sentence that says something like `Report bugs to
-+   ADDR.'.  */
-+const char *argp_program_bug_address;
-diff --git a/libuargp/argp-eexst.c b/libuargp/argp-eexst.c
-new file mode 100644
-index 0000000..445b68d
---- /dev/null
-+++ b/libuargp/argp-eexst.c
-@@ -0,0 +1,32 @@
-+/* Default definition for ARGP_ERR_EXIT_STATUS
-+   Copyright (C) 1997 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include <sysexits.h>
-+
-+#include <argp.h>
-+
-+/* The exit status that argp will use when exiting due to a parsing error.
-+   If not defined or set by the user program, this defaults to EX_USAGE from
-+   <sysexits.h>.  */
-+error_t argp_err_exit_status = EX_USAGE;
-diff --git a/libuargp/argp-fmtstream.c b/libuargp/argp-fmtstream.c
-new file mode 100644
-index 0000000..75227f9
---- /dev/null
-+++ b/libuargp/argp-fmtstream.c
-@@ -0,0 +1,439 @@
-+/* Word-wrapping and line-truncating streams
-+   Copyright (C) 1997-1999,2001,2002,2003,2005 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.
-+
-+   Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
-+*/
-+
-+/* This package emulates glibc `line_wrap_stream' semantics for systems that
-+   don't have that.  */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include <stdlib.h>
-+#include <string.h>
-+#include <errno.h>
-+#include <stdarg.h>
-+#include <ctype.h>
-+
-+#include "argp-fmtstream.h"
-+
-+#ifndef ARGP_FMTSTREAM_USE_LINEWRAP
-+
-+#ifndef isblank
-+#define isblank(ch) ((ch)==' ' || (ch)=='\t')
-+#endif
-+
-+#if defined _LIBC && defined USE_IN_LIBIO
-+# include <wchar.h>
-+# include <libio/libioP.h>
-+# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
-+#else
-+# define __vsnprintf(s, l, f, a) vsnprintf (s, l, f, a)
-+#endif
-+
-+#define INIT_BUF_SIZE 200
-+#define PRINTF_SIZE_GUESS 150
-+
-+/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
-+   written on it with LMARGIN spaces and limits them to RMARGIN columns
-+   total.  If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
-+   replacing the whitespace before them with a newline and WMARGIN spaces.
-+   Otherwise, chars beyond RMARGIN are simply dropped until a newline.
-+   Returns NULL if there was an error.  */
-+argp_fmtstream_t
-+__argp_make_fmtstream (FILE *stream,
-+                      size_t lmargin, size_t rmargin, ssize_t wmargin)
-+{
-+  argp_fmtstream_t fs;
-+
-+  fs = (struct argp_fmtstream *) malloc (sizeof (struct argp_fmtstream));
-+  if (fs != NULL)
-+    {
-+      fs->stream = stream;
-+
-+      fs->lmargin = lmargin;
-+      fs->rmargin = rmargin;
-+      fs->wmargin = wmargin;
-+      fs->point_col = 0;
-+      fs->point_offs = 0;
-+
-+      fs->buf = (char *) malloc (INIT_BUF_SIZE);
-+      if (! fs->buf)
-+       {
-+         free (fs);
-+         fs = 0;
-+       }
-+      else
-+       {
-+         fs->p = fs->buf;
-+         fs->end = fs->buf + INIT_BUF_SIZE;
-+       }
-+    }
-+
-+  return fs;
-+}
-+#if 0
-+/* Not exported.  */
-+#ifdef weak_alias
-+weak_alias (__argp_make_fmtstream, argp_make_fmtstream)
-+#endif
-+#endif
-+
-+/* Flush FS to its stream, and free it (but don't close the stream).  */
-+void
-+__argp_fmtstream_free (argp_fmtstream_t fs)
-+{
-+  __argp_fmtstream_update (fs);
-+  if (fs->p > fs->buf)
-+    {
-+#ifdef USE_IN_LIBIO
-+      __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
-+#else
-+      fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
-+#endif
-+    }
-+  free (fs->buf);
-+  free (fs);
-+}
-+#if 0
-+/* Not exported.  */
-+#ifdef weak_alias
-+weak_alias (__argp_fmtstream_free, argp_fmtstream_free)
-+#endif
-+#endif
-+
-+/* Process FS's buffer so that line wrapping is done from POINT_OFFS to the
-+   end of its buffer.  This code is mostly from glibc stdio/linewrap.c.  */
-+void
-+__argp_fmtstream_update (argp_fmtstream_t fs)
-+{
-+  char *buf, *nl;
-+  size_t len;
-+
-+  /* Scan the buffer for newlines.  */
-+  buf = fs->buf + fs->point_offs;
-+  while (buf < fs->p)
-+    {
-+      size_t r;
-+
-+      if (fs->point_col == 0 && fs->lmargin != 0)
-+       {
-+         /* We are starting a new line.  Print spaces to the left margin.  */
-+         const size_t pad = fs->lmargin;
-+         if (fs->p + pad < fs->end)
-+           {
-+             /* We can fit in them in the buffer by moving the
-+                buffer text up and filling in the beginning.  */
-+             memmove (buf + pad, buf, fs->p - buf);
-+             fs->p += pad; /* Compensate for bigger buffer. */
-+             memset (buf, ' ', pad); /* Fill in the spaces.  */
-+             buf += pad; /* Don't bother searching them.  */
-+           }
-+         else
-+           {
-+             /* No buffer space for spaces.  Must flush.  */
-+             size_t i;
-+             for (i = 0; i < pad; i++)
-+               {
-+#ifdef USE_IN_LIBIO
-+                 if (_IO_fwide (fs->stream, 0) > 0)
-+                   putwc_unlocked (L' ', fs->stream);
-+                 else
-+#endif
-+                   putc_unlocked (' ', fs->stream);
-+               }
-+           }
-+         fs->point_col = pad;
-+       }
-+
-+      len = fs->p - buf;
-+      nl = memchr (buf, '\n', len);
-+
-+      if (fs->point_col < 0)
-+       fs->point_col = 0;
-+
-+      if (!nl)
-+       {
-+         /* The buffer ends in a partial line.  */
-+
-+         if (fs->point_col + len < fs->rmargin)
-+           {
-+             /* The remaining buffer text is a partial line and fits
-+                within the maximum line width.  Advance point for the
-+                characters to be written and stop scanning.  */
-+             fs->point_col += len;
-+             break;
-+           }
-+         else
-+           /* Set the end-of-line pointer for the code below to
-+              the end of the buffer.  */
-+           nl = fs->p;
-+       }
-+      else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin)
-+       {
-+         /* The buffer contains a full line that fits within the maximum
-+            line width.  Reset point and scan the next line.  */
-+         fs->point_col = 0;
-+         buf = nl + 1;
-+         continue;
-+       }
-+
-+      /* This line is too long.  */
-+      r = fs->rmargin - 1;
-+
-+      if (fs->wmargin < 0)
-+       {
-+         /* Truncate the line by overwriting the excess with the
-+            newline and anything after it in the buffer.  */
-+         if (nl < fs->p)
-+           {
-+             memmove (buf + (r - fs->point_col), nl, fs->p - nl);
-+             fs->p -= buf + (r - fs->point_col) - nl;
-+             /* Reset point for the next line and start scanning it.  */
-+             fs->point_col = 0;
-+             buf += r + 1; /* Skip full line plus \n. */
-+           }
-+         else
-+           {
-+             /* The buffer ends with a partial line that is beyond the
-+                maximum line width.  Advance point for the characters
-+                written, and discard those past the max from the buffer.  */
-+             fs->point_col += len;
-+             fs->p -= fs->point_col - r;
-+             break;
-+           }
-+       }
-+      else
-+       {
-+         /* Do word wrap.  Go to the column just past the maximum line
-+            width and scan back for the beginning of the word there.
-+            Then insert a line break.  */
-+
-+         char *p, *nextline;
-+         int i;
-+
-+         p = buf + (r + 1 - fs->point_col);
-+         while (p >= buf && !isblank (*p))
-+           --p;
-+         nextline = p + 1;     /* This will begin the next line.  */
-+
-+         if (nextline > buf)
-+           {
-+             /* Swallow separating blanks.  */
-+             if (p >= buf)
-+               do
-+                 --p;
-+               while (p >= buf && isblank (*p));
-+             nl = p + 1;       /* The newline will replace the first blank. */
-+           }
-+         else
-+           {
-+             /* A single word that is greater than the maximum line width.
-+                Oh well.  Put it on an overlong line by itself.  */
-+             p = buf + (r + 1 - fs->point_col);
-+             /* Find the end of the long word.  */
-+             do
-+               ++p;
-+             while (p < nl && !isblank (*p));
-+             if (p == nl)
-+               {
-+                 /* It already ends a line.  No fussing required.  */
-+                 fs->point_col = 0;
-+                 buf = nl + 1;
-+                 continue;
-+               }
-+             /* We will move the newline to replace the first blank.  */
-+             nl = p;
-+             /* Swallow separating blanks.  */
-+             do
-+               ++p;
-+             while (isblank (*p));
-+             /* The next line will start here.  */
-+             nextline = p;
-+           }
-+
-+         /* Note: There are a bunch of tests below for
-+            NEXTLINE == BUF + LEN + 1; this case is where NL happens to fall
-+            at the end of the buffer, and NEXTLINE is in fact empty (and so
-+            we need not be careful to maintain its contents).  */
-+
-+         if ((nextline == buf + len + 1
-+              ? fs->end - nl < fs->wmargin + 1
-+              : nextline - (nl + 1) < fs->wmargin)
-+             && fs->p > nextline)
-+           {
-+             /* The margin needs more blanks than we removed.  */
-+             if (fs->end - fs->p > fs->wmargin + 1)
-+               /* Make some space for them.  */
-+               {
-+                 size_t mv = fs->p - nextline;
-+                 memmove (nl + 1 + fs->wmargin, nextline, mv);
-+                 nextline = nl + 1 + fs->wmargin;
-+                 len = nextline + mv - buf;
-+                 *nl++ = '\n';
-+               }
-+             else
-+               /* Output the first line so we can use the space.  */
-+               {
-+#if defined _LIBC && defined USE_IN_LIBIO
-+                 __fxprintf (fs->stream, "%.*s\n",
-+                             (int) (nl - fs->buf), fs->buf);
-+#else
-+                 if (nl > fs->buf)
-+                   fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream);
-+                 putc_unlocked ('\n', fs->stream);
-+#endif
-+
-+                 len += buf - fs->buf;
-+                 nl = buf = fs->buf;
-+               }
-+           }
-+         else
-+           /* We can fit the newline and blanks in before
-+              the next word.  */
-+           *nl++ = '\n';
-+
-+         if (nextline - nl >= fs->wmargin
-+             || (nextline == buf + len + 1 && fs->end - nextline >= fs->wmargin))
-+           /* Add blanks up to the wrap margin column.  */
-+           for (i = 0; i < fs->wmargin; ++i)
-+             *nl++ = ' ';
-+         else
-+           for (i = 0; i < fs->wmargin; ++i)
-+#ifdef USE_IN_LIBIO
-+             if (_IO_fwide (fs->stream, 0) > 0)
-+               putwc_unlocked (L' ', fs->stream);
-+             else
-+#endif
-+               putc_unlocked (' ', fs->stream);
-+
-+         /* Copy the tail of the original buffer into the current buffer
-+            position.  */
-+         if (nl < nextline)
-+           memmove (nl, nextline, buf + len - nextline);
-+         len -= nextline - buf;
-+
-+         /* Continue the scan on the remaining lines in the buffer.  */
-+         buf = nl;
-+
-+         /* Restore bufp to include all the remaining text.  */
-+         fs->p = nl + len;
-+
-+         /* Reset the counter of what has been output this line.  If wmargin
-+            is 0, we want to avoid the lmargin getting added, so we set
-+            point_col to a magic value of -1 in that case.  */
-+         fs->point_col = fs->wmargin ? fs->wmargin : -1;
-+       }
-+    }
-+
-+  /* Remember that we've scanned as far as the end of the buffer.  */
-+  fs->point_offs = fs->p - fs->buf;
-+}
-+
-+/* Ensure that FS has space for AMOUNT more bytes in its buffer, either by
-+   growing the buffer, or by flushing it.  True is returned iff we succeed. */
-+int
-+__argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
-+{
-+  if ((size_t) (fs->end - fs->p) < amount)
-+    {
-+      ssize_t wrote;
-+
-+      /* Flush FS's buffer.  */
-+      __argp_fmtstream_update (fs);
-+
-+#if defined _LIBC && defined USE_IN_LIBIO
-+      __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
-+      wrote = fs->p - fs->buf;
-+#else
-+      wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
-+#endif
-+      if (wrote == fs->p - fs->buf)
-+       {
-+         fs->p = fs->buf;
-+         fs->point_offs = 0;
-+       }
-+      else
-+       {
-+         fs->p -= wrote;
-+         fs->point_offs -= wrote;
-+         memmove (fs->buf, fs->buf + wrote, fs->p - fs->buf);
-+         return 0;
-+       }
-+
-+      if ((size_t) (fs->end - fs->buf) < amount)
-+       /* Gotta grow the buffer.  */
-+       {
-+         size_t old_size = fs->end - fs->buf;
-+         size_t new_size = old_size + amount;
-+         char *new_buf;
-+
-+         if (new_size < old_size || ! (new_buf = realloc (fs->buf, new_size)))
-+           {
-+             __set_errno (ENOMEM);
-+             return 0;
-+           }
-+
-+         fs->buf = new_buf;
-+         fs->end = new_buf + new_size;
-+         fs->p = fs->buf;
-+       }
-+    }
-+
-+  return 1;
-+}
-+
-+ssize_t
-+__argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...)
-+{
-+  int out;
-+  size_t avail;
-+  size_t size_guess = PRINTF_SIZE_GUESS; /* How much space to reserve. */
-+
-+  do
-+    {
-+      va_list args;
-+
-+      if (! __argp_fmtstream_ensure (fs, size_guess))
-+       return -1;
-+
-+      va_start (args, fmt);
-+      avail = fs->end - fs->p;
-+      out = __vsnprintf (fs->p, avail, fmt, args);
-+      va_end (args);
-+      if ((size_t) out >= avail)
-+       size_guess = out + 1;
-+    }
-+  while ((size_t) out >= avail);
-+
-+  fs->p += out;
-+
-+  return out;
-+}
-+#if 0
-+/* Not exported.  */
-+#ifdef weak_alias
-+weak_alias (__argp_fmtstream_printf, argp_fmtstream_printf)
-+#endif
-+#endif
-+
-+#endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */
-diff --git a/libuargp/argp-fmtstream.h b/libuargp/argp-fmtstream.h
-new file mode 100644
-index 0000000..ca7c834
---- /dev/null
-+++ b/libuargp/argp-fmtstream.h
-@@ -0,0 +1,314 @@
-+/* Word-wrapping and line-truncating streams.
-+   Copyright (C) 1997 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.
-+
-+   Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
-+*/
-+
-+/* This package emulates glibc `line_wrap_stream' semantics for systems that
-+   don't have that.  If the system does have it, it is just a wrapper for
-+   that.  This header file is only used internally while compiling argp, and
-+   shouldn't be installed.  */
-+
-+#ifndef _ARGP_FMTSTREAM_H
-+#define _ARGP_FMTSTREAM_H
-+
-+#include <stdio.h>
-+#include <string.h>
-+#include <unistd.h>
-+
-+#ifndef __attribute__
-+/* This feature is available in gcc versions 2.5 and later.  */
-+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__)
-+#  define __attribute__(Spec) /* empty */
-+# endif
-+/* The __-protected variants of `format' and `printf' attributes
-+   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
-+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__)
-+#  define __format__ format
-+#  define __printf__ printf
-+# endif
-+#endif
-+
-+#if 0 /* uClibc: disabled */
-+#if    (_LIBC - 0 && !defined (USE_IN_LIBIO)) \
-+    || (defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H))
-+/* line_wrap_stream is available, so use that.  */
-+#define ARGP_FMTSTREAM_USE_LINEWRAP
-+#endif
-+#else
-+/* line_wrap stream NOT available */
-+# undef ARGP_FMTSTREAM_USE_LINEWRAP
-+#endif
-+
-+#ifdef ARGP_FMTSTREAM_USE_LINEWRAP
-+/* Just be a simple wrapper for line_wrap_stream; the semantics are
-+   *slightly* different, as line_wrap_stream doesn't actually make a new
-+   object, it just modifies the given stream (reversibly) to do
-+   line-wrapping.  Since we control who uses this code, it doesn't matter.  */
-+
-+#include <linewrap.h>
-+
-+typedef FILE *argp_fmtstream_t;
-+
-+#define argp_make_fmtstream line_wrap_stream
-+#define __argp_make_fmtstream line_wrap_stream
-+#define argp_fmtstream_free line_unwrap_stream
-+#define __argp_fmtstream_free line_unwrap_stream
-+
-+#define __argp_fmtstream_putc(fs,ch) putc(ch,fs)
-+#define argp_fmtstream_putc(fs,ch) putc(ch,fs)
-+#define __argp_fmtstream_puts(fs,str) fputs(str,fs)
-+#define argp_fmtstream_puts(fs,str) fputs(str,fs)
-+#define __argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs)
-+#define argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs)
-+#define __argp_fmtstream_printf fprintf
-+#define argp_fmtstream_printf fprintf
-+
-+#define __argp_fmtstream_lmargin line_wrap_lmargin
-+#define argp_fmtstream_lmargin line_wrap_lmargin
-+#define __argp_fmtstream_set_lmargin line_wrap_set_lmargin
-+#define argp_fmtstream_set_lmargin line_wrap_set_lmargin
-+#define __argp_fmtstream_rmargin line_wrap_rmargin
-+#define argp_fmtstream_rmargin line_wrap_rmargin
-+#define __argp_fmtstream_set_rmargin line_wrap_set_rmargin
-+#define argp_fmtstream_set_rmargin line_wrap_set_rmargin
-+#define __argp_fmtstream_wmargin line_wrap_wmargin
-+#define argp_fmtstream_wmargin line_wrap_wmargin
-+#define __argp_fmtstream_set_wmargin line_wrap_set_wmargin
-+#define argp_fmtstream_set_wmargin line_wrap_set_wmargin
-+#define __argp_fmtstream_point line_wrap_point
-+#define argp_fmtstream_point line_wrap_point
-+
-+#else /* !ARGP_FMTSTREAM_USE_LINEWRAP */
-+/* Guess we have to define our own version.  */
-+
-+#ifndef __const
-+#define __const const
-+#endif
-+
-+struct argp_fmtstream
-+{
-+  FILE *stream;                        /* The stream we're outputting to.  */
-+
-+  size_t lmargin, rmargin;     /* Left and right margins.  */
-+  ssize_t wmargin;             /* Margin to wrap to, or -1 to truncate.  */
-+
-+  /* Point in buffer to which we've processed for wrapping, but not output.  */
-+  size_t point_offs;
-+  /* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin.  */
-+  ssize_t point_col;
-+
-+  char *buf;                   /* Output buffer.  */
-+  char *p;                     /* Current end of text in BUF. */
-+  char *end;                   /* Absolute end of BUF.  */
-+};
-+
-+typedef struct argp_fmtstream *argp_fmtstream_t;
-+
-+/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
-+   written on it with LMARGIN spaces and limits them to RMARGIN columns
-+   total.  If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
-+   replacing the whitespace before them with a newline and WMARGIN spaces.
-+   Otherwise, chars beyond RMARGIN are simply dropped until a newline.
-+   Returns NULL if there was an error.  */
-+extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream,
-+                                              size_t __lmargin,
-+                                              size_t __rmargin,
-+                                              ssize_t __wmargin);
-+extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream,
-+                                            size_t __lmargin,
-+                                            size_t __rmargin,
-+                                            ssize_t __wmargin);
-+
-+/* Flush __FS to its stream, and free it (but don't close the stream).  */
-+extern void __argp_fmtstream_free (argp_fmtstream_t __fs);
-+extern void argp_fmtstream_free (argp_fmtstream_t __fs);
-+
-+extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs,
-+                                      __const char *__fmt, ...)
-+     __attribute__ ((__format__ (printf, 2, 3)));
-+extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
-+                                     __const char *__fmt, ...)
-+     __attribute__ ((__format__ (printf, 2, 3)));
-+
-+extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
-+extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
-+
-+extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str);
-+extern int argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str);
-+
-+extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs,
-+                                     __const char *__str, size_t __len);
-+extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
-+                                   __const char *__str, size_t __len);
-+
-+/* Access macros for various bits of state.  */
-+#define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin)
-+#define argp_fmtstream_rmargin(__fs) ((__fs)->rmargin)
-+#define argp_fmtstream_wmargin(__fs) ((__fs)->wmargin)
-+#define __argp_fmtstream_lmargin argp_fmtstream_lmargin
-+#define __argp_fmtstream_rmargin argp_fmtstream_rmargin
-+#define __argp_fmtstream_wmargin argp_fmtstream_wmargin
-+
-+/* Set __FS's left margin to LMARGIN and return the old value.  */
-+extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
-+                                         size_t __lmargin);
-+extern size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
-+                                           size_t __lmargin);
-+
-+/* Set __FS's right margin to __RMARGIN and return the old value.  */
-+extern size_t argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
-+                                         size_t __rmargin);
-+extern size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
-+                                           size_t __rmargin);
-+
-+/* Set __FS's wrap margin to __WMARGIN and return the old value.  */
-+extern size_t argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
-+                                         size_t __wmargin);
-+extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
-+                                           size_t __wmargin);
-+
-+/* Return the column number of the current output point in __FS.  */
-+extern size_t argp_fmtstream_point (argp_fmtstream_t __fs);
-+extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs);
-+
-+/* Internal routines.  */
-+extern void _argp_fmtstream_update (argp_fmtstream_t __fs);
-+extern void __argp_fmtstream_update (argp_fmtstream_t __fs);
-+extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
-+extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
-+
-+#ifdef __OPTIMIZE__
-+/* Inline versions of above routines.  */
-+
-+#if !_LIBC
-+#define __argp_fmtstream_putc argp_fmtstream_putc
-+#define __argp_fmtstream_puts argp_fmtstream_puts
-+#define __argp_fmtstream_write argp_fmtstream_write
-+#define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin
-+#define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin
-+#define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin
-+#define __argp_fmtstream_point argp_fmtstream_point
-+#define __argp_fmtstream_update _argp_fmtstream_update
-+#define __argp_fmtstream_ensure _argp_fmtstream_ensure
-+#endif
-+
-+#ifndef ARGP_FS_EI
-+#define ARGP_FS_EI __extern_inline
-+#endif
-+
-+ARGP_FS_EI size_t
-+__argp_fmtstream_write (argp_fmtstream_t __fs,
-+                       __const char *__str, size_t __len)
-+{
-+  if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len))
-+    {
-+      memcpy (__fs->p, __str, __len);
-+      __fs->p += __len;
-+      return __len;
-+    }
-+  else
-+    return 0;
-+}
-+
-+ARGP_FS_EI int
-+__argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str)
-+{
-+  size_t __len = strlen (__str);
-+  if (__len)
-+    {
-+      size_t __wrote = __argp_fmtstream_write (__fs, __str, __len);
-+      return __wrote == __len ? 0 : -1;
-+    }
-+  else
-+    return 0;
-+}
-+
-+ARGP_FS_EI int
-+__argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch)
-+{
-+  if (__fs->p < __fs->end || __argp_fmtstream_ensure (__fs, 1))
-+    return *__fs->p++ = __ch;
-+  else
-+    return EOF;
-+}
-+
-+/* Set __FS's left margin to __LMARGIN and return the old value.  */
-+ARGP_FS_EI size_t
-+__argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin)
-+{
-+  size_t __old;
-+  if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
-+    __argp_fmtstream_update (__fs);
-+  __old = __fs->lmargin;
-+  __fs->lmargin = __lmargin;
-+  return __old;
-+}
-+
-+/* Set __FS's right margin to __RMARGIN and return the old value.  */
-+ARGP_FS_EI size_t
-+__argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin)
-+{
-+  size_t __old;
-+  if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
-+    __argp_fmtstream_update (__fs);
-+  __old = __fs->rmargin;
-+  __fs->rmargin = __rmargin;
-+  return __old;
-+}
-+
-+/* Set FS's wrap margin to __WMARGIN and return the old value.  */
-+ARGP_FS_EI size_t
-+__argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin)
-+{
-+  size_t __old;
-+  if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
-+    __argp_fmtstream_update (__fs);
-+  __old = __fs->wmargin;
-+  __fs->wmargin = __wmargin;
-+  return __old;
-+}
-+
-+/* Return the column number of the current output point in __FS.  */
-+ARGP_FS_EI size_t
-+__argp_fmtstream_point (argp_fmtstream_t __fs)
-+{
-+  if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
-+    __argp_fmtstream_update (__fs);
-+  return __fs->point_col >= 0 ? __fs->point_col : 0;
-+}
-+
-+#if !_LIBC
-+#undef __argp_fmtstream_putc
-+#undef __argp_fmtstream_puts
-+#undef __argp_fmtstream_write
-+#undef __argp_fmtstream_set_lmargin
-+#undef __argp_fmtstream_set_rmargin
-+#undef __argp_fmtstream_set_wmargin
-+#undef __argp_fmtstream_point
-+#undef __argp_fmtstream_update
-+#undef __argp_fmtstream_ensure
-+#endif
-+
-+#endif /* __OPTIMIZE__ */
-+
-+#endif /* ARGP_FMTSTREAM_USE_LINEWRAP */
-+
-+#endif /* argp-fmtstream.h */
-diff --git a/libuargp/argp-fs-xinl.c b/libuargp/argp-fs-xinl.c
-new file mode 100644
-index 0000000..473cbbd
---- /dev/null
-+++ b/libuargp/argp-fs-xinl.c
-@@ -0,0 +1,44 @@
-+/* Real definitions for extern inline functions in argp-fmtstream.h
-+   Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#define ARGP_FS_EI
-+#undef __OPTIMIZE__
-+#define __OPTIMIZE__ 1
-+#include "argp-fmtstream.h"
-+
-+#if 0
-+/* Not exported.  */
-+/* Add weak aliases.  */
-+#if _LIBC - 0 && !defined (ARGP_FMTSTREAM_USE_LINEWRAP) && defined (weak_alias)
-+
-+weak_alias (__argp_fmtstream_putc, argp_fmtstream_putc)
-+weak_alias (__argp_fmtstream_puts, argp_fmtstream_puts)
-+weak_alias (__argp_fmtstream_write, argp_fmtstream_write)
-+weak_alias (__argp_fmtstream_set_lmargin, argp_fmtstream_set_lmargin)
-+weak_alias (__argp_fmtstream_set_rmargin, argp_fmtstream_set_rmargin)
-+weak_alias (__argp_fmtstream_set_wmargin, argp_fmtstream_set_wmargin)
-+weak_alias (__argp_fmtstream_point, argp_fmtstream_point)
-+
-+#endif
-+#endif
-diff --git a/libuargp/argp-help.c b/libuargp/argp-help.c
-new file mode 100644
-index 0000000..58a5e6e
---- /dev/null
-+++ b/libuargp/argp-help.c
-@@ -0,0 +1,1882 @@
-+/* Hierarchial argument parsing help output
-+   Copyright (C) 1995-2003, 2004, 2005, 2006, 2007
-+   Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.
-+
-+   Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
-+*/
-+
-+#ifndef _GNU_SOURCE
-+# define _GNU_SOURCE   1
-+#endif
-+
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
-+
-+/* AIX requires this to be the first thing in the file.  */
-+#ifndef __GNUC__
-+# if HAVE_ALLOCA_H || defined _LIBC
-+#  include <alloca.h>
-+# else
-+#  ifdef _AIX
-+#pragma alloca
-+#  else
-+#   ifndef alloca /* predefined by HP cc +Olibcalls */
-+char *alloca ();
-+#   endif
-+#  endif
-+# endif
-+#endif
-+
-+#include <stddef.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <assert.h>
-+#include <stdarg.h>
-+#include <ctype.h>
-+#include <limits.h>
-+#ifdef _LIBC
-+# include <wchar.h>
-+#endif
-+
-+#include <features.h>
-+#ifndef _
-+/* This is for other GNU distributions with internationalized messages.  */
-+# if (defined HAVE_LIBINTL_H || defined _LIBC) && defined __UCLIBC_HAS_GETTEXT_AWARENESS__
-+#  include <libintl.h>
-+#  ifdef _LIBC
-+#   undef dgettext
-+#   define dgettext(domain, msgid) \
-+  INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
-+#  endif
-+# else
-+#  define dgettext(domain, msgid) (msgid)
-+# endif
-+#endif
-+
-+#ifndef _LIBC
-+# if HAVE_STRERROR_R
-+#  if !HAVE_DECL_STRERROR_R
-+char *strerror_r (int errnum, char *buf, size_t buflen);
-+#  endif
-+# else
-+#  if !HAVE_DECL_STRERROR
-+char *strerror (int errnum);
-+#  endif
-+# endif
-+#endif
-+
-+#include <argp.h>
-+#include "argp-fmtstream.h"
-+#include <stdbool.h>
-+#include <stdint.h>
-+
-+#ifndef SIZE_MAX
-+# define SIZE_MAX ((size_t) -1)
-+#endif
-+
-+/* User-selectable (using an environment variable) formatting parameters.
-+
-+   These may be specified in an environment variable called `ARGP_HELP_FMT',
-+   with a contents like:  VAR1=VAL1,VAR2=VAL2,BOOLVAR2,no-BOOLVAR2
-+   Where VALn must be a positive integer.  The list of variables is in the
-+   UPARAM_NAMES vector, below.  */
-+
-+/* Default parameters.  */
-+#define DUP_ARGS      0                /* True if option argument can be duplicated. */
-+#define DUP_ARGS_NOTE 1                /* True to print a note about duplicate args. */
-+#define SHORT_OPT_COL 2                /* column in which short options start */
-+#define LONG_OPT_COL  6                /* column in which long options start */
-+#define DOC_OPT_COL   2                /* column in which doc options start */
-+#define OPT_DOC_COL  29                /* column in which option text starts */
-+#define HEADER_COL    1                /* column in which group headers are printed */
-+#define USAGE_INDENT 12                /* indentation of wrapped usage lines */
-+#define RMARGIN      79                /* right margin used for wrapping */
-+
-+/* User-selectable (using an environment variable) formatting parameters.
-+   They must all be of type `int' for the parsing code to work.  */
-+struct uparams
-+{
-+  /* If true, arguments for an option are shown with both short and long
-+     options, even when a given option has both, e.g. `-x ARG, --longx=ARG'.
-+     If false, then if an option has both, the argument is only shown with
-+     the long one, e.g., `-x, --longx=ARG', and a message indicating that
-+     this really means both is printed below the options.  */
-+  int dup_args;
-+
-+  /* This is true if when DUP_ARGS is false, and some duplicate arguments have
-+     been suppressed, an explanatory message should be printed.  */
-+  int dup_args_note;
-+
-+  /* Various output columns.  */
-+  int short_opt_col;
-+  int long_opt_col;
-+  int doc_opt_col;
-+  int opt_doc_col;
-+  int header_col;
-+  int usage_indent;
-+  int rmargin;
-+};
-+
-+/* This is a global variable, as user options are only ever read once.  */
-+static struct uparams uparams = {
-+  DUP_ARGS, DUP_ARGS_NOTE,
-+  SHORT_OPT_COL, LONG_OPT_COL, DOC_OPT_COL, OPT_DOC_COL, HEADER_COL,
-+  USAGE_INDENT, RMARGIN
-+};
-+
-+/* A particular uparam, and what the user name is.  */
-+struct uparam_name
-+{
-+  const char name[14];         /* User name.  */
-+  bool is_bool;                        /* Whether it's `boolean'.  */
-+  uint8_t uparams_offs;                /* Location of the (int) field in UPARAMS.  */
-+};
-+
-+/* The name-field mappings we know about.  */
-+static const struct uparam_name uparam_names[] =
-+{
-+  { "dup-args",       true, offsetof (struct uparams, dup_args) },
-+  { "dup-args-note",  true, offsetof (struct uparams, dup_args_note) },
-+  { "short-opt-col",  false, offsetof (struct uparams, short_opt_col) },
-+  { "long-opt-col",   false, offsetof (struct uparams, long_opt_col) },
-+  { "doc-opt-col",    false, offsetof (struct uparams, doc_opt_col) },
-+  { "opt-doc-col",    false, offsetof (struct uparams, opt_doc_col) },
-+  { "header-col",     false, offsetof (struct uparams, header_col) },
-+  { "usage-indent",   false, offsetof (struct uparams, usage_indent) },
-+  { "rmargin",        false, offsetof (struct uparams, rmargin) }
-+};
-+#define nuparam_names (sizeof (uparam_names) / sizeof (uparam_names[0]))
-+
-+/* Read user options from the environment, and fill in UPARAMS appropiately.  */
-+static void
-+fill_in_uparams (const struct argp_state *state)
-+{
-+  const char *var = getenv ("ARGP_HELP_FMT");
-+
-+#define SKIPWS(p) do { while (isspace (*p)) p++; } while (0);
-+
-+  if (var)
-+    /* Parse var. */
-+    while (*var)
-+      {
-+       SKIPWS (var);
-+
-+       if (isalpha (*var))
-+         {
-+           size_t var_len;
-+           const struct uparam_name *un;
-+           int unspec = 0, val = 0;
-+           const char *arg = var;
-+
-+           while (isalnum (*arg) || *arg == '-' || *arg == '_')
-+             arg++;
-+           var_len = arg - var;
-+
-+           SKIPWS (arg);
-+
-+           if (*arg == '\0' || *arg == ',')
-+             unspec = 1;
-+           else if (*arg == '=')
-+             {
-+               arg++;
-+               SKIPWS (arg);
-+             }
-+
-+           if (unspec)
-+             {
-+               if (var[0] == 'n' && var[1] == 'o' && var[2] == '-')
-+                 {
-+                   val = 0;
-+                   var += 3;
-+                   var_len -= 3;
-+                 }
-+               else
-+                 val = 1;
-+             }
-+           else if (isdigit (*arg))
-+             {
-+               val = atoi (arg);
-+               while (isdigit (*arg))
-+                 arg++;
-+               SKIPWS (arg);
-+             }
-+
-+           un = uparam_names;
-+           size_t u;
-+           for (u = 0; u < nuparam_names; ++un, ++u)
-+             if (strlen (un->name) == var_len
-+                 && strncmp (var, un->name, var_len) == 0)
-+               {
-+                 if (unspec && !un->is_bool)
-+                   argp_failure (state, 0, 0,
-+                                   dgettext (state == NULL ? NULL
-+                                             : state->root_argp->argp_domain,
-+                                             "\
-+%.*s: ARGP_HELP_FMT parameter requires a value"),
-+                                   (int) var_len, var);
-+                 else
-+                   *(int *)((char *)&uparams + un->uparams_offs) = val;
-+                 break;
-+               }
-+           if (u == nuparam_names)
-+             argp_failure (state, 0, 0,
-+                             dgettext (state == NULL ? NULL
-+                                       : state->root_argp->argp_domain, "\
-+%.*s: Unknown ARGP_HELP_FMT parameter"),
-+                             (int) var_len, var);
-+
-+           var = arg;
-+           if (*var == ',')
-+             var++;
-+         }
-+       else if (*var)
-+         {
-+           argp_failure (state, 0, 0,
-+                           dgettext (state == NULL ? NULL
-+                                     : state->root_argp->argp_domain,
-+                                     "Garbage in ARGP_HELP_FMT: %s"), var);
-+           break;
-+         }
-+      }
-+}
-+
-+/* Returns true if OPT hasn't been marked invisible.  Visibility only affects
-+   whether OPT is displayed or used in sorting, not option shadowing.  */
-+#define ovisible(opt) (! ((opt)->flags & OPTION_HIDDEN))
-+
-+/* Returns true if OPT is an alias for an earlier option.  */
-+#define oalias(opt) ((opt)->flags & OPTION_ALIAS)
-+
-+/* Returns true if OPT is an documentation-only entry.  */
-+#define odoc(opt) ((opt)->flags & OPTION_DOC)
-+
-+/* Returns true if OPT is the end-of-list marker for a list of options.  */
-+#define oend(opt) __option_is_end (opt)
-+
-+/* Returns true if OPT has a short option.  */
-+#define oshort(opt) __option_is_short (opt)
-+
-+/*
-+   The help format for a particular option is like:
-+
-+     -xARG, -yARG, --long1=ARG, --long2=ARG        Documentation...
-+
-+   Where ARG will be omitted if there's no argument, for this option, or
-+   will be surrounded by "[" and "]" appropiately if the argument is
-+   optional.  The documentation string is word-wrapped appropiately, and if
-+   the list of options is long enough, it will be started on a separate line.
-+   If there are no short options for a given option, the first long option is
-+   indented slighly in a way that's supposed to make most long options appear
-+   to be in a separate column.
-+
-+   For example, the following output (from ps):
-+
-+     -p PID, --pid=PID          List the process PID
-+        --pgrp=PGRP            List processes in the process group PGRP
-+     -P, -x, --no-parent        Include processes without parents
-+     -Q, --all-fields           Don't elide unusable fields (normally if there's
-+                               some reason ps can't print a field for any
-+                               process, it's removed from the output entirely)
-+     -r, --reverse, --gratuitously-long-reverse-option
-+                               Reverse the order of any sort
-+        --session[=SID]        Add the processes from the session SID (which
-+                               defaults to the sid of the current process)
-+
-+    Here are some more options:
-+     -f ZOT, --foonly=ZOT       Glork a foonly
-+     -z, --zaza                 Snit a zar
-+
-+     -?, --help                 Give this help list
-+        --usage                Give a short usage message
-+     -V, --version              Print program version
-+
-+   The struct argp_option array for the above could look like:
-+
-+   {
-+     {"pid",       'p',      "PID",  0, "List the process PID"},
-+     {"pgrp",      OPT_PGRP, "PGRP", 0, "List processes in the process group PGRP"},
-+     {"no-parent", 'P',              0,     0, "Include processes without parents"},
-+     {0,           'x',       0,     OPTION_ALIAS},
-+     {"all-fields",'Q',       0,     0, "Don't elide unusable fields (normally"
-+                                        " if there's some reason ps can't"
-+                                       " print a field for any process, it's"
-+                                        " removed from the output entirely)" },
-+     {"reverse",   'r',       0,     0, "Reverse the order of any sort"},
-+     {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS},
-+     {"session",   OPT_SESS,  "SID", OPTION_ARG_OPTIONAL,
-+                                        "Add the processes from the session"
-+                                       " SID (which defaults to the sid of"
-+                                       " the current process)" },
-+
-+     {0,0,0,0, "Here are some more options:"},
-+     {"foonly", 'f', "ZOT", 0, "Glork a foonly"},
-+     {"zaza", 'z', 0, 0, "Snit a zar"},
-+
-+     {0}
-+   }
-+
-+   Note that the last three options are automatically supplied by argp_parse,
-+   unless you tell it not to with ARGP_NO_HELP.
-+
-+*/
-+
-+/* Returns true if CH occurs between BEG and END.  */
-+static int
-+find_char (char ch, char *beg, char *end)
-+{
-+  while (beg < end)
-+    if (*beg == ch)
-+      return 1;
-+    else
-+      beg++;
-+  return 0;
-+}
-+
-+struct hol_cluster;            /* fwd decl */
-+
-+struct hol_entry
-+{
-+  /* First option.  */
-+  const struct argp_option *opt;
-+  /* Number of options (including aliases).  */
-+  unsigned num;
-+
-+  /* A pointers into the HOL's short_options field, to the first short option
-+     letter for this entry.  The order of the characters following this point
-+     corresponds to the order of options pointed to by OPT, and there are at
-+     most NUM.  A short option recorded in a option following OPT is only
-+     valid if it occurs in the right place in SHORT_OPTIONS (otherwise it's
-+     probably been shadowed by some other entry).  */
-+  char *short_options;
-+
-+  /* Entries are sorted by their group first, in the order:
-+       1, 2, ..., n, 0, -m, ..., -2, -1
-+     and then alphabetically within each group.  The default is 0.  */
-+  int group;
-+
-+  /* The cluster of options this entry belongs to, or 0 if none.  */
-+  struct hol_cluster *cluster;
-+
-+  /* The argp from which this option came.  */
-+  const struct argp *argp;
-+};
-+
-+/* A cluster of entries to reflect the argp tree structure.  */
-+struct hol_cluster
-+{
-+  /* A descriptive header printed before options in this cluster.  */
-+  const char *header;
-+
-+  /* Used to order clusters within the same group with the same parent,
-+     according to the order in which they occurred in the parent argp's child
-+     list.  */
-+  int index;
-+
-+  /* How to sort this cluster with respect to options and other clusters at the
-+     same depth (clusters always follow options in the same group).  */
-+  int group;
-+
-+  /* The cluster to which this cluster belongs, or 0 if it's at the base
-+     level.  */
-+  struct hol_cluster *parent;
-+
-+  /* The argp from which this cluster is (eventually) derived.  */
-+  const struct argp *argp;
-+
-+  /* The distance this cluster is from the root.  */
-+  int depth;
-+
-+  /* Clusters in a given hol are kept in a linked list, to make freeing them
-+     possible.  */
-+  struct hol_cluster *next;
-+};
-+
-+/* A list of options for help.  */
-+struct hol
-+{
-+  /* An array of hol_entry's.  */
-+  struct hol_entry *entries;
-+  /* The number of entries in this hol.  If this field is zero, the others
-+     are undefined.  */
-+  unsigned num_entries;
-+
-+  /* A string containing all short options in this HOL.  Each entry contains
-+     pointers into this string, so the order can't be messed with blindly.  */
-+  char *short_options;
-+
-+  /* Clusters of entries in this hol.  */
-+  struct hol_cluster *clusters;
-+};
-+
-+/* Create a struct hol from the options in ARGP.  CLUSTER is the
-+   hol_cluster in which these entries occur, or 0, if at the root.  */
-+static struct hol *
-+make_hol (const struct argp *argp, struct hol_cluster *cluster)
-+{
-+  char *so;
-+  const struct argp_option *o;
-+  const struct argp_option *opts = argp->options;
-+  struct hol_entry *entry;
-+  unsigned num_short_options = 0;
-+  struct hol *hol = malloc (sizeof (struct hol));
-+
-+  assert (hol);
-+
-+  hol->num_entries = 0;
-+  hol->clusters = 0;
-+
-+  if (opts)
-+    {
-+      int cur_group = 0;
-+
-+      /* The first option must not be an alias.  */
-+      assert (! oalias (opts));
-+
-+      /* Calculate the space needed.  */
-+      for (o = opts; ! oend (o); o++)
-+       {
-+         if (! oalias (o))
-+           hol->num_entries++;
-+         if (oshort (o))
-+           num_short_options++;        /* This is an upper bound.  */
-+       }
-+
-+      hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries);
-+      hol->short_options = malloc (num_short_options + 1);
-+
-+      assert (hol->entries && hol->short_options);
-+#if SIZE_MAX <= UINT_MAX
-+      assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry));
-+#endif
-+
-+      /* Fill in the entries.  */
-+      so = hol->short_options;
-+      for (o = opts, entry = hol->entries; ! oend (o); entry++)
-+       {
-+         entry->opt = o;
-+         entry->num = 0;
-+         entry->short_options = so;
-+         entry->group = cur_group =
-+           o->group
-+           ? o->group
-+           : ((!o->name && !o->key)
-+              ? cur_group + 1
-+              : cur_group);
-+         entry->cluster = cluster;
-+         entry->argp = argp;
-+
-+         do
-+           {
-+             entry->num++;
-+             if (oshort (o) && ! find_char (o->key, hol->short_options, so))
-+               /* O has a valid short option which hasn't already been used.*/
-+               *so++ = o->key;
-+             o++;
-+           }
-+         while (! oend (o) && oalias (o));
-+       }
-+      *so = '\0';              /* null terminated so we can find the length */
-+    }
-+
-+  return hol;
-+}
-+
-+/* Add a new cluster to HOL, with the given GROUP and HEADER (taken from the
-+   associated argp child list entry), INDEX, and PARENT, and return a pointer
-+   to it.  ARGP is the argp that this cluster results from.  */
-+static struct hol_cluster *
-+hol_add_cluster (struct hol *hol, int group, const char *header, int index,
-+                struct hol_cluster *parent, const struct argp *argp)
-+{
-+  struct hol_cluster *cl = malloc (sizeof (struct hol_cluster));
-+  if (cl)
-+    {
-+      cl->group = group;
-+      cl->header = header;
-+
-+      cl->index = index;
-+      cl->parent = parent;
-+      cl->argp = argp;
-+      cl->depth = parent ? parent->depth + 1 : 0;
-+
-+      cl->next = hol->clusters;
-+      hol->clusters = cl;
-+    }
-+  return cl;
-+}
-+
-+/* Free HOL and any resources it uses.  */
-+static void
-+hol_free (struct hol *hol)
-+{
-+  struct hol_cluster *cl = hol->clusters;
-+
-+  while (cl)
-+    {
-+      struct hol_cluster *next = cl->next;
-+      free (cl);
-+      cl = next;
-+    }
-+
-+  if (hol->num_entries > 0)
-+    {
-+      free (hol->entries);
-+      free (hol->short_options);
-+    }
-+
-+  free (hol);
-+}
-+
-+static int
-+hol_entry_short_iterate (const struct hol_entry *entry,
-+                        int (*func)(const struct argp_option *opt,
-+                                    const struct argp_option *real,
-+                                    const char *domain, void *cookie),
-+                        const char *domain, void *cookie)
-+{
-+  unsigned nopts;
-+  int val = 0;
-+  const struct argp_option *opt, *real = entry->opt;
-+  char *so = entry->short_options;
-+
-+  for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--)
-+    if (oshort (opt) && *so == opt->key)
-+      {
-+       if (!oalias (opt))
-+         real = opt;
-+       if (ovisible (opt))
-+         val = (*func)(opt, real, domain, cookie);
-+       so++;
-+      }
-+
-+  return val;
-+}
-+
-+static __inline__ int
-+__attribute__ ((always_inline))
-+hol_entry_long_iterate (const struct hol_entry *entry,
-+                       int (*func)(const struct argp_option *opt,
-+                                   const struct argp_option *real,
-+                                   const char *domain, void *cookie),
-+                       const char *domain, void *cookie)
-+{
-+  unsigned nopts;
-+  int val = 0;
-+  const struct argp_option *opt, *real = entry->opt;
-+
-+  for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--)
-+    if (opt->name)
-+      {
-+       if (!oalias (opt))
-+         real = opt;
-+       if (ovisible (opt))
-+         val = (*func)(opt, real, domain, cookie);
-+      }
-+
-+  return val;
-+}
-+
-+/* Iterator that returns true for the first short option.  */
-+static __inline__ int
-+until_short (const struct argp_option *opt, const struct argp_option *real,
-+            const char *domain, void *cookie)
-+{
-+  return oshort (opt) ? opt->key : 0;
-+}
-+
-+/* Returns the first valid short option in ENTRY, or 0 if there is none.  */
-+static char
-+hol_entry_first_short (const struct hol_entry *entry)
-+{
-+  return hol_entry_short_iterate (entry, until_short,
-+                                 entry->argp->argp_domain, 0);
-+}
-+
-+/* Returns the first valid long option in ENTRY, or 0 if there is none.  */
-+static const char *
-+hol_entry_first_long (const struct hol_entry *entry)
-+{
-+  const struct argp_option *opt;
-+  unsigned num;
-+  for (opt = entry->opt, num = entry->num; num > 0; opt++, num--)
-+    if (opt->name && ovisible (opt))
-+      return opt->name;
-+  return 0;
-+}
-+
-+/* Returns the entry in HOL with the long option name NAME, or 0 if there is
-+   none.  */
-+static struct hol_entry *
-+hol_find_entry (struct hol *hol, const char *name)
-+{
-+  struct hol_entry *entry = hol->entries;
-+  unsigned num_entries = hol->num_entries;
-+
-+  while (num_entries-- > 0)
-+    {
-+      const struct argp_option *opt = entry->opt;
-+      unsigned num_opts = entry->num;
-+
-+      while (num_opts-- > 0)
-+       if (opt->name && ovisible (opt) && strcmp (opt->name, name) == 0)
-+         return entry;
-+       else
-+         opt++;
-+
-+      entry++;
-+    }
-+
-+  return 0;
-+}
-+
-+/* If an entry with the long option NAME occurs in HOL, set it's special
-+   sort position to GROUP.  */
-+static void
-+hol_set_group (struct hol *hol, const char *name, int group)
-+{
-+  struct hol_entry *entry = hol_find_entry (hol, name);
-+  if (entry)
-+    entry->group = group;
-+}
-+
-+/* Order by group:  0, 1, 2, ..., n, -m, ..., -2, -1.
-+   EQ is what to return if GROUP1 and GROUP2 are the same.  */
-+static int
-+group_cmp (int group1, int group2, int eq)
-+{
-+  if (group1 == group2)
-+    return eq;
-+  else if ((group1 < 0 && group2 < 0) || (group1 >= 0 && group2 >= 0))
-+    return group1 - group2;
-+  else
-+    return group2 - group1;
-+}
-+
-+/* Compare clusters CL1 & CL2 by the order that they should appear in
-+   output.  */
-+static int
-+hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2)
-+{
-+  /* If one cluster is deeper than the other, use its ancestor at the same
-+     level, so that finding the common ancestor is straightforward.  */
-+  while (cl1->depth > cl2->depth)
-+    cl1 = cl1->parent;
-+  while (cl2->depth > cl1->depth)
-+    cl2 = cl2->parent;
-+
-+  /* Now reduce both clusters to their ancestors at the point where both have
-+     a common parent; these can be directly compared.  */
-+  while (cl1->parent != cl2->parent)
-+    cl1 = cl1->parent, cl2 = cl2->parent;
-+
-+  return group_cmp (cl1->group, cl2->group, cl2->index - cl1->index);
-+}
-+
-+/* Return the ancestor of CL that's just below the root (i.e., has a parent
-+   of 0).  */
-+static struct hol_cluster *
-+hol_cluster_base (struct hol_cluster *cl)
-+{
-+  while (cl->parent)
-+    cl = cl->parent;
-+  return cl;
-+}
-+
-+/* Return true if CL1 is a child of CL2.  */
-+static int
-+hol_cluster_is_child (const struct hol_cluster *cl1,
-+                     const struct hol_cluster *cl2)
-+{
-+  while (cl1 && cl1 != cl2)
-+    cl1 = cl1->parent;
-+  return cl1 == cl2;
-+}
-+
-+/* Given the name of a OPTION_DOC option, modifies NAME to start at the tail
-+   that should be used for comparisons, and returns true iff it should be
-+   treated as a non-option.  */
-+static int
-+canon_doc_option (const char **name)
-+{
-+  int non_opt;
-+  /* Skip initial whitespace.  */
-+  while (isspace (**name))
-+    (*name)++;
-+  /* Decide whether this looks like an option (leading `-') or not.  */
-+  non_opt = (**name != '-');
-+  /* Skip until part of name used for sorting.  */
-+  while (**name && !isalnum (**name))
-+    (*name)++;
-+  return non_opt;
-+}
-+
-+/* Order ENTRY1 & ENTRY2 by the order which they should appear in a help
-+   listing.  */
-+static int
-+hol_entry_cmp (const struct hol_entry *entry1,
-+              const struct hol_entry *entry2)
-+{
-+  /* The group numbers by which the entries should be ordered; if either is
-+     in a cluster, then this is just the group within the cluster.  */
-+  int group1 = entry1->group, group2 = entry2->group;
-+
-+  if (entry1->cluster != entry2->cluster)
-+    {
-+      /* The entries are not within the same cluster, so we can't compare them
-+        directly, we have to use the appropiate clustering level too.  */
-+      if (! entry1->cluster)
-+       /* ENTRY1 is at the `base level', not in a cluster, so we have to
-+          compare it's group number with that of the base cluster in which
-+          ENTRY2 resides.  Note that if they're in the same group, the
-+          clustered option always comes laster.  */
-+       return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1);
-+      else if (! entry2->cluster)
-+       /* Likewise, but ENTRY2's not in a cluster.  */
-+       return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1);
-+      else
-+       /* Both entries are in clusters, we can just compare the clusters.  */
-+       return hol_cluster_cmp (entry1->cluster, entry2->cluster);
-+    }
-+  else if (group1 == group2)
-+    /* The entries are both in the same cluster and group, so compare them
-+       alphabetically.  */
-+    {
-+      int short1 = hol_entry_first_short (entry1);
-+      int short2 = hol_entry_first_short (entry2);
-+      int doc1 = odoc (entry1->opt);
-+      int doc2 = odoc (entry2->opt);
-+      const char *long1 = hol_entry_first_long (entry1);
-+      const char *long2 = hol_entry_first_long (entry2);
-+
-+      if (doc1)
-+       doc1 = long1 != NULL && canon_doc_option (&long1);
-+      if (doc2)
-+       doc2 = long2 != NULL && canon_doc_option (&long2);
-+
-+      if (doc1 != doc2)
-+       /* `documentation' options always follow normal options (or
-+          documentation options that *look* like normal options).  */
-+       return doc1 - doc2;
-+      else if (!short1 && !short2 && long1 && long2)
-+       /* Only long options.  */
-+       return strcasecmp (long1, long2);
-+      else
-+       /* Compare short/short, long/short, short/long, using the first
-+          character of long options.  Entries without *any* valid
-+          options (such as options with OPTION_HIDDEN set) will be put
-+          first, but as they're not displayed, it doesn't matter where
-+          they are.  */
-+       {
-+         char first1 = short1 ? short1 : long1 ? *long1 : 0;
-+         char first2 = short2 ? short2 : long2 ? *long2 : 0;
-+#ifdef _tolower
-+         int lower_cmp = _tolower (first1) - _tolower (first2);
-+#else
-+         int lower_cmp = tolower (first1) - tolower (first2);
-+#endif
-+         /* Compare ignoring case, except when the options are both the
-+            same letter, in which case lower-case always comes first.  */
-+         return lower_cmp ? lower_cmp : first2 - first1;
-+       }
-+    }
-+  else
-+    /* Within the same cluster, but not the same group, so just compare
-+       groups.  */
-+    return group_cmp (group1, group2, 0);
-+}
-+
-+/* Version of hol_entry_cmp with correct signature for qsort.  */
-+static int
-+hol_entry_qcmp (const void *entry1_v, const void *entry2_v)
-+{
-+  return hol_entry_cmp (entry1_v, entry2_v);
-+}
-+
-+/* Sort HOL by group and alphabetically by option name (with short options
-+   taking precedence over long).  Since the sorting is for display purposes
-+   only, the shadowing of options isn't effected.  */
-+static void
-+hol_sort (struct hol *hol)
-+{
-+  if (hol->num_entries > 0)
-+    qsort (hol->entries, hol->num_entries, sizeof (struct hol_entry),
-+          hol_entry_qcmp);
-+}
-+
-+/* Append MORE to HOL, destroying MORE in the process.  Options in HOL shadow
-+   any in MORE with the same name.  */
-+static void
-+hol_append (struct hol *hol, struct hol *more)
-+{
-+  struct hol_cluster **cl_end = &hol->clusters;
-+
-+  /* Steal MORE's cluster list, and add it to the end of HOL's.  */
-+  while (*cl_end)
-+    cl_end = &(*cl_end)->next;
-+  *cl_end = more->clusters;
-+  more->clusters = 0;
-+
-+  /* Merge entries.  */
-+  if (more->num_entries > 0)
-+    {
-+      if (hol->num_entries == 0)
-+       {
-+         hol->num_entries = more->num_entries;
-+         hol->entries = more->entries;
-+         hol->short_options = more->short_options;
-+         more->num_entries = 0;        /* Mark MORE's fields as invalid.  */
-+       }
-+      else
-+       /* Append the entries in MORE to those in HOL, taking care to only add
-+          non-shadowed SHORT_OPTIONS values.  */
-+       {
-+         unsigned left;
-+         char *so, *more_so;
-+         struct hol_entry *e;
-+         unsigned num_entries = hol->num_entries + more->num_entries;
-+         struct hol_entry *entries =
-+           malloc (num_entries * sizeof (struct hol_entry));
-+         unsigned hol_so_len = strlen (hol->short_options);
-+         char *short_options =
-+           malloc (hol_so_len + strlen (more->short_options) + 1);
-+
-+         assert (entries && short_options);
-+#if SIZE_MAX <= UINT_MAX
-+         assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry));
-+#endif
-+
-+         mempcpy (mempcpy (entries, hol->entries,
-+                               hol->num_entries * sizeof (struct hol_entry)),
-+                    more->entries,
-+                    more->num_entries * sizeof (struct hol_entry));
-+
-+         mempcpy (short_options, hol->short_options, hol_so_len);
-+
-+         /* Fix up the short options pointers from HOL.  */
-+         for (e = entries, left = hol->num_entries; left > 0; e++, left--)
-+           e->short_options += (short_options - hol->short_options);
-+
-+         /* Now add the short options from MORE, fixing up its entries
-+            too.  */
-+         so = short_options + hol_so_len;
-+         more_so = more->short_options;
-+         for (left = more->num_entries; left > 0; e++, left--)
-+           {
-+             int opts_left;
-+             const struct argp_option *opt;
-+
-+             e->short_options = so;
-+
-+             for (opts_left = e->num, opt = e->opt; opts_left; opt++, opts_left--)
-+               {
-+                 int ch = *more_so;
-+                 if (oshort (opt) && ch == opt->key)
-+                   /* The next short option in MORE_SO, CH, is from OPT.  */
-+                   {
-+                     if (! find_char (ch, short_options,
-+                                      short_options + hol_so_len))
-+                       /* The short option CH isn't shadowed by HOL's options,
-+                          so add it to the sum.  */
-+                       *so++ = ch;
-+                     more_so++;
-+                   }
-+               }
-+           }
-+
-+         *so = '\0';
-+
-+         free (hol->entries);
-+         free (hol->short_options);
-+
-+         hol->entries = entries;
-+         hol->num_entries = num_entries;
-+         hol->short_options = short_options;
-+       }
-+    }
-+
-+  hol_free (more);
-+}
-+
-+/* Inserts enough spaces to make sure STREAM is at column COL.  */
-+static void
-+indent_to (argp_fmtstream_t stream, unsigned col)
-+{
-+  int needed = col - __argp_fmtstream_point (stream);
-+  while (needed-- > 0)
-+    __argp_fmtstream_putc (stream, ' ');
-+}
-+
-+/* Output to STREAM either a space, or a newline if there isn't room for at
-+   least ENSURE characters before the right margin.  */
-+static void
-+space (argp_fmtstream_t stream, size_t ensure)
-+{
-+  if (__argp_fmtstream_point (stream) + ensure
-+      >= __argp_fmtstream_rmargin (stream))
-+    __argp_fmtstream_putc (stream, '\n');
-+  else
-+    __argp_fmtstream_putc (stream, ' ');
-+}
-+
-+/* If the option REAL has an argument, we print it in using the printf
-+   format REQ_FMT or OPT_FMT depending on whether it's a required or
-+   optional argument.  */
-+static void
-+arg (const struct argp_option *real, const char *req_fmt, const char *opt_fmt,
-+     const char *domain, argp_fmtstream_t stream)
-+{
-+  if (real->arg)
-+    {
-+      if (real->flags & OPTION_ARG_OPTIONAL)
-+       __argp_fmtstream_printf (stream, opt_fmt,
-+                                dgettext (domain, real->arg));
-+      else
-+       __argp_fmtstream_printf (stream, req_fmt,
-+                                dgettext (domain, real->arg));
-+    }
-+}
-+
-+/* Helper functions for hol_entry_help.  */
-+
-+/* State used during the execution of hol_help.  */
-+struct hol_help_state
-+{
-+  /* PREV_ENTRY should contain the previous entry printed, or 0.  */
-+  struct hol_entry *prev_entry;
-+
-+  /* If an entry is in a different group from the previous one, and SEP_GROUPS
-+     is true, then a blank line will be printed before any output. */
-+  int sep_groups;
-+
-+  /* True if a duplicate option argument was suppressed (only ever set if
-+     UPARAMS.dup_args is false).  */
-+  int suppressed_dup_arg;
-+};
-+
-+/* Some state used while printing a help entry (used to communicate with
-+   helper functions).  See the doc for hol_entry_help for more info, as most
-+   of the fields are copied from its arguments.  */
-+struct pentry_state
-+{
-+  const struct hol_entry *entry;
-+  argp_fmtstream_t stream;
-+  struct hol_help_state *hhstate;
-+
-+  /* True if nothing's been printed so far.  */
-+  int first;
-+
-+  /* If non-zero, the state that was used to print this help.  */
-+  const struct argp_state *state;
-+};
-+
-+/* If a user doc filter should be applied to DOC, do so.  */
-+static const char *
-+filter_doc (const char *doc, int key, const struct argp *argp,
-+           const struct argp_state *state)
-+{
-+  if (argp && argp->help_filter)
-+    /* We must apply a user filter to this output.  */
-+    {
-+      void *input = __argp_input (argp, state);
-+      return (*argp->help_filter) (key, doc, input);
-+    }
-+  else
-+    /* No filter.  */
-+    return doc;
-+}
-+
-+/* Prints STR as a header line, with the margin lines set appropiately, and
-+   notes the fact that groups should be separated with a blank line.  ARGP is
-+   the argp that should dictate any user doc filtering to take place.  Note
-+   that the previous wrap margin isn't restored, but the left margin is reset
-+   to 0.  */
-+static void
-+print_header (const char *str, const struct argp *argp,
-+             struct pentry_state *pest)
-+{
-+  const char *tstr = dgettext (argp->argp_domain, str);
-+  const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_HEADER, argp, pest->state);
-+
-+  if (fstr)
-+    {
-+      if (*fstr)
-+       {
-+         if (pest->hhstate->prev_entry)
-+           /* Precede with a blank line.  */
-+           __argp_fmtstream_putc (pest->stream, '\n');
-+         indent_to (pest->stream, uparams.header_col);
-+         __argp_fmtstream_set_lmargin (pest->stream, uparams.header_col);
-+         __argp_fmtstream_set_wmargin (pest->stream, uparams.header_col);
-+         __argp_fmtstream_puts (pest->stream, fstr);
-+         __argp_fmtstream_set_lmargin (pest->stream, 0);
-+         __argp_fmtstream_putc (pest->stream, '\n');
-+       }
-+
-+      pest->hhstate->sep_groups = 1; /* Separate subsequent groups. */
-+    }
-+
-+  if (fstr != tstr)
-+    free ((char *) fstr);
-+}
-+
-+/* Inserts a comma if this isn't the first item on the line, and then makes
-+   sure we're at least to column COL.  If this *is* the first item on a line,
-+   prints any pending whitespace/headers that should precede this line. Also
-+   clears FIRST.  */
-+static void
-+comma (unsigned col, struct pentry_state *pest)
-+{
-+  if (pest->first)
-+    {
-+      const struct hol_entry *pe = pest->hhstate->prev_entry;
-+      const struct hol_cluster *cl = pest->entry->cluster;
-+
-+      if (pest->hhstate->sep_groups && pe && pest->entry->group != pe->group)
-+       __argp_fmtstream_putc (pest->stream, '\n');
-+
-+      if (cl && cl->header && *cl->header
-+         && (!pe
-+             || (pe->cluster != cl
-+                 && !hol_cluster_is_child (pe->cluster, cl))))
-+       /* If we're changing clusters, then this must be the start of the
-+          ENTRY's cluster unless that is an ancestor of the previous one
-+          (in which case we had just popped into a sub-cluster for a bit).
-+          If so, then print the cluster's header line.  */
-+       {
-+         int old_wm = __argp_fmtstream_wmargin (pest->stream);
-+         print_header (cl->header, cl->argp, pest);
-+         __argp_fmtstream_set_wmargin (pest->stream, old_wm);
-+       }
-+
-+      pest->first = 0;
-+    }
-+  else
-+    __argp_fmtstream_puts (pest->stream, ", ");
-+
-+  indent_to (pest->stream, col);
-+}
-+
-+/* Print help for ENTRY to STREAM.  */
-+static void
-+hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
-+               argp_fmtstream_t stream, struct hol_help_state *hhstate)
-+{
-+  unsigned num;
-+  const struct argp_option *real = entry->opt, *opt;
-+  char *so = entry->short_options;
-+  int have_long_opt = 0;       /* We have any long options.  */
-+  /* Saved margins.  */
-+  int old_lm = __argp_fmtstream_set_lmargin (stream, 0);
-+  int old_wm = __argp_fmtstream_wmargin (stream);
-+  /* PEST is a state block holding some of our variables that we'd like to
-+     share with helper functions.  */
-+  struct pentry_state pest = { entry, stream, hhstate, 1, state };
-+
-+  if (! odoc (real))
-+    for (opt = real, num = entry->num; num > 0; opt++, num--)
-+      if (opt->name && ovisible (opt))
-+       {
-+         have_long_opt = 1;
-+         break;
-+       }
-+
-+  /* First emit short options.  */
-+  __argp_fmtstream_set_wmargin (stream, uparams.short_opt_col); /* For truly bizarre cases. */
-+  for (opt = real, num = entry->num; num > 0; opt++, num--)
-+    if (oshort (opt) && opt->key == *so)
-+      /* OPT has a valid (non shadowed) short option.  */
-+      {
-+       if (ovisible (opt))
-+         {
-+           comma (uparams.short_opt_col, &pest);
-+           __argp_fmtstream_putc (stream, '-');
-+           __argp_fmtstream_putc (stream, *so);
-+           if (!have_long_opt || uparams.dup_args)
-+             arg (real, " %s", "[%s]",
-+                  state == NULL ? NULL : state->root_argp->argp_domain,
-+                  stream);
-+           else if (real->arg)
-+             hhstate->suppressed_dup_arg = 1;
-+         }
-+       so++;
-+      }
-+
-+  /* Now, long options.  */
-+  if (odoc (real))
-+    /* A `documentation' option.  */
-+    {
-+      __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col);
-+      for (opt = real, num = entry->num; num > 0; opt++, num--)
-+       if (opt->name && ovisible (opt))
-+         {
-+           comma (uparams.doc_opt_col, &pest);
-+           /* Calling gettext here isn't quite right, since sorting will
-+              have been done on the original; but documentation options
-+              should be pretty rare anyway...  */
-+           __argp_fmtstream_puts (stream,
-+                                  dgettext (state == NULL ? NULL
-+                                            : state->root_argp->argp_domain,
-+                                            opt->name));
-+         }
-+    }
-+  else
-+    /* A real long option.  */
-+    {
-+      __argp_fmtstream_set_wmargin (stream, uparams.long_opt_col);
-+      for (opt = real, num = entry->num; num > 0; opt++, num--)
-+       if (opt->name && ovisible (opt))
-+         {
-+           comma (uparams.long_opt_col, &pest);
-+           __argp_fmtstream_printf (stream, "--%s", opt->name);
-+           arg (real, "=%s", "[=%s]",
-+                state == NULL ? NULL : state->root_argp->argp_domain, stream);
-+         }
-+    }
-+
-+  /* Next, documentation strings.  */
-+  __argp_fmtstream_set_lmargin (stream, 0);
-+
-+  if (pest.first)
-+    {
-+      /* Didn't print any switches, what's up?  */
-+      if (!oshort (real) && !real->name)
-+       /* This is a group header, print it nicely.  */
-+       print_header (real->doc, entry->argp, &pest);
-+      else
-+       /* Just a totally shadowed option or null header; print nothing.  */
-+       goto cleanup;           /* Just return, after cleaning up.  */
-+    }
-+  else
-+    {
-+      const char *tstr = real->doc ? dgettext (state == NULL ? NULL
-+                                              : state->root_argp->argp_domain,
-+                                              real->doc) : 0;
-+      const char *fstr = filter_doc (tstr, real->key, entry->argp, state);
-+      if (fstr && *fstr)
-+       {
-+         unsigned int col = __argp_fmtstream_point (stream);
-+
-+         __argp_fmtstream_set_lmargin (stream, uparams.opt_doc_col);
-+         __argp_fmtstream_set_wmargin (stream, uparams.opt_doc_col);
-+
-+         if (col > (unsigned int) (uparams.opt_doc_col + 3))
-+           __argp_fmtstream_putc (stream, '\n');
-+         else if (col >= (unsigned int) uparams.opt_doc_col)
-+           __argp_fmtstream_puts (stream, "   ");
-+         else
-+           indent_to (stream, uparams.opt_doc_col);
-+
-+         __argp_fmtstream_puts (stream, fstr);
-+       }
-+      if (fstr && fstr != tstr)
-+       free ((char *) fstr);
-+
-+      /* Reset the left margin.  */
-+      __argp_fmtstream_set_lmargin (stream, 0);
-+      __argp_fmtstream_putc (stream, '\n');
-+    }
-+
-+  hhstate->prev_entry = entry;
-+
-+cleanup:
-+  __argp_fmtstream_set_lmargin (stream, old_lm);
-+  __argp_fmtstream_set_wmargin (stream, old_wm);
-+}
-+
-+/* Output a long help message about the options in HOL to STREAM.  */
-+static void
-+hol_help (struct hol *hol, const struct argp_state *state,
-+         argp_fmtstream_t stream)
-+{
-+  unsigned num;
-+  struct hol_entry *entry;
-+  struct hol_help_state hhstate = { 0, 0, 0 };
-+
-+  for (entry = hol->entries, num = hol->num_entries; num > 0; entry++, num--)
-+    hol_entry_help (entry, state, stream, &hhstate);
-+
-+  if (hhstate.suppressed_dup_arg && uparams.dup_args_note)
-+    {
-+      const char *tstr = dgettext (state == NULL ? NULL
-+                                  : state->root_argp->argp_domain, "\
-+Mandatory or optional arguments to long options are also mandatory or \
-+optional for any corresponding short options.");
-+      const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE,
-+                                    state ? state->root_argp : 0, state);
-+      if (fstr && *fstr)
-+       {
-+         __argp_fmtstream_putc (stream, '\n');
-+         __argp_fmtstream_puts (stream, fstr);
-+         __argp_fmtstream_putc (stream, '\n');
-+       }
-+      if (fstr && fstr != tstr)
-+       free ((char *) fstr);
-+    }
-+}
-+
-+/* Helper functions for hol_usage.  */
-+
-+/* If OPT is a short option without an arg, append its key to the string
-+   pointer pointer to by COOKIE, and advance the pointer.  */
-+static int
-+add_argless_short_opt (const struct argp_option *opt,
-+                      const struct argp_option *real,
-+                      const char *domain, void *cookie)
-+{
-+  char **snao_end = cookie;
-+  if (!(opt->arg || real->arg)
-+      && !((opt->flags | real->flags) & OPTION_NO_USAGE))
-+    *(*snao_end)++ = opt->key;
-+  return 0;
-+}
-+
-+/* If OPT is a short option with an arg, output a usage entry for it to the
-+   stream pointed at by COOKIE.  */
-+static int
-+usage_argful_short_opt (const struct argp_option *opt,
-+                       const struct argp_option *real,
-+                       const char *domain, void *cookie)
-+{
-+  argp_fmtstream_t stream = cookie;
-+  const char *arg = opt->arg;
-+  int flags = opt->flags | real->flags;
-+
-+  if (! arg)
-+    arg = real->arg;
-+
-+  if (arg && !(flags & OPTION_NO_USAGE))
-+    {
-+      arg = dgettext (domain, arg);
-+
-+      if (flags & OPTION_ARG_OPTIONAL)
-+       __argp_fmtstream_printf (stream, " [-%c[%s]]", opt->key, arg);
-+      else
-+       {
-+         /* Manually do line wrapping so that it (probably) won't
-+            get wrapped at the embedded space.  */
-+         space (stream, 6 + strlen (arg));
-+         __argp_fmtstream_printf (stream, "[-%c %s]", opt->key, arg);
-+       }
-+    }
-+
-+  return 0;
-+}
-+
-+/* Output a usage entry for the long option opt to the stream pointed at by
-+   COOKIE.  */
-+static int
-+usage_long_opt (const struct argp_option *opt,
-+               const struct argp_option *real,
-+               const char *domain, void *cookie)
-+{
-+  argp_fmtstream_t stream = cookie;
-+  const char *arg = opt->arg;
-+  int flags = opt->flags | real->flags;
-+
-+  if (! arg)
-+    arg = real->arg;
-+
-+  if (! (flags & OPTION_NO_USAGE))
-+    {
-+      if (arg)
-+       {
-+         arg = dgettext (domain, arg);
-+         if (flags & OPTION_ARG_OPTIONAL)
-+           __argp_fmtstream_printf (stream, " [--%s[=%s]]", opt->name, arg);
-+         else
-+           __argp_fmtstream_printf (stream, " [--%s=%s]", opt->name, arg);
-+       }
-+      else
-+       __argp_fmtstream_printf (stream, " [--%s]", opt->name);
-+    }
-+
-+  return 0;
-+}
-+
-+/* Print a short usage description for the arguments in HOL to STREAM.  */
-+static void
-+hol_usage (struct hol *hol, argp_fmtstream_t stream)
-+{
-+  if (hol->num_entries > 0)
-+    {
-+      unsigned nentries;
-+      struct hol_entry *entry;
-+      char *short_no_arg_opts = alloca (strlen (hol->short_options) + 1);
-+      char *snao_end = short_no_arg_opts;
-+
-+      /* First we put a list of short options without arguments.  */
-+      for (entry = hol->entries, nentries = hol->num_entries
-+          ; nentries > 0
-+          ; entry++, nentries--)
-+       hol_entry_short_iterate (entry, add_argless_short_opt,
-+                                entry->argp->argp_domain, &snao_end);
-+      if (snao_end > short_no_arg_opts)
-+       {
-+         *snao_end++ = 0;
-+         __argp_fmtstream_printf (stream, " [-%s]", short_no_arg_opts);
-+       }
-+
-+      /* Now a list of short options *with* arguments.  */
-+      for (entry = hol->entries, nentries = hol->num_entries
-+          ; nentries > 0
-+          ; entry++, nentries--)
-+       hol_entry_short_iterate (entry, usage_argful_short_opt,
-+                                entry->argp->argp_domain, stream);
-+
-+      /* Finally, a list of long options (whew!).  */
-+      for (entry = hol->entries, nentries = hol->num_entries
-+          ; nentries > 0
-+          ; entry++, nentries--)
-+       hol_entry_long_iterate (entry, usage_long_opt,
-+                               entry->argp->argp_domain, stream);
-+    }
-+}
-+
-+/* Make a HOL containing all levels of options in ARGP.  CLUSTER is the
-+   cluster in which ARGP's entries should be clustered, or 0.  */
-+static struct hol *
-+argp_hol (const struct argp *argp, struct hol_cluster *cluster)
-+{
-+  const struct argp_child *child = argp->children;
-+  struct hol *hol = make_hol (argp, cluster);
-+  if (child)
-+    while (child->argp)
-+      {
-+       struct hol_cluster *child_cluster =
-+         ((child->group || child->header)
-+          /* Put CHILD->argp within its own cluster.  */
-+          ? hol_add_cluster (hol, child->group, child->header,
-+                             child - argp->children, cluster, argp)
-+          /* Just merge it into the parent's cluster.  */
-+          : cluster);
-+       hol_append (hol, argp_hol (child->argp, child_cluster)) ;
-+       child++;
-+      }
-+  return hol;
-+}
-+
-+/* Calculate how many different levels with alternative args strings exist in
-+   ARGP.  */
-+static size_t
-+argp_args_levels (const struct argp *argp)
-+{
-+  size_t levels = 0;
-+  const struct argp_child *child = argp->children;
-+
-+  if (argp->args_doc && strchr (argp->args_doc, '\n'))
-+    levels++;
-+
-+  if (child)
-+    while (child->argp)
-+      levels += argp_args_levels ((child++)->argp);
-+
-+  return levels;
-+}
-+
-+/* Print all the non-option args documented in ARGP to STREAM.  Any output is
-+   preceded by a space.  LEVELS is a pointer to a byte vector the length
-+   returned by argp_args_levels; it should be initialized to zero, and
-+   updated by this routine for the next call if ADVANCE is true.  True is
-+   returned as long as there are more patterns to output.  */
-+static int
-+argp_args_usage (const struct argp *argp, const struct argp_state *state,
-+                char **levels, int advance, argp_fmtstream_t stream)
-+{
-+  char *our_level = *levels;
-+  int multiple = 0;
-+  const struct argp_child *child = argp->children;
-+  const char *tdoc = dgettext (argp->argp_domain, argp->args_doc), *nl = 0;
-+  const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC, argp, state);
-+
-+  if (fdoc)
-+    {
-+      const char *cp = fdoc;
-+      nl = strchrnul (cp, '\n');
-+      if (*nl != '\0')
-+       /* This is a `multi-level' args doc; advance to the correct position
-+          as determined by our state in LEVELS, and update LEVELS.  */
-+       {
-+         int i;
-+         multiple = 1;
-+         for (i = 0; i < *our_level; i++)
-+           cp = nl + 1, nl = strchrnul (cp, '\n');
-+         (*levels)++;
-+       }
-+
-+      /* Manually do line wrapping so that it (probably) won't get wrapped at
-+        any embedded spaces.  */
-+      space (stream, 1 + nl - cp);
-+
-+      __argp_fmtstream_write (stream, cp, nl - cp);
-+    }
-+  if (fdoc && fdoc != tdoc)
-+    free ((char *)fdoc);       /* Free user's modified doc string.  */
-+
-+  if (child)
-+    while (child->argp)
-+      advance = !argp_args_usage ((child++)->argp, state, levels, advance, stream);
-+
-+  if (advance && multiple)
-+    {
-+      /* Need to increment our level.  */
-+      if (*nl)
-+       /* There's more we can do here.  */
-+       {
-+         (*our_level)++;
-+         advance = 0;          /* Our parent shouldn't advance also. */
-+       }
-+      else if (*our_level > 0)
-+       /* We had multiple levels, but used them up; reset to zero.  */
-+       *our_level = 0;
-+    }
-+
-+  return !advance;
-+}
-+
-+/* Print the documentation for ARGP to STREAM; if POST is false, then
-+   everything preceeding a `\v' character in the documentation strings (or
-+   the whole string, for those with none) is printed, otherwise, everything
-+   following the `\v' character (nothing for strings without).  Each separate
-+   bit of documentation is separated a blank line, and if PRE_BLANK is true,
-+   then the first is as well.  If FIRST_ONLY is true, only the first
-+   occurrence is output.  Returns true if anything was output.  */
-+static int
-+argp_doc (const struct argp *argp, const struct argp_state *state,
-+         int post, int pre_blank, int first_only,
-+         argp_fmtstream_t stream)
-+{
-+  const char *text;
-+  const char *inp_text;
-+  void *input = 0;
-+  int anything = 0;
-+  size_t inp_text_limit = 0;
-+  const char *doc = dgettext (argp->argp_domain, argp->doc);
-+  const struct argp_child *child = argp->children;
-+
-+  if (doc)
-+    {
-+      char *vt = strchr (doc, '\v');
-+      inp_text = post ? (vt ? vt + 1 : 0) : doc;
-+      inp_text_limit = (!post && vt) ? (vt - doc) : 0;
-+    }
-+  else
-+    inp_text = 0;
-+
-+  if (argp->help_filter)
-+    /* We have to filter the doc strings.  */
-+    {
-+      if (inp_text_limit)
-+       /* Copy INP_TEXT so that it's nul-terminated.  */
-+       inp_text = strndup (inp_text, inp_text_limit);
-+      input = __argp_input (argp, state);
-+      text =
-+       (*argp->help_filter) (post
-+                             ? ARGP_KEY_HELP_POST_DOC
-+                             : ARGP_KEY_HELP_PRE_DOC,
-+                             inp_text, input);
-+    }
-+  else
-+    text = (const char *) inp_text;
-+
-+  if (text)
-+    {
-+      if (pre_blank)
-+       __argp_fmtstream_putc (stream, '\n');
-+
-+      if (text == inp_text && inp_text_limit)
-+       __argp_fmtstream_write (stream, inp_text, inp_text_limit);
-+      else
-+       __argp_fmtstream_puts (stream, text);
-+
-+      if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream))
-+       __argp_fmtstream_putc (stream, '\n');
-+
-+      anything = 1;
-+    }
-+
-+  if (text && text != inp_text)
-+    free ((char *) text);      /* Free TEXT returned from the help filter.  */
-+  if (inp_text && inp_text_limit && argp->help_filter)
-+    free ((char *) inp_text);  /* We copied INP_TEXT, so free it now.  */
-+
-+  if (post && argp->help_filter)
-+    /* Now see if we have to output a ARGP_KEY_HELP_EXTRA text.  */
-+    {
-+      text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input);
-+      if (text)
-+       {
-+         if (anything || pre_blank)
-+           __argp_fmtstream_putc (stream, '\n');
-+         __argp_fmtstream_puts (stream, text);
-+         free ((char *) text);
-+         if (__argp_fmtstream_point (stream)
-+             > __argp_fmtstream_lmargin (stream))
-+           __argp_fmtstream_putc (stream, '\n');
-+         anything = 1;
-+       }
-+    }
-+
-+  if (child)
-+    while (child->argp && !(first_only && anything))
-+      anything |=
-+       argp_doc ((child++)->argp, state,
-+                 post, anything || pre_blank, first_only,
-+                 stream);
-+
-+  return anything;
-+}
-+
-+/* Output a usage message for ARGP to STREAM.  If called from
-+   argp_state_help, STATE is the relevent parsing state.  FLAGS are from the
-+   set ARGP_HELP_*.  NAME is what to use wherever a `program name' is
-+   needed. */
-+static void
-+_help (const struct argp *argp, const struct argp_state *state, FILE *stream,
-+       unsigned flags, char *name)
-+{
-+  int anything = 0;            /* Whether we've output anything.  */
-+  struct hol *hol = 0;
-+  argp_fmtstream_t fs;
-+
-+  if (! stream)
-+    return;
-+
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+  flockfile (stream);
-+#endif
-+
-+  fill_in_uparams (state);
-+
-+  fs = __argp_make_fmtstream (stream, 0, uparams.rmargin, 0);
-+  if (! fs)
-+    {
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+      funlockfile (stream);
-+#endif
-+      return;
-+    }
-+
-+  if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG))
-+    {
-+      hol = argp_hol (argp, 0);
-+
-+      /* If present, these options always come last.  */
-+      hol_set_group (hol, "help", -1);
-+      hol_set_group (hol, "version", -1);
-+
-+      hol_sort (hol);
-+    }
-+
-+  if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE))
-+    /* Print a short `Usage:' message.  */
-+    {
-+      int first_pattern = 1, more_patterns;
-+      size_t num_pattern_levels = argp_args_levels (argp);
-+      char *pattern_levels = alloca (num_pattern_levels);
-+
-+      memset (pattern_levels, 0, num_pattern_levels);
-+
-+      do
-+       {
-+         int old_lm;
-+         int old_wm = __argp_fmtstream_set_wmargin (fs, uparams.usage_indent);
-+         char *levels = pattern_levels;
-+
-+         if (first_pattern)
-+           __argp_fmtstream_printf (fs, "%s %s",
-+                                    dgettext (argp->argp_domain, "Usage:"),
-+                                    name);
-+         else
-+           __argp_fmtstream_printf (fs, "%s %s",
-+                                    dgettext (argp->argp_domain, "  or: "),
-+                                    name);
-+
-+         /* We set the lmargin as well as the wmargin, because hol_usage
-+            manually wraps options with newline to avoid annoying breaks.  */
-+         old_lm = __argp_fmtstream_set_lmargin (fs, uparams.usage_indent);
-+
-+         if (flags & ARGP_HELP_SHORT_USAGE)
-+           /* Just show where the options go.  */
-+           {
-+             if (hol->num_entries > 0)
-+               __argp_fmtstream_puts (fs, dgettext (argp->argp_domain,
-+                                                    " [OPTION...]"));
-+           }
-+         else
-+           /* Actually print the options.  */
-+           {
-+             hol_usage (hol, fs);
-+             flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once.  */
-+           }
-+
-+         more_patterns = argp_args_usage (argp, state, &levels, 1, fs);
-+
-+         __argp_fmtstream_set_wmargin (fs, old_wm);
-+         __argp_fmtstream_set_lmargin (fs, old_lm);
-+
-+         __argp_fmtstream_putc (fs, '\n');
-+         anything = 1;
-+
-+         first_pattern = 0;
-+       }
-+      while (more_patterns);
-+    }
-+
-+  if (flags & ARGP_HELP_PRE_DOC)
-+    anything |= argp_doc (argp, state, 0, 0, 1, fs);
-+
-+  if (flags & ARGP_HELP_SEE)
-+    {
-+      __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, "\
-+Try `%s --help' or `%s --usage' for more information.\n"),
-+                              name, name);
-+      anything = 1;
-+    }
-+
-+  if (flags & ARGP_HELP_LONG)
-+    /* Print a long, detailed help message.  */
-+    {
-+      /* Print info about all the options.  */
-+      if (hol->num_entries > 0)
-+       {
-+         if (anything)
-+           __argp_fmtstream_putc (fs, '\n');
-+         hol_help (hol, state, fs);
-+         anything = 1;
-+       }
-+    }
-+
-+  if (flags & ARGP_HELP_POST_DOC)
-+    /* Print any documentation strings at the end.  */
-+    anything |= argp_doc (argp, state, 1, anything, 0, fs);
-+
-+  if ((flags & ARGP_HELP_BUG_ADDR) && argp_program_bug_address)
-+    {
-+      if (anything)
-+       __argp_fmtstream_putc (fs, '\n');
-+      __argp_fmtstream_printf (fs, dgettext (argp->argp_domain,
-+                                            "Report bugs to %s.\n"),
-+                              argp_program_bug_address);
-+      anything = 1;
-+    }
-+
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+  funlockfile (stream);
-+#endif
-+
-+  if (hol)
-+    hol_free (hol);
-+
-+  __argp_fmtstream_free (fs);
-+}
-+
-+/* Output a usage message for ARGP to STREAM.  FLAGS are from the set
-+   ARGP_HELP_*.  NAME is what to use wherever a `program name' is needed. */
-+void argp_help (const struct argp *argp, FILE *stream,
-+                 unsigned flags, char *name)
-+{
-+  _help (argp, 0, stream, flags, name);
-+}
-+
-+char *
-+__argp_short_program_name (void)
-+{
-+# ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__
-+/*
-+ * uClibc provides both program_invocation_name and
-+ * program_invocation_short_name
-+ */
-+ return (char *) program_invocation_short_name;
-+# else
-+  /* FIXME: What now? Miles suggests that it is better to use NULL,
-+     but currently the value is passed on directly to fputs_unlocked,
-+     so that requires more changes. */
-+# if __GNUC__
-+#  warning No reasonable value to return
-+# endif /* __GNUC__ */
-+  return "";
-+# endif
-+}
-+
-+/* Output, if appropriate, a usage message for STATE to STREAM.  FLAGS are
-+   from the set ARGP_HELP_*.  */
-+void
-+argp_state_help (const struct argp_state *state, FILE *stream, unsigned flags)
-+{
-+  if ((!state || ! (state->flags & ARGP_NO_ERRS)) && stream)
-+    {
-+      if (state && (state->flags & ARGP_LONG_ONLY))
-+       flags |= ARGP_HELP_LONG_ONLY;
-+
-+      _help (state ? state->root_argp : 0, state, stream, flags,
-+            state ? state->name : __argp_short_program_name ());
-+
-+      if (!state || ! (state->flags & ARGP_NO_EXIT))
-+       {
-+         if (flags & ARGP_HELP_EXIT_ERR)
-+           exit (argp_err_exit_status);
-+         if (flags & ARGP_HELP_EXIT_OK)
-+           exit (0);
-+       }
-+  }
-+}
-+
-+/* If appropriate, print the printf string FMT and following args, preceded
-+   by the program name and `:', to stderr, and followed by a `Try ... --help'
-+   message, then exit (1).  */
-+void
-+argp_error (const struct argp_state *state, const char *fmt, ...)
-+{
-+  if (!state || !(state->flags & ARGP_NO_ERRS))
-+    {
-+      FILE *stream = state ? state->err_stream : stderr;
-+
-+      if (stream)
-+       {
-+         va_list ap;
-+
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+         flockfile (stream);
-+#endif
-+
-+         va_start (ap, fmt);
-+
-+#if defined _LIBC && defined USE_IN_LIBIO
-+         char *buf;
-+
-+         if (_IO_vasprintf (&buf, fmt, ap) < 0)
-+           buf = NULL;
-+
-+         __fxprintf (stream, "%s: %s\n",
-+                     state ? state->name : __argp_short_program_name (), buf);
-+
-+         free (buf);
-+#else
-+         fputs_unlocked (state ? state->name : __argp_short_program_name (),
-+                         stream);
-+         putc_unlocked (':', stream);
-+         putc_unlocked (' ', stream);
-+
-+         vfprintf (stream, fmt, ap);
-+
-+         putc_unlocked ('\n', stream);
-+#endif
-+
-+         argp_state_help (state, stream, ARGP_HELP_STD_ERR);
-+
-+         va_end (ap);
-+
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+         funlockfile (stream);
-+#endif
-+       }
-+    }
-+}
-+
-+/* Similar to the standard gnu error-reporting function error(), but will
-+   respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
-+   to STATE->err_stream.  This is useful for argument parsing code that is
-+   shared between program startup (when exiting is desired) and runtime
-+   option parsing (when typically an error code is returned instead).  The
-+   difference between this function and argp_error is that the latter is for
-+   *parsing errors*, and the former is for other problems that occur during
-+   parsing but don't reflect a (syntactic) problem with the input.  */
-+void
-+argp_failure (const struct argp_state *state, int status, int errnum,
-+               const char *fmt, ...)
-+{
-+  if (!state || !(state->flags & ARGP_NO_ERRS))
-+    {
-+      FILE *stream = state ? state->err_stream : stderr;
-+
-+      if (stream)
-+       {
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+         flockfile (stream);
-+#endif
-+
-+#if defined _LIBC && defined USE_IN_LIBIO
-+         __fxprintf (stream, "%s",
-+                     state ? state->name : __argp_short_program_name ());
-+#else
-+         fputs_unlocked (state ? state->name : __argp_short_program_name (),
-+                         stream);
-+#endif
-+
-+         if (fmt)
-+           {
-+             va_list ap;
-+
-+             va_start (ap, fmt);
-+#if defined _LIBC && defined USE_IN_LIBIO
-+             char *buf;
-+
-+             if (_IO_vasprintf (&buf, fmt, ap) < 0)
-+               buf = NULL;
-+
-+             __fxprintf (stream, ": %s", buf);
-+
-+             free (buf);
-+#else
-+             putc_unlocked (':', stream);
-+             putc_unlocked (' ', stream);
-+
-+             vfprintf (stream, fmt, ap);
-+#endif
-+
-+             va_end (ap);
-+           }
-+
-+         if (errnum)
-+           {
-+#if (defined _LIBC && defined USE_IN_LIBIO) || defined HAVE_STRERROR_R
-+             char buf[200];
-+#endif
-+#if defined _LIBC && defined USE_IN_LIBIO
-+             __fxprintf (stream, ": %s",
-+                         strerror_r (errnum, buf, sizeof (buf)));
-+#else
-+             putc_unlocked (':', stream);
-+             putc_unlocked (' ', stream);
-+# ifdef HAVE_STRERROR_R
-+             fputs (strerror_r (errnum, buf, sizeof (buf)), stream);
-+# else
-+             fputs (strerror (errnum), stream);
-+# endif
-+#endif
-+           }
-+
-+#ifdef USE_IN_LIBIO
-+         if (_IO_fwide (stream, 0) > 0)
-+           putwc_unlocked (L'\n', stream);
-+         else
-+#endif
-+           putc_unlocked ('\n', stream);
-+
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+         funlockfile (stream);
-+#endif
-+
-+         if (status && (!state || !(state->flags & ARGP_NO_EXIT)))
-+           exit (status);
-+       }
-+    }
-+}
-diff --git a/libuargp/argp-parse.c b/libuargp/argp-parse.c
-new file mode 100644
-index 0000000..86b2b24
---- /dev/null
-+++ b/libuargp/argp-parse.c
-@@ -0,0 +1,949 @@
-+/* Hierarchial argument parsing, layered over getopt
-+   Copyright (C) 1995-2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.
-+
-+   Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
-+*/
-+
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
-+
-+/* AIX requires this to be the first thing in the file.  */
-+#ifndef __GNUC__
-+# if HAVE_ALLOCA_H || defined _LIBC
-+#  include <alloca.h>
-+# else
-+#  ifdef _AIX
-+#pragma alloca
-+#  else
-+#   ifndef alloca /* predefined by HP cc +Olibcalls */
-+char *alloca ();
-+#   endif
-+#  endif
-+# endif
-+#endif
-+
-+#include <stdlib.h>
-+#include <string.h>
-+#include <unistd.h>
-+#include <limits.h>
-+#include <getopt.h>
-+#include <bits/getopt_int.h>
-+
-+#include <features.h>
-+#ifndef _
-+/* This is for other GNU distributions with internationalized messages.
-+   When compiling libc, the _ macro is predefined.  */
-+# if (defined HAVE_LIBINTL_H || defined _LIBC) && defined __UCLIBC_HAS_GETTEXT_AWARENESS__
-+#  include <libintl.h>
-+#  ifdef _LIBC
-+#   undef dgettext
-+#   define dgettext(domain, msgid) \
-+  INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
-+#  endif
-+# else
-+#  define dgettext(domain, msgid) (msgid)
-+#  define gettext(msgid) (msgid)
-+# endif
-+#endif
-+#ifndef N_
-+# define N_(msgid) (msgid)
-+#endif
-+
-+#include <argp.h>
-+
-+/* Getopt return values.  */
-+#define KEY_END (-1)           /* The end of the options.  */
-+#define KEY_ARG 1              /* A non-option argument.  */
-+#define KEY_ERR '?'            /* An error parsing the options.  */
-+
-+/* The meta-argument used to prevent any further arguments being interpreted
-+   as options.  */
-+#define QUOTE "--"
-+
-+/* The number of bits we steal in a long-option value for our own use.  */
-+#define GROUP_BITS CHAR_BIT
-+
-+/* The number of bits available for the user value.  */
-+#define USER_BITS ((sizeof ((struct option *)0)->val * CHAR_BIT) - GROUP_BITS)
-+#define USER_MASK ((1 << USER_BITS) - 1)
-+
-+/* EZ alias for ARGP_ERR_UNKNOWN.  */
-+#define EBADKEY ARGP_ERR_UNKNOWN
-+
-+/* Default options.  */
-+
-+/* When argp is given the --HANG switch, _ARGP_HANG is set and argp will sleep
-+   for one second intervals, decrementing _ARGP_HANG until it's zero.  Thus
-+   you can force the program to continue by attaching a debugger and setting
-+   it to 0 yourself.  */
-+static volatile int _argp_hang;
-+
-+#define OPT_PROGNAME   -2
-+#define OPT_USAGE      -3
-+#define OPT_HANG       -4
-+
-+static const struct argp_option argp_default_options[] =
-+{
-+  {"help",       '?',          0, 0,  N_("Give this help list"), -1},
-+  {"usage",      OPT_USAGE,    0, 0,  N_("Give a short usage message")},
-+  {"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, N_("Set the program name")},
-+  {"HANG",       OPT_HANG,    "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
-+     N_("Hang for SECS seconds (default 3600)")},
-+  {0, 0}
-+};
-+
-+static error_t
-+argp_default_parser (int key, char *arg, struct argp_state *state)
-+{
-+  switch (key)
-+    {
-+    case '?':
-+      argp_state_help (state, state->out_stream, ARGP_HELP_STD_HELP);
-+      break;
-+    case OPT_USAGE:
-+      argp_state_help (state, state->out_stream,
-+                      ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
-+      break;
-+
-+    case OPT_PROGNAME:         /* Set the program name.  */
-+#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_NAME
-+      program_invocation_name = arg;
-+#endif
-+      /* [Note that some systems only have PROGRAM_INVOCATION_SHORT_NAME (aka
-+        __PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined
-+        to be that, so we have to be a bit careful here.]  */
-+
-+      /* Update what we use for messages.  */
-+      state->name = strrchr (arg, '/');
-+      if (state->name)
-+       state->name++;
-+      else
-+       state->name = arg;
-+
-+#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
-+      program_invocation_short_name = state->name;
-+#endif
-+
-+      if ((state->flags & (ARGP_PARSE_ARGV0 | ARGP_NO_ERRS))
-+         == ARGP_PARSE_ARGV0)
-+       /* Update what getopt uses too.  */
-+       state->argv[0] = arg;
-+
-+      break;
-+
-+    case OPT_HANG:
-+      _argp_hang = atoi (arg ? arg : "3600");
-+      while (_argp_hang-- > 0)
-+       sleep (1);
-+      break;
-+
-+    default:
-+      return EBADKEY;
-+    }
-+  return 0;
-+}
-+
-+static const struct argp argp_default_argp =
-+  {argp_default_options, &argp_default_parser, NULL, NULL, NULL, NULL, "libc"};
-+
-+
-+static const struct argp_option argp_version_options[] =
-+{
-+  {"version",    'V',          0, 0,  N_("Print program version"), -1},
-+  {0, 0}
-+};
-+
-+static error_t
-+argp_version_parser (int key, char *arg, struct argp_state *state)
-+{
-+  switch (key)
-+    {
-+    case 'V':
-+      if (argp_program_version_hook)
-+       (*argp_program_version_hook) (state->out_stream, state);
-+      else if (argp_program_version)
-+       fprintf (state->out_stream, "%s\n", argp_program_version);
-+      else
-+       argp_error (state, dgettext (state->root_argp->argp_domain,
-+                                      "(PROGRAM ERROR) No version known!?"));
-+      if (! (state->flags & ARGP_NO_EXIT))
-+       exit (0);
-+      break;
-+    default:
-+      return EBADKEY;
-+    }
-+  return 0;
-+}
-+
-+static const struct argp argp_version_argp =
-+  {argp_version_options, &argp_version_parser, NULL, NULL, NULL, NULL, "libc"};
-+
-+/* Returns the offset into the getopt long options array LONG_OPTIONS of a
-+   long option with called NAME, or -1 if none is found.  Passing NULL as
-+   NAME will return the number of options.  */
-+static int
-+find_long_option (struct option *long_options, const char *name)
-+{
-+  struct option *l = long_options;
-+  while (l->name != NULL)
-+    if (name != NULL && strcmp (l->name, name) == 0)
-+      return l - long_options;
-+    else
-+      l++;
-+  if (name == NULL)
-+    return l - long_options;
-+  else
-+    return -1;
-+}
-+
-+
-+/* The state of a `group' during parsing.  Each group corresponds to a
-+   particular argp structure from the tree of such descending from the top
-+   level argp passed to argp_parse.  */
-+struct group
-+{
-+  /* This group's parsing function.  */
-+  argp_parser_t parser;
-+
-+  /* Which argp this group is from.  */
-+  const struct argp *argp;
-+
-+  /* Points to the point in SHORT_OPTS corresponding to the end of the short
-+     options for this group.  We use it to determine from which group a
-+     particular short options is from.  */
-+  char *short_end;
-+
-+  /* The number of non-option args sucessfully handled by this parser.  */
-+  unsigned args_processed;
-+
-+  /* This group's parser's parent's group.  */
-+  struct group *parent;
-+  unsigned parent_index;       /* And the our position in the parent.   */
-+
-+  /* These fields are swapped into and out of the state structure when
-+     calling this group's parser.  */
-+  void *input, **child_inputs;
-+  void *hook;
-+};
-+
-+/* Call GROUP's parser with KEY and ARG, swapping any group-specific info
-+   from STATE before calling, and back into state afterwards.  If GROUP has
-+   no parser, EBADKEY is returned.  */
-+static error_t
-+group_parse (struct group *group, struct argp_state *state, int key, char *arg)
-+{
-+  if (group->parser)
-+    {
-+      error_t err;
-+      state->hook = group->hook;
-+      state->input = group->input;
-+      state->child_inputs = group->child_inputs;
-+      state->arg_num = group->args_processed;
-+      err = (*group->parser)(key, arg, state);
-+      group->hook = state->hook;
-+      return err;
-+    }
-+  else
-+    return EBADKEY;
-+}
-+
-+struct parser
-+{
-+  const struct argp *argp;
-+
-+  /* SHORT_OPTS is the getopt short options string for the union of all the
-+     groups of options.  */
-+  char *short_opts;
-+  /* LONG_OPTS is the array of getop long option structures for the union of
-+     all the groups of options.  */
-+  struct option *long_opts;
-+  /* OPT_DATA is the getopt data used for the re-entrant getopt.  */
-+  struct _getopt_data opt_data;
-+
-+  /* States of the various parsing groups.  */
-+  struct group *groups;
-+  /* The end of the GROUPS array.  */
-+  struct group *egroup;
-+  /* An vector containing storage for the CHILD_INPUTS field in all groups.  */
-+  void **child_inputs;
-+
-+  /* True if we think using getopt is still useful; if false, then
-+     remaining arguments are just passed verbatim with ARGP_KEY_ARG.  This is
-+     cleared whenever getopt returns KEY_END, but may be set again if the user
-+     moves the next argument pointer backwards.  */
-+  int try_getopt;
-+
-+  /* State block supplied to parsing routines.  */
-+  struct argp_state state;
-+
-+  /* Memory used by this parser.  */
-+  void *storage;
-+};
-+
-+/* The next usable entries in the various parser tables being filled in by
-+   convert_options.  */
-+struct parser_convert_state
-+{
-+  struct parser *parser;
-+  char *short_end;
-+  struct option *long_end;
-+  void **child_inputs_end;
-+};
-+
-+/* Converts all options in ARGP (which is put in GROUP) and ancestors
-+   into getopt options stored in SHORT_OPTS and LONG_OPTS; SHORT_END and
-+   CVT->LONG_END are the points at which new options are added.  Returns the
-+   next unused group entry.  CVT holds state used during the conversion.  */
-+static struct group *
-+convert_options (const struct argp *argp,
-+                struct group *parent, unsigned parent_index,
-+                struct group *group, struct parser_convert_state *cvt)
-+{
-+  /* REAL is the most recent non-alias value of OPT.  */
-+  const struct argp_option *real = argp->options;
-+  const struct argp_child *children = argp->children;
-+
-+  if (real || argp->parser)
-+    {
-+      const struct argp_option *opt;
-+
-+      if (real)
-+       for (opt = real; !__option_is_end (opt); opt++)
-+         {
-+           if (! (opt->flags & OPTION_ALIAS))
-+             /* OPT isn't an alias, so we can use values from it.  */
-+             real = opt;
-+
-+           if (! (real->flags & OPTION_DOC))
-+             /* A real option (not just documentation).  */
-+             {
-+               if (__option_is_short (opt))
-+                 /* OPT can be used as a short option.  */
-+                 {
-+                   *cvt->short_end++ = opt->key;
-+                   if (real->arg)
-+                     {
-+                       *cvt->short_end++ = ':';
-+                       if (real->flags & OPTION_ARG_OPTIONAL)
-+                         *cvt->short_end++ = ':';
-+                     }
-+                   *cvt->short_end = '\0'; /* keep 0 terminated */
-+                 }
-+
-+               if (opt->name
-+                   && find_long_option (cvt->parser->long_opts, opt->name) < 0)
-+                 /* OPT can be used as a long option.  */
-+                 {
-+                   cvt->long_end->name = opt->name;
-+                   cvt->long_end->has_arg =
-+                     (real->arg
-+                      ? (real->flags & OPTION_ARG_OPTIONAL
-+                         ? optional_argument
-+                         : required_argument)
-+                      : no_argument);
-+                   cvt->long_end->flag = 0;
-+                   /* we add a disambiguating code to all the user's
-+                      values (which is removed before we actually call
-+                      the function to parse the value); this means that
-+                      the user loses use of the high 8 bits in all his
-+                      values (the sign of the lower bits is preserved
-+                      however)...  */
-+                   cvt->long_end->val =
-+                     ((opt->key | real->key) & USER_MASK)
-+                     + (((group - cvt->parser->groups) + 1) << USER_BITS);
-+
-+                   /* Keep the LONG_OPTS list terminated.  */
-+                   (++cvt->long_end)->name = NULL;
-+                 }
-+             }
-+           }
-+
-+      group->parser = argp->parser;
-+      group->argp = argp;
-+      group->short_end = cvt->short_end;
-+      group->args_processed = 0;
-+      group->parent = parent;
-+      group->parent_index = parent_index;
-+      group->input = 0;
-+      group->hook = 0;
-+      group->child_inputs = 0;
-+
-+      if (children)
-+       /* Assign GROUP's CHILD_INPUTS field some space from
-+           CVT->child_inputs_end.*/
-+       {
-+         unsigned num_children = 0;
-+         while (children[num_children].argp)
-+           num_children++;
-+         group->child_inputs = cvt->child_inputs_end;
-+         cvt->child_inputs_end += num_children;
-+       }
-+
-+      parent = group++;
-+    }
-+  else
-+    parent = 0;
-+
-+  if (children)
-+    {
-+      unsigned index = 0;
-+      while (children->argp)
-+       group =
-+         convert_options (children++->argp, parent, index++, group, cvt);
-+    }
-+
-+  return group;
-+}
-+
-+/* Find the merged set of getopt options, with keys appropiately prefixed. */
-+static void
-+parser_convert (struct parser *parser, const struct argp *argp, int flags)
-+{
-+  struct parser_convert_state cvt;
-+
-+  cvt.parser = parser;
-+  cvt.short_end = parser->short_opts;
-+  cvt.long_end = parser->long_opts;
-+  cvt.child_inputs_end = parser->child_inputs;
-+
-+  if (flags & ARGP_IN_ORDER)
-+    *cvt.short_end++ = '-';
-+  else if (flags & ARGP_NO_ARGS)
-+    *cvt.short_end++ = '+';
-+  *cvt.short_end = '\0';
-+
-+  cvt.long_end->name = NULL;
-+
-+  parser->argp = argp;
-+
-+  if (argp)
-+    parser->egroup = convert_options (argp, 0, 0, parser->groups, &cvt);
-+  else
-+    parser->egroup = parser->groups; /* No parsers at all! */
-+}
-+
-+/* Lengths of various parser fields which we will allocated.  */
-+struct parser_sizes
-+{
-+  size_t short_len;            /* Getopt short options string.  */
-+  size_t long_len;             /* Getopt long options vector.  */
-+  size_t num_groups;           /* Group structures we allocate.  */
-+  size_t num_child_inputs;     /* Child input slots.  */
-+};
-+
-+/* For ARGP, increments the NUM_GROUPS field in SZS by the total number of
-+ argp structures descended from it, and the SHORT_LEN & LONG_LEN fields by
-+ the maximum lengths of the resulting merged getopt short options string and
-+ long-options array, respectively.  */
-+static void
-+calc_sizes (const struct argp *argp,  struct parser_sizes *szs)
-+{
-+  const struct argp_child *child = argp->children;
-+  const struct argp_option *opt = argp->options;
-+
-+  if (opt || argp->parser)
-+    {
-+      szs->num_groups++;
-+      if (opt)
-+       {
-+         int num_opts = 0;
-+         while (!__option_is_end (opt++))
-+           num_opts++;
-+         szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */
-+         szs->long_len += num_opts;
-+       }
-+    }
-+
-+  if (child)
-+    while (child->argp)
-+      {
-+       calc_sizes ((child++)->argp, szs);
-+       szs->num_child_inputs++;
-+      }
-+}
-+
-+
-+extern char * __argp_short_program_name (void);
-+/* Initializes PARSER to parse ARGP in a manner described by FLAGS.  */
-+static error_t
-+parser_init (struct parser *parser, const struct argp *argp,
-+            int argc, char **argv, int flags, void *input)
-+{
-+  error_t err = 0;
-+  struct group *group;
-+  struct parser_sizes szs;
-+  struct _getopt_data opt_data = _GETOPT_DATA_INITIALIZER;
-+
-+  szs.short_len = (flags & ARGP_NO_ARGS) ? 0 : 1;
-+  szs.long_len = 0;
-+  szs.num_groups = 0;
-+  szs.num_child_inputs = 0;
-+
-+  if (argp)
-+    calc_sizes (argp, &szs);
-+
-+  /* Lengths of the various bits of storage used by PARSER.  */
-+#define GLEN (szs.num_groups + 1) * sizeof (struct group)
-+#define CLEN (szs.num_child_inputs * sizeof (void *))
-+#define LLEN ((szs.long_len + 1) * sizeof (struct option))
-+#define SLEN (szs.short_len + 1)
-+
-+  parser->storage = malloc (GLEN + CLEN + LLEN + SLEN);
-+  if (! parser->storage)
-+    return ENOMEM;
-+
-+  parser->groups = parser->storage;
-+  parser->child_inputs = parser->storage + GLEN;
-+  parser->long_opts = parser->storage + GLEN + CLEN;
-+  parser->short_opts = parser->storage + GLEN + CLEN + LLEN;
-+  parser->opt_data = opt_data;
-+
-+  memset (parser->child_inputs, 0, szs.num_child_inputs * sizeof (void *));
-+  parser_convert (parser, argp, flags);
-+
-+  memset (&parser->state, 0, sizeof (struct argp_state));
-+  parser->state.root_argp = parser->argp;
-+  parser->state.argc = argc;
-+  parser->state.argv = argv;
-+  parser->state.flags = flags;
-+  parser->state.err_stream = stderr;
-+  parser->state.out_stream = stdout;
-+  parser->state.next = 0;      /* Tell getopt to initialize.  */
-+  parser->state.pstate = parser;
-+
-+  parser->try_getopt = 1;
-+
-+  /* Call each parser for the first time, giving it a chance to propagate
-+     values to child parsers.  */
-+  if (parser->groups < parser->egroup)
-+    parser->groups->input = input;
-+  for (group = parser->groups;
-+       group < parser->egroup && (!err || err == EBADKEY);
-+       group++)
-+    {
-+      if (group->parent)
-+       /* If a child parser, get the initial input value from the parent. */
-+       group->input = group->parent->child_inputs[group->parent_index];
-+
-+      if (!group->parser
-+         && group->argp->children && group->argp->children->argp)
-+       /* For the special case where no parsing function is supplied for an
-+          argp, propagate its input to its first child, if any (this just
-+          makes very simple wrapper argps more convenient).  */
-+       group->child_inputs[0] = group->input;
-+
-+      err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0);
-+    }
-+  if (err == EBADKEY)
-+    err = 0;                   /* Some parser didn't understand.  */
-+
-+  if (err)
-+    return err;
-+
-+  if (parser->state.flags & ARGP_NO_ERRS)
-+    {
-+      parser->opt_data.opterr = 0;
-+      if (parser->state.flags & ARGP_PARSE_ARGV0)
-+       /* getopt always skips ARGV[0], so we have to fake it out.  As long
-+          as OPTERR is 0, then it shouldn't actually try to access it.  */
-+       parser->state.argv--, parser->state.argc++;
-+    }
-+  else
-+    parser->opt_data.opterr = 1;       /* Print error messages.  */
-+
-+  if (parser->state.argv == argv && argv[0])
-+    /* There's an argv[0]; use it for messages.  */
-+    {
-+      char *short_name = strrchr (argv[0], '/');
-+      parser->state.name = short_name ? short_name + 1 : argv[0];
-+    }
-+  else
-+    parser->state.name = __argp_short_program_name ();
-+
-+  return 0;
-+}
-+
-+/* Free any storage consumed by PARSER (but not PARSER itself).  */
-+static error_t
-+parser_finalize (struct parser *parser,
-+                error_t err, int arg_ebadkey, int *end_index)
-+{
-+  struct group *group;
-+
-+  if (err == EBADKEY && arg_ebadkey)
-+    /* Suppress errors generated by unparsed arguments.  */
-+    err = 0;
-+
-+  if (! err)
-+    {
-+      if (parser->state.next == parser->state.argc)
-+       /* We successfully parsed all arguments!  Call all the parsers again,
-+          just a few more times... */
-+       {
-+         for (group = parser->groups;
-+              group < parser->egroup && (!err || err==EBADKEY);
-+              group++)
-+           if (group->args_processed == 0)
-+             err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0);
-+         for (group = parser->egroup - 1;
-+              group >= parser->groups && (!err || err==EBADKEY);
-+              group--)
-+           err = group_parse (group, &parser->state, ARGP_KEY_END, 0);
-+
-+         if (err == EBADKEY)
-+           err = 0;            /* Some parser didn't understand.  */
-+
-+         /* Tell the user that all arguments are parsed.  */
-+         if (end_index)
-+           *end_index = parser->state.next;
-+       }
-+      else if (end_index)
-+       /* Return any remaining arguments to the user.  */
-+       *end_index = parser->state.next;
-+      else
-+       /* No way to return the remaining arguments, they must be bogus. */
-+       {
-+         if (!(parser->state.flags & ARGP_NO_ERRS)
-+             && parser->state.err_stream)
-+           fprintf (parser->state.err_stream,
-+                    dgettext (parser->argp->argp_domain,
-+                              "%s: Too many arguments\n"),
-+                    parser->state.name);
-+         err = EBADKEY;
-+       }
-+    }
-+
-+  /* Okay, we're all done, with either an error or success; call the parsers
-+     to indicate which one.  */
-+
-+  if (err)
-+    {
-+      /* Maybe print an error message.  */
-+      if (err == EBADKEY)
-+       /* An appropriate message describing what the error was should have
-+          been printed earlier.  */
-+       argp_state_help (&parser->state, parser->state.err_stream,
-+                          ARGP_HELP_STD_ERR);
-+
-+      /* Since we didn't exit, give each parser an error indication.  */
-+      for (group = parser->groups; group < parser->egroup; group++)
-+       group_parse (group, &parser->state, ARGP_KEY_ERROR, 0);
-+    }
-+  else
-+    /* Notify parsers of success, and propagate back values from parsers.  */
-+    {
-+      /* We pass over the groups in reverse order so that child groups are
-+        given a chance to do there processing before passing back a value to
-+        the parent.  */
-+      for (group = parser->egroup - 1
-+          ; group >= parser->groups && (!err || err == EBADKEY)
-+          ; group--)
-+       err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0);
-+      if (err == EBADKEY)
-+       err = 0;                /* Some parser didn't understand.  */
-+    }
-+
-+  /* Call parsers once more, to do any final cleanup.  Errors are ignored.  */
-+  for (group = parser->egroup - 1; group >= parser->groups; group--)
-+    group_parse (group, &parser->state, ARGP_KEY_FINI, 0);
-+
-+  if (err == EBADKEY)
-+    err = EINVAL;
-+
-+  free (parser->storage);
-+
-+  return err;
-+}
-+
-+/* Call the user parsers to parse the non-option argument VAL, at the current
-+   position, returning any error.  The state NEXT pointer is assumed to have
-+   been adjusted (by getopt) to point after this argument; this function will
-+   adjust it correctly to reflect however many args actually end up being
-+   consumed.  */
-+static error_t
-+parser_parse_arg (struct parser *parser, char *val)
-+{
-+  /* Save the starting value of NEXT, first adjusting it so that the arg
-+     we're parsing is again the front of the arg vector.  */
-+  int index = --parser->state.next;
-+  error_t err = EBADKEY;
-+  struct group *group;
-+  int key = 0;                 /* Which of ARGP_KEY_ARG[S] we used.  */
-+
-+  /* Try to parse the argument in each parser.  */
-+  for (group = parser->groups
-+       ; group < parser->egroup && err == EBADKEY
-+       ; group++)
-+    {
-+      parser->state.next++;    /* For ARGP_KEY_ARG, consume the arg.  */
-+      key = ARGP_KEY_ARG;
-+      err = group_parse (group, &parser->state, key, val);
-+
-+      if (err == EBADKEY)
-+       /* This parser doesn't like ARGP_KEY_ARG; try ARGP_KEY_ARGS instead. */
-+       {
-+         parser->state.next--; /* For ARGP_KEY_ARGS, put back the arg.  */
-+         key = ARGP_KEY_ARGS;
-+         err = group_parse (group, &parser->state, key, 0);
-+       }
-+    }
-+
-+  if (! err)
-+    {
-+      if (key == ARGP_KEY_ARGS)
-+       /* The default for ARGP_KEY_ARGS is to assume that if NEXT isn't
-+          changed by the user, *all* arguments should be considered
-+          consumed.  */
-+       parser->state.next = parser->state.argc;
-+
-+      if (parser->state.next > index)
-+       /* Remember that we successfully processed a non-option
-+          argument -- but only if the user hasn't gotten tricky and set
-+          the clock back.  */
-+       (--group)->args_processed += (parser->state.next - index);
-+      else
-+       /* The user wants to reparse some args, give getopt another try.  */
-+       parser->try_getopt = 1;
-+    }
-+
-+  return err;
-+}
-+
-+/* Call the user parsers to parse the option OPT, with argument VAL, at the
-+   current position, returning any error.  */
-+static error_t
-+parser_parse_opt (struct parser *parser, int opt, char *val)
-+{
-+  /* The group key encoded in the high bits; 0 for short opts or
-+     group_number + 1 for long opts.  */
-+  int group_key = opt >> USER_BITS;
-+  error_t err = EBADKEY;
-+
-+  if (group_key == 0)
-+    /* A short option.  By comparing OPT's position in SHORT_OPTS to the
-+       various starting positions in each group's SHORT_END field, we can
-+       determine which group OPT came from.  */
-+    {
-+      struct group *group;
-+      char *short_index = strchr (parser->short_opts, opt);
-+
-+      if (short_index)
-+       for (group = parser->groups; group < parser->egroup; group++)
-+         if (group->short_end > short_index)
-+           {
-+             err = group_parse (group, &parser->state, opt,
-+                                parser->opt_data.optarg);
-+             break;
-+           }
-+    }
-+  else
-+    /* A long option.  We use shifts instead of masking for extracting
-+       the user value in order to preserve the sign.  */
-+    err =
-+      group_parse (&parser->groups[group_key - 1], &parser->state,
-+                  (opt << GROUP_BITS) >> GROUP_BITS,
-+                  parser->opt_data.optarg);
-+
-+  if (err == EBADKEY)
-+    /* At least currently, an option not recognized is an error in the
-+       parser, because we pre-compute which parser is supposed to deal
-+       with each option.  */
-+    {
-+      static const char bad_key_err[] =
-+       N_("(PROGRAM ERROR) Option should have been recognized!?");
-+      if (group_key == 0)
-+       argp_error (&parser->state, "-%c: %s", opt,
-+                     dgettext (parser->argp->argp_domain, bad_key_err));
-+      else
-+       {
-+         struct option *long_opt = parser->long_opts;
-+         while (long_opt->val != opt && long_opt->name)
-+           long_opt++;
-+         argp_error (&parser->state, "--%s: %s",
-+                       long_opt->name ? long_opt->name : "???",
-+                       dgettext (parser->argp->argp_domain, bad_key_err));
-+       }
-+    }
-+
-+  return err;
-+}
-+
-+/* Parse the next argument in PARSER (as indicated by PARSER->state.next).
-+   Any error from the parsers is returned, and *ARGP_EBADKEY indicates
-+   whether a value of EBADKEY is due to an unrecognized argument (which is
-+   generally not fatal).  */
-+static error_t
-+parser_parse_next (struct parser *parser, int *arg_ebadkey)
-+{
-+  int opt;
-+  error_t err = 0;
-+
-+  if (parser->state.quoted && parser->state.next < parser->state.quoted)
-+    /* The next argument pointer has been moved to before the quoted
-+       region, so pretend we never saw the quoting `--', and give getopt
-+       another chance.  If the user hasn't removed it, getopt will just
-+       process it again.  */
-+    parser->state.quoted = 0;
-+
-+  if (parser->try_getopt && !parser->state.quoted)
-+    /* Give getopt a chance to parse this.  */
-+    {
-+      /* Put it back in OPTIND for getopt.  */
-+      parser->opt_data.optind = parser->state.next;
-+      /* Distinguish KEY_ERR from a real option.  */
-+      parser->opt_data.optopt = KEY_END;
-+      if (parser->state.flags & ARGP_LONG_ONLY)
-+       opt = _getopt_long_only_r (parser->state.argc, parser->state.argv,
-+                                  parser->short_opts, parser->long_opts, 0,
-+                                  &parser->opt_data);
-+      else
-+       opt = _getopt_long_r (parser->state.argc, parser->state.argv,
-+                             parser->short_opts, parser->long_opts, 0,
-+                             &parser->opt_data);
-+      /* And see what getopt did.  */
-+      parser->state.next = parser->opt_data.optind;
-+
-+      if (opt == KEY_END)
-+       /* Getopt says there are no more options, so stop using
-+          getopt; we'll continue if necessary on our own.  */
-+       {
-+         parser->try_getopt = 0;
-+         if (parser->state.next > 1
-+             && strcmp (parser->state.argv[parser->state.next - 1], QUOTE)
-+                  == 0)
-+           /* Not only is this the end of the options, but it's a
-+              `quoted' region, which may have args that *look* like
-+              options, so we definitely shouldn't try to use getopt past
-+              here, whatever happens.  */
-+           parser->state.quoted = parser->state.next;
-+       }
-+      else if (opt == KEY_ERR && parser->opt_data.optopt != KEY_END)
-+       /* KEY_ERR can have the same value as a valid user short
-+          option, but in the case of a real error, getopt sets OPTOPT
-+          to the offending character, which can never be KEY_END.  */
-+       {
-+         *arg_ebadkey = 0;
-+         return EBADKEY;
-+       }
-+    }
-+  else
-+    opt = KEY_END;
-+
-+  if (opt == KEY_END)
-+    {
-+      /* We're past what getopt considers the options.  */
-+      if (parser->state.next >= parser->state.argc
-+         || (parser->state.flags & ARGP_NO_ARGS))
-+       /* Indicate that we're done.  */
-+       {
-+         *arg_ebadkey = 1;
-+         return EBADKEY;
-+       }
-+      else
-+       /* A non-option arg; simulate what getopt might have done.  */
-+       {
-+         opt = KEY_ARG;
-+         parser->opt_data.optarg = parser->state.argv[parser->state.next++];
-+       }
-+    }
-+
-+  if (opt == KEY_ARG)
-+    /* A non-option argument; try each parser in turn.  */
-+    err = parser_parse_arg (parser, parser->opt_data.optarg);
-+  else
-+    err = parser_parse_opt (parser, opt, parser->opt_data.optarg);
-+
-+  if (err == EBADKEY)
-+    *arg_ebadkey = (opt == KEY_END || opt == KEY_ARG);
-+
-+  return err;
-+}
-+
-+/* Parse the options strings in ARGC & ARGV according to the argp in ARGP.
-+   FLAGS is one of the ARGP_ flags above.  If END_INDEX is non-NULL, the
-+   index in ARGV of the first unparsed option is returned in it.  If an
-+   unknown option is present, EINVAL is returned; if some parser routine
-+   returned a non-zero value, it is returned; otherwise 0 is returned.  */
-+error_t
-+argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags,
-+             int *end_index, void *input)
-+{
-+  error_t err;
-+  struct parser parser;
-+
-+  /* If true, then err == EBADKEY is a result of a non-option argument failing
-+     to be parsed (which in some cases isn't actually an error).  */
-+  int arg_ebadkey = 0;
-+
-+  if (! (flags & ARGP_NO_HELP))
-+    /* Add our own options.  */
-+    {
-+      struct argp_child *child = alloca (4 * sizeof (struct argp_child));
-+      struct argp *top_argp = alloca (sizeof (struct argp));
-+
-+      /* TOP_ARGP has no options, it just serves to group the user & default
-+        argps.  */
-+      memset (top_argp, 0, sizeof (*top_argp));
-+      top_argp->children = child;
-+
-+      memset (child, 0, 4 * sizeof (struct argp_child));
-+
-+      if (argp)
-+       (child++)->argp = argp;
-+      (child++)->argp = &argp_default_argp;
-+      if (argp_program_version || argp_program_version_hook)
-+       (child++)->argp = &argp_version_argp;
-+      child->argp = 0;
-+
-+      argp = top_argp;
-+    }
-+
-+  /* Construct a parser for these arguments.  */
-+  err = parser_init (&parser, argp, argc, argv, flags, input);
-+
-+  if (! err)
-+    /* Parse! */
-+    {
-+      while (! err)
-+       err = parser_parse_next (&parser, &arg_ebadkey);
-+      err = parser_finalize (&parser, err, arg_ebadkey, end_index);
-+    }
-+
-+  return err;
-+}
-+
-+/* Return the input field for ARGP in the parser corresponding to STATE; used
-+   by the help routines.  */
-+void *
-+__argp_input (const struct argp *argp, const struct argp_state *state)
-+{
-+  if (state)
-+    {
-+      struct group *group;
-+      struct parser *parser = state->pstate;
-+
-+      for (group = parser->groups; group < parser->egroup; group++)
-+       if (group->argp == argp)
-+         return group->input;
-+    }
-+
-+  return 0;
-+}
-diff --git a/libuargp/argp-pv.c b/libuargp/argp-pv.c
-new file mode 100644
-index 0000000..f1227b5
---- /dev/null
-+++ b/libuargp/argp-pv.c
-@@ -0,0 +1,25 @@
-+/* Default definition for ARGP_PROGRAM_VERSION.
-+   Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+/* If set by the user program to a non-zero value, then a default option
-+   --version is added (unless the ARGP_NO_HELP flag is used), which will
-+   print this this string followed by a newline and exit (unless the
-+   ARGP_NO_EXIT flag is used).  Overridden by ARGP_PROGRAM_VERSION_HOOK.  */
-+const char *argp_program_version;
-diff --git a/libuargp/argp-pvh.c b/libuargp/argp-pvh.c
-new file mode 100644
-index 0000000..1f1d962
---- /dev/null
-+++ b/libuargp/argp-pvh.c
-@@ -0,0 +1,32 @@
-+/* Default definition for ARGP_PROGRAM_VERSION_HOOK.
-+   Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
-+
-+#include <argp.h>
-+
-+/* If set by the user program to a non-zero value, then a default option
-+   --version is added (unless the ARGP_NO_HELP flag is used), which calls
-+   this function with a stream to print the version to and a pointer to the
-+   current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
-+   used).  This variable takes precedent over ARGP_PROGRAM_VERSION.  */
-+void (*argp_program_version_hook) (FILE *stream, struct argp_state *state);
-diff --git a/libuargp/argp-xinl.c b/libuargp/argp-xinl.c
-new file mode 100644
-index 0000000..f1d3000
---- /dev/null
-+++ b/libuargp/argp-xinl.c
-@@ -0,0 +1,35 @@
-+/* Real definitions for extern inline functions in argp.h
-+   Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#if defined _LIBC || defined HAVE_FEATURES_H
-+# include <features.h>
-+#endif
-+
-+#ifndef __USE_EXTERN_INLINES
-+# define __USE_EXTERN_INLINES  1
-+#endif
-+#define ARGP_EI
-+#undef __OPTIMIZE__
-+#define __OPTIMIZE__ 1
-+#include <argp.h>
-diff --git a/test/argp/Makefile b/test/argp/Makefile
-new file mode 100644
-index 0000000..616fe71
---- /dev/null
-+++ b/test/argp/Makefile
-@@ -0,0 +1,7 @@
-+# uClibc argp tests
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+
-+top_builddir=../../
-+include ../Rules.mak
-+-include Makefile.in
-+include ../Test.mak
-diff --git a/test/argp/Makefile.in b/test/argp/Makefile.in
-new file mode 100644
-index 0000000..d81b359
---- /dev/null
-+++ b/test/argp/Makefile.in
-@@ -0,0 +1,12 @@
-+# uClibc argp tests
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+
-+TESTS := $(addprefix argp-, ex1 ex2 ex3 ex4 test) \
-+         bug-argp1 tst-argp1 tst-argp2
-+
-+EXTRA_LDFLAGS = -luargp
-+
-+OPTS_argp-ex3 = ARG1 ARG2
-+OPTS_argp-ex4 = ARG1 string1 string2 string3
-+OPTS_bug-argp1 = -- --help
-+
-diff --git a/test/argp/argp-ex1.c b/test/argp/argp-ex1.c
-new file mode 100644
-index 0000000..7bb5f22
---- /dev/null
-+++ b/test/argp/argp-ex1.c
-@@ -0,0 +1,15 @@
-+/* Argp example #1 -- a minimal program using argp */
-+
-+/* This is (probably) the smallest possible program that
-+   uses argp.  It won't do much except give an error
-+   messages and exit when there are any arguments, and print
-+   a (rather pointless) messages for --help.  */
-+
-+#include <stdlib.h>
-+#include <argp.h>
-+
-+int main (int argc, char **argv)
-+{
-+  argp_parse (0, argc, argv, 0, 0, 0);
-+  exit (0);
-+}
-diff --git a/test/argp/argp-ex2.c b/test/argp/argp-ex2.c
-new file mode 100644
-index 0000000..c49fbac
---- /dev/null
-+++ b/test/argp/argp-ex2.c
-@@ -0,0 +1,45 @@
-+/* Argp example #2 -- a pretty minimal program using argp */
-+
-+/* This program doesn't use any options or arguments, but uses
-+   argp to be compliant with the GNU standard command line
-+   format.
-+
-+   In addition to making sure no arguments are given, and
-+   implementing a --help option, this example will have a
-+   --version option, and will put the given documentation string
-+   and bug address in the --help output, as per GNU standards.
-+
-+   The variable ARGP contains the argument parser specification;
-+   adding fields to this structure is the way most parameters are
-+   passed to argp_parse (the first three fields are usually used,
-+   but not in this small program).  There are also two global
-+   variables that argp knows about defined here,
-+   ARGP_PROGRAM_VERSION and ARGP_PROGRAM_BUG_ADDRESS (they are
-+   global variables because they will almost always be constant
-+   for a given program, even if it uses different argument
-+   parsers for various tasks).  */
-+
-+#include <stdlib.h>
-+#include <argp.h>
-+
-+const char *argp_program_version =
-+  "argp-ex2 1.0";
-+const char *argp_program_bug_address =
-+  "<bug-gnu-utils@@gnu.org>";
-+
-+/* Program documentation.  */
-+static char doc[] =
-+  "Argp example #2 -- a pretty minimal program using argp";
-+
-+/* Our argument parser.  The @code{options}, @code{parser}, and
-+   @code{args_doc} fields are zero because we have neither options or
-+   arguments; @code{doc} and @code{argp_program_bug_address} will be
-+   used in the output for @samp{--help}, and the @samp{--version}
-+   option will print out @code{argp_program_version}.  */
-+static struct argp argp = { 0, 0, 0, doc };
-+
-+int main (int argc, char **argv)
-+{
-+  argp_parse (&argp, argc, argv, 0, 0, 0);
-+  exit (0);
-+}
-diff --git a/test/argp/argp-ex3.c b/test/argp/argp-ex3.c
-new file mode 100644
-index 0000000..24d5c50
---- /dev/null
-+++ b/test/argp/argp-ex3.c
-@@ -0,0 +1,153 @@
-+/* Argp example #3 -- a program with options and arguments using argp */
-+
-+/* This program uses the same features as example 2, and uses options and
-+   arguments.
-+
-+   We now use the first four fields in ARGP, so here's a description of them:
-+     OPTIONS  -- A pointer to a vector of struct argp_option (see below)
-+     PARSER   -- A function to parse a single option, called by argp
-+     ARGS_DOC -- A string describing how the non-option arguments should look
-+     DOC      -- A descriptive string about this program; if it contains a
-+                 vertical tab character (\v), the part after it will be
-+                 printed *following* the options
-+
-+   The function PARSER takes the following arguments:
-+     KEY  -- An integer specifying which option this is (taken
-+             from the KEY field in each struct argp_option), or
-+             a special key specifying something else; the only
-+             special keys we use here are ARGP_KEY_ARG, meaning
-+             a non-option argument, and ARGP_KEY_END, meaning
-+             that all arguments have been parsed
-+     ARG  -- For an option KEY, the string value of its
-+             argument, or NULL if it has none
-+     STATE-- A pointer to a struct argp_state, containing
-+             various useful information about the parsing state; used here
-+             are the INPUT field, which reflects the INPUT argument to
-+             argp_parse, and the ARG_NUM field, which is the number of the
-+             current non-option argument being parsed
-+   It should return either 0, meaning success, ARGP_ERR_UNKNOWN, meaning the
-+   given KEY wasn't recognized, or an errno value indicating some other
-+   error.
-+
-+   Note that in this example, main uses a structure to communicate with the
-+   parse_opt function, a pointer to which it passes in the INPUT argument to
-+   argp_parse.  Of course, it's also possible to use global variables
-+   instead, but this is somewhat more flexible.
-+
-+   The OPTIONS field contains a pointer to a vector of struct argp_option's;
-+   that structure has the following fields (if you assign your option
-+   structures using array initialization like this example, unspecified
-+   fields will be defaulted to 0, and need not be specified):
-+     NAME   -- The name of this option's long option (may be zero)
-+     KEY    -- The KEY to pass to the PARSER function when parsing this option,
-+               *and* the name of this option's short option, if it is a
-+               printable ascii character
-+     ARG    -- The name of this option's argument, if any
-+     FLAGS  -- Flags describing this option; some of them are:
-+                 OPTION_ARG_OPTIONAL -- The argument to this option is optional
-+                 OPTION_ALIAS        -- This option is an alias for the
-+                                        previous option
-+                 OPTION_HIDDEN       -- Don't show this option in --help output
-+     DOC    -- A documentation string for this option, shown in --help output
-+
-+   An options vector should be terminated by an option with all fields zero. */
-+
-+#include <stdlib.h>
-+#include <argp.h>
-+
-+const char *argp_program_version =
-+  "argp-ex3 1.0";
-+const char *argp_program_bug_address =
-+  "<bug-gnu-utils@@gnu.org>";
-+
-+/* Program documentation.  */
-+static char doc[] =
-+  "Argp example #3 -- a program with options and arguments using argp";
-+
-+/* A description of the arguments we accept.  */
-+static char args_doc[] = "ARG1 ARG2";
-+
-+/* The options we understand.  */
-+static struct argp_option options[] = {
-+  {"verbose",  'v', 0,      0,  "Produce verbose output" },
-+  {"quiet",    'q', 0,      0,  "Don't produce any output" },
-+  {"silent",   's', 0,      OPTION_ALIAS },
-+  {"output",   'o', "FILE", 0,
-+   "Output to FILE instead of standard output" },
-+  { 0 }
-+};
-+
-+/* Used by @code{main} to communicate with @code{parse_opt}.  */
-+struct arguments
-+{
-+  char *args[2];               /* @var{arg1} & @var{arg2} */
-+  int silent, verbose;
-+  char *output_file;
-+};
-+
-+/* Parse a single option.  */
-+static error_t
-+parse_opt (int key, char *arg, struct argp_state *state)
-+{
-+  /* Get the @var{input} argument from @code{argp_parse}, which we
-+     know is a pointer to our arguments structure.  */
-+  struct arguments *arguments = state->input;
-+
-+  switch (key)
-+    {
-+    case 'q': case 's':
-+      arguments->silent = 1;
-+      break;
-+    case 'v':
-+      arguments->verbose = 1;
-+      break;
-+    case 'o':
-+      arguments->output_file = arg;
-+      break;
-+
-+    case ARGP_KEY_ARG:
-+      if (state->arg_num >= 2)
-+       /* Too many arguments.  */
-+       argp_usage (state);
-+
-+      arguments->args[state->arg_num] = arg;
-+
-+      break;
-+
-+    case ARGP_KEY_END:
-+      if (state->arg_num < 2)
-+       /* Not enough arguments.  */
-+       argp_usage (state);
-+      break;
-+
-+    default:
-+      return ARGP_ERR_UNKNOWN;
-+    }
-+  return 0;
-+}
-+
-+/* Our argp parser.  */
-+static struct argp argp = { options, parse_opt, args_doc, doc };
-+
-+int main (int argc, char **argv)
-+{
-+  struct arguments arguments;
-+
-+  /* Default values.  */
-+  arguments.silent = 0;
-+  arguments.verbose = 0;
-+  arguments.output_file = "-";
-+
-+  /* Parse our arguments; every option seen by @code{parse_opt} will
-+     be reflected in @code{arguments}.  */
-+  argp_parse (&argp, argc, argv, 0, 0, &arguments);
-+
-+  printf ("ARG1 = %s\nARG2 = %s\nOUTPUT_FILE = %s\n"
-+         "VERBOSE = %s\nSILENT = %s\n",
-+         arguments.args[0], arguments.args[1],
-+         arguments.output_file,
-+         arguments.verbose ? "yes" : "no",
-+         arguments.silent ? "yes" : "no");
-+
-+  exit (0);
-+}
-diff --git a/test/argp/argp-ex4.c b/test/argp/argp-ex4.c
-new file mode 100644
-index 0000000..c77c7ef
---- /dev/null
-+++ b/test/argp/argp-ex4.c
-@@ -0,0 +1,167 @@
-+/* Argp example #4 -- a program with somewhat more complicated options */
-+
-+/* This program uses the same features as example 3, but has more
-+   options, and somewhat more structure in the -help output.  It
-+   also shows how you can `steal' the remainder of the input
-+   arguments past a certain point, for programs that accept a
-+   list of items.  It also shows the special argp KEY value
-+   ARGP_KEY_NO_ARGS, which is only given if no non-option
-+   arguments were supplied to the program.
-+
-+   For structuring the help output, two features are used,
-+   *headers* which are entries in the options vector with the
-+   first four fields being zero, and a two part documentation
-+   string (in the variable DOC), which allows documentation both
-+   before and after the options; the two parts of DOC are
-+   separated by a vertical-tab character ('\v', or '\013').  By
-+   convention, the documentation before the options is just a
-+   short string saying what the program does, and that afterwards
-+   is longer, describing the behavior in more detail.  All
-+   documentation strings are automatically filled for output,
-+   although newlines may be included to force a line break at a
-+   particular point.  All documentation strings are also passed to
-+   the `gettext' function, for possible translation into the
-+   current locale.  */
-+
-+#include <stdlib.h>
-+#include <error.h>
-+#include <argp.h>
-+
-+const char *argp_program_version =
-+  "argp-ex4 1.0";
-+const char *argp_program_bug_address =
-+  "<bug-gnu-utils@@prep.ai.mit.edu>";
-+
-+/* Program documentation.  */
-+static char doc[] =
-+  "Argp example #4 -- a program with somewhat more complicated\
-+options\
-+\vThis part of the documentation comes *after* the options;\
-+ note that the text is automatically filled, but it's possible\
-+ to force a line-break, e.g.\n<-- here.";
-+
-+/* A description of the arguments we accept.  */
-+static char args_doc[] = "ARG1 [STRING...]";
-+
-+/* Keys for options without short-options.  */
-+#define OPT_ABORT  1           /* --abort */
-+
-+/* The options we understand.  */
-+static struct argp_option options[] = {
-+  {"verbose",  'v', 0,       0, "Produce verbose output" },
-+  {"quiet",    'q', 0,       0, "Don't produce any output" },
-+  {"silent",   's', 0,       OPTION_ALIAS },
-+  {"output",   'o', "FILE",  0,
-+   "Output to FILE instead of standard output" },
-+
-+  {0,0,0,0, "The following options should be grouped together:" },
-+  {"repeat",   'r', "COUNT", OPTION_ARG_OPTIONAL,
-+   "Repeat the output COUNT (default 10) times"},
-+  {"abort",    OPT_ABORT, 0, 0, "Abort before showing any output"},
-+
-+  { 0 }
-+};
-+
-+/* Used by @code{main} to communicate with @code{parse_opt}.  */
-+struct arguments
-+{
-+  char *arg1;                  /* @var{arg1} */
-+  char **strings;              /* [@var{string}@dots{}] */
-+  int silent, verbose, abort;  /* @samp{-s}, @samp{-v}, @samp{--abort} */
-+  char *output_file;           /* @var{file} arg to @samp{--output} */
-+  int repeat_count;            /* @var{count} arg to @samp{--repeat} */
-+};
-+
-+/* Parse a single option.  */
-+static error_t
-+parse_opt (int key, char *arg, struct argp_state *state)
-+{
-+  /* Get the @code{input} argument from @code{argp_parse}, which we
-+     know is a pointer to our arguments structure.  */
-+  struct arguments *arguments = state->input;
-+
-+  switch (key)
-+    {
-+    case 'q': case 's':
-+      arguments->silent = 1;
-+      break;
-+    case 'v':
-+      arguments->verbose = 1;
-+      break;
-+    case 'o':
-+      arguments->output_file = arg;
-+      break;
-+    case 'r':
-+      arguments->repeat_count = arg ? atoi (arg) : 10;
-+      break;
-+    case OPT_ABORT:
-+      arguments->abort = 1;
-+      break;
-+
-+    case ARGP_KEY_NO_ARGS:
-+      argp_usage (state);
-+
-+    case ARGP_KEY_ARG:
-+      /* Here we know that @code{state->arg_num == 0}, since we
-+        force argument parsing to end before any more arguments can
-+        get here.  */
-+      arguments->arg1 = arg;
-+
-+      /* Now we consume all the rest of the arguments.
-+        @code{state->next} is the index in @code{state->argv} of the
-+        next argument to be parsed, which is the first @var{string}
-+        we're interested in, so we can just use
-+        @code{&state->argv[state->next]} as the value for
-+        arguments->strings.
-+
-+        @emph{In addition}, by setting @code{state->next} to the end
-+        of the arguments, we can force argp to stop parsing here and
-+        return.  */
-+      arguments->strings = &state->argv[state->next];
-+      state->next = state->argc;
-+
-+      break;
-+
-+    default:
-+      return ARGP_ERR_UNKNOWN;
-+    }
-+  return 0;
-+}
-+
-+/* Our argp parser.  */
-+static struct argp argp = { options, parse_opt, args_doc, doc };
-+
-+int main (int argc, char **argv)
-+{
-+  int i, j;
-+  struct arguments arguments;
-+
-+  /* Default values.  */
-+  arguments.silent = 0;
-+  arguments.verbose = 0;
-+  arguments.output_file = "-";
-+  arguments.repeat_count = 1;
-+  arguments.abort = 0;
-+
-+  /* Parse our arguments; every option seen by @code{parse_opt} will be
-+     reflected in @code{arguments}.  */
-+  argp_parse (&argp, argc, argv, 0, 0, &arguments);
-+
-+  if (arguments.abort)
-+    error (10, 0, "ABORTED");
-+
-+  for (i = 0; i < arguments.repeat_count; i++)
-+    {
-+      printf ("ARG1 = %s\n", arguments.arg1);
-+      printf ("STRINGS = ");
-+      for (j = 0; arguments.strings[j]; j++)
-+       printf (j == 0 ? "%s" : ", %s", arguments.strings[j]);
-+      printf ("\n");
-+      printf ("OUTPUT_FILE = %s\nVERBOSE = %s\nSILENT = %s\n",
-+             arguments.output_file,
-+             arguments.verbose ? "yes" : "no",
-+             arguments.silent ? "yes" : "no");
-+    }
-+
-+  exit (0);
-+}
-diff --git a/test/argp/argp-test.c b/test/argp/argp-test.c
-new file mode 100644
-index 0000000..b3d573b
---- /dev/null
-+++ b/test/argp/argp-test.c
-@@ -0,0 +1,209 @@
-+/* Test program for argp argument parser
-+   Copyright (C) 1997 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
-+
-+#include <stdlib.h>
-+#include <time.h>
-+#include <string.h>
-+#include <argp.h>
-+
-+const char *argp_program_version = "argp-test 1.0";
-+
-+struct argp_option sub_options[] =
-+{
-+  {"subopt1",       's',     0,  0, "Nested option 1"},
-+  {"subopt2",       'S',     0,  0, "Nested option 2"},
-+
-+  { 0, 0, 0, 0, "Some more nested options:", 10},
-+  {"subopt3",       'p',     0,  0, "Nested option 3"},
-+
-+  {"subopt4",       'q',     0,  0, "Nested option 4", 1},
-+
-+  {0}
-+};
-+
-+static const char sub_args_doc[] = "STRING...\n-";
-+static const char sub_doc[] = "\vThis is the doc string from the sub-arg-parser.";
-+
-+static error_t
-+sub_parse_opt (int key, char *arg, struct argp_state *state)
-+{
-+  switch (key)
-+    {
-+    case ARGP_KEY_NO_ARGS:
-+      printf ("NO SUB ARGS\n");
-+      break;
-+    case ARGP_KEY_ARG:
-+      printf ("SUB ARG: %s\n", arg);
-+      break;
-+
-+    case 's' : case 'S': case 'p': case 'q':
-+      printf ("SUB KEY %c\n", key);
-+      break;
-+
-+    default:
-+      return ARGP_ERR_UNKNOWN;
-+    }
-+  return 0;
-+}
-+
-+static char *
-+sub_help_filter (int key, const char *text, void *input)
-+{
-+  if (key == ARGP_KEY_HELP_EXTRA)
-+    return strdup ("This is some extra text from the sub parser (note that it \
-+is preceded by a blank line).");
-+  else
-+    return (char *)text;
-+}
-+
-+static struct argp sub_argp = {
-+  sub_options, sub_parse_opt, sub_args_doc, sub_doc, 0, sub_help_filter
-+};
-+
-+/* Structure used to communicate with the parsing functions.  */
-+struct params
-+{
-+  unsigned foonly;             /* Value parsed for foonly.  */
-+  unsigned foonly_default;     /* Default value for it.  */
-+};
-+
-+#define OPT_PGRP 1
-+#define OPT_SESS 2
-+
-+struct argp_option options[] =
-+{
-+  {"pid",       'p',     "PID", 0, "List the process PID"},
-+  {"pgrp",      OPT_PGRP,"PGRP",0, "List processes in the process group PGRP"},
-+  {"no-parent", 'P',    0,     0, "Include processes without parents"},
-+  {0,           'x',     0,     OPTION_ALIAS},
-+  {"all-fields",'Q',     0,     0, "Don't elide unusable fields (normally"
-+                                  " if there's some reason ps can't"
-+                                  " print a field for any process, it's"
-+                                  " removed from the output entirely)" },
-+  {"reverse",   'r',    0,      0, "Reverse the order of any sort"},
-+  {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS},
-+  {"session",  OPT_SESS,"SID",  OPTION_ARG_OPTIONAL,
-+                                  "Add the processes from the session"
-+                                  " SID (which defaults to the sid of"
-+                                  " the current process)" },
-+
-+  {0,0,0,0, "Here are some more options:"},
-+  {"foonly", 'f', "ZOT", OPTION_ARG_OPTIONAL, "Glork a foonly"},
-+  {"zaza", 'z', 0, 0, "Snit a zar"},
-+
-+  {0}
-+};
-+
-+static const char args_doc[] = "STRING";
-+static const char doc[] = "Test program for argp."
-+ "\vThis doc string comes after the options."
-+ "\nHey!  Some manual formatting!"
-+ "\nThe current time is: %s";
-+
-+static void
-+popt (int key, char *arg)
-+{
-+  char buf[10];
-+  if (isprint (key))
-+    sprintf (buf, "%c", key);
-+  else
-+    sprintf (buf, "%d", key);
-+  if (arg)
-+    printf ("KEY %s: %s\n", buf, arg);
-+  else
-+    printf ("KEY %s\n", buf);
-+}
-+
-+static error_t
-+parse_opt (int key, char *arg, struct argp_state *state)
-+{
-+  struct params *params = state->input;
-+
-+  switch (key)
-+    {
-+    case ARGP_KEY_NO_ARGS:
-+      printf ("NO ARGS\n");
-+      break;
-+
-+    case ARGP_KEY_ARG:
-+      if (state->arg_num > 0)
-+       return ARGP_ERR_UNKNOWN; /* Leave it for the sub-arg parser.  */
-+      printf ("ARG: %s\n", arg);
-+      break;
-+
-+    case 'f':
-+      if (arg)
-+       params->foonly = atoi (arg);
-+      else
-+       params->foonly = params->foonly_default;
-+      popt (key, arg);
-+      break;
-+
-+    case 'p': case 'P': case OPT_PGRP: case 'x': case 'Q':
-+    case 'r': case OPT_SESS: case 'z':
-+      popt (key, arg);
-+      break;
-+
-+    default:
-+      return ARGP_ERR_UNKNOWN;
-+    }
-+  return 0;
-+}
-+
-+static char *
-+help_filter (int key, const char *text, void *input)
-+{
-+  char *new_text;
-+  struct params *params = input;
-+
-+  if (key == ARGP_KEY_HELP_POST_DOC && text)
-+    {
-+      time_t now = time (0);
-+      asprintf (&new_text, text, ctime (&now));
-+    }
-+  else if (key == 'f')
-+    /* Show the default for the --foonly option.  */
-+    asprintf (&new_text, "%s (ZOT defaults to %x)",
-+             text, params->foonly_default);
-+  else
-+    new_text = (char *)text;
-+
-+  return new_text;
-+}
-+
-+static struct argp_child argp_children[] = { { &sub_argp }, { 0 } };
-+static struct argp argp = {
-+  options, parse_opt, args_doc, doc, argp_children, help_filter
-+};
-+
-+int
-+main (int argc, char **argv)
-+{
-+  struct params params;
-+  params.foonly = 0;
-+  params.foonly_default = random ();
-+  argp_parse (&argp, argc, argv, 0, 0, &params);
-+  printf ("After parsing: foonly = %x\n", params.foonly);
-+  return 0;
-+}
-diff --git a/test/argp/bug-argp1.c b/test/argp/bug-argp1.c
-new file mode 100644
-index 0000000..a28cf4b
---- /dev/null
-+++ b/test/argp/bug-argp1.c
-@@ -0,0 +1,26 @@
-+#include <argp.h>
-+
-+
-+static const struct argp_option test_options[] =
-+{
-+  { NULL, 'a', NULL, OPTION_DOC, NULL },
-+  { NULL, 'b', NULL, OPTION_DOC, NULL },
-+  { NULL, 0, NULL, 0, NULL }
-+};
-+
-+static struct argp test_argp =
-+{
-+  test_options
-+};
-+
-+
-+static int
-+do_test (int argc, char *argv[])
-+{
-+  int i;
-+  argp_parse (&test_argp, argc, argv, 0, &i, NULL);
-+  return 0;
-+}
-+
-+#define TEST_FUNCTION do_test (argc, argv)
-+#include "../test-skeleton.c"
-diff --git a/test/argp/tst-argp1.c b/test/argp/tst-argp1.c
-new file mode 100644
-index 0000000..827daca
---- /dev/null
-+++ b/test/argp/tst-argp1.c
-@@ -0,0 +1,118 @@
-+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Ulrich Drepper <drepper at redhat.com>, 2002.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <argp.h>
-+
-+
-+
-+
-+#define OPT_TO_THREAD          300
-+#define OPT_TO_PROCESS         301
-+#define OPT_SYNC_SIGNAL                302
-+#define OPT_SYNC_JOIN          303
-+#define OPT_TOPLEVEL           304
-+
-+
-+static const struct argp_option test_options[] =
-+  {
-+    { NULL, 0, NULL, 0, "\
-+This is a test for threads so we allow ther user to selection the number of \
-+threads which are used at any one time.  Independently the total number of \
-+rounds can be selected.  This is the total number of threads which will have \
-+run when the process terminates:" },
-+    { "threads", 't', "NUMBER", 0, "Number of threads used at once" },
-+    { "starts", 's', "NUMBER", 0, "Total number of working threads" },
-+    { "toplevel", OPT_TOPLEVEL, "NUMBER", 0,
-+      "Number of toplevel threads which start the other threads; this \
-+implies --sync-join" },
-+
-+    { NULL, 0, NULL, 0, "\
-+Each thread can do one of two things: sleep or do work.  The latter is 100% \
-+CPU bound.  The work load is the probability a thread does work.  All values \
-+from zero to 100 (inclusive) are valid.  How often each thread repeats this \
-+can be determined by the number of rounds.  The work cost determines how long \
-+each work session (not sleeping) takes.  If it is zero a thread would \
-+effectively nothing.  By setting the number of rounds to zero the thread \
-+does no work at all and pure thread creation times can be measured." },
-+    { "workload", 'w', "PERCENT", 0, "Percentage of time spent working" },
-+    { "workcost", 'c', "NUMBER", 0,
-+      "Factor in the cost of each round of working" },
-+    { "rounds", 'r', "NUMBER", 0, "Number of rounds each thread runs" },
-+
-+    { NULL, 0, NULL, 0, "\
-+There are a number of different methods how thread creation can be \
-+synchronized.  Synchronization is necessary since the number of concurrently \
-+running threads is limited." },
-+    { "sync-signal", OPT_SYNC_SIGNAL, NULL, 0,
-+      "Synchronize using a signal (default)" },
-+    { "sync-join", OPT_SYNC_JOIN, NULL, 0, "Synchronize using pthread_join" },
-+
-+    { NULL, 0, NULL, 0, "\
-+One parameter for each threads execution is the size of the stack.  If this \
-+parameter is not used the system's default stack size is used.  If many \
-+threads are used the stack size should be chosen quite small." },
-+    { "stacksize", 'S', "BYTES", 0, "Size of threads stack" },
-+    { "guardsize", 'g', "BYTES", 0,
-+      "Size of stack guard area; must fit into the stack" },
-+
-+    { NULL, 0, NULL, 0, "Signal options:" },
-+    { "to-thread", OPT_TO_THREAD, NULL, 0, "Send signal to main thread" },
-+    { "to-process", OPT_TO_PROCESS, NULL, 0,
-+      "Send signal to process (default)" },
-+
-+    { NULL, 0, NULL, 0, "Administrative options:" },
-+    { "progress", 'p', NULL, 0, "Show signs of progress" },
-+    { "timing", 'T', NULL, 0,
-+      "Measure time from startup to the last thread finishing" },
-+    { NULL, 0, NULL, 0, NULL }
-+  };
-+
-+/* Prototype for option handler.  */
-+static error_t parse_opt (int key, char *arg, struct argp_state *state);
-+
-+/* Data structure to communicate with argp functions.  */
-+static struct argp argp =
-+{
-+  test_options, parse_opt
-+};
-+
-+
-+static int
-+do_test (void)
-+{
-+  int argc = 2;
-+  char *argv[3] = { (char *) "tst-argp1", (char *) "--help", NULL };
-+  int remaining;
-+
-+  /* Parse and process arguments.  */
-+  argp_parse (&argp, argc, argv, 0, &remaining, NULL);
-+
-+  return 0;
-+}
-+
-+
-+/* Handle program arguments.  */
-+static error_t
-+parse_opt (int key, char *arg, struct argp_state *state)
-+{
-+  return ARGP_ERR_UNKNOWN;
-+}
-+
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
-diff --git a/test/argp/tst-argp2.c b/test/argp/tst-argp2.c
-new file mode 100644
-index 0000000..705cdca
---- /dev/null
-+++ b/test/argp/tst-argp2.c
-@@ -0,0 +1,101 @@
-+/* Copyright (C) 2007 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Jakub Jelinek <jakub at redhat.com>, 2007.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <argp.h>
-+
-+static const struct argp_option opt1[] =
-+  {
-+    { "opt1", '1', "NUMBER", 0, "Option 1" },
-+    { NULL, 0, NULL, 0, NULL }
-+  };
-+
-+static const struct argp_option opt2[] =
-+  {
-+    { "opt2", '2', "NUMBER", 0, "Option 2" },
-+    { NULL, 0, NULL, 0, NULL }
-+  };
-+
-+static const struct argp_option opt3[] =
-+  {
-+    { "opt3", '3', "NUMBER", 0, "Option 3" },
-+    { NULL, 0, NULL, 0, NULL }
-+  };
-+
-+static const struct argp_option opt4[] =
-+  {
-+    { "opt4", '4', "NUMBER", 0, "Option 4" },
-+    { NULL, 0, NULL, 0, NULL }
-+  };
-+
-+static const struct argp_option opt5[] =
-+  {
-+    { "opt5", '5', "NUMBER", 0, "Option 5" },
-+    { NULL, 0, NULL, 0, NULL }
-+  };
-+
-+static struct argp argp5 =
-+  {
-+    opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL
-+  };
-+
-+static struct argp argp4 =
-+  {
-+    opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL
-+  };
-+
-+static struct argp argp3 =
-+  {
-+    opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL
-+  };
-+
-+static struct argp_child children2[] =
-+  {
-+    { &argp4, 0, "child3", 3 },
-+    { &argp5, 0, "child4", 4 },
-+    { NULL, 0, NULL, 0 }
-+  };
-+
-+static struct argp argp2 =
-+  {
-+    opt2, NULL, "args doc2", "doc2", children2, NULL, NULL
-+  };
-+
-+static struct argp_child children1[] =
-+  {
-+    { &argp2, 0, "child1", 1 },
-+    { &argp3, 0, "child2", 2 },
-+    { NULL, 0, NULL, 0 }
-+  };
-+
-+static struct argp argp1 =
-+  {
-+    opt1, NULL, "args doc1", "doc1", children1, NULL, NULL
-+  };
-+
-+
-+static int
-+do_test (void)
-+{
-+  argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2");
-+  return 0;
-+}
-+
-+
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
--- 
-2.1.4
-
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 64/73] acpid: Fix build on musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (62 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 63/73] uclibc: Update to 1.0.11 Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-22 12:43   ` Burton, Ross
  2016-01-17 11:36 ` [PATCH 65/73] grub: Backport fix for largefile detection/use Khem Raj
                   ` (9 subsequent siblings)
  73 siblings, 1 reply; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

implement isfdtype() if libc does not provide it

Fix build when S != B

use top_builddir instead of top_srcdir

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-bsp/acpid/acpid.inc                   |  2 +
 ...1-Define-isfdtype-if-libc-doesn-t-have-it.patch | 62 ++++++++++++++++++++++
 ...-config.h-from-builddir-instead-of-srcdir.patch | 51 ++++++++++++++++++
 3 files changed, 115 insertions(+)
 create mode 100644 meta/recipes-bsp/acpid/acpid/0001-Define-isfdtype-if-libc-doesn-t-have-it.patch
 create mode 100644 meta/recipes-bsp/acpid/acpid/0001-Use-config.h-from-builddir-instead-of-srcdir.patch

diff --git a/meta/recipes-bsp/acpid/acpid.inc b/meta/recipes-bsp/acpid/acpid.inc
index e015619..1d1ce98 100644
--- a/meta/recipes-bsp/acpid/acpid.inc
+++ b/meta/recipes-bsp/acpid/acpid.inc
@@ -5,6 +5,8 @@ SECTION = "base"
 LICENSE = "GPLv2+"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/acpid2/acpid-${PV}.tar.xz \
+           file://0001-Define-isfdtype-if-libc-doesn-t-have-it.patch \
+           file://0001-Use-config.h-from-builddir-instead-of-srcdir.patch \
            file://init \
            file://acpid.service \
           "
diff --git a/meta/recipes-bsp/acpid/acpid/0001-Define-isfdtype-if-libc-doesn-t-have-it.patch b/meta/recipes-bsp/acpid/acpid/0001-Define-isfdtype-if-libc-doesn-t-have-it.patch
new file mode 100644
index 0000000..9ffae30
--- /dev/null
+++ b/meta/recipes-bsp/acpid/acpid/0001-Define-isfdtype-if-libc-doesn-t-have-it.patch
@@ -0,0 +1,62 @@
+From 61c9d448e2f18ed46b1a18fe82113e7c75f64d7e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 12 Jan 2016 08:18:08 +0000
+Subject: [PATCH] Define isfdtype() if libc doesn't have it.
+
+musl does not implement isfdtype() so don't assume libc will always
+provide it, instead check for it and provide an implementation if libc
+doesn't provide one.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ configure.ac |  2 +-
+ sock.c       | 12 +++++++++++-
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 241db45..8cef8a4 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -41,7 +41,7 @@ AC_CHECK_FUNC(fstatat, AC_DEFINE(HAVE_FSTATAT, 1, "Define if fstatat() exists"),
+ AC_CHECK_FUNC(openat, AC_DEFINE(HAVE_OPENAT, 1, "Define if openat() exists"), AC_MSG_ERROR(["openat() not found"]))
+ AC_CHECK_FUNC(asprintf, AC_DEFINE(HAVE_ASPRINTF, 1, "Define if asprintf() exists"), AC_MSG_ERROR(["asprintf() not found"]))
+ # These are actually required.  Should switch to above form.
+-AC_CHECK_FUNCS([alarm dup2 memset regcomp select socket strcasecmp strdup strerror strrchr strtol])
++AC_CHECK_FUNCS([alarm dup2 isfdtype memset regcomp select socket strcasecmp strdup strerror strrchr strtol])
+ 
+ # removed for now as kacpimon was not included in dist target
+ #AC_ARG_ENABLE([kacpimon],AS_HELP_STRING([--enable-kacpimon], [Build kacpimon]))
+diff --git a/sock.c b/sock.c
+index 31f816d..546e1b2 100644
+--- a/sock.c
++++ b/sock.c
+@@ -50,13 +50,23 @@ int clientmax = ACPID_CLIENTMAX;
+ /* the number of non-root clients that are connected */
+ int non_root_clients;
+ 
++#ifndef HAVE_ISFDTYPE
++static int
++isfdtype (int fd, int fdtype)
++{
++	struct stat64 st;
++	if (fstat64 (fd, &st) != 0)
++		return -1;
++	return ((st.st_mode & S_IFMT) == (mode_t) fdtype);
++}
++#endif
++
+ /* determine if a file descriptor is in fact a socket */
+ int
+ is_socket(int fd)
+ {
+     return (isfdtype(fd, S_IFSOCK) == 1);
+ }
+-
+ /* accept a new client connection */
+ static void
+ process_sock(int fd)
+-- 
+2.7.0
+
diff --git a/meta/recipes-bsp/acpid/acpid/0001-Use-config.h-from-builddir-instead-of-srcdir.patch b/meta/recipes-bsp/acpid/acpid/0001-Use-config.h-from-builddir-instead-of-srcdir.patch
new file mode 100644
index 0000000..81f2215
--- /dev/null
+++ b/meta/recipes-bsp/acpid/acpid/0001-Use-config.h-from-builddir-instead-of-srcdir.patch
@@ -0,0 +1,51 @@
+From df452e28eccead1ca04cff228bc7cf55413e5b0c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 12 Jan 2016 09:35:07 -0800
+Subject: [PATCH] Use config.h from builddir instead of srcdir
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ Changelog   | 3 +++
+ Makefile.am | 4 ++--
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/Changelog b/Changelog
+index a9bcaeb..17afd08 100644
+--- a/Changelog
++++ b/Changelog
+@@ -6,6 +6,9 @@
+   - Fix missing libc_compat.h in release tarball.
+     (Makefile.am kacpimon/Makefile.am kacpimon/libc_compat.h)
+     (Ted Felix)
++  - Fix out of tree build.
++    (Makefile.am)
++    (Khem Raj)
+ 
+ * Sat Aug 15 2015  Ted Felix <ted@tedfelix.com>
+   - 2.0.24 release
+diff --git a/Makefile.am b/Makefile.am
+index a27e0fe..417528f 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -7,7 +7,7 @@
+ SUBDIRS = kacpimon
+ 
+ AM_CFLAGS = -Wall -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes -Wformat=2
+-AM_CPPFLAGS = -include $(top_srcdir)/config.h
++AM_CPPFLAGS = -include $(top_builddir)/config.h
+ 
+ sbin_PROGRAMS = acpid
+ bin_PROGRAMS = acpi_listen
+@@ -23,6 +23,6 @@ dist_man8_MANS = acpid.8 acpi_listen.8
+ dist_doc_DATA = COPYING Changelog README TESTPLAN TODO
+ 
+ # Just docs to add to the dist.
+-# One problem with this is that it includes all files in the samples dir 
++# One problem with this is that it includes all files in the samples dir
+ # including editor backups ending in ~.  It's the best we've got for now.
+ EXTRA_DIST = acpid-design.odg samples
+-- 
+2.7.0
+
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 65/73] grub: Backport fix for largefile detection/use
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (63 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 64/73] acpid: Fix build on musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-22 12:32   ` Burton, Ross
  2016-01-17 11:36 ` [PATCH 66/73] console-tools: Fix header inclusion when not using glibc Khem Raj
                   ` (8 subsequent siblings)
  73 siblings, 1 reply; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

This is inspired by musl porting, where grub's configure is enabling
largefile support based on glibc versions, instead an upstream patch
turns it into autoconf check

Update git version recipe

arm platforms use this recipe to provide grub and it needed fixes from
upstream so upgrade to latest tip of git and forward port patches as
well as drop the ones already applied upstream

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...ct-_llseek-code-and-require-long-filesyst.patch | 80 ++++++++++++++++++++++
 meta/recipes-bsp/grub/grub-efi_2.00.bb             |  2 +
 ...-mfpmath-sse-as-well-when-SSE-is-disabled.patch | 46 +++++++++++++
 ...1-grub.d-10_linux.in-add-oe-s-kernel-name.patch | 56 +++++++++++++++
 meta/recipes-bsp/grub/grub2.inc                    |  1 +
 meta/recipes-bsp/grub/grub_2.00.bb                 |  2 +
 meta/recipes-bsp/grub/grub_git.bb                  | 13 ++--
 7 files changed, 195 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch
 create mode 100644 meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch
 create mode 100644 meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch

diff --git a/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch b/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch
new file mode 100644
index 0000000..277bca6
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch
@@ -0,0 +1,80 @@
+From 3bac4caa2bc64db313aaee54fffb90383e118517 Mon Sep 17 00:00:00 2001
+From: Felix Janda <felix.janda@posteo.de>
+Date: Thu, 22 Jan 2015 19:54:36 +0100
+Subject: [PATCH] Remove direct _llseek code and require long filesystem libc.
+
+---
+Upstream-Status: Backport
+ configure.ac                    |  8 ++++++++
+ grub-core/osdep/unix/hostdisk.c | 24 ------------------------
+ 4 files changed, 13 insertions(+), 24 deletions(-)
+
+Index: grub-2.00/configure.ac
+===================================================================
+--- grub-2.00.orig/configure.ac
++++ grub-2.00/configure.ac
+@@ -306,6 +306,14 @@ if test x$grub_cv_apple_cc = xyes ; then
+   HOST_LDFLAGS="$HOST_LDFLAGS -Wl,-allow_stack_execute"
+ fi
+ 
++case "$host_os" in
++  cygwin | windows* | mingw32* | aros*)
++     ;;
++  *)
++     AC_CHECK_SIZEOF(off_t)
++     test x"$ac_cv_sizeof_off_t" = x8 || AC_MSG_ERROR([Large file support is required]);;
++esac
++
+ if test x$USE_NLS = xno; then
+   HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
+ fi
+Index: grub-2.00/grub-core/kern/emu/hostdisk.c
+===================================================================
+--- grub-2.00.orig/grub-core/kern/emu/hostdisk.c
++++ grub-2.00/grub-core/kern/emu/hostdisk.c
+@@ -44,11 +44,6 @@
+ #ifdef __linux__
+ # include <sys/ioctl.h>         /* ioctl */
+ # include <sys/mount.h>
+-# if !defined(__GLIBC__) || \
+-        ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
+-/* Maybe libc doesn't have large file support.  */
+-#  include <linux/unistd.h>     /* _llseek */
+-# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */
+ # ifndef BLKFLSBUF
+ #  define BLKFLSBUF     _IO (0x12,97)   /* flush buffer cache */
+ # endif /* ! BLKFLSBUF */
+@@ -761,25 +756,6 @@ linux_find_partition (char *dev, grub_di
+ }
+ #endif /* __linux__ */
+ 
+-#if defined(__linux__) && (!defined(__GLIBC__) || \
+-        ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))))
+-  /* Maybe libc doesn't have large file support.  */
+-grub_err_t
+-grub_util_fd_seek (int fd, const char *name, grub_uint64_t off)
+-{
+-  loff_t offset, result;
+-  static int _llseek (uint filedes, ulong hi, ulong lo,
+-		      loff_t *res, uint wh);
+-  _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo,
+-	     loff_t *, res, uint, wh);
+-
+-  offset = (loff_t) off;
+-  if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))
+-    return grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot seek `%s': %s"),
+-		       name, strerror (errno));
+-  return GRUB_ERR_NONE;
+-}
+-#else
+ grub_err_t
+ grub_util_fd_seek (int fd, const char *name, grub_uint64_t off)
+ {
+@@ -790,7 +766,6 @@ grub_util_fd_seek (int fd, const char *n
+ 		       name, strerror (errno));
+   return 0;
+ }
+-#endif
+ 
+ static void
+ flush_initial_buffer (const char *os_dev __attribute__ ((unused)))
diff --git a/meta/recipes-bsp/grub/grub-efi_2.00.bb b/meta/recipes-bsp/grub/grub-efi_2.00.bb
index ecc6c9a..4e80e18 100644
--- a/meta/recipes-bsp/grub/grub-efi_2.00.bb
+++ b/meta/recipes-bsp/grub/grub-efi_2.00.bb
@@ -33,6 +33,8 @@ EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \
                 --enable-efiemu=no --program-prefix='' \
                 --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
 
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '--enable-largefile ac_cv_sizeof_off_t=8', '--disable-largefile', d)}"
+
 do_install_class-native() {
 	install -d ${D}${bindir}
 	install -m 755 grub-mkimage ${D}${bindir}
diff --git a/meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch b/meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch
new file mode 100644
index 0000000..87ec29e
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch
@@ -0,0 +1,46 @@
+From fb7b827a56b1f92f882d0f5ef130acc968b23293 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jan 2016 19:17:31 +0000
+Subject: [PATCH] Disable -mfpmath=sse as well when SSE is disabled
+
+Fixes
+
+configure:20574: i586-poky-linux-gcc  -m32    -march=core2 -msse3
+-mtune=generic -mfpmath=sse
+--sysroot=/usr/local/dev/yocto/grubtest2/build/tmp/sysroots/emenlow -o
+conftest -O2 -pipe -g -feliminate-unused-debug-types -Wall -W -Wshadow
+-Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g
+-falign-jumps=1 -falign-loops=1 -falign-functions=1 -mno-mmx -mno-sse
+-mno-sse2 -mno-3dnow -fno-dwarf2-cfi-asm -m32 -fno-stack-protector
+-mno-stack-arg-probe -Werror -nostdlib -Wl,--defsym,___main=0x8100
+-Wall -W -I$(top_srcdir)/include -I$(top_builddir)/include
+-DGRUB_MACHINE_PCBIOS=1 -DGRUB_MACHINE=I386_PC -Wl,-O1
+-Wl,--hash-style=gnu -Wl,--as-needed conftest.c  >&5
+conftest.c:1:0: error: SSE instruction set disabled, using 387
+arithmetics [-Werror]
+cc1: all warnings being treated as errors
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 26d2f33..9ce56de 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -783,7 +783,7 @@ fi
+ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
+   # Some toolchains enable these features by default, but they need
+   # registers that aren't set up properly in GRUB.
+-  TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow"
++  TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -mfpmath=387"
+ fi
+ 
+ # GRUB doesn't use float or doubles at all. Yet some toolchains may decide
+-- 
+2.7.0
+
diff --git a/meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch b/meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch
new file mode 100644
index 0000000..d5bfaa1
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch
@@ -0,0 +1,56 @@
+From b512c77222a8b133d7dd71a0dcef081a921d97d4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jan 2016 19:28:00 +0000
+Subject: [PATCH] grub.d/10_linux.in: add oe's kernel name
+
+Our kernel's name is bzImage, we need add it to grub.d/10_linux.in so
+that the grub-mkconfig and grub-install can work correctly.
+
+We only need add the bzImage to util/grub.d/10_linux.in, but also add it
+to util/grub.d/20_linux_xen.in to keep compatibility.
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Inappropriate [OE specific]
+
+ util/grub.d/10_linux.in     | 6 +++---
+ util/grub.d/20_linux_xen.in | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 859b608..946be5d 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -148,12 +148,12 @@ machine=`uname -m`
+ case "x$machine" in
+     xi?86 | xx86_64)
+ 	list=
+-	for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
++	for i in /boot/bzImage-* /bzImage-* /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
+ 	    if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
+ 	done ;;
+-    *) 
++    *)
+ 	list=
+-	for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
++	for i in /boot/bzImage-* /boot/vmlinuz-* /boot/vmlinux-* /bzImage-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
+                   if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
+ 	done ;;
+ esac
+diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
+index f532fb9..1994244 100644
+--- a/util/grub.d/20_linux_xen.in
++++ b/util/grub.d/20_linux_xen.in
+@@ -138,7 +138,7 @@ EOF
+ }
+ 
+ linux_list=
+-for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
++for i in /boot/bzImage[xz]-* /bzImage[xz]-* /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
+     if grub_file_is_not_garbage "$i"; then
+     	basename=$(basename $i)
+ 	version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
+-- 
+2.7.0
+
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index a8c41f8..84a4727 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -28,6 +28,7 @@ SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
            file://0001-parse_dhcp_vendor-Add-missing-const-qualifiers.patch \
            file://grub2-fix-initrd-size-bug.patch \
            file://0001-Fix-CVE-2015-8370-Grub2-user-pass-vulnerability.patch \
+           file://0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch \
             "
 
 DEPENDS = "flex-native bison-native xz"
diff --git a/meta/recipes-bsp/grub/grub_2.00.bb b/meta/recipes-bsp/grub/grub_2.00.bb
index c1be133..addc1b2 100644
--- a/meta/recipes-bsp/grub/grub_2.00.bb
+++ b/meta/recipes-bsp/grub/grub_2.00.bb
@@ -6,6 +6,8 @@ PR = "r1"
 EXTRA_OECONF = "--with-platform=pc --disable-grub-mkfont --program-prefix="" \
                --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
 
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '--enable-largefile ac_cv_sizeof_off_t=8', '--disable-largefile', d)}"
+
 do_install_append () {
     install -d ${D}${sysconfdir}/grub.d
 }
diff --git a/meta/recipes-bsp/grub/grub_git.bb b/meta/recipes-bsp/grub/grub_git.bb
index 6a0e3ee..3ebab7f 100644
--- a/meta/recipes-bsp/grub/grub_git.bb
+++ b/meta/recipes-bsp/grub/grub_git.bb
@@ -5,13 +5,14 @@ DEPENDS += "autogen-native"
 DEFAULT_PREFERENCE = "-1"
 DEFAULT_PREFERENCE_arm = "1"
 
+FILESEXTRAPATHS =. "${FILE_DIRNAME}/grub-git:"
+
 PV = "2.00+${SRCPV}"
-SRCREV = "87de66d9d83446ecddb29cfbdf7369102c8e209e"
+SRCREV = "b95e92678882f56056c64ae29092bc9cf129905f"
 SRC_URI = "git://git.savannah.gnu.org/grub.git \
-           file://grub-2.00-fpmath-sse-387-fix.patch \
+           file://0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch \
            file://autogen.sh-exclude-pc.patch \
-           file://grub-2.00-add-oe-kernel.patch \
-           file://0001-Fix-build-with-glibc-2.20.patch \
+           file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
           "
 
 S = "${WORKDIR}/git"
@@ -30,6 +31,8 @@ GRUBPLATFORM ??= "pc"
 EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} --disable-grub-mkfont --program-prefix="" \
                 --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
 
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '--enable-largefile ac_cv_sizeof_off_t=8', '--disable-largefile', d)}"
+
 do_configure_prepend() {
     ( cd ${S}
       ${S}/autogen.sh )
@@ -37,7 +40,7 @@ do_configure_prepend() {
 
 do_install_append () {
     install -d ${D}${sysconfdir}/grub.d
- 
+    rm -rf ${D}${libdir}/charset.alias
 }
 
 # debugedit chokes on bare metal binaries
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 66/73] console-tools: Fix header inclusion when not using glibc
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (64 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 65/73] grub: Backport fix for largefile detection/use Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 67/73] gpgme: Define __error_t_defined on musl Khem Raj
                   ` (7 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

It did differentiate on features in libc but assumed always glibc
this patch make that assumption clear

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0001-Cover-the-else-with-__GLIBC__.patch       | 51 ++++++++++++++++++++++
 .../console-tools/console-tools_0.3.2.bb           |  3 ++
 2 files changed, 54 insertions(+)
 create mode 100644 meta/recipes-core/console-tools/console-tools-0.3.2/0001-Cover-the-else-with-__GLIBC__.patch

diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/0001-Cover-the-else-with-__GLIBC__.patch b/meta/recipes-core/console-tools/console-tools-0.3.2/0001-Cover-the-else-with-__GLIBC__.patch
new file mode 100644
index 0000000..ace4bf0
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/0001-Cover-the-else-with-__GLIBC__.patch
@@ -0,0 +1,51 @@
+From b6a59b05f1fa514c6b387c9544bd63b1bfcf2eed Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jan 2016 05:38:29 +0000
+Subject: [PATCH] Cover the else with __GLIBC__
+
+Fixes build errors on musl/x86
+
+| In file included from
+/home/ubuntu/work/oe/openembedded-core/build/tmp-musl/sysroots/qemux86/usr/include/asm/termios.h:1:0,
+|                  from
+/home/ubuntu/work/oe/openembedded-core/build/tmp-musl/sysroots/qemux86/usr/include/linux/termios.h:5,
+|                  from
+/home/ubuntu/work/oe/openembedded-core/build/tmp-musl/work/i586-oe-linux-musl/console-tools/0.3.2-r8/console-tools-0.3.2/vttools/resizecons.c:86:
+|
+/home/ubuntu/work/oe/openembedded-core/build/tmp-musl/sysroots/qemux86/usr/include/asm-generic/termios.h:14:8:
+error: redefinition of 'struct winsize'
+|  struct winsize {
+|         ^
+| In file included from
+/home/ubuntu/work/oe/openembedded-core/build/tmp-musl/sysroots/qemux86/usr/include/sys/ioctl.h:7:0,
+|                  from
+/home/ubuntu/work/oe/openembedded-core/build/tmp-musl/work/i586-oe-linux-musl/console-tools/0.3.2-r8/console-tools-0.3.2/vttools/resizecons.c:81:
+|
+/home/ubuntu/work/oe/openembedded-core/build/tmp-musl/sysroots/qemux86/usr/include/bits/ioctl.h:90:8:
+note: originally defined here
+|  struct winsize {
+|         ^
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ vttools/resizecons.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/vttools/resizecons.c b/vttools/resizecons.c
+index f0a7055..e8753b1 100644
+--- a/vttools/resizecons.c
++++ b/vttools/resizecons.c
+@@ -81,7 +81,7 @@
+ #include <sys/ioctl.h>
+ #if (__GNU_LIBRARY__ >= 6)
+ # include <sys/perm.h>
+-#else
++#elif defined __GLIBC__
+ # include <linux/types.h>
+ # include <linux/termios.h>
+ #endif
+-- 
+2.7.0
+
diff --git a/meta/recipes-core/console-tools/console-tools_0.3.2.bb b/meta/recipes-core/console-tools/console-tools_0.3.2.bb
index d14d683..1db8414 100644
--- a/meta/recipes-core/console-tools/console-tools_0.3.2.bb
+++ b/meta/recipes-core/console-tools/console-tools_0.3.2.bb
@@ -15,6 +15,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/lct/console-tools-${PV}.tar.gz \
            file://fix-libconsole-linking.patch \
            file://no-dep-on-libfl.patch \
            file://0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch \
+           file://0001-Cover-the-else-with-__GLIBC__.patch \
            file://lcmessage.m4 \
            file://Makevars"
 
@@ -24,6 +25,8 @@ SRC_URI[sha256sum] = "eea6b441672dacd251079fc85ed322e196282e0e66c16303ec64c3a2b1
 UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/lct/files/console-tools-devel/"
 UPSTREAM_CHECK_REGEX = "/console-tools-devel/(?P<pver>(\d\d?\.)+\d\d?)/"
 
+CFLAGS_append_aarch64 = " -D_USE_TERMIOS "
+
 do_configure_prepend () {
 	mkdir -p ${S}/m4
 	cp ${WORKDIR}/lcmessage.m4 ${S}/m4/
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 67/73] gpgme: Define __error_t_defined on musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (65 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 66/73] console-tools: Fix header inclusion when not using glibc Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 68/73] mdadm: Fix build with musl Khem Raj
                   ` (6 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Configure looks for error_t in errno.h and musl does not define error_t
if its not defined then configure emits a definition to be used, now we
also use standalone argp implementation from glibc on musl based systems
which defines this in argp.h as well so now we have it defined twice
and errors like

|
/a/builder/mnt/build-oe/tmp-musl/sysroots/raspberrypi2/usr/include/argp.h:40:13:
error: cannot combine with previous 'int' declaration specifier
| typedef int error_t;
|             ^
| ../config.h:257:17: note: expanded from macro 'error_t'
| #define error_t int
|                 ^
| 1 error generated.

are seen. argp.h definition is conditional on __error_t_defined which is
true here so lets define it on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-support/gpgme/gpgme_1.5.4.bb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-support/gpgme/gpgme_1.5.4.bb b/meta/recipes-support/gpgme/gpgme_1.5.4.bb
index 1598377..f2211f1 100644
--- a/meta/recipes-support/gpgme/gpgme_1.5.4.bb
+++ b/meta/recipes-support/gpgme/gpgme_1.5.4.bb
@@ -27,6 +27,7 @@ PACKAGES =+ "${PN}-pthread"
 FILES_${PN}-pthread = "${libdir}/libgpgme-pthread.so.*"
 FILES_${PN}-dev += "${datadir}/common-lisp/source/gpgme/*"
 
+CFLAGS_append_libc-musl = " -D__error_t_defined "
 do_configure_prepend () {
 	# Else these could be used in preference to those in aclocal-copy
 	rm -f ${S}/m4/gpg-error.m4
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 68/73] mdadm: Fix build with musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (66 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 67/73] gpgme: Define __error_t_defined on musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 69/73] eglinfo: Fix build on raspberrypi Khem Raj
                   ` (5 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Define _POSIX_C_SOURCE if not defined
Add sockaddr_un* to sockaddr* typecast to make compiler happy

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0001-Define-_POSIX_C_SOURCE-if-undefined.patch | 59 ++++++++++++++++++++++
 meta/recipes-extended/mdadm/mdadm_3.3.4.bb         |  2 +-
 2 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/mdadm/files/0001-Define-_POSIX_C_SOURCE-if-undefined.patch

diff --git a/meta/recipes-extended/mdadm/files/0001-Define-_POSIX_C_SOURCE-if-undefined.patch b/meta/recipes-extended/mdadm/files/0001-Define-_POSIX_C_SOURCE-if-undefined.patch
new file mode 100644
index 0000000..a461b76
--- /dev/null
+++ b/meta/recipes-extended/mdadm/files/0001-Define-_POSIX_C_SOURCE-if-undefined.patch
@@ -0,0 +1,59 @@
+From d74b02d4653d1ea26029c2528eb93d7268b83eb3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jan 2016 07:28:33 +0000
+Subject: [PATCH] Define _POSIX_C_SOURCE if undefined
+
+typecast second argument of connect() API to use struct sockaddr*
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ config.c | 3 +++
+ mdmon.c  | 2 +-
+ msg.c    | 2 +-
+ 3 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/config.c b/config.c
+index a882ed3..a675688 100644
+--- a/config.c
++++ b/config.c
+@@ -63,6 +63,9 @@
+  * but may not wrap over lines
+  *
+  */
++#ifndef _POSIX_C_SOURCE
++#define _POSIX_C_SOURCE 200809L
++#endif
+ 
+ #ifndef CONFFILE
+ #define CONFFILE "/etc/mdadm.conf"
+diff --git a/mdmon.c b/mdmon.c
+index ee12b7c..e4b73d9 100644
+--- a/mdmon.c
++++ b/mdmon.c
+@@ -235,7 +235,7 @@ static int make_control_sock(char *devname)
+ 	addr.sun_family = PF_LOCAL;
+ 	strcpy(addr.sun_path, path);
+ 	umask(077); /* ensure no world write access */
+-	if (bind(sfd, &addr, sizeof(addr)) < 0) {
++	if (bind(sfd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
+ 		close(sfd);
+ 		return -1;
+ 	}
+diff --git a/msg.c b/msg.c
+index 754630b..45cd450 100644
+--- a/msg.c
++++ b/msg.c
+@@ -170,7 +170,7 @@ int connect_monitor(char *devname)
+ 
+ 	addr.sun_family = PF_LOCAL;
+ 	strcpy(addr.sun_path, path);
+-	if (connect(sfd, &addr, sizeof(addr)) < 0) {
++	if (connect(sfd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
+ 		close(sfd);
+ 		return -1;
+ 	}
+-- 
+2.7.0
+
diff --git a/meta/recipes-extended/mdadm/mdadm_3.3.4.bb b/meta/recipes-extended/mdadm/mdadm_3.3.4.bb
index 0993611..e004030 100644
--- a/meta/recipes-extended/mdadm/mdadm_3.3.4.bb
+++ b/meta/recipes-extended/mdadm/mdadm_3.3.4.bb
@@ -14,13 +14,13 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
            file://mdadm-3.3.2_x32_abi_time_t.patch \
            file://0001-Fix-typo-in-comparision.patch \
            file://mdadm-fix-ptest-build-errors.patch \
+           file://0001-Define-_POSIX_C_SOURCE-if-undefined.patch \
            file://run-ptest \
 	  "
 SRC_URI[md5sum] = "7ca8b114710f98f53f20c5787b674a09"
 SRC_URI[sha256sum] = "8ae5f45306b873190e91f410709b00e51997b633c072b33f8efd9f7df022ca68"
 
 CFLAGS += "-fno-strict-aliasing"
-
 inherit autotools-brokensep
 
 EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CXFLAGS="${CFLAGS}"'
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 69/73] eglinfo: Fix build on raspberrypi
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (67 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 68/73] mdadm: Fix build with musl Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 70/73] puzzles: Silence warning on arm with clang Khem Raj
                   ` (4 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-graphics/eglinfo/eglinfo.inc          |  4 ++-
 ...GING_INCDIR-to-searchpath-for-egl-headers.patch | 34 ++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/eglinfo/files/0001-Add-STAGING_INCDIR-to-searchpath-for-egl-headers.patch

diff --git a/meta/recipes-graphics/eglinfo/eglinfo.inc b/meta/recipes-graphics/eglinfo/eglinfo.inc
index fb89175..d0c0c27 100644
--- a/meta/recipes-graphics/eglinfo/eglinfo.inc
+++ b/meta/recipes-graphics/eglinfo/eglinfo.inc
@@ -6,7 +6,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=8d4f33bc3add976f7dfae85dab66f03c"
 
 DEPENDS = "virtual/egl"
 
-SRC_URI = "git://github.com/dv1/eglinfo.git;branch=master"
+SRC_URI = "git://github.com/dv1/eglinfo.git;branch=master \
+           file://0001-Add-STAGING_INCDIR-to-searchpath-for-egl-headers.patch \
+          "
 SRCREV = "4b317648ec6cf39556a9e5d8078f605bc0edd5de"
 
 S = "${WORKDIR}/git"
diff --git a/meta/recipes-graphics/eglinfo/files/0001-Add-STAGING_INCDIR-to-searchpath-for-egl-headers.patch b/meta/recipes-graphics/eglinfo/files/0001-Add-STAGING_INCDIR-to-searchpath-for-egl-headers.patch
new file mode 100644
index 0000000..ca9f55c
--- /dev/null
+++ b/meta/recipes-graphics/eglinfo/files/0001-Add-STAGING_INCDIR-to-searchpath-for-egl-headers.patch
@@ -0,0 +1,34 @@
+From 94b1e6daf7d70550b0e32fbb269fcf6887948d3f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jan 2016 16:08:22 -0800
+Subject: [PATCH] Add STAGING_INCDIR to searchpath for egl headers
+
+bcm_host.h is in standard includedir in sysroot
+add that to header search paths.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ wscript | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/wscript b/wscript
+index fcbb55b..cece8bf 100644
+--- a/wscript
++++ b/wscript
+@@ -163,9 +163,10 @@ def configure_raspberrypi_device(conf, platform):
+ 	conf.check_cxx(mandatory = 1, lib = ['GLESv2', 'EGL', 'bcm_host'], uselib_store = 'EGL')
+ 	import os
+ 	sysroot = conf.options.sysroot + conf.options.prefix
++        std_include_path = os.path.join(sysroot, 'include')
+ 	vcos_pthread_path = os.path.join(sysroot, 'include/interface/vcos/pthreads')
+ 	vcms_host_path = os.path.join(sysroot, 'include/interface/vmcs_host/linux')
+-	if not conf.check_cxx(mandatory = 0, header_name = ['vcos_platform_types.h', 'EGL/egl.h', 'bcm_host.h'], includes = [vcos_pthread_path, vcms_host_path], uselib_store = 'EGL'):
++	if not conf.check_cxx(mandatory = 0, header_name = ['vcos_platform_types.h', 'EGL/egl.h', 'bcm_host.h'], includes = [vcos_pthread_path, vcms_host_path, std_include_path], uselib_store = 'EGL'):
+ 		conf.fatal('Check if --prefix and --sysroot are set correctly.')
+ 	conf.env['WITH_APIS'] = []
+ 	if check_gles2(conf):
+-- 
+2.7.0
+
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 70/73] puzzles: Silence warning on arm with clang
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (68 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 69/73] eglinfo: Fix build on raspberrypi Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 71/73] binutils: Fix gold linking errors due to unresolved R_ARM_MOVW_ABS_NC Khem Raj
                   ` (3 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

Clang finds overflows when comparison is done between an unsigned char
and a integer constant. So explicitly typecast the constant before
comparison

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...1-palisade-Fix-warnings-with-clang-on-arm.patch | 72 ++++++++++++++++++++++
 meta/recipes-sato/puzzles/puzzles_git.bb           |  1 +
 2 files changed, 73 insertions(+)
 create mode 100644 meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch

diff --git a/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch b/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch
new file mode 100644
index 0000000..5351f8e
--- /dev/null
+++ b/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch
@@ -0,0 +1,72 @@
+From 6d8326275802a2e6e61d3e99460af6891ae8362f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jan 2016 23:10:19 -0800
+Subject: [puzzles][PATCH] palisade: Fix warnings with clang on arm
+
+ARM treats 'char' as unsigned char when 'char' is not qualified with
+'signed' or 'unsigned' explicitly.
+
+This results in warnings e.g.
+
+palisade.c:531:22: error: comparison of constant -1 with expression of
+type 'clue' (aka 'char') is always false
+[-Werror,-Wtautological-constant-out-of-range-compare]
+        if (clues[i] == EMPTY) continue;
+
+Therefore, typcast the contant to char in such places to be explicit
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ palisade.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/palisade.c b/palisade.c
+index 984e616..2b9c25c 100644
+--- a/palisade.c
++++ b/palisade.c
+@@ -295,11 +295,11 @@ static void solver_connected_clues_versus_region_size(solver_ctx *ctx)
+      * If p = q = 3 then the region has size exactly 2. */
+ 
+     for (i = 0; i < wh; ++i) {
+-        if (ctx->clues[i] == EMPTY) continue;
++        if (ctx->clues[i] == (char)EMPTY) continue;
+         for (dir = 0; dir < 4; ++dir) {
+             int j = i + dx[dir] + w*dy[dir];
+             if (disconnected(ctx, i, j, dir)) continue;
+-            if (ctx->clues[j] == EMPTY) continue;
++            if (ctx->clues[j] == (char)EMPTY) continue;
+             if ((8 - ctx->clues[i] - ctx->clues[j] > ctx->params->k) ||
+                 (ctx->clues[i] == 3 && ctx->clues[j] == 3 &&
+                  ctx->params->k != 2))
+@@ -317,7 +317,7 @@ static int solver_number_exhausted(solver_ctx *ctx)
+     int changed = FALSE;
+ 
+     for (i = 0; i < wh; ++i) {
+-        if (ctx->clues[i] == EMPTY) continue;
++        if (ctx->clues[i] == (char)EMPTY) continue;
+ 
+         if (bitcount[(ctx->borders[i] & BORDER_MASK)] == ctx->clues[i]) {
+             for (dir = 0; dir < 4; ++dir) {
+@@ -528,7 +528,7 @@ static int is_solved(const game_params *params, clue *clues,
+     for (i = 0; i < wh; ++i) {
+         if (dsf[i] == UNVISITED) dfs_dsf(i, params->w, border, dsf, TRUE);
+         if (dsf_size(dsf, i) != k) goto error;
+-        if (clues[i] == EMPTY) continue;
++        if (clues[i] == (char)EMPTY) continue;
+         if (clues[i] != bitcount[border[i] & BORDER_MASK]) goto error;
+     }
+ 
+@@ -674,7 +674,7 @@ static char *new_game_desc(const game_params *params, random_state *rs,
+     p = numbers;
+     r = 0;
+     for (i = 0; i < wh; ++i) {
+-        if (numbers[i] != EMPTY) {
++        if (numbers[i] != (char)EMPTY) {
+             while (r) {
+                 while (r > 26) {
+                     *p++ = 'z';
+-- 
+2.7.0
+
diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb
index 9c8170c..dab5440 100644
--- a/meta/recipes-sato/puzzles/puzzles_git.bb
+++ b/meta/recipes-sato/puzzles/puzzles_git.bb
@@ -13,6 +13,7 @@ SRC_URI = "git://git.tartarus.org/simon/puzzles.git \
            file://fix-compiling-failure-with-option-g-O.patch \
            file://0001-Use-labs-instead-of-abs.patch \
            file://0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch \
+           file://0001-palisade-Fix-warnings-with-clang-on-arm.patch \
 "
 SRCREV = "346584bf6e38232be8773c24fd7dedcbd7b3d9ed"
 PE = "1"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 71/73] binutils: Fix gold linking errors due to unresolved R_ARM_MOVW_ABS_NC
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (69 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 70/73] puzzles: Silence warning on arm with clang Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 72/73] syslinux: Set LD to avoid using build host ld Khem Raj
                   ` (2 subsequent siblings)
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

This issue has been seen in multiple times e.g.

http://patchwork.openembedded.org/patch/103083/

https://www.mail-archive.com/openembedded-core@lists.openembedded.org/msg72513.html

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/binutils/binutils-2.25.1.inc |    1 +
 ...h-adds-IFUNC-support-for-arm-gold-backend.patch | 1004 ++++++++++++++++++++
 2 files changed, 1005 insertions(+)
 create mode 100644 meta/recipes-devtools/binutils/binutils/0016-This-patch-adds-IFUNC-support-for-arm-gold-backend.patch

diff --git a/meta/recipes-devtools/binutils/binutils-2.25.1.inc b/meta/recipes-devtools/binutils/binutils-2.25.1.inc
index bf29da1..dc23c4d 100644
--- a/meta/recipes-devtools/binutils/binutils-2.25.1.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.25.1.inc
@@ -35,6 +35,7 @@ SRC_URI = "\
      file://0013-Fix-an-internal-error-in-do_print_to_mapfile-seen-wi.patch \
      file://0014-gold-arm-Skip-pic-check-for-R_ARM_REL32.patch \
      file://0015-Fix-dynamic-list-so-that-symbols-not-in-the-list-are.patch \
+     file://0016-This-patch-adds-IFUNC-support-for-arm-gold-backend.patch \
      file://binutils-octeon3.patch \
      file://add-thunderx-support-for-gas.patch \
      "
diff --git a/meta/recipes-devtools/binutils/binutils/0016-This-patch-adds-IFUNC-support-for-arm-gold-backend.patch b/meta/recipes-devtools/binutils/binutils/0016-This-patch-adds-IFUNC-support-for-arm-gold-backend.patch
new file mode 100644
index 0000000..dcac308
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0016-This-patch-adds-IFUNC-support-for-arm-gold-backend.patch
@@ -0,0 +1,1004 @@
+From b780c9e06cabe6d8e301aaf46f33f116f3224021 Mon Sep 17 00:00:00 2001
+From: Han Shen <shenhan@google.com>
+Date: Thu, 29 Jan 2015 10:00:46 -0800
+Subject: [PATCH] This patch adds IFUNC support for arm gold backend.
+
+This is a feature required in chromeos arm development work.
+
+Tested:
+1) Built passed all-gold on x86_64 machine
+2) Tested with basic gold aarch64 ifunc unittests -
+   a) global ifunc, statically/non-statically linked
+   b) local ifunc, statically/non-statically linked
+   c) global/local, other shared library routine mixed,
+   statically/non-statically linked
+   d) arm/thumb mode ifunc
+   e) linking chrome browser passed
+---
+Upstream-Status: Backport
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+ elfcpp/arm.h    |   5 +-
+ gold/aarch64.cc |   2 +-
+ gold/arm.cc     | 593 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
+ gold/output.h   |  11 ++
+ 4 files changed, 561 insertions(+), 50 deletions(-)
+
+diff --git a/elfcpp/arm.h b/elfcpp/arm.h
+index 8c6b6bf..1c13dc9 100644
+--- a/elfcpp/arm.h
++++ b/elfcpp/arm.h
+@@ -192,11 +192,12 @@ enum
+   R_ARM_PRIVATE_14 = 126,
+   R_ARM_PRIVATE_15 = 127,
+   R_ARM_ME_TOO = 128,		// Obsolete
+-  R_ARM_THM_TLS_DESCSEQ16 = 129,// Static	Thumb16	
++  R_ARM_THM_TLS_DESCSEQ16 = 129,// Static	Thumb16
+   R_ARM_THM_TLS_DESCSEQ32 = 130,// Static	Thumb32
+   // 131 - 139			Unallocated
+   // 140 - 159			Dynamic		Reserved for future allocation
+-  // 160 - 255			Unallocated
++  R_ARM_IRELATIVE = 160,	// Dynamic
++  // 161 - 255			Unallocated
+ };
+ 
+ // e_flags values used for ARM.  We only support flags defined in AAELF.
+diff --git a/gold/aarch64.cc b/gold/aarch64.cc
+index afb9024..7fbbdbd 100644
+--- a/gold/aarch64.cc
++++ b/gold/aarch64.cc
+@@ -1226,7 +1226,7 @@ class Output_data_plt_aarch64 : public Output_section_data
+   // The number of PLT entries.
+   unsigned int count_;
+ 
+-  // Number of PLT entries with R_X86_64_IRELATIVE relocs.  These
++  // Number of PLT entries with R_AARCH64_IRELATIVE relocs.  These
+   // follow the regular PLT entries.
+   unsigned int irelative_count_;
+ 
+diff --git a/gold/arm.cc b/gold/arm.cc
+index 6c472bb..8719cc9 100644
+--- a/gold/arm.cc
++++ b/gold/arm.cc
+@@ -2119,8 +2119,8 @@ class Target_arm : public Sized_target<32, big_endian>
+ 
+   Target_arm(const Target::Target_info* info = &arm_info)
+     : Sized_target<32, big_endian>(info),
+-      got_(NULL), plt_(NULL), got_plt_(NULL), rel_dyn_(NULL),
+-      copy_relocs_(elfcpp::R_ARM_COPY),
++      got_(NULL), plt_(NULL), got_plt_(NULL), got_irelative_(NULL),
++      rel_dyn_(NULL), rel_irelative_(NULL), copy_relocs_(elfcpp::R_ARM_COPY),
+       got_mod_index_offset_(-1U), tls_base_symbol_defined_(false),
+       stub_tables_(), stub_factory_(Stub_factory::get_instance()),
+       should_force_pic_veneer_(false),
+@@ -2258,6 +2258,18 @@ class Target_arm : public Sized_target<32, big_endian>
+   uint64_t
+   do_dynsym_value(const Symbol*) const;
+ 
++  // Return the plt address for globals. Since we have irelative plt entries,
++  // address calculation is not as straightforward as plt_address + plt_offset.
++  uint64_t
++  do_plt_address_for_global(const Symbol* gsym) const
++  { return this->plt_section()->address_for_global(gsym); }
++
++  // Return the plt address for locals. Since we have irelative plt entries,
++  // address calculation is not as straightforward as plt_address + plt_offset.
++  uint64_t
++  do_plt_address_for_local(const Relobj* relobj, unsigned int symndx) const
++  { return this->plt_section()->address_for_local(relobj, symndx); }
++
+   // Relocate a section.
+   void
+   relocate_section(const Relocate_info<32, big_endian>*,
+@@ -2357,6 +2369,10 @@ class Target_arm : public Sized_target<32, big_endian>
+   unsigned int
+   plt_entry_size() const;
+ 
++  // Get the section to use for IRELATIVE relocations, create it if necessary.
++  Reloc_section*
++  rel_irelative_section(Layout*);
++
+   // Map platform-specific reloc types
+   static unsigned int
+   get_real_reloc_type(unsigned int r_type);
+@@ -2448,8 +2464,11 @@ class Target_arm : public Sized_target<32, big_endian>
+  protected:
+   // Make the PLT-generator object.
+   Output_data_plt_arm<big_endian>*
+-  make_data_plt(Layout* layout, Output_data_space* got_plt)
+-  { return this->do_make_data_plt(layout, got_plt); }
++  make_data_plt(Layout* layout,
++		Arm_output_data_got<big_endian>* got,
++		Output_data_space* got_plt,
++		Output_data_space* got_irelative)
++  { return this->do_make_data_plt(layout, got, got_plt, got_irelative); }
+ 
+   // Make an ELF object.
+   Object*
+@@ -2530,9 +2549,14 @@ class Target_arm : public Sized_target<32, big_endian>
+   do_define_standard_symbols(Symbol_table*, Layout*);
+ 
+   virtual Output_data_plt_arm<big_endian>*
+-  do_make_data_plt(Layout* layout, Output_data_space* got_plt)
++  do_make_data_plt(Layout* layout,
++		   Arm_output_data_got<big_endian>* got,
++		   Output_data_space* got_plt,
++		   Output_data_space* got_irelative)
+   {
+-    return new Output_data_plt_arm_standard<big_endian>(layout, got_plt);
++    gold_assert(got_plt != NULL && got_irelative != NULL);
++    return new Output_data_plt_arm_standard<big_endian>(
++	layout, got, got_plt, got_irelative);
+   }
+ 
+  private:
+@@ -2602,6 +2626,9 @@ class Target_arm : public Sized_target<32, big_endian>
+       if (sym->is_undefined() && !parameters->options().shared())
+ 	return false;
+ 
++      if (sym->type() == elfcpp::STT_GNU_IFUNC)
++	return true;
++
+       return (!parameters->doing_static_link()
+ 	      && (sym->type() == elfcpp::STT_FUNC
+ 		  || sym->type() == elfcpp::STT_ARM_TFUNC)
+@@ -2613,6 +2640,11 @@ class Target_arm : public Sized_target<32, big_endian>
+     inline bool
+     possible_function_pointer_reloc(unsigned int r_type);
+ 
++    // Whether a plt entry is needed for ifunc.
++    bool
++    reloc_needs_plt_for_ifunc(Sized_relobj_file<32, big_endian>*,
++			      unsigned int r_type);
++
+     // Whether we have issued an error about a non-PIC compilation.
+     bool issued_non_pic_error_;
+   };
+@@ -2718,10 +2750,20 @@ class Target_arm : public Sized_target<32, big_endian>
+     return this->got_plt_;
+   }
+ 
++  // Create the PLT section.
++  void
++  make_plt_section(Symbol_table* symtab, Layout* layout);
++
+   // Create a PLT entry for a global symbol.
+   void
+   make_plt_entry(Symbol_table*, Layout*, Symbol*);
+ 
++  // Create a PLT entry for a local STT_GNU_IFUNC symbol.
++  void
++  make_local_ifunc_plt_entry(Symbol_table*, Layout*,
++			     Sized_relobj_file<32, big_endian>* relobj,
++			     unsigned int local_sym_index);
++
+   // Define the _TLS_MODULE_BASE_ symbol in the TLS segment.
+   void
+   define_tls_base_symbol(Symbol_table*, Layout*);
+@@ -2903,8 +2945,12 @@ class Target_arm : public Sized_target<32, big_endian>
+   Output_data_plt_arm<big_endian>* plt_;
+   // The GOT PLT section.
+   Output_data_space* got_plt_;
++  // The GOT section for IRELATIVE relocations.
++  Output_data_space* got_irelative_;
+   // The dynamic reloc section.
+   Reloc_section* rel_dyn_;
++  // The section to use for IRELATIVE relocs.
++  Reloc_section* rel_irelative_;
+   // Relocs saved to avoid a COPY reloc.
+   Copy_relocs<elfcpp::SHT_REL, 32, big_endian> copy_relocs_;
+   // Offset of the GOT entry for the TLS module index.
+@@ -4244,6 +4290,15 @@ Target_arm<big_endian>::got_section(Symbol_table* symtab, Layout* layout)
+ 				    elfcpp::STB_LOCAL,
+ 				    elfcpp::STV_HIDDEN, 0,
+ 				    false, false);
++
++      // If there are any IRELATIVE relocations, they get GOT entries
++      // in .got.plt after the jump slot entries.
++      this->got_irelative_ = new Output_data_space(4, "** GOT IRELATIVE PLT");
++      layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
++				      (elfcpp::SHF_ALLOC | elfcpp::SHF_WRITE),
++				      this->got_irelative_,
++				      got_order, is_got_relro);
++
+     }
+   return this->got_;
+ }
+@@ -4257,14 +4312,43 @@ Target_arm<big_endian>::rel_dyn_section(Layout* layout)
+   if (this->rel_dyn_ == NULL)
+     {
+       gold_assert(layout != NULL);
++      // Create both relocation sections in the same place, so as to ensure
++      // their relative order in the output section.
+       this->rel_dyn_ = new Reloc_section(parameters->options().combreloc());
++      this->rel_irelative_ = new Reloc_section(false);
+       layout->add_output_section_data(".rel.dyn", elfcpp::SHT_REL,
+ 				      elfcpp::SHF_ALLOC, this->rel_dyn_,
+ 				      ORDER_DYNAMIC_RELOCS, false);
++      layout->add_output_section_data(".rel.dyn", elfcpp::SHT_REL,
++				      elfcpp::SHF_ALLOC, this->rel_irelative_,
++				      ORDER_DYNAMIC_RELOCS, false);
+     }
+   return this->rel_dyn_;
+ }
+ 
++
++// Get the section to use for IRELATIVE relocs, creating it if necessary.  These
++// go in .rela.dyn, but only after all other dynamic relocations.  They need to
++// follow the other dynamic relocations so that they can refer to global
++// variables initialized by those relocs.
++
++template<bool big_endian>
++typename Target_arm<big_endian>::Reloc_section*
++Target_arm<big_endian>::rel_irelative_section(Layout* layout)
++{
++  if (this->rel_irelative_ == NULL)
++    {
++      // Delegate the creation to rel_dyn_section so as to ensure their order in
++      // the output section.
++      this->rel_dyn_section(layout);
++      gold_assert(this->rel_irelative_ != NULL
++		  && (this->rel_dyn_->output_section()
++		      == this->rel_irelative_->output_section()));
++    }
++  return this->rel_irelative_;
++}
++
++
+ // Insn_template methods.
+ 
+ // Return byte size of an instruction template.
+@@ -7221,24 +7305,80 @@ template<bool big_endian>
+ class Output_data_plt_arm : public Output_section_data
+ {
+  public:
++  // Unlike aarch64, which records symbol value in "addend" field of relocations
++  // and could be done at the same time an IRelative reloc is created for the
++  // symbol, arm puts the symbol value into "GOT" table, which, however, is
++  // issued later in Output_data_plt_arm::do_write(). So we have a struct here
++  // to keep necessary symbol information for later use in do_write. We usually
++  // have only a very limited number of ifuncs, so the extra data required here
++  // is also limited.
++
++  struct IRelative_data
++  {
++    IRelative_data(Sized_symbol<32>* sized_symbol)
++      : symbol_is_global_(true)
++    {
++      u_.global = sized_symbol;
++    }
++
++    IRelative_data(Sized_relobj_file<32, big_endian>* relobj,
++		   unsigned int index)
++      : symbol_is_global_(false)
++    {
++      u_.local.relobj = relobj;
++      u_.local.index = index;
++    }
++
++    union
++    {
++      Sized_symbol<32>* global;
++
++      struct
++      {
++	Sized_relobj_file<32, big_endian>* relobj;
++	unsigned int index;
++      } local;
++    } u_;
++
++    bool symbol_is_global_;
++  };
++
+   typedef Output_data_reloc<elfcpp::SHT_REL, true, 32, big_endian>
+     Reloc_section;
+ 
+-  Output_data_plt_arm(Layout*, uint64_t addralign, Output_data_space*);
++  Output_data_plt_arm(Layout* layout, uint64_t addralign,
++		      Arm_output_data_got<big_endian>* got,
++		      Output_data_space* got_plt,
++		      Output_data_space* got_irelative);
+ 
+   // Add an entry to the PLT.
+   void
+-  add_entry(Symbol* gsym);
++  add_entry(Symbol_table* symtab, Layout* layout, Symbol* gsym);
++
++  // Add the relocation for a plt entry.
++  void
++  add_relocation(Symbol_table* symtab, Layout* layout,
++		 Symbol* gsym, unsigned int got_offset);
++
++  // Add an entry to the PLT for a local STT_GNU_IFUNC symbol.
++  unsigned int
++  add_local_ifunc_entry(Symbol_table* symtab, Layout*,
++			Sized_relobj_file<32, big_endian>* relobj,
++			unsigned int local_sym_index);
+ 
+   // Return the .rel.plt section data.
+   const Reloc_section*
+   rel_plt() const
+   { return this->rel_; }
+ 
++  // Return the PLT relocation container for IRELATIVE.
++  Reloc_section*
++  rel_irelative(Symbol_table*, Layout*);
++
+   // Return the number of PLT entries.
+   unsigned int
+   entry_count() const
+-  { return this->count_; }
++  { return this->count_ + this->irelative_count_; }
+ 
+   // Return the offset of the first non-reserved PLT entry.
+   unsigned int
+@@ -7250,6 +7390,14 @@ class Output_data_plt_arm : public Output_section_data
+   get_plt_entry_size() const
+   { return this->do_get_plt_entry_size(); }
+ 
++  // Return the PLT address for globals.
++  uint32_t
++  address_for_global(const Symbol*) const;
++
++  // Return the PLT address for locals.
++  uint32_t
++  address_for_local(const Relobj*, unsigned int symndx) const;
++
+  protected:
+   // Fill in the first PLT entry.
+   void
+@@ -7298,19 +7446,37 @@ class Output_data_plt_arm : public Output_section_data
+   set_final_data_size()
+   {
+     this->set_data_size(this->first_plt_entry_offset()
+-			+ this->count_ * this->get_plt_entry_size());
++			+ ((this->count_ + this->irelative_count_)
++			   * this->get_plt_entry_size()));
+   }
+ 
+   // Write out the PLT data.
+   void
+   do_write(Output_file*);
+ 
++  // Record irelative symbol data.
++  void insert_irelative_data(const IRelative_data& idata)
++  { irelative_data_vec_.push_back(idata); }
++
+   // The reloc section.
+   Reloc_section* rel_;
++  // The IRELATIVE relocs, if necessary.  These must follow the
++  // regular PLT relocations.
++  Reloc_section* irelative_rel_;
++  // The .got section.
++  Arm_output_data_got<big_endian>* got_;
+   // The .got.plt section.
+   Output_data_space* got_plt_;
++  // The part of the .got.plt section used for IRELATIVE relocs.
++  Output_data_space* got_irelative_;
+   // The number of PLT entries.
+   unsigned int count_;
++  // Number of PLT entries with R_ARM_IRELATIVE relocs.  These
++  // follow the regular PLT entries.
++  unsigned int irelative_count_;
++  // Vector for irelative data.
++  typedef std::vector<IRelative_data> IRelative_data_vec;
++  IRelative_data_vec irelative_data_vec_;
+ };
+ 
+ // Create the PLT section.  The ordinary .got section is an argument,
+@@ -7318,10 +7484,14 @@ class Output_data_plt_arm : public Output_section_data
+ // section just for PLT entries.
+ 
+ template<bool big_endian>
+-Output_data_plt_arm<big_endian>::Output_data_plt_arm(Layout* layout,
+-						     uint64_t addralign,
+-						     Output_data_space* got_plt)
+-  : Output_section_data(addralign), got_plt_(got_plt), count_(0)
++Output_data_plt_arm<big_endian>::Output_data_plt_arm(
++    Layout* layout, uint64_t addralign,
++    Arm_output_data_got<big_endian>* got,
++    Output_data_space* got_plt,
++    Output_data_space* got_irelative)
++  : Output_section_data(addralign), irelative_rel_(NULL),
++    got_(got), got_plt_(got_plt), got_irelative_(got_irelative),
++    count_(0), irelative_count_(0)
+ {
+   this->rel_ = new Reloc_section(false);
+   layout->add_output_section_data(".rel.plt", elfcpp::SHT_REL,
+@@ -7340,40 +7510,210 @@ Output_data_plt_arm<big_endian>::do_adjust_output_section(Output_section* os)
+ 
+ template<bool big_endian>
+ void
+-Output_data_plt_arm<big_endian>::add_entry(Symbol* gsym)
++Output_data_plt_arm<big_endian>::add_entry(Symbol_table* symtab,
++					   Layout* layout,
++					   Symbol* gsym)
+ {
+   gold_assert(!gsym->has_plt_offset());
+ 
+-  // Note that when setting the PLT offset we skip the initial
+-  // reserved PLT entry.
+-  gsym->set_plt_offset((this->count_) * this->get_plt_entry_size()
+-		       + this->first_plt_entry_offset());
++  unsigned int* entry_count;
++  Output_section_data_build* got;
++
++  // We have 2 different types of plt entry here, normal and ifunc.
++
++  // For normal plt, the offset begins with first_plt_entry_offset(20), and the
++  // 1st entry offset would be 20, the second 32, third 44 ... etc.
++
++  // For ifunc plt, the offset begins with 0. So the first offset would 0,
++  // second 12, third 24 ... etc.
++
++  // IFunc plt entries *always* come after *normal* plt entries.
++
++  // Notice, when computing the plt address of a certain symbol, "plt_address +
++  // plt_offset" is no longer correct. Use target->plt_address_for_global() or
++  // target->plt_address_for_local() instead.
++
++  int begin_offset = 0;
++  if (gsym->type() == elfcpp::STT_GNU_IFUNC
++      && gsym->can_use_relative_reloc(false))
++    {
++      entry_count = &this->irelative_count_;
++      got = this->got_irelative_;
++      // For irelative plt entries, offset is relative to the end of normal plt
++      // entries, so it starts from 0.
++      begin_offset = 0;
++      // Record symbol information.
++      this->insert_irelative_data(
++	  IRelative_data(symtab->get_sized_symbol<32>(gsym)));
++    }
++  else
++    {
++      entry_count = &this->count_;
++      got = this->got_plt_;
++      // Note that for normal plt entries, when setting the PLT offset we skip
++      // the initial reserved PLT entry.
++      begin_offset = this->first_plt_entry_offset();
++    }
++
++  gsym->set_plt_offset(begin_offset
++		       + (*entry_count) * this->get_plt_entry_size());
+ 
+-  ++this->count_;
++  ++(*entry_count);
+ 
+-  section_offset_type got_offset = this->got_plt_->current_data_size();
++  section_offset_type got_offset = got->current_data_size();
+ 
+   // Every PLT entry needs a GOT entry which points back to the PLT
+   // entry (this will be changed by the dynamic linker, normally
+   // lazily when the function is called).
+-  this->got_plt_->set_current_data_size(got_offset + 4);
++  got->set_current_data_size(got_offset + 4);
+ 
+   // Every PLT entry needs a reloc.
+-  gsym->set_needs_dynsym_entry();
+-  this->rel_->add_global(gsym, elfcpp::R_ARM_JUMP_SLOT, this->got_plt_,
+-			 got_offset);
++  this->add_relocation(symtab, layout, gsym, got_offset);
+ 
+   // Note that we don't need to save the symbol.  The contents of the
+   // PLT are independent of which symbols are used.  The symbols only
+   // appear in the relocations.
+ }
+ 
++// Add an entry to the PLT for a local STT_GNU_IFUNC symbol.  Return
++// the PLT offset.
++
++template<bool big_endian>
++unsigned int
++Output_data_plt_arm<big_endian>::add_local_ifunc_entry(
++    Symbol_table* symtab,
++    Layout* layout,
++    Sized_relobj_file<32, big_endian>* relobj,
++    unsigned int local_sym_index)
++{
++  this->insert_irelative_data(IRelative_data(relobj, local_sym_index));
++
++  // Notice, when computingthe plt entry address, "plt_address + plt_offset" is
++  // no longer correct. Use target->plt_address_for_local() instead.
++  unsigned int plt_offset = this->irelative_count_ * this->get_plt_entry_size();
++  ++this->irelative_count_;
++
++  section_offset_type got_offset = this->got_irelative_->current_data_size();
++
++  // Every PLT entry needs a GOT entry which points back to the PLT
++  // entry.
++  this->got_irelative_->set_current_data_size(got_offset + 4);
++
++
++  // Every PLT entry needs a reloc.
++  Reloc_section* rel = this->rel_irelative(symtab, layout);
++  rel->add_symbolless_local_addend(relobj, local_sym_index,
++				   elfcpp::R_ARM_IRELATIVE,
++				   this->got_irelative_, got_offset);
++  return plt_offset;
++}
++
++
++// Add the relocation for a PLT entry.
++
++template<bool big_endian>
++void
++Output_data_plt_arm<big_endian>::add_relocation(
++    Symbol_table* symtab, Layout* layout, Symbol* gsym, unsigned int got_offset)
++{
++  if (gsym->type() == elfcpp::STT_GNU_IFUNC
++      && gsym->can_use_relative_reloc(false))
++    {
++      Reloc_section* rel = this->rel_irelative(symtab, layout);
++      rel->add_symbolless_global_addend(gsym, elfcpp::R_ARM_IRELATIVE,
++					this->got_irelative_, got_offset);
++    }
++  else
++    {
++      gsym->set_needs_dynsym_entry();
++      this->rel_->add_global(gsym, elfcpp::R_ARM_JUMP_SLOT, this->got_plt_,
++			     got_offset);
++    }
++}
++
++
++// Create the irelative relocation data.
++
++template<bool big_endian>
++typename Output_data_plt_arm<big_endian>::Reloc_section*
++Output_data_plt_arm<big_endian>::rel_irelative(Symbol_table* symtab,
++						Layout* layout)
++{
++  if (this->irelative_rel_ == NULL)
++    {
++      // Since irelative relocations goes into 'rel.dyn', we delegate the
++      // creation of irelative_rel_ to where rel_dyn section gets created.
++      Target_arm<big_endian>* arm_target =
++	  Target_arm<big_endian>::default_target();
++      this->irelative_rel_ = arm_target->rel_irelative_section(layout);
++
++      // Make sure we have a place for the TLSDESC relocations, in
++      // case we see any later on.
++      // this->rel_tlsdesc(layout);
++      if (parameters->doing_static_link())
++	{
++	  // A statically linked executable will only have a .rel.plt section to
++	  // hold R_ARM_IRELATIVE relocs for STT_GNU_IFUNC symbols.  The library
++	  // will use these symbols to locate the IRELATIVE relocs at program
++	  // startup time.
++	  symtab->define_in_output_data("__rel_iplt_start", NULL,
++					Symbol_table::PREDEFINED,
++					this->irelative_rel_, 0, 0,
++					elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL,
++					elfcpp::STV_HIDDEN, 0, false, true);
++	  symtab->define_in_output_data("__rel_iplt_end", NULL,
++					Symbol_table::PREDEFINED,
++					this->irelative_rel_, 0, 0,
++					elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL,
++					elfcpp::STV_HIDDEN, 0, true, true);
++	}
++    }
++  return this->irelative_rel_;
++}
++
++
++// Return the PLT address for a global symbol.
++
++template<bool big_endian>
++uint32_t
++Output_data_plt_arm<big_endian>::address_for_global(const Symbol* gsym) const
++{
++  uint64_t begin_offset = 0;
++  if (gsym->type() == elfcpp::STT_GNU_IFUNC
++      && gsym->can_use_relative_reloc(false))
++    {
++      begin_offset = (this->first_plt_entry_offset() +
++		      this->count_ * this->get_plt_entry_size());
++    }
++  return this->address() + begin_offset + gsym->plt_offset();
++}
++
++
++// Return the PLT address for a local symbol.  These are always
++// IRELATIVE relocs.
++
++template<bool big_endian>
++uint32_t
++Output_data_plt_arm<big_endian>::address_for_local(
++    const Relobj* object,
++    unsigned int r_sym) const
++{
++  return (this->address()
++	  + this->first_plt_entry_offset()
++	  + this->count_ * this->get_plt_entry_size()
++	  + object->local_plt_offset(r_sym));
++}
++
++
+ template<bool big_endian>
+ class Output_data_plt_arm_standard : public Output_data_plt_arm<big_endian>
+ {
+  public:
+-  Output_data_plt_arm_standard(Layout* layout, Output_data_space* got_plt)
+-    : Output_data_plt_arm<big_endian>(layout, 4, got_plt)
++  Output_data_plt_arm_standard(Layout* layout,
++			       Arm_output_data_got<big_endian>* got,
++			       Output_data_space* got_plt,
++			       Output_data_space* got_irelative)
++    : Output_data_plt_arm<big_endian>(layout, 4, got, got_plt, got_irelative)
+   { }
+ 
+  protected:
+@@ -7485,8 +7825,11 @@ Output_data_plt_arm<big_endian>::do_write(Output_file* of)
+   unsigned char* const oview = of->get_output_view(offset, oview_size);
+ 
+   const off_t got_file_offset = this->got_plt_->offset();
++  gold_assert(got_file_offset + this->got_plt_->data_size()
++	      == this->got_irelative_->offset());
+   const section_size_type got_size =
+-    convert_to_section_size_type(this->got_plt_->data_size());
++    convert_to_section_size_type(this->got_plt_->data_size()
++				 + this->got_irelative_->data_size());
+   unsigned char* const got_view = of->get_output_view(got_file_offset,
+ 						      got_size);
+   unsigned char* pov = oview;
+@@ -7505,7 +7848,8 @@ Output_data_plt_arm<big_endian>::do_write(Output_file* of)
+ 
+   unsigned int plt_offset = this->first_plt_entry_offset();
+   unsigned int got_offset = 12;
+-  const unsigned int count = this->count_;
++  const unsigned int count = this->count_ + this->irelative_count_;
++  gold_assert(this->irelative_count_ == this->irelative_data_vec_.size());
+   for (unsigned int i = 0;
+        i < count;
+        ++i,
+@@ -7518,8 +7862,33 @@ Output_data_plt_arm<big_endian>::do_write(Output_file* of)
+       this->fill_plt_entry(pov, got_address, plt_address,
+ 			   got_offset, plt_offset);
+ 
+-      // Set the entry in the GOT.
+-      elfcpp::Swap<32, big_endian>::writeval(got_pov, plt_address);
++      Arm_address value;
++      if (i < this->count_)
++	{
++	  // For non-irelative got entries, the value is the beginning of plt.
++	  value = plt_address;
++	}
++      else
++	{
++	  // For irelative got entries, the value is the (global/local) symbol
++	  // address.
++	  const IRelative_data& idata =
++	      this->irelative_data_vec_[i - this->count_];
++	  if (idata.symbol_is_global_)
++	    {
++	      // Set the entry in the GOT for irelative symbols.  The content is
++	      // the address of the ifunc, not the address of plt start.
++	      const Sized_symbol<32>* sized_symbol = idata.u_.global;
++	      gold_assert(sized_symbol->type() == elfcpp::STT_GNU_IFUNC);
++	      value = sized_symbol->value();
++	    }
++	  else
++	    {
++	      value = idata.u_.local.relobj->local_symbol_value(
++		  idata.u_.local.index, 0);
++	    }
++	}
++      elfcpp::Swap<32, big_endian>::writeval(got_pov, value);
+     }
+ 
+   gold_assert(static_cast<section_size_type>(pov - oview) == oview_size);
+@@ -7529,6 +7898,7 @@ Output_data_plt_arm<big_endian>::do_write(Output_file* of)
+   of->write_output_view(got_file_offset, got_size, got_view);
+ }
+ 
++
+ // Create a PLT entry for a global symbol.
+ 
+ template<bool big_endian>
+@@ -7540,20 +7910,58 @@ Target_arm<big_endian>::make_plt_entry(Symbol_table* symtab, Layout* layout,
+     return;
+ 
+   if (this->plt_ == NULL)
++    this->make_plt_section(symtab, layout);
++
++  this->plt_->add_entry(symtab, layout, gsym);
++}
++
++
++// Create the PLT section.
++template<bool big_endian>
++void
++Target_arm<big_endian>::make_plt_section(
++  Symbol_table* symtab, Layout* layout)
++{
++  if (this->plt_ == NULL)
+     {
+-      // Create the GOT sections first.
++      // Create the GOT section first.
+       this->got_section(symtab, layout);
+ 
+-      this->plt_ = this->make_data_plt(layout, this->got_plt_);
++      // GOT for irelatives is create along with got.plt.
++      gold_assert(this->got_ != NULL
++		  && this->got_plt_ != NULL
++		  && this->got_irelative_ != NULL);
++      this->plt_ = this->make_data_plt(layout, this->got_, this->got_plt_,
++				       this->got_irelative_);
+ 
+       layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS,
+ 				      (elfcpp::SHF_ALLOC
+ 				       | elfcpp::SHF_EXECINSTR),
+ 				      this->plt_, ORDER_PLT, false);
+     }
+-  this->plt_->add_entry(gsym);
+ }
+ 
++
++// Make a PLT entry for a local STT_GNU_IFUNC symbol.
++
++template<bool big_endian>
++void
++Target_arm<big_endian>::make_local_ifunc_plt_entry(
++    Symbol_table* symtab, Layout* layout,
++    Sized_relobj_file<32, big_endian>* relobj,
++    unsigned int local_sym_index)
++{
++  if (relobj->local_has_plt_offset(local_sym_index))
++    return;
++  if (this->plt_ == NULL)
++    this->make_plt_section(symtab, layout);
++  unsigned int plt_offset = this->plt_->add_local_ifunc_entry(symtab, layout,
++							      relobj,
++							      local_sym_index);
++  relobj->set_local_plt_offset(local_sym_index, plt_offset);
++}
++
++
+ // Return the number of entries in the PLT.
+ 
+ template<bool big_endian>
+@@ -7823,6 +8231,7 @@ Target_arm<big_endian>::Scan::check_non_pic(Relobj* object,
+     case elfcpp::R_ARM_JUMP_SLOT:
+     case elfcpp::R_ARM_ABS32:
+     case elfcpp::R_ARM_ABS32_NOI:
++    case elfcpp::R_ARM_IRELATIVE:
+     case elfcpp::R_ARM_PC24:
+     // FIXME: The following 3 types are not supported by Android's dynamic
+     // linker.
+@@ -7853,6 +8262,27 @@ Target_arm<big_endian>::Scan::check_non_pic(Relobj* object,
+     }
+ }
+ 
++
++// Return whether we need to make a PLT entry for a relocation of the
++// given type against a STT_GNU_IFUNC symbol.
++
++template<bool big_endian>
++bool
++Target_arm<big_endian>::Scan::reloc_needs_plt_for_ifunc(
++    Sized_relobj_file<32, big_endian>* object,
++    unsigned int r_type)
++{
++  int flags = Scan::get_reference_flags(r_type);
++  if (flags & Symbol::TLS_REF)
++    {
++      gold_error(_("%s: unsupported TLS reloc %u for IFUNC symbol"),
++		 object->name().c_str(), r_type);
++      return false;
++    }
++  return flags != 0;
++}
++
++
+ // Scan a relocation for a local symbol.
+ // FIXME: This only handles a subset of relocation types used by Android
+ // on ARM v5te devices.
+@@ -7874,6 +8304,15 @@ Target_arm<big_endian>::Scan::local(Symbol_table* symtab,
+     return;
+ 
+   r_type = get_real_reloc_type(r_type);
++
++  // A local STT_GNU_IFUNC symbol may require a PLT entry.
++  bool is_ifunc = lsym.get_st_type() == elfcpp::STT_GNU_IFUNC;
++  if (is_ifunc && this->reloc_needs_plt_for_ifunc(object, r_type))
++    {
++      unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
++      target->make_local_ifunc_plt_entry(symtab, layout, object, r_sym);
++    }
++
+   switch (r_type)
+     {
+     case elfcpp::R_ARM_NONE:
+@@ -7898,7 +8337,7 @@ Target_arm<big_endian>::Scan::local(Symbol_table* symtab,
+ 	  // we need to add check_non_pic(object, r_type) here.
+ 	  rel_dyn->add_local_relative(object, r_sym, elfcpp::R_ARM_RELATIVE,
+ 				      output_section, data_shndx,
+-				      reloc.get_r_offset());
++				      reloc.get_r_offset(), is_ifunc);
+ 	}
+       break;
+ 
+@@ -8265,6 +8704,11 @@ Target_arm<big_endian>::Scan::global(Symbol_table* symtab,
+       && strcmp(gsym->name(), "_GLOBAL_OFFSET_TABLE_") == 0)
+     target->got_section(symtab, layout);
+ 
++  // A STT_GNU_IFUNC symbol may require a PLT entry.
++  if (gsym->type() == elfcpp::STT_GNU_IFUNC
++      && this->reloc_needs_plt_for_ifunc(object, r_type))
++    target->make_plt_entry(symtab, layout, gsym);
++
+   r_type = get_real_reloc_type(r_type);
+   switch (r_type)
+     {
+@@ -8309,6 +8753,24 @@ Target_arm<big_endian>::Scan::global(Symbol_table* symtab,
+ 	      }
+ 	    else if ((r_type == elfcpp::R_ARM_ABS32
+ 		      || r_type == elfcpp::R_ARM_ABS32_NOI)
++		     && gsym->type() == elfcpp::STT_GNU_IFUNC
++		     && gsym->can_use_relative_reloc(false)
++		     && !gsym->is_from_dynobj()
++		     && !gsym->is_undefined()
++		     && !gsym->is_preemptible())
++	      {
++		// Use an IRELATIVE reloc for a locally defined STT_GNU_IFUNC
++		// symbol. This makes a function address in a PIE executable
++		// match the address in a shared library that it links against.
++		Reloc_section* rel_irelative =
++		    target->rel_irelative_section(layout);
++		unsigned int r_type = elfcpp::R_ARM_IRELATIVE;
++		rel_irelative->add_symbolless_global_addend(
++		    gsym, r_type, output_section, object,
++		    data_shndx, reloc.get_r_offset());
++	      }
++	    else if ((r_type == elfcpp::R_ARM_ABS32
++		      || r_type == elfcpp::R_ARM_ABS32_NOI)
+ 		     && gsym->can_use_relative_reloc(false))
+ 	      {
+ 		Reloc_section* rel_dyn = target->rel_dyn_section(layout);
+@@ -8442,7 +8904,13 @@ Target_arm<big_endian>::Scan::global(Symbol_table* symtab,
+ 	Arm_output_data_got<big_endian>* got =
+ 	  target->got_section(symtab, layout);
+ 	if (gsym->final_value_is_known())
+-	  got->add_global(gsym, GOT_TYPE_STANDARD);
++	  {
++	    // For a STT_GNU_IFUNC symbol we want the PLT address.
++	    if (gsym->type() == elfcpp::STT_GNU_IFUNC)
++	      got->add_global_plt(gsym, GOT_TYPE_STANDARD);
++	    else
++	      got->add_global(gsym, GOT_TYPE_STANDARD);
++	  }
+ 	else
+ 	  {
+ 	    // If this symbol is not fully resolved, we need to add a
+@@ -8452,12 +8920,29 @@ Target_arm<big_endian>::Scan::global(Symbol_table* symtab,
+ 		|| gsym->is_undefined()
+ 		|| gsym->is_preemptible()
+ 		|| (gsym->visibility() == elfcpp::STV_PROTECTED
+-		    && parameters->options().shared()))
++		    && parameters->options().shared())
++		|| (gsym->type() == elfcpp::STT_GNU_IFUNC
++		    && parameters->options().output_is_position_independent()))
+ 	      got->add_global_with_rel(gsym, GOT_TYPE_STANDARD,
+ 				       rel_dyn, elfcpp::R_ARM_GLOB_DAT);
+ 	    else
+ 	      {
+-		if (got->add_global(gsym, GOT_TYPE_STANDARD))
++		// For a STT_GNU_IFUNC symbol we want to write the PLT
++		// offset into the GOT, so that function pointer
++		// comparisons work correctly.
++		bool is_new;
++		if (gsym->type() != elfcpp::STT_GNU_IFUNC)
++		  is_new = got->add_global(gsym, GOT_TYPE_STANDARD);
++		else
++		  {
++		    is_new = got->add_global_plt(gsym, GOT_TYPE_STANDARD);
++		    // Tell the dynamic linker to use the PLT address
++		    // when resolving relocations.
++		    if (gsym->is_from_dynobj()
++			&& !parameters->options().shared())
++		      gsym->set_needs_dynsym_value();
++		  }
++		if (is_new)
+ 		  rel_dyn->add_global_relative(
+ 		      gsym, elfcpp::R_ARM_RELATIVE, got,
+ 		      gsym->got_offset(GOT_TYPE_STANDARD));
+@@ -8919,8 +9404,7 @@ Target_arm<big_endian>::Relocate::relocate(
+ 	  if (gsym->use_plt_offset(Scan::get_reference_flags(r_type)))
+ 	    {
+ 	      // This uses a PLT, change the symbol value.
+-	      symval.set_output_value(target->plt_section()->address()
+-				      + gsym->plt_offset());
++	      symval.set_output_value(target->plt_address_for_global(gsym));
+ 	      psymval = &symval;
+ 	    }
+ 	  else if (gsym->is_weak_undefined())
+@@ -8958,6 +9442,13 @@ Target_arm<big_endian>::Relocate::relocate(
+ 	  elfcpp::Elf_types<32>::Elf_WXword r_info = rel.get_r_info();
+ 	  unsigned int r_sym = elfcpp::elf_r_sym<32>(r_info);
+ 	  thumb_bit = object->local_symbol_is_thumb_function(r_sym) ? 1 : 0;
++
++	  if (psymval->is_ifunc_symbol() && object->local_has_plt_offset(r_sym))
++	    {
++	      symval.set_output_value(
++		  target->plt_address_for_local(object, r_sym));
++	      psymval = &symval;
++	    }
+ 	}
+     }
+   else
+@@ -9936,7 +10427,7 @@ uint64_t
+ Target_arm<big_endian>::do_dynsym_value(const Symbol* gsym) const
+ {
+   gold_assert(gsym->is_from_dynobj() && gsym->has_plt_offset());
+-  return this->plt_section()->address() + gsym->plt_offset();
++  return this->plt_address_for_global(gsym);
+ }
+ 
+ // Map platform-specific relocs to real relocs
+@@ -11083,8 +11574,7 @@ Target_arm<big_endian>::scan_reloc_for_stub(
+       if (gsym->use_plt_offset(Scan::get_reference_flags(r_type)))
+ 	{
+ 	  // This uses a PLT, change the symbol value.
+-	  symval.set_output_value(this->plt_section()->address()
+-				  + gsym->plt_offset());
++	  symval.set_output_value(this->plt_address_for_global(gsym));
+ 	  psymval = &symval;
+ 	  target_is_thumb = false;
+ 	}
+@@ -12187,8 +12677,13 @@ class Target_arm_nacl : public Target_arm<big_endian>
+ 
+  protected:
+   virtual Output_data_plt_arm<big_endian>*
+-  do_make_data_plt(Layout* layout, Output_data_space* got_plt)
+-  { return new Output_data_plt_arm_nacl<big_endian>(layout, got_plt); }
++  do_make_data_plt(
++		   Layout* layout,
++		   Arm_output_data_got<big_endian>* got,
++		   Output_data_space* got_plt,
++		   Output_data_space* got_irelative)
++  { return new Output_data_plt_arm_nacl<big_endian>(
++      layout, got, got_plt, got_irelative); }
+ 
+  private:
+   static const Target::Target_info arm_nacl_info;
+@@ -12225,8 +12720,12 @@ template<bool big_endian>
+ class Output_data_plt_arm_nacl : public Output_data_plt_arm<big_endian>
+ {
+  public:
+-  Output_data_plt_arm_nacl(Layout* layout, Output_data_space* got_plt)
+-    : Output_data_plt_arm<big_endian>(layout, 16, got_plt)
++  Output_data_plt_arm_nacl(
++      Layout* layout,
++      Arm_output_data_got<big_endian>* got,
++      Output_data_space* got_plt,
++      Output_data_space* got_irelative)
++    : Output_data_plt_arm<big_endian>(layout, 16, got, got_plt, got_irelative)
+   { }
+ 
+  protected:
+diff --git a/gold/output.h b/gold/output.h
+index ba0cdaa..599c2b7 100644
+--- a/gold/output.h
++++ b/gold/output.h
+@@ -1714,6 +1714,17 @@ class Output_data_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>
+ 				    address, true, true, false, false));
+   }
+ 
++  void
++  add_local_relative(Sized_relobj<size, big_endian>* relobj,
++		     unsigned int local_sym_index, unsigned int type,
++		     Output_data* od, unsigned int shndx, Address address,
++		     bool use_plt_offset)
++  {
++    this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx,
++				    address, true, true, false,
++				    use_plt_offset));
++  }
++
+   // Add a local relocation which does not use a symbol for the relocation,
+   // but which gets its addend from a symbol.
+ 
+-- 
+2.7.0
+
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 72/73] syslinux: Set LD to avoid using build host ld
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (70 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 71/73] binutils: Fix gold linking errors due to unresolved R_ARM_MOVW_ABS_NC Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-17 11:36 ` [PATCH 73/73] glib-2.0: Fix locale location on musl Khem Raj
  2016-01-18 21:39 ` [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

base ld is used during link phase and since its x86 so it
works mostly, however it can cause problems depending upon
build host. During cross build we should use cross linker
Fixes errors e.g.

ld -shared -m elf_i386 --hash-style=gnu -T
/home/ubuntu/work/oe/openembedded-core/build/tmp-glibc/work/i586-oe-linux/syslinux/6.03-r0/syslinux-6.03/com32/lib/i386/elf.ld
-soname libcom32.c32 -o libcom32.elf zlib/adler32.o zlib/compress.
o zlib/crc32.o zlib/uncompr.o zlib/deflate.o zlib/trees.o zlib/zutil.o
zlib/inflate.o zlib/infback.o zlib/inftrees.o zlib/inffast.o sys/zfile.o
sys/zfopen.o libpng/png.o libpng/pngset.o libpng/pngget.o
libpng/pngrutil.o libpng/pngtrans.o
libpng/pngwutil.o libpng/pngread.o libpng/pngrio.o libpng/pngwio.o
libpng/pngwrite.o libpng/pngrtran.o libpng/pngwtran.o libpng/pngmem.o
libpng/pngerror.o libpng/pngpread.o jpeg/tinyjpeg.o jpeg/jidctflt.o
jpeg/decode1.o jpeg/decode3.o jpe
g/rgb24.o jpeg/bgr24.o jpeg/yuv420p.o jpeg/grey.o jpeg/rgba32.o
jpeg/bgra32.o pci/cfgtype.o pci/scan.o pci/bios.o pci/readb.o
pci/readw.o pci/readl.o pci/writeb.o pci/writew.o pci/writel.o
sys/vesacon_write.o sys/vesaserial_write.o sys/ve
sa/initvesa.o sys/vesa/drawtxt.o sys/vesa/background.o
sys/vesa/alphatbl.o sys/vesa/screencpy.o sys/vesa/fmtpixel.o
sys/vesa/i915resolution.o syslinux/reboot.o syslinux/keyboard.o
syslinux/version.o syslinux/pxe_get_cached.o syslinux/pxe_get_nic.o
syslinux/pxe_dns.o syslinux/video/fontquery.o
syslinux/video/reportmode.o syslinux/addlist.o syslinux/freelist.o
syslinux/memmap.o syslinux/movebits.o syslinux/shuffle.o
syslinux/shuffle_pm.o syslinux/shuffle_rm.o syslinux/bios$oot.o
syslinux/zonelist.o syslinux/dump_mmap.o syslinux/dump_movelist.o
syslinux/run_default.o syslinux/run_command.o syslinux/cleanup.o
syslinux/localboot.o syslinux/runimage.o syslinux/loadfile.o
syslinux/floadfile.o syslinux/zloadfile$o syslinux/load_linux.o
syslinux/initramfs.o syslinux/initramfs_file.o
syslinux/initramfs_loadfile.o syslinux/initramfs_archive.o sys/libansi.o
sys/gpxe.o atexit.o onexit.o abort.o
| ld: zlib/deflate.o: unrecognized relocation (0x2b) in section `.text'
| ld: final link failed: Bad value
| make[4]: *** [libcom32.elf] Error 1

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/syslinux/syslinux_6.03.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-devtools/syslinux/syslinux_6.03.bb b/meta/recipes-devtools/syslinux/syslinux_6.03.bb
index 8534528..51d5474 100644
--- a/meta/recipes-devtools/syslinux/syslinux_6.03.bb
+++ b/meta/recipes-devtools/syslinux/syslinux_6.03.bb
@@ -59,11 +59,11 @@ do_compile() {
 
 	# Rebuild only the installer; keep precompiled bootloaders
 	# as per author's request (doc/distrib.txt)
-	oe_runmake CC="${CC} ${CFLAGS}" LDFLAGS="${LDFLAGS}" firmware="bios" installer
+	oe_runmake CC="${CC} ${CFLAGS}" LD="${LD}" LDFLAGS="${LDFLAGS}" firmware="bios" installer
 }
 
 do_install() {
-	oe_runmake CC="${CC} ${CFLAGS}" install INSTALLROOT="${D}" firmware="bios"
+	oe_runmake CC="${CC} ${CFLAGS}" LD="${LD}" install INSTALLROOT="${D}" firmware="bios"
 
 	install -d ${D}${datadir}/syslinux/
 	install -m 644 ${S}/bios/core/ldlinux.sys ${D}${datadir}/syslinux/
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 73/73] glib-2.0: Fix locale location on musl
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (71 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 72/73] syslinux: Set LD to avoid using build host ld Khem Raj
@ 2016-01-17 11:36 ` Khem Raj
  2016-01-18 21:39 ` [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-17 11:36 UTC (permalink / raw)
  To: openembedded-core

gettext.m4 macro does not detect musl triplets and falls back to
${libdir}/locale

It ends up with lot of packging warning
"files installed but not packaged"

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../{uclibc.patch => uclibc_musl_translation.patch}  | 20 +++++++++++---------
 meta/recipes-core/glib-2.0/glib-2.0_2.46.1.bb        |  2 +-
 meta/recipes-core/glib-2.0/glib.inc                  |  4 ++++
 3 files changed, 16 insertions(+), 10 deletions(-)
 rename meta/recipes-core/glib-2.0/glib-2.0/{uclibc.patch => uclibc_musl_translation.patch} (51%)

diff --git a/meta/recipes-core/glib-2.0/glib-2.0/uclibc.patch b/meta/recipes-core/glib-2.0/glib-2.0/uclibc_musl_translation.patch
similarity index 51%
rename from meta/recipes-core/glib-2.0/glib-2.0/uclibc.patch
rename to meta/recipes-core/glib-2.0/glib-2.0/uclibc_musl_translation.patch
index 2a154fd..7aa6217 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0/uclibc.patch
+++ b/meta/recipes-core/glib-2.0/glib-2.0/uclibc_musl_translation.patch
@@ -5,16 +5,18 @@ based systems therefore lets set DATADIRNAME to "share".
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 Upstream-Status: Pending
-Index: glib-2.38.2/m4macros/glib-gettext.m4
+Index: glib-2.46.1/m4macros/glib-gettext.m4
 ===================================================================
---- glib-2.38.2.orig/m4macros/glib-gettext.m4	2013-11-07 07:29:13.000000000 -0800
-+++ glib-2.38.2/m4macros/glib-gettext.m4	2014-03-15 14:51:54.712135644 -0700
-@@ -239,7 +239,7 @@
- 	      [CATOBJEXT=.mo
-                DATADIRNAME=lib])
- 	    ;;
--	    *-*-openbsd*)
-+	    *-*-openbsd* | *-*-linux-uclibc*)
+--- glib-2.46.1.orig/m4macros/glib-gettext.m4
++++ glib-2.46.1/m4macros/glib-gettext.m4
+@@ -243,6 +243,10 @@ msgstr ""
  	    CATOBJEXT=.mo
              DATADIRNAME=share
  	    ;;
++	    *-*-musl* | *-*-linux-uclibc*)
++	    CATOBJEXT=.gmo
++            DATADIRNAME=share
++	    ;;
+ 	    *)
+ 	    CATOBJEXT=.mo
+             DATADIRNAME=lib
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.46.1.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.46.1.bb
index 04951f4..937ae65 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.46.1.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.46.1.bb
@@ -11,7 +11,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
            file://glib-2.0-configure-readlink.patch \
            file://run-ptest \
            file://ptest-paths.patch \
-           file://uclibc.patch \
+           file://uclibc_musl_translation.patch \
            file://0001-configure.ac-Do-not-use-readlink-when-cross-compilin.patch \
            file://allow-run-media-sdX-drive-mount-if-username-root.patch \
 	   file://0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch \
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index 86f7e0e..66082a2 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -73,6 +73,10 @@ do_install_append () {
 	fi
 }
 
+do_install_append_libc-musl () {
+	rm -f ${D}${libdir}/charset.alias
+}
+
 RDEPENDS_${PN}-ptest += "\
             gnome-desktop-testing \
             tzdata \
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 93+ messages in thread

* Re: [PATCH 19/73] mtools: Fix build with uclibc
  2016-01-17 11:35 ` [PATCH 19/73] mtools: Fix build with uclibc Khem Raj
@ 2016-01-18  7:17   ` Roman Khimov
  2016-01-18 21:51     ` Khem Raj
  0 siblings, 1 reply; 93+ messages in thread
From: Roman Khimov @ 2016-01-18  7:17 UTC (permalink / raw)
  To: openembedded-core

В письме от 17 января 2016 03:35:52 пользователь Khem Raj написал:
> --- a/meta/recipes-devtools/mtools/mtools_4.0.18.bb
> +++ b/meta/recipes-devtools/mtools/mtools_4.0.18.bb
> @@ -5,6 +5,7 @@ SECTION = "optional"
>  LICENSE = "GPLv3"
>  LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
> 
> +DEPENDS += "virtual/libiconv"
> 
>  RDEPENDS_${PN}_libc-glibc = "glibc-gconv-ibm850"
>  RRECOMMENDS_${PN}_libc-glibc = "\
> @@ -35,6 +36,8 @@ inherit autotools texinfo
> 
>  EXTRA_OECONF = "--without-x"
> 
> +LDFLAGS_append_libc-uclibc = " -liconv "
> +
>  BBCLASSEXTEND = "native nativesdk"
> 
>  PACKAGECONFIG ??= ""

I've just checked to see that my mtools bbappend (based on fido) has it solved 
like this:

DEPENDS_class-target += "virtual/libiconv"
export LIBS = "-liconv"
LIBS_class-native = ""

And from what I remember, I had some issue building native package with 
'DEPENDS +='. Although that's an old branch and probably things are different 
now.

Same thing with parted.

-- 
 http://roman.khimov.ru
mailto: roman@khimov.ru
gpg --keyserver hkp://subkeys.pgp.net --recv-keys 0xE5E055C3


^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 22/73] libdrm: Upgrade 2.4.65 -> 2.4.66
  2016-01-17 11:35 ` [PATCH 22/73] libdrm: Upgrade 2.4.65 -> 2.4.66 Khem Raj
@ 2016-01-18 15:40   ` Burton, Ross
  2016-01-18 21:29     ` Khem Raj
  0 siblings, 1 reply; 93+ messages in thread
From: Burton, Ross @ 2016-01-18 15:40 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 783 bytes --]

On 17 January 2016 at 11:35, Khem Raj <raj.khem@gmail.com> wrote:

> Fix test build failures
>

packages/corei7-64-poky-linux/libdrm/libdrm: PKG changed from libdrm2 to
libdrm [default] - may indicate debian renaming failure
packages/corei7-64-poky-linux/libdrm/libdrm: PKGSIZE changed from 56367 to
176551 (+213%)
  * PV changed from "2.4.65" to "2.4.66"
  * FILELIST: added "/usr/bin/random /usr/bin/getversion
/usr/bin/updatedraw /usr/bin/setversion /usr/bin/name_from_fd
/usr/bin/getstats /usr/bin/hash /usr/bin/openclose
/usr/bin/kms-universal-planes /usr/bin/kms-steal-crtc /usr/bin/getclient"

Please remember to run buildhistory-diff :)

This is a simple matter of more binaries being added and overly-restricted
FILES matches, I've fixed locally.

Ross

[-- Attachment #2: Type: text/html, Size: 1522 bytes --]

^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 22/73] libdrm: Upgrade 2.4.65 -> 2.4.66
  2016-01-18 15:40   ` Burton, Ross
@ 2016-01-18 21:29     ` Khem Raj
  0 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-18 21:29 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core


[-- Attachment #1.1: Type: text/plain, Size: 1107 bytes --]

Hi Ross

> On Jan 18, 2016, at 7:40 AM, Burton, Ross <ross.burton@intel.com> wrote:
> 
> 
> On 17 January 2016 at 11:35, Khem Raj <raj.khem@gmail.com <mailto:raj.khem@gmail.com>> wrote:
> Fix test build failures
> 
> packages/corei7-64-poky-linux/libdrm/libdrm: PKG changed from libdrm2 to libdrm [default] - may indicate debian renaming failure
> packages/corei7-64-poky-linux/libdrm/libdrm: PKGSIZE changed from 56367 to 176551 (+213%)
>   * PV changed from "2.4.65" to "2.4.66"
>   * FILELIST: added "/usr/bin/random /usr/bin/getversion /usr/bin/updatedraw /usr/bin/setversion /usr/bin/name_from_fd /usr/bin/getstats /usr/bin/hash /usr/bin/openclose /usr/bin/kms-universal-planes /usr/bin/kms-steal-crtc /usr/bin/getclient"
> 
> Please remember to run buildhistory-diff :)

I think we have a bit relaxed QA checks for nodistro in OE-Core, may be we should tighten it up to make it similar to poky. I will locally add them in my site.conf


> 
> This is a simple matter of more binaries being added and overly-restricted FILES matches, I've fixed locally.
> 

thanks for the help


[-- Attachment #1.2: Type: text/html, Size: 2516 bytes --]

[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 00/73] musl fixes part 3 & 4 combined
  2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
                   ` (72 preceding siblings ...)
  2016-01-17 11:36 ` [PATCH 73/73] glib-2.0: Fix locale location on musl Khem Raj
@ 2016-01-18 21:39 ` Khem Raj
  73 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-18 21:39 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 28238 bytes --]


> On Jan 17, 2016, at 3:36 AM, Khem Raj <raj.khem@gmail.com> wrote:
> 
> 
> This patchset rebases the last pull request on top of latest master
> since lot of recipes went in and the patches wont apply straight
> 
> core-image-weston/core-image-sato/core-image-full-cmdline build for
> all qemu machines work well.
> 
> No regressions seen on glibc based world builds
> 
> Here are some of world build results for qemu (musl)
> 
> http://errors.yoctoproject.org/Errors/Build/11636/
> http://errors.yoctoproject.org/Errors/Build/11637/
> http://errors.yoctoproject.org/Errors/Build/11638/
> 
> more to follow as the run finishes
> 
> One patch is for upgrading uclibc to 1.0.11
> 
> The following changes since commit b3b679d5be86f73d1a06c7230cb00872f0a407b5:
> 

For glibc I see 1 issue on qemuarm which is valgrind and I think Andre wanted to
send a patch to fix it since valgrind won’t work on arm < v7 without patching.
Another issue on ppc kernel is due to 2.26 binutils/gas upgrade, I have sent
and email about that separately besides that all world builds are clean.

uclibc/qemu runs

Building world for qemuarm/uclibc...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11654/
Building world for qemuarm64/uclibc...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11655/
Building world for qemux86/uclibc...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11657/
Building world for qemux86-64/uclibc...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11658/
Building world for qemumips/uclibc...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11660/
Building world for qemuppc/uclibc...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11661/


musl/qemu world builds


---------------------------------------------------------------------
Building world for qemuarm/musl ...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11636/
---------------------------------------------------------------------
Building world for qemuarm64/musl ...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11637/
---------------------------------------------------------------------
Building world for qemux86/musl ...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11638/
---------------------------------------------------------------------
Building world for qemux86-64/musl ...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11640/
---------------------------------------------------------------------
Building world for qemumips/musl ...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11641/
---------------------------------------------------------------------
Building world for qemuppc/musl ...
Your entry can be found here: http://errors.yoctoproject.org/Errors/Build/11645/

>  openssh: update to 7.1p2 (2016-01-15 15:44:51 +0000)
> 
> are available in the git repository at:
> 
>  git://github.com/kraj/openembedded-core kraj/musl-fixes
>  https://github.com/kraj/openembedded-core/tree/kraj/musl-fixes
> 
> Khem Raj (72):
>  powertop: Include right headers for timval struct
>  blktrace: Include <sys/types.h for dev_t
>  ppp: Fix build with musl
>  tcp-wrappers: Fix build with musl
>  fts: Add recipe
>  connman: include config.h for HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR
>  libcgroup: Add dependency on fts when building on musl
>  linux-libc-headers: Port patches for linux-headers for musl
>  xserver-xorg: Fix build with musl
>  gdk-pixbuf: Fix latent build  issue exposed by musl
>  argp-standalone: Add recipe
>  gnutls: Link with libargp on musl and depend on argp-standalone
>  util-linux: Fix ptest builds on musl
>  elfutils: Fix build with uclibc/musl
>  systemd: Update and fix build with uclibc
>  packagegroup-self-hosted.bb: Move glibc-gconv-ibm850 to glibc only
>    case
>  guile: Fix build with uclibc
>  gnutls: Link with libuargp on uclibc
>  mtools: Fix build with uclibc
>  parted: Fix build with uclibc
>  net-tools: Link with libintl on uclibc
>  libdrm: Upgrade 2.4.65 -> 2.4.66
>  directfb: Fix build with musl
>  gzip: Fix build with musl
>  watchdog: Fix build with musl
>  xinetd: Fix build with musl
>  dpkg: Add musleabi to known architectures
>  puzzles: Zero'ise structs before use
>  apt: Add support for building for musl targets
>  libunwind: backtrace APIs are glibc specific
>  babeltrace: Add missing header for MAXNAMLEN define
>  sysklogd: untangle header inclusion maze
>  console-tools: Include sys/types.h for u_char and u_short defs
>  webkitgtk: Fix build with clang/musl
>  rt-tests: Fix build with non-gcc compilers
>  tar: Fix build for musl based targets
>  pax: Fix build with musl
>  iputils: Use member based initialization for mrghdr struct
>  libuser: Fix build when secure getenv is not there
>  iproute2: Fix build with musl
>  irda-utils: Fix header inclusions
>  nspr: Drop older glibc code
>  chkconfig: Avoid using caddr_t
>  tcf-agent: Implement canonicalize_file_name() for musl as well
>  bsd-headers,musl: Add recipe for bsd missing features
>  nfs-utils: Disable tcp-wrappers for musl
>  portmap: Point to tirpc headers and libraries on musl
>  systemd: Skip parsing on musl based targets
>  libsolv: Update to 0.6.17+
>  db: Use cross libtool
>  kexec-tools: Define _GNU_SOURCE for getting loff_t definition
>  pcmciautils: Fix parallel build and include sys/types.h
>  btrfs-tools: Disable backtrace on musl
>  apmd: Fix build with musl
>  nss: Undefine HAVE_SYS_CDEFS_H
>  dosfstools: Correct cross-compile CFLAGS and fix build with musl
>  fts: Fix linker hash-style option
>  musl: Create ld.so as a relative symlink
>  bsd-headers: Package cdefs.h
>  guile: Fix build with musl
>  unfs3: Depend on libtirpc when building on musl
>  uclibc: Update to 1.0.11
>  acpid: Fix build on musl
>  grub: Backport fix for largefile detection/use
>  console-tools: Fix header inclusion when not using glibc
>  gpgme: Define __error_t_defined on musl
>  mdadm: Fix build with musl
>  eglinfo: Fix build on raspberrypi
>  puzzles: Silence warning on arm with clang
>  binutils: Fix gold linking errors due to unresolved R_ARM_MOVW_ABS_NC
>  syslinux: Set LD to avoid using build host ld
>  glib-2.0: Fix locale location on musl
> 
> Ross Burton (1):
>  oprofile: fix build with musl
> 
> meta/recipes-bsp/acpid/acpid.inc                   |    2 +
> ...1-Define-isfdtype-if-libc-doesn-t-have-it.patch |   62 +
> ...-config.h-from-builddir-instead-of-srcdir.patch |   51 +
> meta/recipes-bsp/apmd/apmd/wexitcode.patch         |   26 +
> meta/recipes-bsp/apmd/apmd_3.2.2-15.bb             |    1 +
> ...ct-_llseek-code-and-require-long-filesyst.patch |   80 +
> meta/recipes-bsp/grub/grub-efi_2.00.bb             |    2 +
> ...-mfpmath-sse-as-well-when-SSE-is-disabled.patch |   46 +
> ...1-grub.d-10_linux.in-add-oe-s-kernel-name.patch |   56 +
> meta/recipes-bsp/grub/grub2.inc                    |    1 +
> meta/recipes-bsp/grub/grub_2.00.bb                 |    2 +
> meta/recipes-bsp/grub/grub_git.bb                  |   13 +-
> .../0001-fix-a-parallel-building-issue.patch       |   18 +-
> .../pcmciautils-018/lex_sys_types.patch            |   21 +
> meta/recipes-bsp/pcmciautils/pcmciautils_018.bb    |    1 +
> .../0003-Fix-header-inclusions-for-musl.patch      |   79 +-
> .../iproute2/iproute2/iproute2-4.3.0-musl.patch    |   97 +
> .../iproute2/iproute2_4.3.0.bb                     |    1 +
> .../irda-utils/irda-utils-0.9.18/musl.patch        |   29 +
> .../irda-utils/irda-utils_0.9.18.bb                |    1 +
> .../nfs-utils/nfs-utils_1.3.3.bb                   |    1 +
> meta/recipes-connectivity/portmap/portmap_6.0.bb   |    4 +
> .../ppp/ppp/0001-Fix-build-with-musl.patch         |  163 +
> meta/recipes-connectivity/ppp/ppp_2.4.7.bb         |    3 +
> meta/recipes-core/bsd-headers/bsd-headers.bb       |   27 +
> .../bsd-headers/bsd-headers/sys-cdefs.h            |   26 +
> .../bsd-headers/bsd-headers/sys-queue.h            |  846 +++
> .../bsd-headers/bsd-headers/sys-tree.h             |  761 +++
> .../0001-Cover-the-else-with-__GLIBC__.patch       |   51 +
> ...clude-sys-types.h-for-u_char-and-u_short-.patch |   44 +
> .../console-tools/console-tools_0.3.2.bb           |    4 +
> meta/recipes-core/fts/fts.bb                       |   45 +
> .../fts/fts/fts-header-correctness.patch           |   25 +
> meta/recipes-core/fts/fts/fts-uclibc.patch         |   50 +
> meta/recipes-core/fts/fts/gcc5.patch               | 1368 +++++
> meta/recipes-core/fts/fts/remove_cdefs.patch       |   69 +
> meta/recipes-core/fts/fts/stdint.patch             |   15 +
> ...{uclibc.patch => uclibc_musl_translation.patch} |   20 +-
> meta/recipes-core/glib-2.0/glib-2.0_2.46.1.bb      |    2 +-
> meta/recipes-core/glib-2.0/glib.inc                |    4 +
> .../libcgroup/libcgroup/musl-decls-compat.patch    |  235 +
> meta/recipes-core/libcgroup/libcgroup_0.41.bb      |    4 +
> ...dynamic-linker-a-relative-symlink-to-libc.patch |   34 +
> meta/recipes-core/musl/musl_git.bb                 |    4 +-
> .../packagegroups/packagegroup-self-hosted.bb      |    2 +-
> .../systemd/0001-define-exp10-if-missing.patch     |    4 +-
> ...r-getty-to-agetty-in-console-setup-system.patch |    4 +-
> ...pper-instead-of-looking-for-relative-opti.patch |   61 +
> ...v-when-secure-versions-are-not-available.patch} |   21 +-
> ...c-Change-the-default-device-timeout-to-2.patch} |    4 +-
> ...-install-dependency-links-at-install-tim.patch} |    6 +-
> ...eck-for-additional-features-that-uclibc-.patch} |   12 +-
> ...n-Use-execvpe-only-when-libc-supports-it.patch} |    4 +-
> ...unimplemented-_SC_PHYS_PAGES-system-conf.patch} |    4 +-
> ...010-implment-systemd-sysv-install-for-OE.patch} |    4 +-
> ...es-Build-conditionally-when-HAVE_MYHOSTN.patch} |    6 +-
> ...patch => 0012-rules-whitelist-hd-devices.patch} |    4 +-
> ...or-add-support-for-executing-scripts-und.patch} |    4 +-
> ...-Make-root-s-home-directory-configurable.patch} |   14 +-
> ...015-systemd-user-avoid-using-system-auth.patch} |    4 +-
> ...vert-rules-remove-firmware-loading-rules.patch} |    4 +-
> ...remove-userspace-firmware-loading-suppor.patch} |   16 +-
> ...sing.h-for-getting-secure_getenv-definiti.patch |   25 +
> ...il-don-t-fail-if-libc-doesn-t-support-IDN.patch |   34 +
> meta/recipes-core/systemd/systemd_228.bb           |   50 +-
> meta/recipes-core/uclibc/uclibc-git.inc            |    5 +-
> .../uclibc-git/0003-Add-argp-implementation.patch  | 5811 --------------------
> .../util-linux/uuid-test-error-api.patch           |   92 +
> meta/recipes-core/util-linux/util-linux_2.27.1.bb  |    1 +
> meta/recipes-devtools/apt/apt.inc                  |    1 +
> ....mak-musl-based-systems-can-generate-shar.patch |   29 +
> meta/recipes-devtools/apt/apt_1.0.10.1.bb          |    3 +-
> meta/recipes-devtools/binutils/binutils-2.25.1.inc |    1 +
> ...h-adds-IFUNC-support-for-arm-gold-backend.patch | 1004 ++++
> ...001-btrfs-corrupt-blocks-Include-limits.h.patch |   34 +
> .../btrfs-tools/btrfs-tools_4.3.1.bb               |    3 +
> .../0001-mkfs.fat-fix-incorrect-int-type.patch     |   46 +
> .../dosfstools/dosfstools/largefile.patch          |   19 +
> .../dosfstools/dosfstools_3.0.28.bb                |    7 +-
> ...0006-add-musleabi-to-known-target-tripets.patch |   42 +
> meta/recipes-devtools/dpkg/dpkg_1.18.2.bb          |    3 +-
> ...de-alternatives-for-glibc-assumptions-hel.patch | 1161 ++++
> .../elfutils/elfutils-0.164/aarch64_uio.patch      |   47 +
> .../elfutils/elfutils-0.164/shadow.patch           |   23 +
> .../elfutils/elfutils-0.164/uclibc-support.patch   |  129 +
> .../elfutils/elfutils/mempcpy.patch                |   24 -
> meta/recipes-devtools/elfutils/elfutils_0.148.bb   |    1 -
> meta/recipes-devtools/elfutils/elfutils_0.164.bb   |   13 +-
> ...guile-Check-for-strtol_l-during-configure.patch |   56 +
> .../guile/files/remove_strcase_l_funcs.patch       |   38 +
> meta/recipes-devtools/guile/guile_2.0.11.bb        |   13 +
> meta/recipes-devtools/mtools/mtools_4.0.18.bb      |    3 +
> meta/recipes-devtools/syslinux/syslinux_6.03.bb    |    4 +-
> ...nonicalize_file_name-is-specific-to-glibc.patch |   46 +
> meta/recipes-devtools/tcf-agent/tcf-agent_git.bb   |    1 +
> meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb   |    8 +-
> .../chkconfig/chkconfig/replace_caddr_t.patch      |   33 +
> .../recipes-extended/chkconfig/chkconfig_1.3.58.bb |    4 +-
> meta/recipes-extended/gzip/gzip.inc                |    7 +
> .../files/0001-Fix-header-inclusion-for-musl.patch |   92 +
> .../0001-Intialize-struct-elements-by-name.patch   |   52 +
> meta/recipes-extended/iputils/iputils_s20151218.bb |    2 +
> meta/recipes-extended/libsolv/libsolv_git.bb       |    4 +-
> .../libuser/libuser/0001-Check-for-issetugid.patch |   62 +
> .../libuser/0002-remove-unused-execinfo.h.patch    |   27 +
> meta/recipes-extended/libuser/libuser_0.62.bb      |    4 +-
> .../0001-Define-_POSIX_C_SOURCE-if-undefined.patch |   59 +
> meta/recipes-extended/mdadm/mdadm_3.3.4.bb         |    2 +-
> .../net-tools/net-tools/musl-fixes.patch           |  100 +
> .../net-tools/net-tools_1.60-26.bb                 |    3 +-
> meta/recipes-extended/parted/parted_3.2.bb         |    3 +-
> .../pax/pax/0001-Fix-build-with-musl.patch         | 1287 +++++
> .../pax/0001-use-strtoll-instead-of-strtoq.patch   |   33 +
> meta/recipes-extended/pax/pax_3.4.bb               |   10 +
> .../sysklogd/files/0001-Fix-build-with-musl.patch  |  132 +
> meta/recipes-extended/sysklogd/sysklogd.inc        |    1 +
> meta/recipes-extended/tar/tar/musl_dirent.patch    |   19 +
> meta/recipes-extended/tar/tar_1.28.bb              |    6 +
> .../tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch |   31 +
> .../tcp-wrappers/tcp-wrappers_7.6.bb               |    4 +
> ...d-issues-found-with-non-glibc-C-libraries.patch |   99 +
> meta/recipes-extended/watchdog/watchdog_5.14.bb    |    8 +-
> ...se-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch |  100 +
> meta/recipes-extended/xinetd/xinetd_2.3.15.bb      |    5 +
> .../gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch      |   63 +
> meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb |    1 +
> meta/recipes-graphics/directfb/directfb.inc        |    3 +
> .../directfb/directfb/compar_fn_t.patch            |   62 +
> .../directfb/directfb/union-sigval.patch           |   19 +
> .../directfb/use-PTHREAD_MUTEX_RECURSIVE.patch     |  116 +
> ...tests-kms-steal-crtc-Include-sys-select.h.patch |   33 +
> .../recipes-graphics/drm/libdrm/installtests.patch |   24 +-
> .../drm/{libdrm_2.4.65.bb => libdrm_2.4.66.bb}     |    8 +-
> meta/recipes-graphics/eglinfo/eglinfo.inc          |    4 +-
> ...GING_INCDIR-to-searchpath-for-egl-headers.patch |   34 +
> .../xserver-xorg/musl-arm-inb-outb.patch           |   18 +
> .../xorg-xserver/xserver-xorg_1.18.0.bb            |    4 +-
> ...-include-sys-types.h-for-dev_t-definition.patch |   30 +
> meta/recipes-kernel/blktrace/blktrace_git.bb       |    4 +-
> .../0001-vmcore-dmesg-Define-_GNU_SOURCE.patch     |   31 +
> meta/recipes-kernel/kexec/kexec-tools_2.0.11.bb    |    1 +
> ...mpat.h-fix-some-issues-arising-from-in6.h.patch |   82 +
> ...t.h-prevent-redefinition-of-struct-ethhdr.patch |   59 +
> ...remove-inclusion-of-sysinfo.h-in-kernel.h.patch |   32 +
> .../linux-libc-headers/linux-libc-headers_4.1.bb   |    5 +
> ...Include-sys-param.h-for-MAXNAMLEN-definti.patch |   29 +
> meta/recipes-kernel/lttng/babeltrace_1.3.1.bb      |    5 +-
> meta/recipes-kernel/oprofile/oprofile.inc          |    2 +
> meta/recipes-kernel/oprofile/oprofile/musl.patch   |   46 +
> ...0001-include-rquired-headers-for-typedefs.patch |   47 +
> meta/recipes-kernel/powertop/powertop_2.8.bb       |    4 +-
> ...t-CC-AR-variable-only-if-it-doesn-t-have-.patch |   30 +
> meta/recipes-rt/rt-tests/rt-tests_0.96.bb          |    3 +-
> ...1-palisade-Fix-warnings-with-clang-on-arm.patch |   72 +
> ...mpiler-errors-about-uninitialized-use-of-.patch |   32 +
> meta/recipes-sato/puzzles/puzzles_git.bb           |    2 +
> ...nable-backtrace-on-linux-when-using-glibc.patch |   39 +
> ...x-build-with-non-glibc-libraries-on-linux.patch |   61 +
> meta/recipes-sato/webkit/webkitgtk/clang.patch     |   25 +
> meta/recipes-sato/webkit/webkitgtk_2.10.4.bb       |    3 +
> .../argp-standalone/argp-standalone_1.3.bb         |   28 +
> .../files/0001-throw-in-funcdef.patch              |   84 +
> .../argp-standalone/files/0002-isprint.patch       |   51 +
> meta/recipes-support/db/db_5.3.28.bb               |    1 +
> meta/recipes-support/db/db_6.0.30.bb               |    1 +
> meta/recipes-support/gnutls/gnutls.inc             |    5 +-
> meta/recipes-support/gpgme/gpgme_1.5.4.bb          |    1 +
> ...-backtrace-Use-only-with-glibc-and-uclibc.patch |   45 +
> meta/recipes-support/libunwind/libunwind_1.1.bb    |    1 +
> ...001-Remove-the-check-for-LINUX-glibc-case.patch |   35 +
> meta/recipes-support/nspr/nspr_4.11.bb             |    9 +
> meta/recipes-support/nss/nss_3.19.2.bb             |    4 +
> 172 files changed, 10817 insertions(+), 6019 deletions(-)
> create mode 100644 meta/recipes-bsp/acpid/acpid/0001-Define-isfdtype-if-libc-doesn-t-have-it.patch
> create mode 100644 meta/recipes-bsp/acpid/acpid/0001-Use-config.h-from-builddir-instead-of-srcdir.patch
> create mode 100644 meta/recipes-bsp/apmd/apmd/wexitcode.patch
> create mode 100644 meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch
> create mode 100644 meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch
> create mode 100644 meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch
> create mode 100644 meta/recipes-bsp/pcmciautils/pcmciautils-018/lex_sys_types.patch
> create mode 100644 meta/recipes-connectivity/iproute2/iproute2/iproute2-4.3.0-musl.patch
> create mode 100644 meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/musl.patch
> create mode 100644 meta/recipes-connectivity/ppp/ppp/0001-Fix-build-with-musl.patch
> create mode 100644 meta/recipes-core/bsd-headers/bsd-headers.bb
> create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-cdefs.h
> create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-queue.h
> create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-tree.h
> create mode 100644 meta/recipes-core/console-tools/console-tools-0.3.2/0001-Cover-the-else-with-__GLIBC__.patch
> create mode 100644 meta/recipes-core/console-tools/console-tools-0.3.2/0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch
> create mode 100644 meta/recipes-core/fts/fts.bb
> create mode 100644 meta/recipes-core/fts/fts/fts-header-correctness.patch
> create mode 100644 meta/recipes-core/fts/fts/fts-uclibc.patch
> create mode 100644 meta/recipes-core/fts/fts/gcc5.patch
> create mode 100644 meta/recipes-core/fts/fts/remove_cdefs.patch
> create mode 100644 meta/recipes-core/fts/fts/stdint.patch
> rename meta/recipes-core/glib-2.0/glib-2.0/{uclibc.patch => uclibc_musl_translation.patch} (51%)
> create mode 100644 meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch
> create mode 100644 meta/recipes-core/musl/files/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
> create mode 100644 meta/recipes-core/systemd/systemd/0003-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch
> rename meta/recipes-core/systemd/systemd/{0003-Use-getenv-when-secure-versions-are-not-available.patch => 0004-Use-getenv-when-secure-versions-are-not-available.patch} (56%)
> rename meta/recipes-core/systemd/systemd/{0004-core-device.c-Change-the-default-device-timeout-to-2.patch => 0005-core-device.c-Change-the-default-device-timeout-to-2.patch} (88%)
> rename meta/recipes-core/systemd/systemd/{0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch => 0006-binfmt-Don-t-install-dependency-links-at-install-tim.patch} (92%)
> rename meta/recipes-core/systemd/systemd/{0006-configure-Check-for-additional-features-that-uclibc-.patch => 0007-configure-Check-for-additional-features-that-uclibc-.patch} (72%)
> rename meta/recipes-core/systemd/systemd/{0007-nspawn-Use-execvpe-only-when-libc-supports-it.patch => 0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch} (89%)
> rename meta/recipes-core/systemd/systemd/{0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch => 0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch} (90%)
> rename meta/recipes-core/systemd/systemd/{0009-implment-systemd-sysv-install-for-OE.patch => 0010-implment-systemd-sysv-install-for-OE.patch} (91%)
> rename meta/recipes-core/systemd/systemd/{0010-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch => 0011-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch} (83%)
> rename meta/recipes-core/systemd/systemd/{0011-rules-whitelist-hd-devices.patch => 0012-rules-whitelist-hd-devices.patch} (91%)
> rename meta/recipes-core/systemd/systemd/{0012-sysv-generator-add-support-for-executing-scripts-und.patch => 0013-sysv-generator-add-support-for-executing-scripts-und.patch} (98%)
> rename meta/recipes-core/systemd/systemd/{0013-Make-root-s-home-directory-configurable.patch => 0014-Make-root-s-home-directory-configurable.patch} (95%)
> rename meta/recipes-core/systemd/systemd/{0014-systemd-user-avoid-using-system-auth.patch => 0015-systemd-user-avoid-using-system-auth.patch} (87%)
> rename meta/recipes-core/systemd/systemd/{0015-Revert-rules-remove-firmware-loading-rules.patch => 0016-Revert-rules-remove-firmware-loading-rules.patch} (84%)
> rename meta/recipes-core/systemd/systemd/{0016-Revert-udev-remove-userspace-firmware-loading-suppor.patch => 0017-Revert-udev-remove-userspace-firmware-loading-suppor.patch} (96%)
> create mode 100644 meta/recipes-core/systemd/systemd/0018-include-missing.h-for-getting-secure_getenv-definiti.patch
> create mode 100644 meta/recipes-core/systemd/systemd/0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch
> delete mode 100644 meta/recipes-core/uclibc/uclibc-git/0003-Add-argp-implementation.patch
> create mode 100644 meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch
> create mode 100644 meta/recipes-devtools/apt/apt/0001-environment.mak-musl-based-systems-can-generate-shar.patch
> create mode 100644 meta/recipes-devtools/binutils/binutils/0016-This-patch-adds-IFUNC-support-for-arm-gold-backend.patch
> create mode 100644 meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-corrupt-blocks-Include-limits.h.patch
> create mode 100644 meta/recipes-devtools/dosfstools/dosfstools/0001-mkfs.fat-fix-incorrect-int-type.patch
> create mode 100644 meta/recipes-devtools/dosfstools/dosfstools/largefile.patch
> create mode 100644 meta/recipes-devtools/dpkg/dpkg/0006-add-musleabi-to-known-target-tripets.patch
> create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
> create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/aarch64_uio.patch
> create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/shadow.patch
> create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.164/uclibc-support.patch
> delete mode 100644 meta/recipes-devtools/elfutils/elfutils/mempcpy.patch
> create mode 100644 meta/recipes-devtools/guile/files/0001-libguile-Check-for-strtol_l-during-configure.patch
> create mode 100644 meta/recipes-devtools/guile/files/remove_strcase_l_funcs.patch
> create mode 100644 meta/recipes-devtools/tcf-agent/tcf-agent/0001-canonicalize_file_name-is-specific-to-glibc.patch
> create mode 100644 meta/recipes-extended/chkconfig/chkconfig/replace_caddr_t.patch
> create mode 100644 meta/recipes-extended/iputils/files/0001-Fix-header-inclusion-for-musl.patch
> create mode 100644 meta/recipes-extended/iputils/files/0001-Intialize-struct-elements-by-name.patch
> create mode 100644 meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch
> create mode 100644 meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch
> create mode 100644 meta/recipes-extended/mdadm/files/0001-Define-_POSIX_C_SOURCE-if-undefined.patch
> create mode 100644 meta/recipes-extended/net-tools/net-tools/musl-fixes.patch
> create mode 100644 meta/recipes-extended/pax/pax/0001-Fix-build-with-musl.patch
> create mode 100644 meta/recipes-extended/pax/pax/0001-use-strtoll-instead-of-strtoq.patch
> create mode 100644 meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch
> create mode 100644 meta/recipes-extended/tar/tar/musl_dirent.patch
> create mode 100644 meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch
> create mode 100644 meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch
> create mode 100644 meta/recipes-extended/xinetd/xinetd/0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch
> create mode 100644 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch
> create mode 100644 meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
> create mode 100644 meta/recipes-graphics/directfb/directfb/union-sigval.patch
> create mode 100644 meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
> create mode 100644 meta/recipes-graphics/drm/libdrm/0001-tests-kms-steal-crtc-Include-sys-select.h.patch
> rename meta/recipes-graphics/drm/{libdrm_2.4.65.bb => libdrm_2.4.66.bb} (86%)
> create mode 100644 meta/recipes-graphics/eglinfo/files/0001-Add-STAGING_INCDIR-to-searchpath-for-egl-headers.patch
> create mode 100644 meta/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch
> create mode 100644 meta/recipes-kernel/blktrace/blktrace/0001-include-sys-types.h-for-dev_t-definition.patch
> create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0001-vmcore-dmesg-Define-_GNU_SOURCE.patch
> create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch
> create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch
> create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch
> create mode 100644 meta/recipes-kernel/lttng/babeltrace/0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch
> create mode 100644 meta/recipes-kernel/oprofile/oprofile/musl.patch
> create mode 100644 meta/recipes-kernel/powertop/powertop/0001-include-rquired-headers-for-typedefs.patch
> create mode 100644 meta/recipes-rt/rt-tests/files/0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch
> create mode 100644 meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch
> create mode 100644 meta/recipes-sato/puzzles/files/0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch
> create mode 100644 meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
> create mode 100644 meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch
> create mode 100644 meta/recipes-sato/webkit/webkitgtk/clang.patch
> create mode 100644 meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
> create mode 100644 meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch
> create mode 100644 meta/recipes-support/argp-standalone/files/0002-isprint.patch
> create mode 100644 meta/recipes-support/libunwind/libunwind-1.1/0001-backtrace-Use-only-with-glibc-and-uclibc.patch
> create mode 100644 meta/recipes-support/nspr/nspr/0001-Remove-the-check-for-LINUX-glibc-case.patch
> 
> --
> 2.7.0
> 


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 19/73] mtools: Fix build with uclibc
  2016-01-18  7:17   ` Roman Khimov
@ 2016-01-18 21:51     ` Khem Raj
  2016-01-19  6:17       ` Roman Khimov
  0 siblings, 1 reply; 93+ messages in thread
From: Khem Raj @ 2016-01-18 21:51 UTC (permalink / raw)
  To: Roman Khimov; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1961 bytes --]

Hi Roman

> On Jan 17, 2016, at 11:17 PM, Roman Khimov <roman@khimov.ru> wrote:
> 
> В письме от 17 января 2016 03:35:52 пользователь Khem Raj написал:
>> --- a/meta/recipes-devtools/mtools/mtools_4.0.18.bb
>> +++ b/meta/recipes-devtools/mtools/mtools_4.0.18.bb
>> @@ -5,6 +5,7 @@ SECTION = "optional"
>> LICENSE = "GPLv3"
>> LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
>> 
>> +DEPENDS += "virtual/libiconv"
>> 
>> RDEPENDS_${PN}_libc-glibc = "glibc-gconv-ibm850"
>> RRECOMMENDS_${PN}_libc-glibc = "\
>> @@ -35,6 +36,8 @@ inherit autotools texinfo
>> 
>> EXTRA_OECONF = "--without-x"
>> 
>> +LDFLAGS_append_libc-uclibc = " -liconv "
>> +
>> BBCLASSEXTEND = "native nativesdk"
>> 
>> PACKAGECONFIG ??= ""
> 
> I've just checked to see that my mtools bbappend (based on fido) has it solved
> like this:
> 
> DEPENDS_class-target += "virtual/libiconv"
> export LIBS = "-liconv"
> LIBS_class-native = “"

Both are doing same thing in the end. if LIBS is altered we inject the compiler flags
same happens via LDFLAGS except that if we use LDFLAGS then we can utilize overrides
at recipe level and they are automatically exported into component Make systems.

LIBS is supposed to be computed during configure if one was to use libs approach
then USERLDLIBS is safer.

> 
> And from what I remember, I had some issue building native package with
> 'DEPENDS +='. Although that's an old branch and probably things are different
> now.

I guess what you might have seen is that there is no provider for libiconv-native
which is already fixed by
https://github.com/kraj/openembedded-core/commit/a5e6f5939c0ee4280eabd7cfc01131052040bc81

if it was something else. Please report with more details.

> 
> Same thing with parted.
> 
> --
> http://roman.khimov.ru
> mailto: roman@khimov.ru
> gpg --keyserver hkp://subkeys.pgp.net --recv-keys 0xE5E055C3


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 19/73] mtools: Fix build with uclibc
  2016-01-18 21:51     ` Khem Raj
@ 2016-01-19  6:17       ` Roman Khimov
  2016-01-19 15:00         ` Khem Raj
  0 siblings, 1 reply; 93+ messages in thread
From: Roman Khimov @ 2016-01-19  6:17 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 804 bytes --]

В письме от 18 января 2016 13:51:36 пользователь Khem Raj написал:
> > And from what I remember, I had some issue building native package with
> > 'DEPENDS +='. Although that's an old branch and probably things are
> > different now.
> 
> I guess what you might have seen is that there is no provider for
> libiconv-native which is already fixed by
> https://github.com/kraj/openembedded-core/commit/a5e6f5939c0ee4280eabd7cfc01
> 131052040bc81
> 
> if it was something else. Please report with more details.

True, it was something like that. If that's already fixed, then everything is 
perfect. Will this kind of patches go to jethro?

-- 
 http://roman.khimov.ru
mailto: roman@khimov.ru
gpg --keyserver hkp://subkeys.pgp.net --recv-keys 0xE5E055C3

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 19/73] mtools: Fix build with uclibc
  2016-01-19  6:17       ` Roman Khimov
@ 2016-01-19 15:00         ` Khem Raj
  0 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-19 15:00 UTC (permalink / raw)
  To: roman; +Cc: Patches and discussions about the oe-core layer

On Mon, Jan 18, 2016 at 10:17 PM, Roman Khimov <roman@khimov.ru> wrote:
> В письме от 18 января 2016 13:51:36 пользователь Khem Raj написал:
>> > And from what I remember, I had some issue building native package with
>> > 'DEPENDS +='. Although that's an old branch and probably things are
>> > different now.
>>
>> I guess what you might have seen is that there is no provider for
>> libiconv-native which is already fixed by
>> https://github.com/kraj/openembedded-core/commit/a5e6f5939c0ee4280eabd7cfc01
>> 131052040bc81
>>
>> if it was something else. Please report with more details.
>
> True, it was something like that. If that's already fixed, then everything is
> perfect. Will this kind of patches go to jethro?

Not all of this series but this one in particular can go in. Send a
request for backport and let Robert know.

>
> --
>  http://roman.khimov.ru
> mailto: roman@khimov.ru
> gpg --keyserver hkp://subkeys.pgp.net --recv-keys 0xE5E055C3


^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 14/73] elfutils: Fix build with uclibc/musl
  2016-01-17 11:35 ` [PATCH 14/73] elfutils: Fix build with uclibc/musl Khem Raj
@ 2016-01-22 12:26   ` Burton, Ross
  2016-01-22 17:01     ` Khem Raj
  0 siblings, 1 reply; 93+ messages in thread
From: Burton, Ross @ 2016-01-22 12:26 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

On 17 January 2016 at 11:35, Khem Raj <raj.khem@gmail.com> wrote:

> Remove mempcpy patch its already in uclibc now
> refresh libargp patch to match latest elfutils
>
> Add ALLOW_EMPTY for musl
>
> core-image-cmdline-full asks for elfutils package to be added to package
> it has all eu-* tools but we dont build them on musl. nevertheless lets
> satisfy the dependency so image can build for musl
>
> Build libdw,libasm,libebl along with libelf
>
> enhance the musl portability patch to compile every other library
> except the eu-* tools
>
> Fix build on aarch64/musl issues
>
> Header inclusion ends up with duplicate definitions of iovec struct
> since uclibc defines the same in usersapce, we have been depending upong
> including the kernel header on aarch64, using sys/uio.h is the right
> approach
>
> Fix x86 build warning seen on musl
>

The new patches are missing their Upstream-Status tags.

Ross

[-- Attachment #2: Type: text/html, Size: 1437 bytes --]

^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 65/73] grub: Backport fix for largefile detection/use
  2016-01-17 11:36 ` [PATCH 65/73] grub: Backport fix for largefile detection/use Khem Raj
@ 2016-01-22 12:32   ` Burton, Ross
  2016-01-22 16:58     ` Khem Raj
  0 siblings, 1 reply; 93+ messages in thread
From: Burton, Ross @ 2016-01-22 12:32 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

On 17 January 2016 at 11:36, Khem Raj <raj.khem@gmail.com> wrote:

> +++ b/meta/recipes-bsp/grub
> /files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch
> @@ -0,0 +1,80 @@
> +From 3bac4caa2bc64db313aaee54fffb90383e118517 Mon Sep 17 00:00:00 2001
> +From: Felix Janda <felix.janda@posteo.de>
> +Date: Thu, 22 Jan 2015 19:54:36 +0100
> +Subject: [PATCH] Remove direct _llseek code and require long filesystem
> libc.
> +
> +---
> +Upstream-Status: Backport
>

Missing Signed-off-by.

Ross

[-- Attachment #2: Type: text/html, Size: 1005 bytes --]

^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 15/73] systemd: Update and fix build with uclibc
  2016-01-17 11:35 ` [PATCH 15/73] systemd: Update and fix build with uclibc Khem Raj
@ 2016-01-22 12:34   ` Burton, Ross
  2016-01-22 16:29     ` Khem Raj
  0 siblings, 1 reply; 93+ messages in thread
From: Burton, Ross @ 2016-01-22 12:34 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

On 17 January 2016 at 11:35, Khem Raj <raj.khem@gmail.com> wrote:

>  create mode 100644 meta/recipes-core/systemd/systemd
> /0018-include-missing.h-for-getting-secure_getenv-definiti.patch
>  create mode 100644 meta/recipes-core/systemd/systemd
> /0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch
>

These are missing Upstream-Status.

Ross

[-- Attachment #2: Type: text/html, Size: 863 bytes --]

^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 54/73] btrfs-tools: Disable backtrace on musl
  2016-01-17 11:36 ` [PATCH 54/73] btrfs-tools: Disable backtrace on musl Khem Raj
@ 2016-01-22 12:39   ` Burton, Ross
  2016-01-22 16:29     ` Khem Raj
  0 siblings, 1 reply; 93+ messages in thread
From: Burton, Ross @ 2016-01-22 12:39 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 833 bytes --]

On 17 January 2016 at 11:36, Khem Raj <raj.khem@gmail.com> wrote:

> musl does not support backtrace APIs
> include limit.h for PATH_MAX definition
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>

Since the rebase to btrfs-tools 4.4 this fails to patch:

NOTE: Applying patch '0001-btrfs-corrupt-blocks-Include-limits.h.patch'
(../meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-corrupt-blocks-Include-limits.h.patch)
ERROR: Command Error: exit status: 1  Output:
Applying patch 0001-btrfs-corrupt-blocks-Include-limits.h.patch
patching file btrfs-corrupt-block.c
Hunk #1 FAILED at 21.
1 out of 1 hunk FAILED -- rejects in file btrfs-corrupt-block.c
Patch 0001-btrfs-corrupt-blocks-Include-limits.h.patch can be
reverse-applied

Presumably 4.4 accepted these patches and this can be dropped?

Ross

[-- Attachment #2: Type: text/html, Size: 1370 bytes --]

^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 51/73] db: Use cross libtool
  2016-01-17 11:36 ` [PATCH 51/73] db: Use cross libtool Khem Raj
@ 2016-01-22 12:41   ` Burton, Ross
  2016-01-22 17:08     ` Khem Raj
  0 siblings, 1 reply; 93+ messages in thread
From: Burton, Ross @ 2016-01-22 12:41 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1923 bytes --]

On 17 January 2016 at 11:36, Khem Raj <raj.khem@gmail.com> wrote:

> db is not reconfigured like usual autotools based components so it
> generates its own libtool, and this libtool is not equipped to do cross
> builds, e.g. when building using clang on musl, it misdirects linker to
> use libstdc++.so from build host instead of target, the reason being it
> does not understand sysroot.
>
> Use cross libtool instead to build the target versions
>
> Fixes errors like below
>
> | libtool: link: arm-oe-linux-musleabi-ranlib .libs/libdb-6.0.a
> |
>
> /a/builder/mnt/build-oe/tmp-musl/sysroots/x86_64-linux/usr/bin/arm-oe-linux-musleabi/arm-oe-linux-musleabi-ld:
> error: /usr/lib/libstdc++.so: incompatible target


This fails to build on the autobuilder in poky-lsb configurations (which
turns on securityflags.inc):

/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/sysroots/qemux86/usr/lib/libc_nonshared.a(elf-init.oS):
In function `__libc_csu_init':
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/work/i586-poky-linux/glibc/2.22-r0/git/csu/elf-init.c:87:
undefined reference to `__init_array_start'
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/sysroots/x86_64-linux/usr/libexec/i586-poky-linux/gcc/i586-poky-linux/5.3.0/ld:
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/sysroots/qemux86/usr/lib/libc_nonshared.a(elf-init.oS):
relocation R_386_GOTOFF against undefined hidden symbol
`__init_array_start' can not be used when making a shared object
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/sysroots/x86_64-linux/usr/libexec/i586-poky-linux/gcc/i586-poky-linux/5.3.0/ld:
final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:884: recipe for target 'libdb_cxx-6.0.la' failed

Ross

[-- Attachment #2: Type: text/html, Size: 2442 bytes --]

^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 64/73] acpid: Fix build on musl
  2016-01-17 11:36 ` [PATCH 64/73] acpid: Fix build on musl Khem Raj
@ 2016-01-22 12:43   ` Burton, Ross
  2016-01-22 16:28     ` Khem Raj
  0 siblings, 1 reply; 93+ messages in thread
From: Burton, Ross @ 2016-01-22 12:43 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 872 bytes --]

On 17 January 2016 at 11:36, Khem Raj <raj.khem@gmail.com> wrote:

> implement isfdtype() if libc does not provide it
>
> Fix build when S != B
>
> use top_builddir instead of top_srcdir
>

This and Maxin's upgrade are conflicting:

NOTE: Applying patch '0001-Define-isfdtype-if-libc-doesn-t-have-it.patch'
(../meta/recipes-bsp/acpid/acpid/0001-Define-isfdtype-if-libc-doesn-t-have-it.patch)
ERROR: Command Error: exit status: 1  Output:
Applying patch 0001-Define-isfdtype-if-libc-doesn-t-have-it.patch
patching file configure.ac
Hunk #1 FAILED at 41.
1 out of 1 hunk FAILED -- rejects in file configure.ac
patching file sock.c
Hunk #1 succeeded at 61 with fuzz 2 (offset 11 lines).
Patch 0001-Define-isfdtype-if-libc-doesn-t-have-it.patch does not apply
(enforce with -f)

Can you see if anything else is required beyond Maxin's upgrade?

Ross

[-- Attachment #2: Type: text/html, Size: 1564 bytes --]

^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 64/73] acpid: Fix build on musl
  2016-01-22 12:43   ` Burton, Ross
@ 2016-01-22 16:28     ` Khem Raj
  0 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-22 16:28 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 22, 2016 at 4:43 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 17 January 2016 at 11:36, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> implement isfdtype() if libc does not provide it
>>
>> Fix build when S != B
>>
>> use top_builddir instead of top_srcdir
>
>
> This and Maxin's upgrade are conflicting:
>
> NOTE: Applying patch '0001-Define-isfdtype-if-libc-doesn-t-have-it.patch'
> (../meta/recipes-bsp/acpid/acpid/0001-Define-isfdtype-if-libc-doesn-t-have-it.patch)
> ERROR: Command Error: exit status: 1  Output:
> Applying patch 0001-Define-isfdtype-if-libc-doesn-t-have-it.patch
> patching file configure.ac
> Hunk #1 FAILED at 41.
> 1 out of 1 hunk FAILED -- rejects in file configure.ac
> patching file sock.c
> Hunk #1 succeeded at 61 with fuzz 2 (offset 11 lines).
> Patch 0001-Define-isfdtype-if-libc-doesn-t-have-it.patch does not apply
> (enforce with -f)
>
> Can you see if anything else is required beyond Maxin's upgrade?

This whole patch can be dropped.

>
> Ross


^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 54/73] btrfs-tools: Disable backtrace on musl
  2016-01-22 12:39   ` Burton, Ross
@ 2016-01-22 16:29     ` Khem Raj
  0 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-22 16:29 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 22, 2016 at 4:39 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 17 January 2016 at 11:36, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> musl does not support backtrace APIs
>> include limit.h for PATH_MAX definition
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>
>
> Since the rebase to btrfs-tools 4.4 this fails to patch:
>
> NOTE: Applying patch '0001-btrfs-corrupt-blocks-Include-limits.h.patch'
> (../meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-corrupt-blocks-Include-limits.h.patch)
> ERROR: Command Error: exit status: 1  Output:
> Applying patch 0001-btrfs-corrupt-blocks-Include-limits.h.patch
> patching file btrfs-corrupt-block.c
> Hunk #1 FAILED at 21.
> 1 out of 1 hunk FAILED -- rejects in file btrfs-corrupt-block.c
> Patch 0001-btrfs-corrupt-blocks-Include-limits.h.patch can be
> reverse-applied
>
> Presumably 4.4 accepted these patches and this can be dropped?

Patch part is in upstream so can be dropped however there is a recipe
change which is still needed

>
> Ross


^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 15/73] systemd: Update and fix build with uclibc
  2016-01-22 12:34   ` Burton, Ross
@ 2016-01-22 16:29     ` Khem Raj
  0 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-22 16:29 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 22, 2016 at 4:34 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 17 January 2016 at 11:35, Khem Raj <raj.khem@gmail.com> wrote:
>>
>>  create mode 100644
>> meta/recipes-core/systemd/systemd/0018-include-missing.h-for-getting-secure_getenv-definiti.patch
>>  create mode 100644
>> meta/recipes-core/systemd/systemd/0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch
>
>
> These are missing Upstream-Status.

Drop this patch from this series. I will submit it separately.

>
> Ross


^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 65/73] grub: Backport fix for largefile detection/use
  2016-01-22 12:32   ` Burton, Ross
@ 2016-01-22 16:58     ` Khem Raj
  0 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-22 16:58 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 22, 2016 at 4:32 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 17 January 2016 at 11:36, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> +++
>> b/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch
>> @@ -0,0 +1,80 @@
>> +From 3bac4caa2bc64db313aaee54fffb90383e118517 Mon Sep 17 00:00:00 2001
>> +From: Felix Janda <felix.janda@posteo.de>
>> +Date: Thu, 22 Jan 2015 19:54:36 +0100
>> +Subject: [PATCH] Remove direct _llseek code and require long filesystem
>> libc.
>> +
>> +---
>> +Upstream-Status: Backport
>
>
> Missing Signed-off-by.

updated

https://github.com/kraj/openembedded-core/commit/35006da299d2f8c1f45fec6d89d9ae15bf9ca8a6

>
> Ross


^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 14/73] elfutils: Fix build with uclibc/musl
  2016-01-22 12:26   ` Burton, Ross
@ 2016-01-22 17:01     ` Khem Raj
  0 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-22 17:01 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 22, 2016 at 4:26 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 17 January 2016 at 11:35, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> Remove mempcpy patch its already in uclibc now
>> refresh libargp patch to match latest elfutils
>>
>> Add ALLOW_EMPTY for musl
>>
>> core-image-cmdline-full asks for elfutils package to be added to package
>> it has all eu-* tools but we dont build them on musl. nevertheless lets
>> satisfy the dependency so image can build for musl
>>
>> Build libdw,libasm,libebl along with libelf
>>
>> enhance the musl portability patch to compile every other library
>> except the eu-* tools
>>
>> Fix build on aarch64/musl issues
>>
>> Header inclusion ends up with duplicate definitions of iovec struct
>> since uclibc defines the same in usersapce, we have been depending upong
>> including the kernel header on aarch64, using sys/uio.h is the right
>> approach
>>
>> Fix x86 build warning seen on musl
>
>
> The new patches are missing their Upstream-Status tags.
>

updated
https://github.com/kraj/openembedded-core/commit/df09f6aac44253dbf6a313a588f877206264ea64

> Ross


^ permalink raw reply	[flat|nested] 93+ messages in thread

* Re: [PATCH 51/73] db: Use cross libtool
  2016-01-22 12:41   ` Burton, Ross
@ 2016-01-22 17:08     ` Khem Raj
  0 siblings, 0 replies; 93+ messages in thread
From: Khem Raj @ 2016-01-22 17:08 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 22, 2016 at 4:41 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 17 January 2016 at 11:36, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> db is not reconfigured like usual autotools based components so it
>> generates its own libtool, and this libtool is not equipped to do cross
>> builds, e.g. when building using clang on musl, it misdirects linker to
>> use libstdc++.so from build host instead of target, the reason being it
>> does not understand sysroot.
>>
>> Use cross libtool instead to build the target versions
>>
>> Fixes errors like below
>>
>> | libtool: link: arm-oe-linux-musleabi-ranlib .libs/libdb-6.0.a
>> |
>>
>> /a/builder/mnt/build-oe/tmp-musl/sysroots/x86_64-linux/usr/bin/arm-oe-linux-musleabi/arm-oe-linux-musleabi-ld:
>> error: /usr/lib/libstdc++.so: incompatible target
>
>
> This fails to build on the autobuilder in poky-lsb configurations (which
> turns on securityflags.inc):
>
> /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/sysroots/qemux86/usr/lib/libc_nonshared.a(elf-init.oS):
> In function `__libc_csu_init':
> /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/work/i586-poky-linux/glibc/2.22-r0/git/csu/elf-init.c:87:
> undefined reference to `__init_array_start'
> /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/sysroots/x86_64-linux/usr/libexec/i586-poky-linux/gcc/i586-poky-linux/5.3.0/ld:
> /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/sysroots/qemux86/usr/lib/libc_nonshared.a(elf-init.oS):
> relocation R_386_GOTOFF against undefined hidden symbol `__init_array_start'

You can drop this one from this patch set I will submit it another
time after finding the cause and fix.
I need to reproduce it locally here. I think the issue might be that
the makefiles are calling linker directly which works
in common cases but not when -pie is used. Do you have full errors log
somewhere to look into ?

> can not be used when making a shared object
> /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world-lsb/build/build/tmp/sysroots/x86_64-linux/usr/libexec/i586-poky-linux/gcc/i586-poky-linux/5.3.0/ld:
> final link failed: Bad value
> collect2: error: ld returned 1 exit status
> Makefile:884: recipe for target 'libdb_cxx-6.0.la' failed
>
> Ross


^ permalink raw reply	[flat|nested] 93+ messages in thread

end of thread, other threads:[~2016-01-22 17:09 UTC | newest]

Thread overview: 93+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-17 11:36 [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj
2016-01-17 11:35 ` [PATCH 01/73] powertop: Include right headers for timval struct Khem Raj
2016-01-17 11:35 ` [PATCH 02/73] blktrace: Include <sys/types.h for dev_t Khem Raj
2016-01-17 11:35 ` [PATCH 03/73] ppp: Fix build with musl Khem Raj
2016-01-17 11:35 ` [PATCH 04/73] tcp-wrappers: " Khem Raj
2016-01-17 11:35 ` [PATCH 05/73] fts: Add recipe Khem Raj
2016-01-17 11:35 ` [PATCH 06/73] connman: include config.h for HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR Khem Raj
2016-01-17 11:35 ` [PATCH 07/73] libcgroup: Add dependency on fts when building on musl Khem Raj
2016-01-17 11:35 ` [PATCH 08/73] linux-libc-headers: Port patches for linux-headers for musl Khem Raj
2016-01-17 11:35 ` [PATCH 09/73] xserver-xorg: Fix build with musl Khem Raj
2016-01-17 11:35 ` [PATCH 10/73] gdk-pixbuf: Fix latent build issue exposed by musl Khem Raj
2016-01-17 11:35 ` [PATCH 11/73] argp-standalone: Add recipe Khem Raj
2016-01-17 11:35 ` [PATCH 12/73] gnutls: Link with libargp on musl and depend on argp-standalone Khem Raj
2016-01-17 11:35 ` [PATCH 13/73] util-linux: Fix ptest builds on musl Khem Raj
2016-01-17 11:35 ` [PATCH 14/73] elfutils: Fix build with uclibc/musl Khem Raj
2016-01-22 12:26   ` Burton, Ross
2016-01-22 17:01     ` Khem Raj
2016-01-17 11:35 ` [PATCH 15/73] systemd: Update and fix build with uclibc Khem Raj
2016-01-22 12:34   ` Burton, Ross
2016-01-22 16:29     ` Khem Raj
2016-01-17 11:35 ` [PATCH 16/73] packagegroup-self-hosted.bb: Move glibc-gconv-ibm850 to glibc only case Khem Raj
2016-01-17 11:35 ` [PATCH 17/73] guile: Fix build with uclibc Khem Raj
2016-01-17 11:35 ` [PATCH 18/73] gnutls: Link with libuargp on uclibc Khem Raj
2016-01-17 11:35 ` [PATCH 19/73] mtools: Fix build with uclibc Khem Raj
2016-01-18  7:17   ` Roman Khimov
2016-01-18 21:51     ` Khem Raj
2016-01-19  6:17       ` Roman Khimov
2016-01-19 15:00         ` Khem Raj
2016-01-17 11:35 ` [PATCH 20/73] parted: " Khem Raj
2016-01-17 11:35 ` [PATCH 21/73] net-tools: Link with libintl on uclibc Khem Raj
2016-01-17 11:35 ` [PATCH 22/73] libdrm: Upgrade 2.4.65 -> 2.4.66 Khem Raj
2016-01-18 15:40   ` Burton, Ross
2016-01-18 21:29     ` Khem Raj
2016-01-17 11:35 ` [PATCH 23/73] directfb: Fix build with musl Khem Raj
2016-01-17 11:35 ` [PATCH 24/73] gzip: " Khem Raj
2016-01-17 11:35 ` [PATCH 25/73] watchdog: " Khem Raj
2016-01-17 11:35 ` [PATCH 26/73] xinetd: " Khem Raj
2016-01-17 11:36 ` [PATCH 27/73] dpkg: Add musleabi to known architectures Khem Raj
2016-01-17 11:36 ` [PATCH 28/73] puzzles: Zero'ise structs before use Khem Raj
2016-01-17 11:36 ` [PATCH 29/73] apt: Add support for building for musl targets Khem Raj
2016-01-17 11:36 ` [PATCH 30/73] libunwind: backtrace APIs are glibc specific Khem Raj
2016-01-17 11:36 ` [PATCH 31/73] babeltrace: Add missing header for MAXNAMLEN define Khem Raj
2016-01-17 11:36 ` [PATCH 32/73] sysklogd: untangle header inclusion maze Khem Raj
2016-01-17 11:36 ` [PATCH 33/73] console-tools: Include sys/types.h for u_char and u_short defs Khem Raj
2016-01-17 11:36 ` [PATCH 34/73] webkitgtk: Fix build with clang/musl Khem Raj
2016-01-17 11:36 ` [PATCH 35/73] rt-tests: Fix build with non-gcc compilers Khem Raj
2016-01-17 11:36 ` [PATCH 36/73] tar: Fix build for musl based targets Khem Raj
2016-01-17 11:36 ` [PATCH 37/73] pax: Fix build with musl Khem Raj
2016-01-17 11:36 ` [PATCH 38/73] iputils: Use member based initialization for mrghdr struct Khem Raj
2016-01-17 11:36 ` [PATCH 39/73] libuser: Fix build when secure getenv is not there Khem Raj
2016-01-17 11:36 ` [PATCH 40/73] iproute2: Fix build with musl Khem Raj
2016-01-17 11:36 ` [PATCH 41/73] irda-utils: Fix header inclusions Khem Raj
2016-01-17 11:36 ` [PATCH 42/73] nspr: Drop older glibc code Khem Raj
2016-01-17 11:36 ` [PATCH 43/73] chkconfig: Avoid using caddr_t Khem Raj
2016-01-17 11:36 ` [PATCH 44/73] tcf-agent: Implement canonicalize_file_name() for musl as well Khem Raj
2016-01-17 11:36 ` [PATCH 45/73] bsd-headers, musl: Add recipe for bsd missing features Khem Raj
2016-01-17 11:36 ` [PATCH 46/73] nfs-utils: Disable tcp-wrappers for musl Khem Raj
2016-01-17 11:36 ` [PATCH 47/73] portmap: Point to tirpc headers and libraries on musl Khem Raj
2016-01-17 11:36 ` [PATCH 48/73] oprofile: fix build with musl Khem Raj
2016-01-17 11:36 ` [PATCH 49/73] systemd: Skip parsing on musl based targets Khem Raj
2016-01-17 11:36 ` [PATCH 50/73] libsolv: Update to 0.6.17+ Khem Raj
2016-01-17 11:36 ` [PATCH 51/73] db: Use cross libtool Khem Raj
2016-01-22 12:41   ` Burton, Ross
2016-01-22 17:08     ` Khem Raj
2016-01-17 11:36 ` [PATCH 52/73] kexec-tools: Define _GNU_SOURCE for getting loff_t definition Khem Raj
2016-01-17 11:36 ` [PATCH 53/73] pcmciautils: Fix parallel build and include sys/types.h Khem Raj
2016-01-17 11:36 ` [PATCH 54/73] btrfs-tools: Disable backtrace on musl Khem Raj
2016-01-22 12:39   ` Burton, Ross
2016-01-22 16:29     ` Khem Raj
2016-01-17 11:36 ` [PATCH 55/73] apmd: Fix build with musl Khem Raj
2016-01-17 11:36 ` [PATCH 56/73] nss: Undefine HAVE_SYS_CDEFS_H Khem Raj
2016-01-17 11:36 ` [PATCH 57/73] dosfstools: Correct cross-compile CFLAGS and fix build with musl Khem Raj
2016-01-17 11:36 ` [PATCH 58/73] fts: Fix linker hash-style option Khem Raj
2016-01-17 11:36 ` [PATCH 59/73] musl: Create ld.so as a relative symlink Khem Raj
2016-01-17 11:36 ` [PATCH 60/73] bsd-headers: Package cdefs.h Khem Raj
2016-01-17 11:36 ` [PATCH 61/73] guile: Fix build with musl Khem Raj
2016-01-17 11:36 ` [PATCH 62/73] unfs3: Depend on libtirpc when building on musl Khem Raj
2016-01-17 11:36 ` [PATCH 63/73] uclibc: Update to 1.0.11 Khem Raj
2016-01-17 11:36 ` [PATCH 64/73] acpid: Fix build on musl Khem Raj
2016-01-22 12:43   ` Burton, Ross
2016-01-22 16:28     ` Khem Raj
2016-01-17 11:36 ` [PATCH 65/73] grub: Backport fix for largefile detection/use Khem Raj
2016-01-22 12:32   ` Burton, Ross
2016-01-22 16:58     ` Khem Raj
2016-01-17 11:36 ` [PATCH 66/73] console-tools: Fix header inclusion when not using glibc Khem Raj
2016-01-17 11:36 ` [PATCH 67/73] gpgme: Define __error_t_defined on musl Khem Raj
2016-01-17 11:36 ` [PATCH 68/73] mdadm: Fix build with musl Khem Raj
2016-01-17 11:36 ` [PATCH 69/73] eglinfo: Fix build on raspberrypi Khem Raj
2016-01-17 11:36 ` [PATCH 70/73] puzzles: Silence warning on arm with clang Khem Raj
2016-01-17 11:36 ` [PATCH 71/73] binutils: Fix gold linking errors due to unresolved R_ARM_MOVW_ABS_NC Khem Raj
2016-01-17 11:36 ` [PATCH 72/73] syslinux: Set LD to avoid using build host ld Khem Raj
2016-01-17 11:36 ` [PATCH 73/73] glib-2.0: Fix locale location on musl Khem Raj
2016-01-18 21:39 ` [PATCH 00/73] musl fixes part 3 & 4 combined Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.