All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] Add musl to OE-Core
@ 2015-12-08  8:12 Khem Raj
  2015-12-08  8:12 ` [PATCH 01/13] gcc: Add support for building musl configuration Khem Raj
                   ` (13 more replies)
  0 siblings, 14 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

This is a mimimal set of changes brought in from meta-musl
to OE-Core, with this set one can build core-image-minimal using musl
by setting

TCLIBC=musl

for all supported architectures, eventually we will bring
more changes to other packages which will enable more complex
image builds and eventually world.

v2: Address review feedback

Khem Raj (13):
  gcc: Add support for building musl configuration
  autoconf: Add musl support
  gdb: Fix build with musl
  mtd-utils: Backport and create patches to support musl
  squashfs-tools: Define FNM_EXTMATCH if not defined
  mtools: Use proper glibc override to add glibc packages to
    recommendations
  musl: Add recipe
  sysvinit: Fix build with musl
  gettext: Delete libintl.h and charset.alias
  busybox: Add config for musl
  openssl: Add musl configuration support
  libpam: Fix build with musl
  attr: Add patch to account for use of internal glibc header

 meta/recipes-connectivity/openssl/openssl.inc      |   4 +-
 .../openssl/openssl/configure-musl-target.patch    |  27 +++
 .../recipes-connectivity/openssl/openssl_1.0.2d.bb |   1 +
 ...user-use-POSIX-getpwent-instead-of-getpwe.patch |  71 ++++++
 meta/recipes-core/busybox/busybox/musl.cfg         |  12 +
 meta/recipes-core/busybox/busybox_1.24.1.bb        |   2 +
 meta/recipes-core/gettext/gettext_0.16.1.bb        |   5 +
 meta/recipes-core/gettext/gettext_0.19.4.bb        |   4 +
 meta/recipes-core/musl/musl.inc                    |  26 ++
 meta/recipes-core/musl/musl_git.bb                 |  58 +++++
 meta/recipes-core/sysvinit/sysvinit/realpath.patch |  78 ++++++
 meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb     |   1 +
 .../autoconf/autoconf/add_musl_config.patch        |  26 ++
 meta/recipes-devtools/autoconf/autoconf_2.69.bb    |   1 +
 meta/recipes-devtools/gcc/gcc-4.9.inc              |   4 +
 .../gcc/gcc-4.9/0067-gcc-musl-support.patch        | 267 +++++++++++++++++++++
 .../gcc/gcc-4.9/0068-musl-dynamic-linker.patch     | 205 ++++++++++++++++
 .../gcc/gcc-4.9/0069-musl-no-fixincludes.patch     |  21 ++
 .../gcc/gcc-4.9/0070-libstdc-musl.patch            |  32 +++
 meta/recipes-devtools/gcc/gcc-5.2.inc              |   4 +
 .../gcc/gcc-5.2/0043-libstdc-musl.patch            |  32 +++
 .../gcc/gcc-5.2/0044-gcc-musl-support.patch        | 267 +++++++++++++++++++++
 .../gcc/gcc-5.2/0045-musl-dynamic-linker.patch     | 198 +++++++++++++++
 .../gcc/gcc-5.2/0046-musl-no-fixincludes.patch     |  22 ++
 meta/recipes-devtools/gdb/gdb.inc                  |   1 +
 ...0001-Use-exported-definitions-of-SIGRTMIN.patch |  54 +++++
 .../mtd/mtd-utils/0001-Fix-build-with-musl.patch   |  53 ++++
 ...ibfec-use-standard-C-type-instead-of-u_lo.patch |  56 +++++
 .../mtd/mtd-utils/010-fix-rpmatch.patch            |  24 ++
 meta/recipes-devtools/mtd/mtd-utils_git.bb         |   4 +
 meta/recipes-devtools/mtools/mtools_4.0.18.bb      |   4 +-
 .../squashfs-tools/squashfs-tools/fix-compat.patch |  63 +++++
 .../squashfs-tools/squashfs-tools_git.bb           |   1 +
 ...upport-for-defining-missing-funcitonality.patch |  68 ++++++
 .../pam/libpam/include_paths_header.patch          |  59 +++++
 meta/recipes-extended/pam/libpam_1.2.1.bb          |   5 +-
 meta/recipes-support/attr/attr_2.4.47.bb           |   4 +-
 .../attr/files/dont-use-decl-macros.patch          |  56 +++++
 38 files changed, 1815 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-connectivity/openssl/openssl/configure-musl-target.patch
 create mode 100644 meta/recipes-core/busybox/busybox/0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch
 create mode 100644 meta/recipes-core/busybox/busybox/musl.cfg
 create mode 100644 meta/recipes-core/musl/musl.inc
 create mode 100644 meta/recipes-core/musl/musl_git.bb
 create mode 100644 meta/recipes-core/sysvinit/sysvinit/realpath.patch
 create mode 100644 meta/recipes-devtools/autoconf/autoconf/add_musl_config.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0067-gcc-musl-support.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0068-musl-dynamic-linker.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0069-musl-no-fixincludes.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0070-libstdc-musl.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0043-libstdc-musl.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0044-gcc-musl-support.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0046-musl-no-fixincludes.patch
 create mode 100644 meta/recipes-devtools/gdb/gdb/0001-Use-exported-definitions-of-SIGRTMIN.patch
 create mode 100644 meta/recipes-devtools/mtd/mtd-utils/0001-Fix-build-with-musl.patch
 create mode 100644 meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch
 create mode 100644 meta/recipes-devtools/mtd/mtd-utils/010-fix-rpmatch.patch
 create mode 100644 meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch
 create mode 100644 meta/recipes-extended/pam/libpam/0001-Add-support-for-defining-missing-funcitonality.patch
 create mode 100644 meta/recipes-extended/pam/libpam/include_paths_header.patch
 create mode 100644 meta/recipes-support/attr/files/dont-use-decl-macros.patch

-- 
2.6.3



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

* [PATCH 01/13] gcc: Add support for building musl configuration
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-08  8:12 ` [PATCH 02/13] autoconf: Add musl support Khem Raj
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

Most of these patches are already in gcc 6.0/master but we still need them for
older gcc, they have been tested in meta-musl for quite some time

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-4.9.inc              |   4 +
 .../gcc/gcc-4.9/0067-gcc-musl-support.patch        | 267 +++++++++++++++++++++
 .../gcc/gcc-4.9/0068-musl-dynamic-linker.patch     | 205 ++++++++++++++++
 .../gcc/gcc-4.9/0069-musl-no-fixincludes.patch     |  21 ++
 .../gcc/gcc-4.9/0070-libstdc-musl.patch            |  32 +++
 meta/recipes-devtools/gcc/gcc-5.2.inc              |   4 +
 .../gcc/gcc-5.2/0043-libstdc-musl.patch            |  32 +++
 .../gcc/gcc-5.2/0044-gcc-musl-support.patch        | 267 +++++++++++++++++++++
 .../gcc/gcc-5.2/0045-musl-dynamic-linker.patch     | 198 +++++++++++++++
 .../gcc/gcc-5.2/0046-musl-no-fixincludes.patch     |  22 ++
 10 files changed, 1052 insertions(+)
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0067-gcc-musl-support.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0068-musl-dynamic-linker.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0069-musl-no-fixincludes.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0070-libstdc-musl.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0043-libstdc-musl.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0044-gcc-musl-support.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0046-musl-no-fixincludes.patch

diff --git a/meta/recipes-devtools/gcc/gcc-4.9.inc b/meta/recipes-devtools/gcc/gcc-4.9.inc
index 6ac3685..a602cd1 100644
--- a/meta/recipes-devtools/gcc/gcc-4.9.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.9.inc
@@ -82,6 +82,10 @@ SRC_URI = "\
     file://0064-handle-target-sysroot-multilib.patch \
     file://0065-gcc-483-universal-initializer-no-warning.patch \
     file://0066-cxxflags-for-build.patch \
+    file://0067-gcc-musl-support.patch \
+    file://0068-musl-dynamic-linker.patch \
+    file://0069-musl-no-fixincludes.patch \
+    file://0070-libstdc-musl.patch \
 "
 SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327"
 SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e"
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0067-gcc-musl-support.patch b/meta/recipes-devtools/gcc/gcc-4.9/0067-gcc-musl-support.patch
new file mode 100644
index 0000000..9a0b5ad
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.9/0067-gcc-musl-support.patch
@@ -0,0 +1,267 @@
+# HG changeset patch
+# Parent e5b4564f249f8634194bdabef4b3057d0e54ee97
+Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
+Upstream-Status: backport [partial]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+
+Index: gcc-4.9.0/gcc/config.gcc
+===================================================================
+--- gcc-4.9.0.orig/gcc/config.gcc	2014-04-22 22:44:17.153567150 -0700
++++ gcc-4.9.0/gcc/config.gcc	2014-04-23 23:54:31.427357051 -0700
+@@ -594,7 +594,7 @@
+ esac
+ 
+ # Common C libraries.
+-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
+ 
+ # 32-bit x86 processors supported by --with-arch=.  Each processor
+ # MUST be separated by exactly one space.
+@@ -719,6 +719,9 @@
+     *-*-*uclibc*)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
+       ;;
++    *-*-*musl*)
++      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
++      ;;
+     *)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
+       ;;
+@@ -2328,6 +2331,11 @@
+ 	    powerpc*-*-linux*paired*)
+ 		tm_file="${tm_file} rs6000/750cl.h" ;;
+ 	esac
++        case ${target} in
++	    *-linux*-musl*)
++		enable_secureplt=yes ;;
++	esac
++
+ 	if test x${enable_secureplt} = xyes; then
+ 		tm_file="rs6000/secureplt.h ${tm_file}"
+ 	fi
+Index: gcc-4.9.0/gcc/config/linux.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/linux.h	2014-01-02 14:23:26.000000000 -0800
++++ gcc-4.9.0/gcc/config/linux.h	2014-04-24 00:11:29.034028895 -0700
+@@ -32,10 +32,12 @@
+ #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
+ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
+ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
++#define OPTION_MUSL   (DEFAULT_LIBC == LIBC_MUSL)
+ #else
+ #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
+ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
+ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
++#define OPTION_MUSL   (linux_libc == LIBC_MUSL)
+ #endif
+ 
+ #define GNU_USER_TARGET_OS_CPP_BUILTINS()			\
+@@ -53,18 +55,21 @@
+    uClibc or Bionic is the default C library and whether
+    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
+ 
+-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3)	\
+-  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4)	\
++  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
+ 
+ #if DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
+ #elif DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
+ #elif DEFAULT_LIBC == LIBC_BIONIC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif /* DEFAULT_LIBC */
+@@ -84,16 +89,16 @@
+ 
+ #define GNU_USER_DYNAMIC_LINKER						\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER,	\
+-			 BIONIC_DYNAMIC_LINKER)
++			 BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ #define GNU_USER_DYNAMIC_LINKER32					\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
+-			 BIONIC_DYNAMIC_LINKER32)
++			 BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64					\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
+-			 BIONIC_DYNAMIC_LINKER64)
++			 BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ #define GNU_USER_DYNAMIC_LINKERX32					\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
+-			 BIONIC_DYNAMIC_LINKERX32)
++			 BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
+ 
+ /* Whether we have Bionic libc runtime */
+ #undef TARGET_HAS_BIONIC
+@@ -127,3 +132,74 @@
+ # define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
+ 
+ #endif
++
++/* musl avoids problematic includes by rearranging the include directories.
++ * Unfortunately, this is mostly duplicated from cppdefault.c */
++#if DEFAULT_LIBC == LIBC_MUSL
++#define INCLUDE_DEFAULTS_MUSL_GPP			\
++    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,		\
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },		\
++    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,		\
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },		\
++    { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,	\
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
++
++#ifdef LOCAL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_LOCAL			\
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },		\
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_LOCAL
++#endif
++
++#ifdef PREFIX_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_PREFIX			\
++    { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_PREFIX
++#endif
++
++#ifdef CROSS_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_CROSS			\
++    { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#ifdef TOOL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_TOOL			\
++    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_TOOL
++#endif
++
++#ifdef NATIVE_SYSTEM_HEADER_DIR
++#define INCLUDE_DEFAULTS_MUSL_NATIVE			\
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 },	\
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_NATIVE
++#endif
++
++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
++# undef INCLUDE_DEFAULTS_MUSL_LOCAL
++# define INCLUDE_DEFAULTS_MUSL_LOCAL
++# undef INCLUDE_DEFAULTS_MUSL_NATIVE
++# define INCLUDE_DEFAULTS_MUSL_NATIVE
++#else
++# undef INCLUDE_DEFAULTS_MUSL_CROSS
++# define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#undef INCLUDE_DEFAULTS
++#define INCLUDE_DEFAULTS				\
++  {							\
++    INCLUDE_DEFAULTS_MUSL_GPP				\
++    INCLUDE_DEFAULTS_MUSL_PREFIX			\
++    INCLUDE_DEFAULTS_MUSL_CROSS				\
++    INCLUDE_DEFAULTS_MUSL_TOOL				\
++    INCLUDE_DEFAULTS_MUSL_NATIVE			\
++    { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 },		\
++    { 0, 0, 0, 0, 0, 0 }				\
++  }
++#endif
+Index: gcc-4.9.0/gcc/config/linux.opt
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/linux.opt	2014-01-02 14:23:26.000000000 -0800
++++ gcc-4.9.0/gcc/config/linux.opt	2014-04-22 22:44:17.280233817 -0700
+@@ -30,3 +30,7 @@
+ muclibc
+ Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
+ Use uClibc C library
++
++mmusl
++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
++Use musl C library
+Index: gcc-4.9.0/gcc/ginclude/stddef.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/ginclude/stddef.h	2014-01-02 14:23:26.000000000 -0800
++++ gcc-4.9.0/gcc/ginclude/stddef.h	2014-04-22 22:44:17.280233817 -0700
+@@ -181,6 +181,7 @@
+ #ifndef _GCC_SIZE_T
+ #ifndef _SIZET_
+ #ifndef __size_t
++#ifndef __DEFINED_size_t /* musl */
+ #define __size_t__	/* BeOS */
+ #define __SIZE_T__	/* Cray Unicos/Mk */
+ #define _SIZE_T
+@@ -197,6 +198,7 @@
+ #define ___int_size_t_h
+ #define _GCC_SIZE_T
+ #define _SIZET_
++#define __DEFINED_size_t /* musl */
+ #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
+   || defined(__FreeBSD_kernel__)
+ /* __size_t is a typedef on FreeBSD 5, must not trash it. */
+@@ -214,6 +216,7 @@
+ typedef long ssize_t;
+ #endif /* __BEOS__ */
+ #endif /* !(defined (__GNUG__) && defined (size_t)) */
++#endif /* __DEFINED_size_t */
+ #endif /* __size_t */
+ #endif /* _SIZET_ */
+ #endif /* _GCC_SIZE_T */
+Index: gcc-4.9.0/gcc/config/rs6000/secureplt.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/rs6000/secureplt.h	2014-01-02 14:23:26.000000000 -0800
++++ gcc-4.9.0/gcc/config/rs6000/secureplt.h	2014-04-23 23:55:15.114024175 -0700
+@@ -18,3 +18,4 @@
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
+Index: gcc-4.9.0/gcc/config/rs6000/sysv4.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/rs6000/sysv4.h	2014-04-23 23:52:13.854023015 -0700
++++ gcc-4.9.0/gcc/config/rs6000/sysv4.h	2014-04-24 00:10:55.550695334 -0700
+@@ -538,6 +538,10 @@
+ #define CC1_SECURE_PLT_DEFAULT_SPEC ""
+ #endif
+ 
++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
++#define LINK_SECURE_PLT_DEFAULT_SPEC ""
++#endif
++
+ /* Pass -G xxx to the compiler.  */
+ #define	CC1_SPEC "%{G*} %(cc1_cpu)" \
+ "%{meabi: %{!mcall-*: -mcall-sysv }} \
+@@ -585,7 +589,8 @@
+ 
+ /* Override the default target of the linker.  */
+ #define	LINK_TARGET_SPEC \
+-  ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
++  ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
++  "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
+ 
+ /* Any specific OS flags.  */
+ #define LINK_OS_SPEC "\
+@@ -894,6 +899,7 @@
+   { "link_os_openbsd",		LINK_OS_OPENBSD_SPEC },			\
+   { "link_os_default",		LINK_OS_DEFAULT_SPEC },			\
+   { "cc1_secure_plt_default",	CC1_SECURE_PLT_DEFAULT_SPEC },		\
++  { "link_secure_plt_default",	LINK_SECURE_PLT_DEFAULT_SPEC },		\
+   { "cpp_os_ads",		CPP_OS_ADS_SPEC },			\
+   { "cpp_os_yellowknife",	CPP_OS_YELLOWKNIFE_SPEC },		\
+   { "cpp_os_mvme",		CPP_OS_MVME_SPEC },			\
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0068-musl-dynamic-linker.patch b/meta/recipes-devtools/gcc/gcc-4.9/0068-musl-dynamic-linker.patch
new file mode 100644
index 0000000..605ac66
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.9/0068-musl-dynamic-linker.patch
@@ -0,0 +1,205 @@
+# HG changeset patch
+# Parent 6738fd6f6fcc2a72f2ba527bda3325642af26885
+Support for arm-linux-musl.
+Upstream-Status: Backport [partial]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+
+Index: gcc-4.9.2/gcc/config/arm/linux-eabi.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/arm/linux-eabi.h
++++ gcc-4.9.2/gcc/config/arm/linux-eabi.h
+@@ -81,6 +81,23 @@
+ #undef TARGET_FIX_V4BX_SPEC
+ #define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
+ 
++/* For ARM musl currently supports four dynamic linkers:
++   - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
++   - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
++   - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
++   - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
++   musl does not support the legacy OABI mode.
++   All the dynamic linkers live in /lib.
++   We default to soft-float, EL. */
++#undef  MUSL_DYNAMIC_LINKER
++#if TARGET_BIG_ENDIAN_DEFAULT
++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
++#else
++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
++#endif
++#define MUSL_DYNAMIC_LINKER \
++  SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
++
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
+    use the GNU/Linux version, not the generic BPABI version.  */
+ #undef  LINK_SPEC
+Index: gcc-4.9.2/libitm/config/arm/hwcap.cc
+===================================================================
+--- gcc-4.9.2.orig/libitm/config/arm/hwcap.cc
++++ gcc-4.9.2/libitm/config/arm/hwcap.cc
+@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
+ 
+ #ifdef __linux__
+ #include <unistd.h>
++#ifdef __GLIBC__
+ #include <sys/fcntl.h>
++#else
++#include <fcntl.h>
++#endif
+ #include <elf.h>
+ 
+ static void __attribute__((constructor))
+Index: gcc-4.9.2/gcc/config/i386/linux.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/i386/linux.h
++++ gcc-4.9.2/gcc/config/i386/linux.h
+@@ -21,3 +21,4 @@ along with GCC; see the file COPYING3.
+ 
+ #define GNU_USER_LINK_EMULATION "elf_i386"
+ #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
++#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-i386.so.1"
+Index: gcc-4.9.2/gcc/config/i386/linux64.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/i386/linux64.h
++++ gcc-4.9.2/gcc/config/i386/linux64.h
+@@ -30,3 +30,8 @@ see the files COPYING3 and COPYING.RUNTI
+ #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
+ #define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
+ #define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
++
++#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-i386.so.1"
++#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-x86_64.so.1"
++#define MUSL_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-musl-x32.so.1"
++
+Index: gcc-4.9.2/gcc/config/mips/linux.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/mips/linux.h
++++ gcc-4.9.2/gcc/config/mips/linux.h
+@@ -23,3 +23,6 @@ along with GCC; see the file COPYING3.
+ #undef UCLIBC_DYNAMIC_LINKER
+ #define UCLIBC_DYNAMIC_LINKER \
+   "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
++
++#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-mips.so.1"
++
+Index: gcc-4.9.2/gcc/config/mips/linux64.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/mips/linux64.h
++++ gcc-4.9.2/gcc/config/mips/linux64.h
+@@ -39,6 +39,11 @@ along with GCC; see the file COPYING3.
+   "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
+ 
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
++
++#define MUSL_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
++
+ #define GNU_USER_DYNAMIC_LINKERN32 \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
+-			 BIONIC_DYNAMIC_LINKERN32)
++			 BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
+Index: gcc-4.9.2/gcc/config/rs6000/linux64.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/rs6000/linux64.h
++++ gcc-4.9.2/gcc/config/rs6000/linux64.h
+@@ -375,17 +375,22 @@ extern int dot_symbols;
+ #endif
+ #define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
+ #define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-powerpc.so.1"
++#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-powerpc64.so.1"
++
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
+ #elif DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER32 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ 
+ #undef  DEFAULT_ASM_ENDIAN
+ #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
+Index: gcc-4.9.2/gcc/config/rs6000/sysv4.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/rs6000/sysv4.h
++++ gcc-4.9.2/gcc/config/rs6000/sysv4.h
+@@ -768,15 +768,19 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
+ 
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
++
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ 
+ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+Index: gcc-4.9.2/libitm/config/linux/x86/tls.h
+===================================================================
+--- gcc-4.9.2.orig/libitm/config/linux/x86/tls.h
++++ gcc-4.9.2/libitm/config/linux/x86/tls.h
+@@ -25,16 +25,19 @@
+ #ifndef LIBITM_X86_TLS_H
+ #define LIBITM_X86_TLS_H 1
+ 
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ /* Use slots in the TCB head rather than __thread lookups.
+    GLIBC has reserved words 10 through 13 for TM.  */
+ #define HAVE_ARCH_GTM_THREAD 1
+ #define HAVE_ARCH_GTM_THREAD_DISP 1
+ #endif
++#endif
+ 
+ #include "config/generic/tls.h"
+ 
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ namespace GTM HIDDEN {
+ 
+ #ifdef __x86_64__
+@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
+ 
+ } // namespace GTM
+ #endif /* >= GLIBC 2.10 */
++#endif
+ 
+ #endif // LIBITM_X86_TLS_H
+Index: gcc-4.9.2/gcc/config/aarch64/aarch64-linux.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/aarch64/aarch64-linux.h
++++ gcc-4.9.2/gcc/config/aarch64/aarch64-linux.h
+@@ -25,6 +25,8 @@
+ 
+ #define CPP_SPEC "%{pthread:-D_REENTRANT}"
+ 
++#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64.so.1"
++
+ #define LINUX_TARGET_LINK_SPEC  "%{h*}		\
+    %{static:-Bstatic}				\
+    %{shared:-shared}				\
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0069-musl-no-fixincludes.patch b/meta/recipes-devtools/gcc/gcc-4.9/0069-musl-no-fixincludes.patch
new file mode 100644
index 0000000..e2b18a4
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.9/0069-musl-no-fixincludes.patch
@@ -0,0 +1,21 @@
+# HG changeset patch
+# Parent 600a8a422ccaf5627ad1f5a138e7398df2b9e9d8
+Get rid of ever-broken fixincludes on musl.
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+
+Index: gcc-4.9-20140316/fixincludes/mkfixinc.sh
+===================================================================
+--- gcc-4.9-20140316.orig/fixincludes/mkfixinc.sh
++++ gcc-4.9-20140316/fixincludes/mkfixinc.sh
+@@ -19,7 +19,8 @@ case $machine in
+     powerpc-*-eabi*    | \
+     powerpc-*-rtems*   | \
+     powerpcle-*-eabisim* | \
+-    powerpcle-*-eabi* )
++    powerpcle-*-eabi* | \
++    *-musl* )
+ 	#  IF there is no include fixing,
+ 	#  THEN create a no-op fixer and exit
+ 	(echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0070-libstdc-musl.patch b/meta/recipes-devtools/gcc/gcc-4.9/0070-libstdc-musl.patch
new file mode 100644
index 0000000..048e481
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.9/0070-libstdc-musl.patch
@@ -0,0 +1,32 @@
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: gcc-4.9-20140316/libstdc++-v3/configure.host
+===================================================================
+--- gcc-4.9-20140316.orig/libstdc++-v3/configure.host	2014-03-26 01:12:19.466008193 -0700
++++ gcc-4.9-20140316/libstdc++-v3/configure.host	2014-03-26 01:43:48.222684357 -0700
+@@ -264,14 +264,24 @@
+     os_include_dir="os/bsd/freebsd"
+     ;;
+   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
++    # check for musl by target
++    case "${host_os}" in
++      *-musl*)
++        os_include_dir="os/generic"
++        ;;
++      *)
+     if [ "$uclibc" = "yes" ]; then
+       os_include_dir="os/uclibc"
+     elif [ "$bionic" = "yes" ]; then
+       os_include_dir="os/bionic"
++    elif [ "$musl" = "yes" ]; then
++      os_include_dir="os/generic"
+     else
+       os_include_dir="os/gnu-linux"
+     fi
+     ;;
++    esac
++    ;;
+   hpux*)
+     os_include_dir="os/hpux"
+     ;;
diff --git a/meta/recipes-devtools/gcc/gcc-5.2.inc b/meta/recipes-devtools/gcc/gcc-5.2.inc
index a6b385a..af9d887 100644
--- a/meta/recipes-devtools/gcc/gcc-5.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-5.2.inc
@@ -74,6 +74,10 @@ SRC_URI = "\
            file://0040-nativesdk-gcc-support.patch \
            file://0041-handle-target-sysroot-multilib.patch \
            file://0042-cxxflags-for-build.patch \
+           file://0043-libstdc-musl.patch \
+           file://0044-gcc-musl-support.patch \
+           file://0045-musl-dynamic-linker.patch \
+           file://0046-musl-no-fixincludes.patch \
           "
 
 BACKPORTS = ""
diff --git a/meta/recipes-devtools/gcc/gcc-5.2/0043-libstdc-musl.patch b/meta/recipes-devtools/gcc/gcc-5.2/0043-libstdc-musl.patch
new file mode 100644
index 0000000..048e481
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-5.2/0043-libstdc-musl.patch
@@ -0,0 +1,32 @@
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: gcc-4.9-20140316/libstdc++-v3/configure.host
+===================================================================
+--- gcc-4.9-20140316.orig/libstdc++-v3/configure.host	2014-03-26 01:12:19.466008193 -0700
++++ gcc-4.9-20140316/libstdc++-v3/configure.host	2014-03-26 01:43:48.222684357 -0700
+@@ -264,14 +264,24 @@
+     os_include_dir="os/bsd/freebsd"
+     ;;
+   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
++    # check for musl by target
++    case "${host_os}" in
++      *-musl*)
++        os_include_dir="os/generic"
++        ;;
++      *)
+     if [ "$uclibc" = "yes" ]; then
+       os_include_dir="os/uclibc"
+     elif [ "$bionic" = "yes" ]; then
+       os_include_dir="os/bionic"
++    elif [ "$musl" = "yes" ]; then
++      os_include_dir="os/generic"
+     else
+       os_include_dir="os/gnu-linux"
+     fi
+     ;;
++    esac
++    ;;
+   hpux*)
+     os_include_dir="os/hpux"
+     ;;
diff --git a/meta/recipes-devtools/gcc/gcc-5.2/0044-gcc-musl-support.patch b/meta/recipes-devtools/gcc/gcc-5.2/0044-gcc-musl-support.patch
new file mode 100644
index 0000000..4d1ab87
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-5.2/0044-gcc-musl-support.patch
@@ -0,0 +1,267 @@
+# HG changeset patch
+# Parent e5b4564f249f8634194bdabef4b3057d0e54ee97
+Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
+
+Upstream-Status: Backport [partial]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: gcc-4.9.0/gcc/config.gcc
+===================================================================
+--- gcc-4.9.0.orig/gcc/config.gcc	2014-04-22 22:44:17.153567150 -0700
++++ gcc-4.9.0/gcc/config.gcc	2014-04-23 23:54:31.427357051 -0700
+@@ -594,7 +594,7 @@
+ esac
+ 
+ # Common C libraries.
+-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
+ 
+ # 32-bit x86 processors supported by --with-arch=.  Each processor
+ # MUST be separated by exactly one space.
+@@ -719,6 +719,9 @@
+     *-*-*uclibc*)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
+       ;;
++    *-*-*musl*)
++      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
++      ;;
+     *)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
+       ;;
+@@ -2328,6 +2331,11 @@
+ 	    powerpc*-*-linux*paired*)
+ 		tm_file="${tm_file} rs6000/750cl.h" ;;
+ 	esac
++        case ${target} in
++	    *-linux*-musl*)
++		enable_secureplt=yes ;;
++	esac
++
+ 	if test x${enable_secureplt} = xyes; then
+ 		tm_file="rs6000/secureplt.h ${tm_file}"
+ 	fi
+Index: gcc-4.9.0/gcc/config/linux.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/linux.h	2014-01-02 14:23:26.000000000 -0800
++++ gcc-4.9.0/gcc/config/linux.h	2014-04-24 00:11:29.034028895 -0700
+@@ -32,10 +32,12 @@
+ #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
+ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
+ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
++#define OPTION_MUSL   (DEFAULT_LIBC == LIBC_MUSL)
+ #else
+ #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
+ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
+ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
++#define OPTION_MUSL   (linux_libc == LIBC_MUSL)
+ #endif
+ 
+ #define GNU_USER_TARGET_OS_CPP_BUILTINS()			\
+@@ -53,18 +55,21 @@
+    uClibc or Bionic is the default C library and whether
+    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
+ 
+-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3)	\
+-  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4)	\
++  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
+ 
+ #if DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
+ #elif DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
+ #elif DEFAULT_LIBC == LIBC_BIONIC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif /* DEFAULT_LIBC */
+@@ -84,16 +89,16 @@
+ 
+ #define GNU_USER_DYNAMIC_LINKER						\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER,	\
+-			 BIONIC_DYNAMIC_LINKER)
++			 BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ #define GNU_USER_DYNAMIC_LINKER32					\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
+-			 BIONIC_DYNAMIC_LINKER32)
++			 BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64					\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
+-			 BIONIC_DYNAMIC_LINKER64)
++			 BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ #define GNU_USER_DYNAMIC_LINKERX32					\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
+-			 BIONIC_DYNAMIC_LINKERX32)
++			 BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
+ 
+ /* Whether we have Bionic libc runtime */
+ #undef TARGET_HAS_BIONIC
+@@ -127,3 +132,74 @@
+ # define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
+ 
+ #endif
++
++/* musl avoids problematic includes by rearranging the include directories.
++ * Unfortunately, this is mostly duplicated from cppdefault.c */
++#if DEFAULT_LIBC == LIBC_MUSL
++#define INCLUDE_DEFAULTS_MUSL_GPP			\
++    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,		\
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },		\
++    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,		\
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },		\
++    { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,	\
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
++
++#ifdef LOCAL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_LOCAL			\
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },		\
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_LOCAL
++#endif
++
++#ifdef PREFIX_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_PREFIX			\
++    { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_PREFIX
++#endif
++
++#ifdef CROSS_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_CROSS			\
++    { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#ifdef TOOL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_TOOL			\
++    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_TOOL
++#endif
++
++#ifdef NATIVE_SYSTEM_HEADER_DIR
++#define INCLUDE_DEFAULTS_MUSL_NATIVE			\
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 },	\
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_NATIVE
++#endif
++
++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
++# undef INCLUDE_DEFAULTS_MUSL_LOCAL
++# define INCLUDE_DEFAULTS_MUSL_LOCAL
++# undef INCLUDE_DEFAULTS_MUSL_NATIVE
++# define INCLUDE_DEFAULTS_MUSL_NATIVE
++#else
++# undef INCLUDE_DEFAULTS_MUSL_CROSS
++# define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#undef INCLUDE_DEFAULTS
++#define INCLUDE_DEFAULTS				\
++  {							\
++    INCLUDE_DEFAULTS_MUSL_GPP				\
++    INCLUDE_DEFAULTS_MUSL_PREFIX			\
++    INCLUDE_DEFAULTS_MUSL_CROSS				\
++    INCLUDE_DEFAULTS_MUSL_TOOL				\
++    INCLUDE_DEFAULTS_MUSL_NATIVE			\
++    { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 },		\
++    { 0, 0, 0, 0, 0, 0 }				\
++  }
++#endif
+Index: gcc-4.9.0/gcc/config/linux.opt
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/linux.opt	2014-01-02 14:23:26.000000000 -0800
++++ gcc-4.9.0/gcc/config/linux.opt	2014-04-22 22:44:17.280233817 -0700
+@@ -30,3 +30,7 @@
+ muclibc
+ Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
+ Use uClibc C library
++
++mmusl
++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
++Use musl C library
+Index: gcc-4.9.0/gcc/ginclude/stddef.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/ginclude/stddef.h	2014-01-02 14:23:26.000000000 -0800
++++ gcc-4.9.0/gcc/ginclude/stddef.h	2014-04-22 22:44:17.280233817 -0700
+@@ -181,6 +181,7 @@
+ #ifndef _GCC_SIZE_T
+ #ifndef _SIZET_
+ #ifndef __size_t
++#ifndef __DEFINED_size_t /* musl */
+ #define __size_t__	/* BeOS */
+ #define __SIZE_T__	/* Cray Unicos/Mk */
+ #define _SIZE_T
+@@ -197,6 +198,7 @@
+ #define ___int_size_t_h
+ #define _GCC_SIZE_T
+ #define _SIZET_
++#define __DEFINED_size_t /* musl */
+ #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
+   || defined(__FreeBSD_kernel__)
+ /* __size_t is a typedef on FreeBSD 5, must not trash it. */
+@@ -214,6 +216,7 @@
+ typedef long ssize_t;
+ #endif /* __BEOS__ */
+ #endif /* !(defined (__GNUG__) && defined (size_t)) */
++#endif /* __DEFINED_size_t */
+ #endif /* __size_t */
+ #endif /* _SIZET_ */
+ #endif /* _GCC_SIZE_T */
+Index: gcc-4.9.0/gcc/config/rs6000/secureplt.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/rs6000/secureplt.h	2014-01-02 14:23:26.000000000 -0800
++++ gcc-4.9.0/gcc/config/rs6000/secureplt.h	2014-04-23 23:55:15.114024175 -0700
+@@ -18,3 +18,4 @@
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
+Index: gcc-4.9.0/gcc/config/rs6000/sysv4.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/rs6000/sysv4.h	2014-04-23 23:52:13.854023015 -0700
++++ gcc-4.9.0/gcc/config/rs6000/sysv4.h	2014-04-24 00:10:55.550695334 -0700
+@@ -538,6 +538,10 @@
+ #define CC1_SECURE_PLT_DEFAULT_SPEC ""
+ #endif
+ 
++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
++#define LINK_SECURE_PLT_DEFAULT_SPEC ""
++#endif
++
+ /* Pass -G xxx to the compiler.  */
+ #define	CC1_SPEC "%{G*} %(cc1_cpu)" \
+ "%{meabi: %{!mcall-*: -mcall-sysv }} \
+@@ -585,7 +589,8 @@
+ 
+ /* Override the default target of the linker.  */
+ #define	LINK_TARGET_SPEC \
+-  ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
++  ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
++  "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
+ 
+ /* Any specific OS flags.  */
+ #define LINK_OS_SPEC "\
+@@ -894,6 +899,7 @@
+   { "link_os_openbsd",		LINK_OS_OPENBSD_SPEC },			\
+   { "link_os_default",		LINK_OS_DEFAULT_SPEC },			\
+   { "cc1_secure_plt_default",	CC1_SECURE_PLT_DEFAULT_SPEC },		\
++  { "link_secure_plt_default",	LINK_SECURE_PLT_DEFAULT_SPEC },		\
+   { "cpp_os_ads",		CPP_OS_ADS_SPEC },			\
+   { "cpp_os_yellowknife",	CPP_OS_YELLOWKNIFE_SPEC },		\
+   { "cpp_os_mvme",		CPP_OS_MVME_SPEC },			\
diff --git a/meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch b/meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch
new file mode 100644
index 0000000..3dadb95
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch
@@ -0,0 +1,198 @@
+# HG changeset patch
+# Parent 6738fd6f6fcc2a72f2ba527bda3325642af26885
+Support for arm-linux-musl.
+
+Upstream-Status: backport [partial]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+
+Index: gcc-5.1.0/gcc/config/arm/linux-eabi.h
+===================================================================
+--- gcc-5.1.0.orig/gcc/config/arm/linux-eabi.h
++++ gcc-5.1.0/gcc/config/arm/linux-eabi.h
+@@ -81,6 +81,23 @@
+ #undef TARGET_FIX_V4BX_SPEC
+ #define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
+ 
++/* For ARM musl currently supports four dynamic linkers:
++   - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
++   - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
++   - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
++   - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
++   musl does not support the legacy OABI mode.
++   All the dynamic linkers live in /lib.
++   We default to soft-float, EL. */
++#undef  MUSL_DYNAMIC_LINKER
++#if TARGET_BIG_ENDIAN_DEFAULT
++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
++#else
++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
++#endif
++#define MUSL_DYNAMIC_LINKER \
++  SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
++
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
+    use the GNU/Linux version, not the generic BPABI version.  */
+ #undef  LINK_SPEC
+Index: gcc-5.1.0/libitm/config/arm/hwcap.cc
+===================================================================
+--- gcc-5.1.0.orig/libitm/config/arm/hwcap.cc
++++ gcc-5.1.0/libitm/config/arm/hwcap.cc
+@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
+ 
+ #ifdef __linux__
+ #include <unistd.h>
++#ifdef __GLIBC__
+ #include <sys/fcntl.h>
++#else
++#include <fcntl.h>
++#endif
+ #include <elf.h>
+ 
+ static void __attribute__((constructor))
+Index: gcc-5.1.0/gcc/config/i386/linux.h
+===================================================================
+--- gcc-5.1.0.orig/gcc/config/i386/linux.h
++++ gcc-5.1.0/gcc/config/i386/linux.h
+@@ -21,3 +21,4 @@ along with GCC; see the file COPYING3.
+ 
+ #define GNU_USER_LINK_EMULATION "elf_i386"
+ #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
++#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-i386.so.1"
+Index: gcc-5.1.0/gcc/config/i386/linux64.h
+===================================================================
+--- gcc-5.1.0.orig/gcc/config/i386/linux64.h
++++ gcc-5.1.0/gcc/config/i386/linux64.h
+@@ -30,3 +30,8 @@ see the files COPYING3 and COPYING.RUNTI
+ #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
+ #define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
+ #define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
++
++#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-i386.so.1"
++#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-x86_64.so.1"
++#define MUSL_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-musl-x32.so.1"
++
+Index: gcc-5.1.0/gcc/config/mips/linux.h
+===================================================================
+--- gcc-5.1.0.orig/gcc/config/mips/linux.h
++++ gcc-5.1.0/gcc/config/mips/linux.h
+@@ -21,6 +21,10 @@ along with GCC; see the file COPYING3.
+ #define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip"
+ #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
+ 
++#define MUSL_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
++
+ #define GLIBC_DYNAMIC_LINKER32 \
+   "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
+ #define GLIBC_DYNAMIC_LINKER64 \
+@@ -40,4 +44,4 @@ along with GCC; see the file COPYING3.
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
+ #define GNU_USER_DYNAMIC_LINKERN32 \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
+-                         BIONIC_DYNAMIC_LINKERN32)
++                         BIONIC_DYNAMIC_LINKERN32,  MUSL_DYNAMIC_LINKERN32)
+Index: gcc-5.1.0/gcc/config/rs6000/linux64.h
+===================================================================
+--- gcc-5.1.0.orig/gcc/config/rs6000/linux64.h
++++ gcc-5.1.0/gcc/config/rs6000/linux64.h
+@@ -365,17 +365,22 @@ extern int dot_symbols;
+ #endif
+ #define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
+ #define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-powerpc.so.1"
++#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-powerpc64.so.1"
++
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
+ #elif DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER32 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ 
+ #undef  DEFAULT_ASM_ENDIAN
+ #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
+Index: gcc-5.1.0/gcc/config/rs6000/sysv4.h
+===================================================================
+--- gcc-5.1.0.orig/gcc/config/rs6000/sysv4.h
++++ gcc-5.1.0/gcc/config/rs6000/sysv4.h
+@@ -769,15 +769,19 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
+ 
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
++
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ 
+ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+Index: gcc-5.1.0/libitm/config/linux/x86/tls.h
+===================================================================
+--- gcc-5.1.0.orig/libitm/config/linux/x86/tls.h
++++ gcc-5.1.0/libitm/config/linux/x86/tls.h
+@@ -25,16 +25,19 @@
+ #ifndef LIBITM_X86_TLS_H
+ #define LIBITM_X86_TLS_H 1
+ 
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ /* Use slots in the TCB head rather than __thread lookups.
+    GLIBC has reserved words 10 through 13 for TM.  */
+ #define HAVE_ARCH_GTM_THREAD 1
+ #define HAVE_ARCH_GTM_THREAD_DISP 1
+ #endif
++#endif
+ 
+ #include "config/generic/tls.h"
+ 
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ namespace GTM HIDDEN {
+ 
+ #ifdef __x86_64__
+@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
+ 
+ } // namespace GTM
+ #endif /* >= GLIBC 2.10 */
++#endif
+ 
+ #endif // LIBITM_X86_TLS_H
+Index: gcc-5.1.0/gcc/config/aarch64/aarch64-linux.h
+===================================================================
+--- gcc-5.1.0.orig/gcc/config/aarch64/aarch64-linux.h
++++ gcc-5.1.0/gcc/config/aarch64/aarch64-linux.h
+@@ -22,6 +22,7 @@
+ #define GCC_AARCH64_LINUX_H
+ 
+ #define GLIBC_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
++#define MUSL_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-musl-aarch64.so.1"
+ 
+ #undef  ASAN_CC1_SPEC
+ #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
diff --git a/meta/recipes-devtools/gcc/gcc-5.2/0046-musl-no-fixincludes.patch b/meta/recipes-devtools/gcc/gcc-5.2/0046-musl-no-fixincludes.patch
new file mode 100644
index 0000000..05fe52f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-5.2/0046-musl-no-fixincludes.patch
@@ -0,0 +1,22 @@
+# HG changeset patch
+# Parent 600a8a422ccaf5627ad1f5a138e7398df2b9e9d8
+Get rid of ever-broken fixincludes on musl.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+
+Index: gcc-4.9-20140316/fixincludes/mkfixinc.sh
+===================================================================
+--- gcc-4.9-20140316.orig/fixincludes/mkfixinc.sh
++++ gcc-4.9-20140316/fixincludes/mkfixinc.sh
+@@ -19,7 +19,8 @@ case $machine in
+     powerpc-*-eabi*    | \
+     powerpc-*-rtems*   | \
+     powerpcle-*-eabisim* | \
+-    powerpcle-*-eabi* )
++    powerpcle-*-eabi* | \
++    *-musl* )
+ 	#  IF there is no include fixing,
+ 	#  THEN create a no-op fixer and exit
+ 	(echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
-- 
2.6.3



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

* [PATCH 02/13] autoconf: Add musl support
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
  2015-12-08  8:12 ` [PATCH 01/13] gcc: Add support for building musl configuration Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-08  8:12 ` [PATCH 03/13] gdb: Fix build with musl Khem Raj
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

Support musl triplets

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../autoconf/autoconf/add_musl_config.patch        | 26 ++++++++++++++++++++++
 meta/recipes-devtools/autoconf/autoconf_2.69.bb    |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 meta/recipes-devtools/autoconf/autoconf/add_musl_config.patch

diff --git a/meta/recipes-devtools/autoconf/autoconf/add_musl_config.patch b/meta/recipes-devtools/autoconf/autoconf/add_musl_config.patch
new file mode 100644
index 0000000..a9094d2
--- /dev/null
+++ b/meta/recipes-devtools/autoconf/autoconf/add_musl_config.patch
@@ -0,0 +1,26 @@
+backport http://git.savannah.gnu.org/cgit/config.git/commit/config.sub?id=062587eaa891396c936555ae51f7e77eeb71a5fe
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Backport
+Index: autoconf-2.69/build-aux/config.sub
+===================================================================
+--- autoconf-2.69.orig/build-aux/config.sub
++++ autoconf-2.69/build-aux/config.sub
+@@ -123,7 +123,7 @@ esac
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+-  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
++  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+   knetbsd*-gnu* | netbsd*-gnu* | \
+   kopensolaris*-gnu* | \
+   storm-chaos* | os2-emx* | rtmk-nova*)
+@@ -1360,7 +1360,7 @@ case $os in
+ 	      | -chorusos* | -chorusrdb* | -cegcc* \
+ 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ 	      | -mingw32* | -linux-gnu* | -linux-android* \
+-	      | -linux-newlib* | -linux-uclibc* \
++	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+ 	      | -uxpv* | -beos* | -mpeix* | -udk* \
+ 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
diff --git a/meta/recipes-devtools/autoconf/autoconf_2.69.bb b/meta/recipes-devtools/autoconf/autoconf_2.69.bb
index 809007f..b9f6883 100644
--- a/meta/recipes-devtools/autoconf/autoconf_2.69.bb
+++ b/meta/recipes-devtools/autoconf/autoconf_2.69.bb
@@ -13,6 +13,7 @@ SRC_URI += "file://autoreconf-include.patch \
             file://remove-usr-local-lib-from-m4.patch \
             file://preferbash.patch \
             file://autotest-automake-result-format.patch \
+            file://add_musl_config.patch \
            "
 
 SRC_URI[md5sum] = "82d05e03b93e45f5a39b828dc9c6c29b"
-- 
2.6.3



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

* [PATCH 03/13] gdb: Fix build with musl
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
  2015-12-08  8:12 ` [PATCH 01/13] gcc: Add support for building musl configuration Khem Raj
  2015-12-08  8:12 ` [PATCH 02/13] autoconf: Add musl support Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-08  8:12 ` [PATCH 04/13] mtd-utils: Backport and create patches to support musl Khem Raj
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

This is a patch that has been submitted upstream as well

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/gdb/gdb.inc                  |  1 +
 ...0001-Use-exported-definitions-of-SIGRTMIN.patch | 54 ++++++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 meta/recipes-devtools/gdb/gdb/0001-Use-exported-definitions-of-SIGRTMIN.patch

diff --git a/meta/recipes-devtools/gdb/gdb.inc b/meta/recipes-devtools/gdb/gdb.inc
index 88c0213..2162cad 100644
--- a/meta/recipes-devtools/gdb/gdb.inc
+++ b/meta/recipes-devtools/gdb/gdb.inc
@@ -5,6 +5,7 @@ inherit gettext
 SRC_URI += "file://0002-Change-order-of-CFLAGS.patch \
             file://0003-Add-support-for-Renesas-SH-sh4-architecture.patch \
             file://fix-detection-of-64-bit-PPC-inferior-in-gdbserver.patch \
+            file://0001-Use-exported-definitions-of-SIGRTMIN.patch \
            "
 #LDFLAGS_append = " -s"
 #export CFLAGS_append=" -L${STAGING_LIBDIR}"
diff --git a/meta/recipes-devtools/gdb/gdb/0001-Use-exported-definitions-of-SIGRTMIN.patch b/meta/recipes-devtools/gdb/gdb/0001-Use-exported-definitions-of-SIGRTMIN.patch
new file mode 100644
index 0000000..5f0c096
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/0001-Use-exported-definitions-of-SIGRTMIN.patch
@@ -0,0 +1,54 @@
+From 2f97e89e9e4e5797d0d973e1d05c1f44c46b4912 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 5 Jun 2015 20:21:38 -0700
+Subject: [PATCH] Use exorted definitions of SIGRTMIN
+
+Define W_STOPCODE if not defined already
+
+__SIGRTMIN is internal to glibc and other libcs e.g. musl
+may not provide them
+
+Fixes
+https://sourceware.org/bugzilla/show_bug.cgi?id=13012
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ gdb/linux-nat.c     | 4 ++--
+ gdb/nat/linux-nat.h | 4 ++++
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
+index 396c30c..50320ee 100644
+--- a/gdb/linux-nat.c
++++ b/gdb/linux-nat.c
+@@ -4856,10 +4856,10 @@ lin_thread_get_thread_signals (sigset_t *set)
+      fortunately they don't change!  */
+ 
+   if (restart == 0)
+-    restart = __SIGRTMIN;
++    restart = SIGRTMIN;
+ 
+   if (cancel == 0)
+-    cancel = __SIGRTMIN + 1;
++    cancel = SIGRTMIN + 1;
+ 
+   sigaddset (set, restart);
+   sigaddset (set, cancel);
+diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h
+index 83a6d91..efbe0fd 100644
+--- a/gdb/nat/linux-nat.h
++++ b/gdb/nat/linux-nat.h
+@@ -25,4 +25,8 @@
+    instead SIGTRAP with bit 7 set.  */
+ #define SYSCALL_SIGTRAP (SIGTRAP | 0x80)
+ 
++#ifndef W_STOPCODE
++#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
++#endif
++
+ #endif /* LINUX_NAT_H */
+-- 
+2.1.4
+
-- 
2.6.3



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

* [PATCH 04/13] mtd-utils: Backport and create patches to support musl
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
                   ` (2 preceding siblings ...)
  2015-12-08  8:12 ` [PATCH 03/13] gdb: Fix build with musl Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-08  8:12 ` [PATCH 05/13] squashfs-tools: Define FNM_EXTMATCH if not defined Khem Raj
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../mtd/mtd-utils/0001-Fix-build-with-musl.patch   | 53 ++++++++++++++++++++
 ...ibfec-use-standard-C-type-instead-of-u_lo.patch | 56 ++++++++++++++++++++++
 .../mtd/mtd-utils/010-fix-rpmatch.patch            | 24 ++++++++++
 meta/recipes-devtools/mtd/mtd-utils_git.bb         |  4 ++
 4 files changed, 137 insertions(+)
 create mode 100644 meta/recipes-devtools/mtd/mtd-utils/0001-Fix-build-with-musl.patch
 create mode 100644 meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch
 create mode 100644 meta/recipes-devtools/mtd/mtd-utils/010-fix-rpmatch.patch

diff --git a/meta/recipes-devtools/mtd/mtd-utils/0001-Fix-build-with-musl.patch b/meta/recipes-devtools/mtd/mtd-utils/0001-Fix-build-with-musl.patch
new file mode 100644
index 0000000..d3699c6
--- /dev/null
+++ b/meta/recipes-devtools/mtd/mtd-utils/0001-Fix-build-with-musl.patch
@@ -0,0 +1,53 @@
+From e16fa28bc57c29923ab60af2ac343da83e1992d8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 6 Oct 2015 23:51:34 +0000
+Subject: [PATCH] Fix build with musl
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ mkfs.jffs2.c  | 44 ++++++++++++++++++++++++++++++++++++++++++--
+ recv_image.c  |  1 -
+ serve_image.c |  1 -
+ 3 files changed, 42 insertions(+), 4 deletions(-)
+
+diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
+index f09c0b2..ed2dc43 100644
+--- a/mkfs.jffs2.c
++++ b/mkfs.jffs2.c
+@@ -72,6 +72,7 @@
+ #include <byteswap.h>
+ #include <crc32.h>
+ #include <inttypes.h>
++#include <limits.h>
+ 
+ #include "rbtree.h"
+ #include "common.h"
+diff --git a/recv_image.c b/recv_image.c
+index 26a8361..0093831 100644
+--- a/recv_image.c
++++ b/recv_image.c
+@@ -4,7 +4,6 @@
+ #define _BSD_SOURCE	/* struct ip_mreq */
+ 
+ #include <errno.h>
+-#include <error.h>
+ #include <stdio.h>
+ #include <netdb.h>
+ #include <stdlib.h>
+diff --git a/serve_image.c b/serve_image.c
+index 38549a1..4f0e946 100644
+--- a/serve_image.c
++++ b/serve_image.c
+@@ -3,7 +3,6 @@
+ 
+ #include <time.h>
+ #include <errno.h>
+-#include <error.h>
+ #include <netdb.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+-- 
+2.6.1
+
diff --git a/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch b/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch
new file mode 100644
index 0000000..46ed956
--- /dev/null
+++ b/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch
@@ -0,0 +1,56 @@
+From 26cc709291fc6c5d2e45b26c602407706d9142df Mon Sep 17 00:00:00 2001
+From: Imre Kaloz <kaloz@openwrt.org>
+Date: Mon, 4 May 2015 15:36:34 +0200
+Subject: [PATCH] mtd-utils: libfec: use standard C type instead of u_long
+
+Fixes compilation on hosts with the musl C library.
+Also drops the unused u_short typedef.
+
+Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+---
+Upstream-Status: Backport
+
+ lib/libfec.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/lib/libfec.c b/lib/libfec.c
+index ff5a127..bf68381 100644
+--- a/lib/libfec.c
++++ b/lib/libfec.c
+@@ -61,8 +61,6 @@ struct timeval {
+ };
+ #define gettimeofday(x, dummy) { (x)->ticks = clock() ; }
+ #define DIFF_T(a,b) (1+ 1000000*(a.ticks - b.ticks) / CLOCKS_PER_SEC )
+-typedef unsigned long u_long ;
+-typedef unsigned short u_short ;
+ #else /* typically, unix systems */
+ #include <sys/time.h>
+ #define DIFF_T(a,b) \
+@@ -75,12 +73,12 @@ typedef unsigned short u_short ;
+ 	t = x.tv_usec + 1000000* (x.tv_sec & 0xff ) ; \
+ 	}
+ #define TOCK(t) \
+-	{ u_long t1 ; TICK(t1) ; \
++	{ unsigned long t1 ; TICK(t1) ; \
+ 	  if (t1 < t) t = 256000000 + t1 - t ; \
+ 	  else t = t1 - t ; \
+ 	  if (t == 0) t = 1 ;}
+ 
+-u_long ticks[10];	/* vars for timekeeping */
++unsigned long ticks[10];	/* vars for timekeeping */
+ #else
+ #define DEB(x)
+ #define DDB(x)
+@@ -625,7 +623,7 @@ init_fec(void)
+ #define FEC_MAGIC	0xFECC0DEC
+ 
+ struct fec_parms {
+-    u_long magic ;
++    unsigned long magic ;
+     int k, n ;		/* parameters of the code */
+     gf *enc_matrix ;
+ } ;
+-- 
+2.6.0
+
diff --git a/meta/recipes-devtools/mtd/mtd-utils/010-fix-rpmatch.patch b/meta/recipes-devtools/mtd/mtd-utils/010-fix-rpmatch.patch
new file mode 100644
index 0000000..7d783e7
--- /dev/null
+++ b/meta/recipes-devtools/mtd/mtd-utils/010-fix-rpmatch.patch
@@ -0,0 +1,24 @@
+Replace rpmatch() usage with checking first character of line
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+--- a/include/common.h
++++ b/include/common.h
+@@ -122,10 +122,12 @@
+ 		}
+ 
+ 		if (strcmp("\n", line) != 0) {
+-			switch (rpmatch(line)) {
+-			case 0: ret = false; break;
+-			case 1: ret = true; break;
+-			case -1:
++			switch (line[0]) {
++			case 'N':
++			case 'n': ret = false; break;
++			case 'Y':
++			case 'y': ret = true; break;
++			default:
+ 				puts("unknown response; please try again");
+ 				continue;
+ 			}
diff --git a/meta/recipes-devtools/mtd/mtd-utils_git.bb b/meta/recipes-devtools/mtd/mtd-utils_git.bb
index 17dca77..bc15ddd 100644
--- a/meta/recipes-devtools/mtd/mtd-utils_git.bb
+++ b/meta/recipes-devtools/mtd/mtd-utils_git.bb
@@ -15,8 +15,12 @@ SRC_URI = "git://git.infradead.org/mtd-utils.git \
            file://fix-armv7-neon-alignment.patch \
            file://0001-hashtable-Remove-duplicate-hashtable_iterator_value-.patch \
            file://mtd-utils-fix-corrupt-cleanmarker-with-flash_erase--j-command.patch \
+           file://0001-Fix-build-with-musl.patch \
+           file://0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch \
 "
 
+SRC_URI_append_libc-musl = " file://010-fix-rpmatch.patch "
+
 S = "${WORKDIR}/git/"
 
 # xattr support creates an additional compile-time dependency on acl because
-- 
2.6.3



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

* [PATCH 05/13] squashfs-tools: Define FNM_EXTMATCH if not defined
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
                   ` (3 preceding siblings ...)
  2015-12-08  8:12 ` [PATCH 04/13] mtd-utils: Backport and create patches to support musl Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-08  8:12 ` [PATCH 06/13] mtools: Use proper glibc override to add glibc packages to recommendations Khem Raj
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

helps compiling when using musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../squashfs-tools/squashfs-tools/fix-compat.patch | 63 ++++++++++++++++++++++
 .../squashfs-tools/squashfs-tools_git.bb           |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch

diff --git a/meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch b/meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch
new file mode 100644
index 0000000..d545146
--- /dev/null
+++ b/meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch
@@ -0,0 +1,63 @@
+Define FNM_EXTMATCH if not defined its glibc specific define
+include missing sys/stat.h for stat* function declarations
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: squashfs-tools/action.c
+===================================================================
+--- squashfs-tools.orig/action.c
++++ squashfs-tools/action.c
+@@ -44,6 +44,10 @@
+ #include "action.h"
+ #include "error.h"
+ 
++#if !defined(FNM_EXTMATCH)
++#define FNM_EXTMATCH 0
++#endif
++
+ /*
+  * code to parse actions
+  */
+Index: squashfs-tools/mksquashfs.c
+===================================================================
+--- squashfs-tools.orig/mksquashfs.c
++++ squashfs-tools/mksquashfs.c
+@@ -1286,6 +1286,10 @@ void write_dir(squashfs_inode *inode, st
+ 		dir_size + 3, directory_block, directory_offset, NULL, NULL,
+ 		dir, 0);
+ 
++#if !defined(FNM_EXTMATCH)
++#define FNM_EXTMATCH 0
++#endif
++
+ #ifdef SQUASHFS_TRACE
+ 	{
+ 		unsigned char *dirp;
+Index: squashfs-tools/pseudo.c
+===================================================================
+--- squashfs-tools.orig/pseudo.c
++++ squashfs-tools/pseudo.c
+@@ -32,6 +32,7 @@
+ #include <stdlib.h>
+ #include <sys/types.h>
+ #include <sys/wait.h>
++#include <sys/stat.h>
+ #include <ctype.h>
+ 
+ #include "pseudo.h"
+Index: squashfs-tools/unsquashfs.c
+===================================================================
+--- squashfs-tools.orig/unsquashfs.c
++++ squashfs-tools/unsquashfs.c
+@@ -38,6 +38,10 @@
+ #include <limits.h>
+ #include <ctype.h>
+ 
++#ifndef FNM_EXTMATCH
++#define FNM_EXTMATCH 0
++#endif
++
+ struct cache *fragment_cache, *data_cache;
+ struct queue *to_reader, *to_inflate, *to_writer, *from_writer;
+ pthread_t *thread, *inflator_thread;
diff --git a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
index 7aebd00..33ed09a 100644
--- a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
+++ b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
@@ -13,6 +13,7 @@ SRCREV = "9c1db6d13a51a2e009f0027ef336ce03624eac0d"
 SRC_URI = "git://github.com/plougher/squashfs-tools.git;protocol=https \
            http://downloads.sourceforge.net/sevenzip/lzma465.tar.bz2;name=lzma \
            file://0001-mksquashfs.c-get-inline-functions-work-with-C99.patch;striplevel=2 \
+           file://fix-compat.patch \
 "
 SRC_URI[lzma.md5sum] = "29d5ffd03a5a3e51aef6a74e9eafb759"
 SRC_URI[lzma.sha256sum] = "c935fd04dd8e0e8c688a3078f3675d699679a90be81c12686837e0880aa0fa1e"
-- 
2.6.3



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

* [PATCH 06/13] mtools: Use proper glibc override to add glibc packages to recommendations
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
                   ` (4 preceding siblings ...)
  2015-12-08  8:12 ` [PATCH 05/13] squashfs-tools: Define FNM_EXTMATCH if not defined Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-08  8:12 ` [PATCH 07/13] musl: Add recipe Khem Raj
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

Helps building mtools on musl

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

diff --git a/meta/recipes-devtools/mtools/mtools_4.0.18.bb b/meta/recipes-devtools/mtools/mtools_4.0.18.bb
index 24c9d49..bc9b79c 100644
--- a/meta/recipes-devtools/mtools/mtools_4.0.18.bb
+++ b/meta/recipes-devtools/mtools/mtools_4.0.18.bb
@@ -6,8 +6,8 @@ LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
 
-RDEPENDS_${PN} = "glibc-gconv-ibm850"
-RRECOMMENDS_${PN} = "\
+RDEPENDS_${PN}_libc-glibc = "glibc-gconv-ibm850"
+RRECOMMENDS_${PN}_libc-glibc = "\
 	glibc-gconv-ibm437 \
 	glibc-gconv-ibm737 \
 	glibc-gconv-ibm775 \
-- 
2.6.3



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

* [PATCH 07/13] musl: Add recipe
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
                   ` (5 preceding siblings ...)
  2015-12-08  8:12 ` [PATCH 06/13] mtools: Use proper glibc override to add glibc packages to recommendations Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-08  8:12 ` [PATCH 08/13] sysvinit: Fix build with musl Khem Raj
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

musl is posix compliant C library for linux

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/musl/musl.inc    | 26 +++++++++++++++++
 meta/recipes-core/musl/musl_git.bb | 58 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)
 create mode 100644 meta/recipes-core/musl/musl.inc
 create mode 100644 meta/recipes-core/musl/musl_git.bb

diff --git a/meta/recipes-core/musl/musl.inc b/meta/recipes-core/musl/musl.inc
new file mode 100644
index 0000000..c3fd5c8
--- /dev/null
+++ b/meta/recipes-core/musl/musl.inc
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "An implementation of the standard library for Linux-based systems"
+DESCRIPTION = "A new standard library to power a new generation of Linux-based devices. \
+musl is lightweight, fast, simple, free, and strives to be correct in the sense of \
+standards-conformance and safety."
+
+HOMEPAGE = "http://www.musl-libc.org/"
+LICENSE = "MIT"
+SECTION = "libs"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=bccdfe36b123d1b0757d8025278d86ba"
+
+PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
+TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
+STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
+
+
+FILES_SOLIBSDEV = ""
+FILES_${PN} += "${libdir}/lib*${SOLIBSDEV}"
+INSANE_SKIP_${PN} = "dev-so"
+
diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
new file mode 100644
index 0000000..1feb436
--- /dev/null
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -0,0 +1,58 @@
+# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require musl.inc
+
+SRCREV = "6c5cad2aa56745302c1d42d2c8baf6424d29c0f3"
+
+PV = "1.1.11+git${SRCPV}"
+
+# mirror is at git://github.com/bminor/musl.git
+
+SRC_URI = "git://git.musl-libc.org/musl \
+          "
+
+S = "${WORKDIR}/git"
+
+PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc virtual/libiconv virtual/libintl"
+
+DEPENDS = "virtual/${TARGET_PREFIX}binutils \
+           virtual/${TARGET_PREFIX}gcc-initial \
+           libgcc-initial \
+          "
+
+export CROSS_COMPILE="${TARGET_PREFIX}"
+
+EXTRA_OEMAKE = ""
+
+LDFLAGS += "-Wl,-soname,libc.so"
+
+CONFIGUREOPTS = " \
+    --prefix=${prefix} \
+    --exec-prefix=${exec_prefix} \
+    --bindir=${bindir} \
+    --libdir=${libdir} \
+    --includedir=${includedir} \
+    --syslibdir=${base_libdir} \
+"
+
+do_configure() {
+	${S}/configure ${CONFIGUREOPTS}
+}
+
+do_compile() {
+	oe_runmake
+}
+
+do_install() {
+	oe_runmake install DESTDIR='${D}'
+
+	install -d ${D}${bindir}
+	ln -s ${libdir}/libc.so ${D}${bindir}/ldd
+}
+
+RDEPENDS_${PN}-dev = "linux-libc-headers-dev"
+RPROVIDES_${PN}-dev += "libc-dev virtual-libc-dev"
+RPROVIDES_${PN} += "ldd libsegfault rtld(GNU_HASH)"
+
+LEAD_SONAME = "libc.so"
-- 
2.6.3



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

* [PATCH 08/13] sysvinit: Fix build with musl
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
                   ` (6 preceding siblings ...)
  2015-12-08  8:12 ` [PATCH 07/13] musl: Add recipe Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-08 18:08   ` Phil Blundell
  2015-12-08  8:12 ` [PATCH 09/13] gettext: Delete libintl.h and charset.alias Khem Raj
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/sysvinit/sysvinit/realpath.patch | 78 ++++++++++++++++++++++
 meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb     |  1 +
 2 files changed, 79 insertions(+)
 create mode 100644 meta/recipes-core/sysvinit/sysvinit/realpath.patch

diff --git a/meta/recipes-core/sysvinit/sysvinit/realpath.patch b/meta/recipes-core/sysvinit/sysvinit/realpath.patch
new file mode 100644
index 0000000..5e0dca3
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/realpath.patch
@@ -0,0 +1,78 @@
+Fix build on musl use realpath() API its available on all libcs
+
+realpath() API doesnt work on systems with PATH_MAX set to be unlimited e.g. GNU/Hurd
+However for Linux it should always work
+
+Upstream-Status: Inappropriate[Linux specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: sysvinit-2.88dsf/src/ifdown.c
+===================================================================
+--- sysvinit-2.88dsf.orig/src/ifdown.c	2010-03-23 07:37:01.000000000 -0700
++++ sysvinit-2.88dsf/src/ifdown.c	2014-04-02 00:43:43.675437029 -0700
+@@ -26,11 +26,11 @@
+ #include <unistd.h>
+ #include <time.h>
+ #include <string.h>
++#include <errno.h>
+ 
+ #include <sys/ioctl.h>
+ #include <sys/socket.h>
+ #include <sys/time.h>
+-#include <sys/errno.h>
+ 
+ #include <net/if.h>
+ #include <netinet/in.h>
+Index: sysvinit-2.88dsf/src/init.c
+===================================================================
+--- sysvinit-2.88dsf.orig/src/init.c	2014-04-02 00:42:10.488770162 -0700
++++ sysvinit-2.88dsf/src/init.c	2014-04-02 00:42:59.432103823 -0700
+@@ -49,6 +49,7 @@
+ #include <utmp.h>
+ #include <ctype.h>
+ #include <stdarg.h>
++#include <sys/ttydefaults.h>
+ #include <sys/syslog.h>
+ #include <sys/time.h>
+ 
+Index: sysvinit-2.88dsf/src/mountpoint.c
+===================================================================
+--- sysvinit-2.88dsf.orig/src/mountpoint.c	2009-09-10 01:28:49.000000000 -0700
++++ sysvinit-2.88dsf/src/mountpoint.c	2014-04-02 00:44:18.248770942 -0700
+@@ -23,6 +23,7 @@
+  *		Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+  */
+ 
++#include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+Index: sysvinit-2.88dsf/src/killall5.c
+===================================================================
+--- sysvinit-2.88dsf.orig/src/killall5.c	2014-03-26 00:49:52.982668074 -0700
++++ sysvinit-2.88dsf/src/killall5.c	2014-04-02 00:46:45.838771653 -0700
+@@ -846,9 +846,9 @@
+ 	char *oargv1, *pargv1;
+ 	if ((o->argv0 && p->argv0 && !strcmp(o->argv0,p->argv0))) {
+ 		if (o->argv1 && p->argv1) {
+-			if ((oargv1 = canonicalize_file_name(o->argv1)) == NULL)
++			if ((oargv1 = realpath(o->argv1, NULL)) == NULL)
+ 				oargv1 = strdup(o->argv1);
+-			if ((pargv1 = canonicalize_file_name(p->argv1)) == NULL)
++			if ((pargv1 = realpath(p->argv1, NULL)) == NULL)
+ 				pargv1 = strdup(p->argv1);
+ 			if (! strcmp(oargv1, pargv1)) {
+ 				ret = 1;
+Index: sysvinit-2.88dsf/src/wall.c
+===================================================================
+--- sysvinit-2.88dsf.orig/src/wall.c	2009-11-22 14:05:53.000000000 -0800
++++ sysvinit-2.88dsf/src/wall.c	2014-04-02 00:49:15.258772217 -0700
+@@ -29,6 +29,7 @@
+ #include <unistd.h>
+ #include <pwd.h>
+ #include <syslog.h>
++#include <time.h>
+ #include "init.h"
+ 
+ 
diff --git a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
index 5dfe39e..e4aa4c3 100644
--- a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
@@ -14,6 +14,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/sysvinit/sysvinit-${PV}.tar.bz2 \
            file://crypt-lib.patch \
            file://pidof-add-m-option.patch \
            file://0001-This-fixes-an-issue-that-clang-reports-about-mutlipl.patch \
+           file://realpath.patch \
            file://rcS-default \
            file://rc \
            file://rcS \
-- 
2.6.3



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

* [PATCH 09/13] gettext: Delete libintl.h and charset.alias
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
                   ` (7 preceding siblings ...)
  2015-12-08  8:12 ` [PATCH 08/13] sysvinit: Fix build with musl Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-08  8:12 ` [PATCH 10/13] busybox: Add config for musl Khem Raj
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

libintl.h is already provided by musl and charset.alias is regenerated
by packages themselves

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/gettext/gettext_0.16.1.bb | 5 +++++
 meta/recipes-core/gettext/gettext_0.19.4.bb | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/meta/recipes-core/gettext/gettext_0.16.1.bb b/meta/recipes-core/gettext/gettext_0.16.1.bb
index f9f7a7f..cd0b759 100644
--- a/meta/recipes-core/gettext/gettext_0.16.1.bb
+++ b/meta/recipes-core/gettext/gettext_0.16.1.bb
@@ -39,6 +39,11 @@ do_configure_prepend() {
 	rm -f ${S}/config/m4/libtool.m4
 }
 
+do_install_append_libc-musl () {
+	rm -f ${D}${libdir}/charset.alias
+	rm -f ${D}${includedir}/libintl.h
+}
+
 # these lack the .x behind the .so, but shouldn't be in the -dev package
 # Otherwise you get the following results:
 # 7.4M    glibc/images/ep93xx/Angstrom-console-image-glibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
diff --git a/meta/recipes-core/gettext/gettext_0.19.4.bb b/meta/recipes-core/gettext/gettext_0.19.4.bb
index cebf6c7..a9c919a 100644
--- a/meta/recipes-core/gettext/gettext_0.19.4.bb
+++ b/meta/recipes-core/gettext/gettext_0.19.4.bb
@@ -42,6 +42,10 @@ EXTRA_OECONF += "--without-lispdir \
 acpaths = '-I ${S}/gettext-runtime/m4 \
            -I ${S}/gettext-tools/m4'
 
+do_install_append_libc-musl () {
+	rm -f ${D}${libdir}/charset.alias
+	rm -f ${D}${includedir}/libintl.h
+}
 
 # these lack the .x behind the .so, but shouldn't be in the -dev package
 # Otherwise you get the following results:
-- 
2.6.3



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

* [PATCH 10/13] busybox: Add config for musl
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
                   ` (8 preceding siblings ...)
  2015-12-08  8:12 ` [PATCH 09/13] gettext: Delete libintl.h and charset.alias Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-09  1:25   ` Khem Raj
  2015-12-08  8:12 ` [PATCH 11/13] openssl: Add musl configuration support Khem Raj
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

Default config is enabling additional features that dont compile with
musl so lets disable them for musl case and use posix compliant
getpwent()

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...user-use-POSIX-getpwent-instead-of-getpwe.patch | 71 ++++++++++++++++++++++
 meta/recipes-core/busybox/busybox/musl.cfg         | 12 ++++
 meta/recipes-core/busybox/busybox_1.24.1.bb        |  2 +
 3 files changed, 85 insertions(+)
 create mode 100644 meta/recipes-core/busybox/busybox/0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch
 create mode 100644 meta/recipes-core/busybox/busybox/musl.cfg

diff --git a/meta/recipes-core/busybox/busybox/0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch b/meta/recipes-core/busybox/busybox/0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch
new file mode 100644
index 0000000..4cb9a73
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch
@@ -0,0 +1,71 @@
+From f47fa75ef19a43848dedb4a2bff79368878362bf Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 22 Apr 2014 12:41:20 +0000
+Subject: [PATCH] linedit, deluser: use POSIX getpwent instead of getpwent_r
+
+This fixes building with musl libc.
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+Upstream-Status: backport
+
+ libbb/lineedit.c     | 11 ++++-------
+ loginutils/deluser.c | 11 +++++------
+ 2 files changed, 9 insertions(+), 13 deletions(-)
+
+diff --git a/libbb/lineedit.c b/libbb/lineedit.c
+index 8564307..99e6e2c 100644
+--- a/libbb/lineedit.c
++++ b/libbb/lineedit.c
+@@ -672,20 +672,17 @@ static char *username_path_completion(char *ud)
+  */
+ static NOINLINE unsigned complete_username(const char *ud)
+ {
+-	/* Using _r function to avoid pulling in static buffers */
+-	char line_buff[256];
+-	struct passwd pwd;
+-	struct passwd *result;
++	struct passwd *pw;
+ 	unsigned userlen;
+ 
+ 	ud++; /* skip ~ */
+ 	userlen = strlen(ud);
+ 
+ 	setpwent();
+-	while (!getpwent_r(&pwd, line_buff, sizeof(line_buff), &result)) {
++	while ((pw = getpwent())) {
+ 		/* Null usernames should result in all users as possible completions. */
+-		if (/*!userlen || */ strncmp(ud, pwd.pw_name, userlen) == 0) {
+-			add_match(xasprintf("~%s/", pwd.pw_name));
++		if (/*!userlen || */ strncmp(ud, pw->pw_name, userlen) == 0) {
++			add_match(xasprintf("~%s/", pw->pw_name));
+ 		}
+ 	}
+ 	endpwent();
+diff --git a/loginutils/deluser.c b/loginutils/deluser.c
+index e39ac55..d7d9b24 100644
+--- a/loginutils/deluser.c
++++ b/loginutils/deluser.c
+@@ -73,14 +73,13 @@ int deluser_main(int argc, char **argv)
+ 			if (!member) {
+ 				/* "delgroup GROUP" */
+ 				struct passwd *pw;
+-				struct passwd pwent;
+ 				/* Check if the group is in use */
+-#define passwd_buf bb_common_bufsiz1
+-				while (!getpwent_r(&pwent, passwd_buf, sizeof(passwd_buf), &pw)) {
+-					if (pwent.pw_gid == gr->gr_gid)
+-						bb_error_msg_and_die("'%s' still has '%s' as their primary group!", pwent.pw_name, name);
++				setpwent();
++				while ((pw = getpwent())) {
++					if (pw->pw_gid == gr->gr_gid)
++						bb_error_msg_and_die("'%s' still has '%s' as their primary group!", pw->pw_name, name);
+ 				}
+-				//endpwent();
++				endpwent();
+ 			}
+ 			pfile = bb_path_group_file;
+ 			if (ENABLE_FEATURE_SHADOWPASSWDS)
+-- 
+1.9.2
+
diff --git a/meta/recipes-core/busybox/busybox/musl.cfg b/meta/recipes-core/busybox/busybox/musl.cfg
new file mode 100644
index 0000000..facfe85
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/musl.cfg
@@ -0,0 +1,12 @@
+# CONFIG_EXTRA_COMPAT is not set
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_HAVE_RPC is not set
+# CONFIG_WERROR is not set
+# CONFIG_FEATURE_SYSTEMD is not set
+# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
+# CONFIG_PAM is not set
+# CONFIG_FEATURE_INETD_RPC is not set
+# CONFIG_SELINUXENABLED is not set
+# CONFIG_FEATURE_MOUNT_NFS is not set
+# CONFIG_FEATURE_UTMP is not set
+
diff --git a/meta/recipes-core/busybox/busybox_1.24.1.bb b/meta/recipes-core/busybox/busybox_1.24.1.bb
index 7d2a7b2..7c9e5ea 100644
--- a/meta/recipes-core/busybox/busybox_1.24.1.bb
+++ b/meta/recipes-core/busybox/busybox_1.24.1.bb
@@ -32,12 +32,14 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://busybox-cross-menuconfig.patch \
            file://0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch \
            file://0002-Passthrough-r-to-linker.patch \
+           file://0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch \
            file://mount-via-label.cfg \
            file://sha1sum.cfg \
            file://sha256sum.cfg \
            file://getopts.cfg \
            file://resize.cfg \
 "
+SRC_URI_append_libc-musl = " file://musl.cfg "
 
 SRC_URI[tarball.md5sum] = "be98a40cadf84ce2d6b05fa41a275c6a"
 SRC_URI[tarball.sha256sum] = "37d03132cc078937360b392170b7a1d0e5b322eee9f57c0b82292a8b1f0afe3d"
-- 
2.6.3



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

* [PATCH 11/13] openssl: Add musl configuration support
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
                   ` (9 preceding siblings ...)
  2015-12-08  8:12 ` [PATCH 10/13] busybox: Add config for musl Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-08  8:12 ` [PATCH 12/13] libpam: Fix build with musl Khem Raj
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

use termios instead of termio

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-connectivity/openssl/openssl.inc      |  4 +++-
 .../openssl/openssl/configure-musl-target.patch    | 27 ++++++++++++++++++++++
 .../recipes-connectivity/openssl/openssl_1.0.2d.bb |  1 +
 3 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-connectivity/openssl/openssl/configure-musl-target.patch

diff --git a/meta/recipes-connectivity/openssl/openssl.inc b/meta/recipes-connectivity/openssl/openssl.inc
index 429fc5e..199e9ab 100644
--- a/meta/recipes-connectivity/openssl/openssl.inc
+++ b/meta/recipes-connectivity/openssl/openssl.inc
@@ -18,10 +18,12 @@ S = "${WORKDIR}/openssl-${PV}"
 PACKAGECONFIG[perl] = ",,,"
 
 AR_append = " r"
+TERMIO_libc-musl = "-DTERMIOS"
+TERMIO ?= "-DTERMIO"
 # Avoid binaries being marked as requiring an executable stack since it 
 # doesn't(which causes and this causes issues with SELinux
 CFLAG = "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \
-	-DTERMIO ${CFLAGS} -Wall -Wa,--noexecstack"
+	 ${TERMIO} ${CFLAGS} -Wall -Wa,--noexecstack"
 
 # -02 does not work on mipsel: ssh hangs when it tries to read /dev/urandom
 CFLAG_mtx-1 := "${@'${CFLAG}'.replace('-O2', '')}"
diff --git a/meta/recipes-connectivity/openssl/openssl/configure-musl-target.patch b/meta/recipes-connectivity/openssl/openssl/configure-musl-target.patch
new file mode 100644
index 0000000..613dc7b
--- /dev/null
+++ b/meta/recipes-connectivity/openssl/openssl/configure-musl-target.patch
@@ -0,0 +1,27 @@
+Add musl triplet support
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: openssl-1.0.2a/Configure
+===================================================================
+--- openssl-1.0.2a.orig/Configure
++++ openssl-1.0.2a/Configure
+@@ -431,7 +431,7 @@ my %table=(
+ #
+ #       ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
+ #
+-"linux-armv4",	"gcc: -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
++"linux-armv4", "gcc: -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+ "linux-aarch64","gcc: -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${aarch64_asm}:linux64:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+ # Configure script adds minimally required -march for assembly support,
+ # if no -march was specified at command line. mips32 and mips64 below
+@@ -504,6 +504,8 @@ my %table=(
+ "linux-gnueabi-armeb","$ENV{'CC'}:-DB_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG DES_RISC1:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+ "linux-uclibceabi-arm","$ENV{'CC'}:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG DES_RISC1:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+ "linux-uclibceabi-armeb","$ENV{'CC'}:-DB_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG DES_RISC1:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
++"linux-musleabi-arm","$ENV{'CC'}:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG DES_RISC1:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
++"linux-musleabi-armeb","$ENV{'CC'}:-DB_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG DES_RISC1:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+ 
+ "linux-avr32","$ENV{'CC'}:-O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG DES_RISC1:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).",
+ 
diff --git a/meta/recipes-connectivity/openssl/openssl_1.0.2d.bb b/meta/recipes-connectivity/openssl/openssl_1.0.2d.bb
index 249f8c4..454d075 100644
--- a/meta/recipes-connectivity/openssl/openssl_1.0.2d.bb
+++ b/meta/recipes-connectivity/openssl/openssl_1.0.2d.bb
@@ -37,6 +37,7 @@ SRC_URI += "file://find.pl;subdir=${BP}/util/ \
             file://crypto_use_bigint_in_x86-64_perl.patch \
             file://openssl-1.0.2a-x32-asm.patch \
             file://ptest_makefile_deps.patch  \
+            file://configure-musl-target.patch \
            "
 
 SRC_URI[md5sum] = "38dd619b2e77cbac69b99f52a053d25a"
-- 
2.6.3



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

* [PATCH 12/13] libpam: Fix build with musl
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
                   ` (10 preceding siblings ...)
  2015-12-08  8:12 ` [PATCH 11/13] openssl: Add musl configuration support Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-08  8:12 ` [PATCH 13/13] attr: Add patch to account for use of internal glibc header Khem Raj
  2015-12-09  1:36 ` [PATCH 00/13] Add musl to OE-Core Khem Raj
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

Define strndupa if not available in libc additionally fix headers
to explicitly needed include files which glibc was including indirectly

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...upport-for-defining-missing-funcitonality.patch | 68 ++++++++++++++++++++++
 .../pam/libpam/include_paths_header.patch          | 59 +++++++++++++++++++
 meta/recipes-extended/pam/libpam_1.2.1.bb          |  5 +-
 3 files changed, 131 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/pam/libpam/0001-Add-support-for-defining-missing-funcitonality.patch
 create mode 100644 meta/recipes-extended/pam/libpam/include_paths_header.patch

diff --git a/meta/recipes-extended/pam/libpam/0001-Add-support-for-defining-missing-funcitonality.patch b/meta/recipes-extended/pam/libpam/0001-Add-support-for-defining-missing-funcitonality.patch
new file mode 100644
index 0000000..c55b648
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/0001-Add-support-for-defining-missing-funcitonality.patch
@@ -0,0 +1,68 @@
+From 45d1ed58927593968faead7dbb295f3922f41a2f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 8 Aug 2015 14:16:43 -0700
+Subject: [PATCH] Add support for defining missing funcitonality
+
+In order to support alternative libc on linux ( musl, bioninc ) etc we
+need to check for glibc-only features and provide alternatives, in this
+list strndupa is first one, when configure detects that its not included
+in system C library then the altrnative implementation from missing.h is
+used
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ configure.ac                |  3 +++
+ libpam/include/missing.h    | 12 ++++++++++++
+ modules/pam_exec/pam_exec.c |  1 +
+ 3 files changed, 16 insertions(+)
+ create mode 100644 libpam/include/missing.h
+
+diff --git a/configure.ac b/configure.ac
+index 9e1257f..cbed979 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -599,6 +599,9 @@ dnl
+ AC_CHECK_DECL(__NR_keyctl, [have_key_syscalls=1],[have_key_syscalls=0],[#include <sys/syscall.h>])
+ AC_CHECK_DECL(ENOKEY, [have_key_errors=1],[have_key_errors=0],[#include <errno.h>])
+ 
++# musl and bionic don't have strndupa
++AC_CHECK_DECLS_ONCE([strndupa])
++
+ HAVE_KEY_MANAGEMENT=0
+ if test $have_key_syscalls$have_key_errors = 11
+ then
+diff --git a/libpam/include/missing.h b/libpam/include/missing.h
+new file mode 100644
+index 0000000..3cf011c
+--- /dev/null
++++ b/libpam/include/missing.h
+@@ -0,0 +1,12 @@
++#pragma once
++
++#if !HAVE_DECL_STRNDUPA
++#define strndupa(s, n)                                                  \
++        ({                                                              \
++                const char *__old = (s);                                \
++                size_t __len = strnlen(__old, (n));                     \
++                char *__new = alloca(__len + 1);                        \
++                __new[__len] = '\0';                                    \
++                memcpy(__new, __old, __len);                            \
++         })
++#endif
+diff --git a/modules/pam_exec/pam_exec.c b/modules/pam_exec/pam_exec.c
+index 17ba6ca..3aa2694 100644
+--- a/modules/pam_exec/pam_exec.c
++++ b/modules/pam_exec/pam_exec.c
+@@ -59,6 +59,7 @@
+ #include <security/pam_modutil.h>
+ #include <security/pam_ext.h>
+ #include <security/_pam_macros.h>
++#include <missing.h>
+ 
+ #define ENV_ITEM(n) { (n), #n }
+ static struct {
+-- 
+2.1.4
+
diff --git a/meta/recipes-extended/pam/libpam/include_paths_header.patch b/meta/recipes-extended/pam/libpam/include_paths_header.patch
new file mode 100644
index 0000000..e4eb956
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/include_paths_header.patch
@@ -0,0 +1,59 @@
+This patch adds missing include for paths.h which should provide
+_PATH_LASTLOG definition
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Index: Linux-PAM-1.1.6/modules/pam_lastlog/pam_lastlog.c
+===================================================================
+--- Linux-PAM-1.1.6.orig/modules/pam_lastlog/pam_lastlog.c
++++ Linux-PAM-1.1.6/modules/pam_lastlog/pam_lastlog.c
+@@ -23,9 +23,11 @@
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <string.h>
++#include <sys/file.h>
+ #include <sys/types.h>
+ #include <syslog.h>
+ #include <unistd.h>
++#include <paths.h>
+ 
+ #if defined(hpux) || defined(sunos) || defined(solaris)
+ # ifndef _PATH_LASTLOG
+@@ -332,6 +334,23 @@ last_login_read(pam_handle_t *pamh, int
+     return retval;
+ }
+ 
++#ifndef __GLIBC__
++static void logwtmp(const char * line, const char * name, const char * host)
++{
++    struct utmp u;
++    memset(&u, 0, sizeof(u));
++
++    u.ut_pid = getpid();
++    u.ut_type = name[0] ? USER_PROCESS : DEAD_PROCESS;
++    strncpy(u.ut_line, line, sizeof(u.ut_line));
++    strncpy(u.ut_name, name, sizeof(u.ut_name));
++    strncpy(u.ut_host, host, sizeof(u.ut_host));
++    gettimeofday(&(u.ut_tv), NULL);
++
++    updwtmp(_PATH_WTMP, &u);
++}
++#endif /* __GLIBC__ */
++
+ static int
+ last_login_write(pam_handle_t *pamh, int announce, int last_fd,
+ 		 uid_t uid, const char *user)
+Index: Linux-PAM-1.1.6/modules/Makefile.am
+===================================================================
+--- Linux-PAM-1.1.6.orig/modules/Makefile.am
++++ Linux-PAM-1.1.6/modules/Makefile.am
+@@ -7,7 +7,7 @@ SUBDIRS = pam_access pam_cracklib pam_de
+ 	pam_group pam_issue pam_keyinit pam_lastlog pam_limits \
+ 	pam_listfile pam_localuser pam_loginuid pam_mail \
+ 	pam_mkhomedir pam_motd pam_namespace pam_nologin \
+-	pam_permit pam_pwhistory pam_rhosts pam_rootok pam_securetty \
++	pam_permit pam_pwhistory pam_rootok pam_securetty \
+ 	pam_selinux pam_sepermit pam_shells pam_stress \
+ 	pam_succeed_if pam_tally pam_tally2 pam_time pam_timestamp \
+ 	pam_tty_audit pam_umask \
diff --git a/meta/recipes-extended/pam/libpam_1.2.1.bb b/meta/recipes-extended/pam/libpam_1.2.1.bb
index 0353356..7e81e72 100644
--- a/meta/recipes-extended/pam/libpam_1.2.1.bb
+++ b/meta/recipes-extended/pam/libpam_1.2.1.bb
@@ -31,7 +31,10 @@ SRC_URI[sha256sum] = "342b1211c0d3b203a7df2540a5b03a428a087bd8a48c17e49ae268f992
 SRC_URI_append_libc-uclibc = " file://pam-no-innetgr.patch \
                                file://use-utmpx.patch"
 
-SRC_URI_append_libc-musl = " file://pam-no-innetgr.patch"
+SRC_URI_append_libc-musl = " file://pam-no-innetgr.patch \
+                             file://0001-Add-support-for-defining-missing-funcitonality.patch \
+                             file://include_paths_header.patch \
+                           "
 
 DEPENDS = "bison flex flex-native cracklib"
 
-- 
2.6.3



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

* [PATCH 13/13] attr: Add patch to account for use of internal glibc header
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
                   ` (11 preceding siblings ...)
  2015-12-08  8:12 ` [PATCH 12/13] libpam: Fix build with musl Khem Raj
@ 2015-12-08  8:12 ` Khem Raj
  2015-12-09  1:36 ` [PATCH 00/13] Add musl to OE-Core Khem Raj
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-08  8:12 UTC (permalink / raw)
  To: openembedded-core

based on suggestions on musl FAQ
http://wiki.musl-libc.org/wiki/FAQ

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-support/attr/attr_2.4.47.bb           |  4 +-
 .../attr/files/dont-use-decl-macros.patch          | 56 ++++++++++++++++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/attr/files/dont-use-decl-macros.patch

diff --git a/meta/recipes-support/attr/attr_2.4.47.bb b/meta/recipes-support/attr/attr_2.4.47.bb
index ad40c9b..44eee39 100644
--- a/meta/recipes-support/attr/attr_2.4.47.bb
+++ b/meta/recipes-support/attr/attr_2.4.47.bb
@@ -2,7 +2,9 @@ require attr.inc
 
 # configure.ac was missing from the release tarball. This should be fixed in
 # future releases of attr, remove this when updating the recipe.
-SRC_URI_append += "file://attr-Missing-configure.ac.patch"
+SRC_URI_append += "file://attr-Missing-configure.ac.patch \
+                   file://dont-use-decl-macros.patch \
+                  "
 
 SRC_URI[md5sum] = "84f58dec00b60f2dc8fd1c9709291cc7"
 SRC_URI[sha256sum] = "25772f653ac5b2e3ceeb89df50e4688891e21f723c460636548971652af0a859"
diff --git a/meta/recipes-support/attr/files/dont-use-decl-macros.patch b/meta/recipes-support/attr/files/dont-use-decl-macros.patch
new file mode 100644
index 0000000..9d4b892
--- /dev/null
+++ b/meta/recipes-support/attr/files/dont-use-decl-macros.patch
@@ -0,0 +1,56 @@
+Use extern "C" instead of __BEGIN_DECL/__END_DECL macros
+these macros are defined in sys/cdefs.h for glibc and this header is not available on all libc
+
+anyway they defined like below
+
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
+__THROW macro is also not available on musl, defined thusly
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: attr-2.4.47/include/xattr.h
+===================================================================
+--- attr-2.4.47.orig/include/xattr.h	2014-04-02 00:01:30.252091280 -0700
++++ attr-2.4.47/include/xattr.h	2014-04-02 00:12:57.985428099 -0700
+@@ -30,8 +30,20 @@
+ #define XATTR_CREATE  0x1       /* set value, fail if attr already exists */
+ #define XATTR_REPLACE 0x2       /* set value, fail if attr does not exist */
+ 
+-
+-__BEGIN_DECLS
++#ifndef __THROW
++# ifndef __GNUC_PREREQ
++#  define __GNUC_PREREQ(maj, min) (0)
++# endif
++# if defined __cplusplus && __GNUC_PREREQ (2,8)
++#  define __THROW       throw ()
++# else
++#  define __THROW
++# endif
++#endif
++
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ extern int setxattr (const char *__path, const char *__name,
+ 		      const void *__value, size_t __size, int __flags) __THROW;
+@@ -58,6 +70,8 @@
+ extern int lremovexattr (const char *__path, const char *__name) __THROW;
+ extern int fremovexattr (int __filedes,   const char *__name) __THROW;
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif	/* __XATTR_H__ */
-- 
2.6.3



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

* Re: [PATCH 08/13] sysvinit: Fix build with musl
  2015-12-08  8:12 ` [PATCH 08/13] sysvinit: Fix build with musl Khem Raj
@ 2015-12-08 18:08   ` Phil Blundell
  2015-12-08 18:09     ` Phil Blundell
  0 siblings, 1 reply; 19+ messages in thread
From: Phil Blundell @ 2015-12-08 18:08 UTC (permalink / raw)
  To: Khem Raj, openembedded-core

On Tue, 2015-12-08 at 08:12 +0000, Khem Raj wrote:
> 
+Upstream-Status: Inappropriate[Linux specific]
> 


Er, isn't sysvinit itself fairly Linux-specific?

p.



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

* Re: [PATCH 08/13] sysvinit: Fix build with musl
  2015-12-08 18:08   ` Phil Blundell
@ 2015-12-08 18:09     ` Phil Blundell
  0 siblings, 0 replies; 19+ messages in thread
From: Phil Blundell @ 2015-12-08 18:09 UTC (permalink / raw)
  To: Khem Raj, openembedded-core

On Tue, 2015-12-08 at 18:08 +0000, Phil Blundell wrote:
> On Tue, 2015-12-08 at 08:12 +0000, Khem Raj wrote:
> > 
> +Upstream-Status: Inappropriate[Linux specific]
> > 
> 
> 
> Er, isn't sysvinit itself fairly Linux-specific?

Oh, never mind, I see the comment about Hurd now.

p.



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

* Re: [PATCH 10/13] busybox: Add config for musl
  2015-12-08  8:12 ` [PATCH 10/13] busybox: Add config for musl Khem Raj
@ 2015-12-09  1:25   ` Khem Raj
  0 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-09  1:25 UTC (permalink / raw)
  To: openembedded-core

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


> On Dec 8, 2015, at 12:12 AM, Khem Raj <raj.khem@gmail.com> wrote:
> 
> Default config is enabling additional features that dont compile with
> musl so lets disable them for musl case and use posix compliant
> getpwent()

0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch is no longer needed after 1.24 upgrade
so I have dropped it from pull request branch.


> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> ...user-use-POSIX-getpwent-instead-of-getpwe.patch | 71 ++++++++++++++++++++++
> meta/recipes-core/busybox/busybox/musl.cfg         | 12 ++++
> meta/recipes-core/busybox/busybox_1.24.1.bb        |  2 +
> 3 files changed, 85 insertions(+)
> create mode 100644 meta/recipes-core/busybox/busybox/0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch
> create mode 100644 meta/recipes-core/busybox/busybox/musl.cfg
> 
> diff --git a/meta/recipes-core/busybox/busybox/0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch b/meta/recipes-core/busybox/busybox/0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch
> new file mode 100644
> index 0000000..4cb9a73
> --- /dev/null
> +++ b/meta/recipes-core/busybox/busybox/0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch
> @@ -0,0 +1,71 @@
> +From f47fa75ef19a43848dedb4a2bff79368878362bf Mon Sep 17 00:00:00 2001
> +From: Natanael Copa <ncopa@alpinelinux.org>
> +Date: Tue, 22 Apr 2014 12:41:20 +0000
> +Subject: [PATCH] linedit, deluser: use POSIX getpwent instead of getpwent_r
> +
> +This fixes building with musl libc.
> +
> +Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> +---
> +Upstream-Status: backport
> +
> + libbb/lineedit.c     | 11 ++++-------
> + loginutils/deluser.c | 11 +++++------
> + 2 files changed, 9 insertions(+), 13 deletions(-)
> +
> +diff --git a/libbb/lineedit.c b/libbb/lineedit.c
> +index 8564307..99e6e2c 100644
> +--- a/libbb/lineedit.c
> ++++ b/libbb/lineedit.c
> +@@ -672,20 +672,17 @@ static char *username_path_completion(char *ud)
> +  */
> + static NOINLINE unsigned complete_username(const char *ud)
> + {
> +-	/* Using _r function to avoid pulling in static buffers */
> +-	char line_buff[256];
> +-	struct passwd pwd;
> +-	struct passwd *result;
> ++	struct passwd *pw;
> + 	unsigned userlen;
> +
> + 	ud++; /* skip ~ */
> + 	userlen = strlen(ud);
> +
> + 	setpwent();
> +-	while (!getpwent_r(&pwd, line_buff, sizeof(line_buff), &result)) {
> ++	while ((pw = getpwent())) {
> + 		/* Null usernames should result in all users as possible completions. */
> +-		if (/*!userlen || */ strncmp(ud, pwd.pw_name, userlen) == 0) {
> +-			add_match(xasprintf("~%s/", pwd.pw_name));
> ++		if (/*!userlen || */ strncmp(ud, pw->pw_name, userlen) == 0) {
> ++			add_match(xasprintf("~%s/", pw->pw_name));
> + 		}
> + 	}
> + 	endpwent();
> +diff --git a/loginutils/deluser.c b/loginutils/deluser.c
> +index e39ac55..d7d9b24 100644
> +--- a/loginutils/deluser.c
> ++++ b/loginutils/deluser.c
> +@@ -73,14 +73,13 @@ int deluser_main(int argc, char **argv)
> + 			if (!member) {
> + 				/* "delgroup GROUP" */
> + 				struct passwd *pw;
> +-				struct passwd pwent;
> + 				/* Check if the group is in use */
> +-#define passwd_buf bb_common_bufsiz1
> +-				while (!getpwent_r(&pwent, passwd_buf, sizeof(passwd_buf), &pw)) {
> +-					if (pwent.pw_gid == gr->gr_gid)
> +-						bb_error_msg_and_die("'%s' still has '%s' as their primary group!", pwent.pw_name, name);
> ++				setpwent();
> ++				while ((pw = getpwent())) {
> ++					if (pw->pw_gid == gr->gr_gid)
> ++						bb_error_msg_and_die("'%s' still has '%s' as their primary group!", pw->pw_name, name);
> + 				}
> +-				//endpwent();
> ++				endpwent();
> + 			}
> + 			pfile = bb_path_group_file;
> + 			if (ENABLE_FEATURE_SHADOWPASSWDS)
> +--
> +1.9.2
> +
> diff --git a/meta/recipes-core/busybox/busybox/musl.cfg b/meta/recipes-core/busybox/busybox/musl.cfg
> new file mode 100644
> index 0000000..facfe85
> --- /dev/null
> +++ b/meta/recipes-core/busybox/busybox/musl.cfg
> @@ -0,0 +1,12 @@
> +# CONFIG_EXTRA_COMPAT is not set
> +# CONFIG_SELINUX is not set
> +# CONFIG_FEATURE_HAVE_RPC is not set
> +# CONFIG_WERROR is not set
> +# CONFIG_FEATURE_SYSTEMD is not set
> +# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
> +# CONFIG_PAM is not set
> +# CONFIG_FEATURE_INETD_RPC is not set
> +# CONFIG_SELINUXENABLED is not set
> +# CONFIG_FEATURE_MOUNT_NFS is not set
> +# CONFIG_FEATURE_UTMP is not set
> +
> diff --git a/meta/recipes-core/busybox/busybox_1.24.1.bb b/meta/recipes-core/busybox/busybox_1.24.1.bb
> index 7d2a7b2..7c9e5ea 100644
> --- a/meta/recipes-core/busybox/busybox_1.24.1.bb
> +++ b/meta/recipes-core/busybox/busybox_1.24.1.bb
> @@ -32,12 +32,14 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
>            file://busybox-cross-menuconfig.patch \
>            file://0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch \
>            file://0002-Passthrough-r-to-linker.patch \
> +           file://0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch \
>            file://mount-via-label.cfg \
>            file://sha1sum.cfg \
>            file://sha256sum.cfg \
>            file://getopts.cfg \
>            file://resize.cfg \
> "
> +SRC_URI_append_libc-musl = " file://musl.cfg "
> 
> SRC_URI[tarball.md5sum] = "be98a40cadf84ce2d6b05fa41a275c6a"
> SRC_URI[tarball.sha256sum] = "37d03132cc078937360b392170b7a1d0e5b322eee9f57c0b82292a8b1f0afe3d"
> --
> 2.6.3
> 


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

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

* Re: [PATCH 00/13] Add musl to OE-Core
  2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
                   ` (12 preceding siblings ...)
  2015-12-08  8:12 ` [PATCH 13/13] attr: Add patch to account for use of internal glibc header Khem Raj
@ 2015-12-09  1:36 ` Khem Raj
  13 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-12-09  1:36 UTC (permalink / raw)
  To: openembedded-core

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


> On Dec 8, 2015, at 12:12 AM, Khem Raj <raj.khem@gmail.com> wrote:
> 
> This is a mimimal set of changes brought in from meta-musl
> to OE-Core, with this set one can build core-image-minimal using musl
> by setting
> 
> TCLIBC=musl
> 
> for all supported architectures, eventually we will bring
> more changes to other packages which will enable more complex
> image builds and eventually world.
> 
> v2: Address review feedback


For some reason create-pull-request does not add the pull branch info here the branch is here on github

git://github.com/kraj/openembedded-core kraj/musl

web-ui

https://github.com/kraj/openembedded-core/commits/kraj/musl

> 
> Khem Raj (13):
>  gcc: Add support for building musl configuration
>  autoconf: Add musl support
>  gdb: Fix build with musl
>  mtd-utils: Backport and create patches to support musl
>  squashfs-tools: Define FNM_EXTMATCH if not defined
>  mtools: Use proper glibc override to add glibc packages to
>    recommendations
>  musl: Add recipe
>  sysvinit: Fix build with musl
>  gettext: Delete libintl.h and charset.alias
>  busybox: Add config for musl
>  openssl: Add musl configuration support
>  libpam: Fix build with musl
>  attr: Add patch to account for use of internal glibc header
> 
> meta/recipes-connectivity/openssl/openssl.inc      |   4 +-
> .../openssl/openssl/configure-musl-target.patch    |  27 +++
> .../recipes-connectivity/openssl/openssl_1.0.2d.bb |   1 +
> ...user-use-POSIX-getpwent-instead-of-getpwe.patch |  71 ++++++
> meta/recipes-core/busybox/busybox/musl.cfg         |  12 +
> meta/recipes-core/busybox/busybox_1.24.1.bb        |   2 +
> meta/recipes-core/gettext/gettext_0.16.1.bb        |   5 +
> meta/recipes-core/gettext/gettext_0.19.4.bb        |   4 +
> meta/recipes-core/musl/musl.inc                    |  26 ++
> meta/recipes-core/musl/musl_git.bb                 |  58 +++++
> meta/recipes-core/sysvinit/sysvinit/realpath.patch |  78 ++++++
> meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb     |   1 +
> .../autoconf/autoconf/add_musl_config.patch        |  26 ++
> meta/recipes-devtools/autoconf/autoconf_2.69.bb    |   1 +
> meta/recipes-devtools/gcc/gcc-4.9.inc              |   4 +
> .../gcc/gcc-4.9/0067-gcc-musl-support.patch        | 267 +++++++++++++++++++++
> .../gcc/gcc-4.9/0068-musl-dynamic-linker.patch     | 205 ++++++++++++++++
> .../gcc/gcc-4.9/0069-musl-no-fixincludes.patch     |  21 ++
> .../gcc/gcc-4.9/0070-libstdc-musl.patch            |  32 +++
> meta/recipes-devtools/gcc/gcc-5.2.inc              |   4 +
> .../gcc/gcc-5.2/0043-libstdc-musl.patch            |  32 +++
> .../gcc/gcc-5.2/0044-gcc-musl-support.patch        | 267 +++++++++++++++++++++
> .../gcc/gcc-5.2/0045-musl-dynamic-linker.patch     | 198 +++++++++++++++
> .../gcc/gcc-5.2/0046-musl-no-fixincludes.patch     |  22 ++
> meta/recipes-devtools/gdb/gdb.inc                  |   1 +
> ...0001-Use-exported-definitions-of-SIGRTMIN.patch |  54 +++++
> .../mtd/mtd-utils/0001-Fix-build-with-musl.patch   |  53 ++++
> ...ibfec-use-standard-C-type-instead-of-u_lo.patch |  56 +++++
> .../mtd/mtd-utils/010-fix-rpmatch.patch            |  24 ++
> meta/recipes-devtools/mtd/mtd-utils_git.bb         |   4 +
> meta/recipes-devtools/mtools/mtools_4.0.18.bb      |   4 +-
> .../squashfs-tools/squashfs-tools/fix-compat.patch |  63 +++++
> .../squashfs-tools/squashfs-tools_git.bb           |   1 +
> ...upport-for-defining-missing-funcitonality.patch |  68 ++++++
> .../pam/libpam/include_paths_header.patch          |  59 +++++
> meta/recipes-extended/pam/libpam_1.2.1.bb          |   5 +-
> meta/recipes-support/attr/attr_2.4.47.bb           |   4 +-
> .../attr/files/dont-use-decl-macros.patch          |  56 +++++
> 38 files changed, 1815 insertions(+), 5 deletions(-)
> create mode 100644 meta/recipes-connectivity/openssl/openssl/configure-musl-target.patch
> create mode 100644 meta/recipes-core/busybox/busybox/0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.patch
> create mode 100644 meta/recipes-core/busybox/busybox/musl.cfg
> create mode 100644 meta/recipes-core/musl/musl.inc
> create mode 100644 meta/recipes-core/musl/musl_git.bb
> create mode 100644 meta/recipes-core/sysvinit/sysvinit/realpath.patch
> create mode 100644 meta/recipes-devtools/autoconf/autoconf/add_musl_config.patch
> create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0067-gcc-musl-support.patch
> create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0068-musl-dynamic-linker.patch
> create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0069-musl-no-fixincludes.patch
> create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0070-libstdc-musl.patch
> create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0043-libstdc-musl.patch
> create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0044-gcc-musl-support.patch
> create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch
> create mode 100644 meta/recipes-devtools/gcc/gcc-5.2/0046-musl-no-fixincludes.patch
> create mode 100644 meta/recipes-devtools/gdb/gdb/0001-Use-exported-definitions-of-SIGRTMIN.patch
> create mode 100644 meta/recipes-devtools/mtd/mtd-utils/0001-Fix-build-with-musl.patch
> create mode 100644 meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch
> create mode 100644 meta/recipes-devtools/mtd/mtd-utils/010-fix-rpmatch.patch
> create mode 100644 meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch
> create mode 100644 meta/recipes-extended/pam/libpam/0001-Add-support-for-defining-missing-funcitonality.patch
> create mode 100644 meta/recipes-extended/pam/libpam/include_paths_header.patch
> create mode 100644 meta/recipes-support/attr/files/dont-use-decl-macros.patch
> 
> --
> 2.6.3
> 


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

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

* [PATCH 05/13] squashfs-tools: Define FNM_EXTMATCH if not defined
  2015-11-19 17:10 ` [PATCH 00/13] Add musl to OE-Core Khem Raj
@ 2015-11-19 17:10   ` Khem Raj
  0 siblings, 0 replies; 19+ messages in thread
From: Khem Raj @ 2015-11-19 17:10 UTC (permalink / raw)
  To: openembedded-core

helps compiling when using musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../squashfs-tools/squashfs-tools/fix-compat.patch | 63 ++++++++++++++++++++++
 .../squashfs-tools/squashfs-tools_git.bb           |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch

diff --git a/meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch b/meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch
new file mode 100644
index 0000000..d545146
--- /dev/null
+++ b/meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch
@@ -0,0 +1,63 @@
+Define FNM_EXTMATCH if not defined its glibc specific define
+include missing sys/stat.h for stat* function declarations
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: squashfs-tools/action.c
+===================================================================
+--- squashfs-tools.orig/action.c
++++ squashfs-tools/action.c
+@@ -44,6 +44,10 @@
+ #include "action.h"
+ #include "error.h"
+ 
++#if !defined(FNM_EXTMATCH)
++#define FNM_EXTMATCH 0
++#endif
++
+ /*
+  * code to parse actions
+  */
+Index: squashfs-tools/mksquashfs.c
+===================================================================
+--- squashfs-tools.orig/mksquashfs.c
++++ squashfs-tools/mksquashfs.c
+@@ -1286,6 +1286,10 @@ void write_dir(squashfs_inode *inode, st
+ 		dir_size + 3, directory_block, directory_offset, NULL, NULL,
+ 		dir, 0);
+ 
++#if !defined(FNM_EXTMATCH)
++#define FNM_EXTMATCH 0
++#endif
++
+ #ifdef SQUASHFS_TRACE
+ 	{
+ 		unsigned char *dirp;
+Index: squashfs-tools/pseudo.c
+===================================================================
+--- squashfs-tools.orig/pseudo.c
++++ squashfs-tools/pseudo.c
+@@ -32,6 +32,7 @@
+ #include <stdlib.h>
+ #include <sys/types.h>
+ #include <sys/wait.h>
++#include <sys/stat.h>
+ #include <ctype.h>
+ 
+ #include "pseudo.h"
+Index: squashfs-tools/unsquashfs.c
+===================================================================
+--- squashfs-tools.orig/unsquashfs.c
++++ squashfs-tools/unsquashfs.c
+@@ -38,6 +38,10 @@
+ #include <limits.h>
+ #include <ctype.h>
+ 
++#ifndef FNM_EXTMATCH
++#define FNM_EXTMATCH 0
++#endif
++
+ struct cache *fragment_cache, *data_cache;
+ struct queue *to_reader, *to_inflate, *to_writer, *from_writer;
+ pthread_t *thread, *inflator_thread;
diff --git a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
index 7aebd00..33ed09a 100644
--- a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
+++ b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
@@ -13,6 +13,7 @@ SRCREV = "9c1db6d13a51a2e009f0027ef336ce03624eac0d"
 SRC_URI = "git://github.com/plougher/squashfs-tools.git;protocol=https \
            http://downloads.sourceforge.net/sevenzip/lzma465.tar.bz2;name=lzma \
            file://0001-mksquashfs.c-get-inline-functions-work-with-C99.patch;striplevel=2 \
+           file://fix-compat.patch \
 "
 SRC_URI[lzma.md5sum] = "29d5ffd03a5a3e51aef6a74e9eafb759"
 SRC_URI[lzma.sha256sum] = "c935fd04dd8e0e8c688a3078f3675d699679a90be81c12686837e0880aa0fa1e"
-- 
2.6.3



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

end of thread, other threads:[~2015-12-09  1:36 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08  8:12 [PATCH 00/13] Add musl to OE-Core Khem Raj
2015-12-08  8:12 ` [PATCH 01/13] gcc: Add support for building musl configuration Khem Raj
2015-12-08  8:12 ` [PATCH 02/13] autoconf: Add musl support Khem Raj
2015-12-08  8:12 ` [PATCH 03/13] gdb: Fix build with musl Khem Raj
2015-12-08  8:12 ` [PATCH 04/13] mtd-utils: Backport and create patches to support musl Khem Raj
2015-12-08  8:12 ` [PATCH 05/13] squashfs-tools: Define FNM_EXTMATCH if not defined Khem Raj
2015-12-08  8:12 ` [PATCH 06/13] mtools: Use proper glibc override to add glibc packages to recommendations Khem Raj
2015-12-08  8:12 ` [PATCH 07/13] musl: Add recipe Khem Raj
2015-12-08  8:12 ` [PATCH 08/13] sysvinit: Fix build with musl Khem Raj
2015-12-08 18:08   ` Phil Blundell
2015-12-08 18:09     ` Phil Blundell
2015-12-08  8:12 ` [PATCH 09/13] gettext: Delete libintl.h and charset.alias Khem Raj
2015-12-08  8:12 ` [PATCH 10/13] busybox: Add config for musl Khem Raj
2015-12-09  1:25   ` Khem Raj
2015-12-08  8:12 ` [PATCH 11/13] openssl: Add musl configuration support Khem Raj
2015-12-08  8:12 ` [PATCH 12/13] libpam: Fix build with musl Khem Raj
2015-12-08  8:12 ` [PATCH 13/13] attr: Add patch to account for use of internal glibc header Khem Raj
2015-12-09  1:36 ` [PATCH 00/13] Add musl to OE-Core Khem Raj
  -- strict thread matches above, loose matches on Subject: below --
2015-11-19 17:10 [PATCH 01/13] gcc: Add support for building musl configuration Khem Raj
2015-11-19 17:10 ` [PATCH 00/13] Add musl to OE-Core Khem Raj
2015-11-19 17:10   ` [PATCH 05/13] squashfs-tools: Define FNM_EXTMATCH if not defined 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.