summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/uclibc/uclibc-config.inc1
-rw-r--r--meta/recipes-core/uclibc/uclibc-git.inc21
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-Revert-glibc-compat-bump-glibc-minor-version.patch28
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-fcntl-Add-AT_EMPTY_PATH-for-all-and-O_PATH-for-arm.patch42
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-gcc5-optimizes-away-the-write-only-static-functions-.patch51
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-wire-in-syncfs.patch49
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0004-Dont-support-localised-optimizations-this-helps-to-h.patch30
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0005-Always-use-O2-for-compiling-fork.c.patch33
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0006-ldso-limited-support-for-ORIGIN-in-rpath.patch233
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0007-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch35
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/libc-stdlib-canonicalize_file_name-memory-leak.patch95
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/uClibc.distro4
-rw-r--r--meta/recipes-core/uclibc/uclibc.inc8
13 files changed, 135 insertions, 495 deletions
diff --git a/meta/recipes-core/uclibc/uclibc-config.inc b/meta/recipes-core/uclibc/uclibc-config.inc
index 8b9e41c64d..ed7b522269 100644
--- a/meta/recipes-core/uclibc/uclibc-config.inc
+++ b/meta/recipes-core/uclibc/uclibc-config.inc
@@ -119,6 +119,7 @@ def features_to_uclibc_settings(d):
119 uclibc_cfg('thumb-interwork', distro_features,'USE_BX', cnf, rem) 119 uclibc_cfg('thumb-interwork', distro_features,'USE_BX', cnf, rem)
120 uclibc_cfg('xattr', distro_features, 'UCLIBC_HAS_XATTR', cnf, rem) 120 uclibc_cfg('xattr', distro_features, 'UCLIBC_HAS_XATTR', cnf, rem)
121 uclibc_cfg('ssp', distro_features, 'UCLIBC_HAS_SSP', cnf, rem) 121 uclibc_cfg('ssp', distro_features, 'UCLIBC_HAS_SSP', cnf, rem)
122 uclibc_cfg('ssp', distro_features, 'UCLIBC_BUILD_SSP', cnf, rem)
122 uclibc_cfg('argp', distro_features, 'UCLIBC_HAS_ARGP', cnf, rem) 123 uclibc_cfg('argp', distro_features, 'UCLIBC_HAS_ARGP', cnf, rem)
123 uclibc_cfg('libc-posix-clang-wchar', distro_features,'UCLIBC_HAS_WCHAR', cnf, rem) 124 uclibc_cfg('libc-posix-clang-wchar', distro_features,'UCLIBC_HAS_WCHAR', cnf, rem)
124 return "\n".join(cnf), "\n".join(rem) 125 return "\n".join(cnf), "\n".join(rem)
diff --git a/meta/recipes-core/uclibc/uclibc-git.inc b/meta/recipes-core/uclibc/uclibc-git.inc
index 716a647ccd..b84912ba7a 100644
--- a/meta/recipes-core/uclibc/uclibc-git.inc
+++ b/meta/recipes-core/uclibc/uclibc-git.inc
@@ -1,24 +1,19 @@
1SRCREV = "ca1c74d67dd115d059a875150e10b8560a9c35a8" 1SRCREV = "d1b81113b43a6d26dec4e0e58a380895d121006e"
2 2
3PV = "0.9.33+git${SRCPV}" 3PV = "1.0.9+git${SRCPV}"
4 4
5FILESEXTRAPATHS =. "${FILE_DIRNAME}/uclibc-git:" 5FILESEXTRAPATHS =. "${FILE_DIRNAME}/uclibc-git:"
6 6
7SRC_URI = "git://uclibc.org/uClibc.git;branch=master \ 7SRC_URI = "git://uclibc-ng.org/git/uclibc-ng;branch=1.0 \
8 file://0001-Disable-lrount_tes-function.patch \
9 file://0001-Revert-glibc-compat-bump-glibc-minor-version.patch \
10 file://0002-Add-implementation-for-copysignl-for-ppc.patch \
11 file://0003-Add-argp-implementation.patch \
12 file://libc-stdlib-canonicalize_file_name-memory-leak.patch \
8 file://uClibc.machine \ 13 file://uClibc.machine \
9 file://uClibc.distro \ 14 file://uClibc.distro \
10 file://obstack.cfg \ 15 file://obstack.cfg \
11 file://locale.cfg \ 16 file://locale.cfg \
12 file://0001-Disable-lrount_tes-function.patch \
13 file://0002-Add-implementation-for-copysignl-for-ppc.patch \
14 file://0003-Add-argp-implementation.patch \
15 file://0004-Dont-support-localised-optimizations-this-helps-to-h.patch \
16 file://0005-Always-use-O2-for-compiling-fork.c.patch \
17 file://0006-ldso-limited-support-for-ORIGIN-in-rpath.patch \
18 file://0007-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch \
19 file://0001-gcc5-optimizes-away-the-write-only-static-functions-.patch \
20 file://0001-fcntl-Add-AT_EMPTY_PATH-for-all-and-O_PATH-for-arm.patch \
21 file://0001-wire-in-syncfs.patch \
22" 17"
23S = "${WORKDIR}/git" 18S = "${WORKDIR}/git"
24 19
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-Revert-glibc-compat-bump-glibc-minor-version.patch b/meta/recipes-core/uclibc/uclibc-git/0001-Revert-glibc-compat-bump-glibc-minor-version.patch
new file mode 100644
index 0000000000..72d010932a
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-Revert-glibc-compat-bump-glibc-minor-version.patch
@@ -0,0 +1,28 @@
1From f9f566849ad0785b2fd3fd6c4c5d324f9f822aac Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 13 Dec 2015 17:25:11 +0000
4Subject: [PATCH] Revert "glibc compat: bump glibc minor version"
5
6This reverts commit 4ff3a6c8eb91db71d6dc3d2932b66e848bd20ac3.
7---
8Upstream-Status: Inappropriate [ OE-Specific ]
9
10 include/features.h | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/include/features.h b/include/features.h
14index f6fbbf4..dcf1348 100644
15--- a/include/features.h
16+++ b/include/features.h
17@@ -393,7 +393,7 @@ uClibc was built without large file support enabled.
18 these macros to test for features in specific releases. */
19 /* Don't do it, if you want to keep uClibc happy. */
20 #define __GLIBC__ 2
21-#define __GLIBC_MINOR__ 10
22+#define __GLIBC_MINOR__ 2
23 #endif
24
25 #define __GLIBC_PREREQ(maj, min) \
26--
272.6.4
28
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-fcntl-Add-AT_EMPTY_PATH-for-all-and-O_PATH-for-arm.patch b/meta/recipes-core/uclibc/uclibc-git/0001-fcntl-Add-AT_EMPTY_PATH-for-all-and-O_PATH-for-arm.patch
deleted file mode 100644
index 6942db4624..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0001-fcntl-Add-AT_EMPTY_PATH-for-all-and-O_PATH-for-arm.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From 4c8f5fe7d41493e8e181941ae5a01713155f44d1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 15 Oct 2015 15:34:39 +0000
4Subject: [PATCH] fcntl: Add AT_EMPTY_PATH for all and O_PATH for arm
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8Upstream-Status: Pending
9
10 include/fcntl.h | 3 +++
11 libc/sysdeps/linux/arm/bits/fcntl.h | 1 +
12 2 files changed, 4 insertions(+)
13
14diff --git a/include/fcntl.h b/include/fcntl.h
15index 11000dd..8a7ad9b 100644
16--- a/include/fcntl.h
17+++ b/include/fcntl.h
18@@ -65,6 +65,9 @@ __BEGIN_DECLS
19 # define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
20 # define AT_EACCESS 0x200 /* Test access permitted for
21 effective IDs, not real IDs. */
22+# ifdef __USE_GNU
23+# define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname. */
24+# endif
25 #endif
26
27 /* Do the file control operation described by CMD on FD.
28diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h
29index aedc154..c6ba958 100644
30--- a/libc/sysdeps/linux/arm/bits/fcntl.h
31+++ b/libc/sysdeps/linux/arm/bits/fcntl.h
32@@ -50,6 +50,7 @@
33 # define O_DIRECT 0200000 /* Direct disk access. */
34 # define O_NOATIME 01000000 /* Do not set atime. */
35 # define O_CLOEXEC 02000000 /* Set close_on_exec. */
36+# define O_PATH 010000000 /* Resolve pathname but do not open file. */
37 #endif
38
39 /* For now Linux has synchronisity options for data and read operations.
40--
412.6.1
42
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-gcc5-optimizes-away-the-write-only-static-functions-.patch b/meta/recipes-core/uclibc/uclibc-git/0001-gcc5-optimizes-away-the-write-only-static-functions-.patch
deleted file mode 100644
index e622f87ba9..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0001-gcc5-optimizes-away-the-write-only-static-functions-.patch
+++ /dev/null
@@ -1,51 +0,0 @@
1From 2659fb25d32f4b29c1c96aa5730fe40e19d53ab0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 14 Oct 2015 17:38:37 -0700
4Subject: [PATCH] gcc5 optimizes away the write only static functions and we
5 end up with
6
7 librt/librt_so.a(rt-unwind-resume.oS): In function `_Unwind_Resume':
8 rt-unwind-resume.c:(.text+0x3c): undefined reference to `libgcc_s_resume'
9 collect2: error: ld returned 1 exit status
10 make[2]: *** [lib/librt.so] Error 1
11
12marking these functions explicitly used with __attribute_used__ avoids
13that optimization.
14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17Upstream-Status: Pending
18
19 libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c | 2 +-
20 libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c | 2 +-
21 2 files changed, 2 insertions(+), 2 deletions(-)
22
23diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
24index f4d6f41..0c2edd7 100644
25--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
26+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
27@@ -27,7 +27,7 @@
28 #define __libc_fatal(x) {/*write(STDERR_FILENO, x, strlen(x));*/ abort();}
29
30 static void *libgcc_s_handle;
31-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
32+static void (*libgcc_s_resume) (struct _Unwind_Exception *exc) __attribute_used__;
33 static _Unwind_Reason_Code (*libgcc_s_personality)
34 (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
35 static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
36diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c
37index f9a4ffb..f0c3047 100644
38--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c
39+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c
40@@ -25,7 +25,7 @@
41 #define __libc_dlclose dlclose
42 #define __libc_fatal(x) {/*write(STDERR_FILENO, x, strlen(x));*/ abort();}
43
44-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
45+static void (*libgcc_s_resume) (struct _Unwind_Exception *exc) __attribute_used__;
46 static _Unwind_Reason_Code (*libgcc_s_personality)
47 (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
48
49--
502.6.1
51
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-wire-in-syncfs.patch b/meta/recipes-core/uclibc/uclibc-git/0001-wire-in-syncfs.patch
deleted file mode 100644
index 079ad6b3b4..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0001-wire-in-syncfs.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1From 4f2db1b46bda5e376245ec36198b137709f069e8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 15 Oct 2015 17:03:37 +0000
4Subject: [PATCH] wire in syncfs
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8Upstream-Status: Pending
9
10 include/unistd.h | 2 +-
11 libc/sysdeps/linux/common/syncfs.c | 13 +++++++++++++
12 2 files changed, 14 insertions(+), 1 deletion(-)
13 create mode 100644 libc/sysdeps/linux/common/syncfs.c
14
15diff --git a/include/unistd.h b/include/unistd.h
16index 3793d2d..d01bb08 100644
17--- a/include/unistd.h
18+++ b/include/unistd.h
19@@ -1073,7 +1073,7 @@ extern char *getpass (const char *__prompt) __nonnull ((1));
20 extern int fsync (int __fd);
21 #endif /* Use BSD || X/Open || Unix98. */
22
23-#if 0 /*def __USE_GNU */
24+#ifdef __USE_GNU
25 /* Make all changes done to all files on the file system associated
26 * with FD actually appear on disk. */
27 extern int syncfs (int __fd) __THROW;
28diff --git a/libc/sysdeps/linux/common/syncfs.c b/libc/sysdeps/linux/common/syncfs.c
29new file mode 100644
30index 0000000..d2eed05
31--- /dev/null
32+++ b/libc/sysdeps/linux/common/syncfs.c
33@@ -0,0 +1,13 @@
34+/* vi: set sw=4 ts=4: */
35+/*
36+ * fsync() for uClibc
37+ *
38+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
39+ *
40+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
41+ */
42+
43+#include <sys/syscall.h>
44+#include <unistd.h>
45+
46+_syscall1(int, syncfs, int, fd)
47--
482.6.1
49
diff --git a/meta/recipes-core/uclibc/uclibc-git/0004-Dont-support-localised-optimizations-this-helps-to-h.patch b/meta/recipes-core/uclibc/uclibc-git/0004-Dont-support-localised-optimizations-this-helps-to-h.patch
deleted file mode 100644
index 629e13c762..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0004-Dont-support-localised-optimizations-this-helps-to-h.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 31785c544abe8b215dbb2264fb11ee7051515797 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 16 Aug 2015 20:58:59 -0700
4Subject: [PATCH 4/7] Dont support localised optimizations this helps to have a
5 global -O level
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9Upstream-Status: Pending
10
11 libpthread/nptl/pthread_mutex_timedlock.c | 2 ++
12 1 file changed, 2 insertions(+)
13
14diff --git a/libpthread/nptl/pthread_mutex_timedlock.c b/libpthread/nptl/pthread_mutex_timedlock.c
15index 04187f6..f56f6c5 100644
16--- a/libpthread/nptl/pthread_mutex_timedlock.c
17+++ b/libpthread/nptl/pthread_mutex_timedlock.c
18@@ -28,7 +28,9 @@
19 * error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
20 */
21 int
22+#ifndef __OPTIMIZE__
23 attribute_optimize("Os")
24+#endif
25 pthread_mutex_timedlock (
26 pthread_mutex_t *mutex,
27 const struct timespec *abstime)
28--
292.1.4
30
diff --git a/meta/recipes-core/uclibc/uclibc-git/0005-Always-use-O2-for-compiling-fork.c.patch b/meta/recipes-core/uclibc/uclibc-git/0005-Always-use-O2-for-compiling-fork.c.patch
deleted file mode 100644
index ad9b246ab5..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0005-Always-use-O2-for-compiling-fork.c.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 883debc22e30a947fe5858cc07ee5aebd3d07a2e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 16 Aug 2015 20:59:56 -0700
4Subject: [PATCH 5/7] Always use -O2 for compiling fork.c
5
6When compiling in thumb mode for arm with -Os gcc gives up since it can
7not find registers to spill. So we use -O2 option for compiling fork.c
8It may be addressable in gcc.
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12Upstream-Status: Pending
13
14 libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch | 6 ++++++
15 1 file changed, 6 insertions(+)
16
17diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
18index 0ea0b29..0767e9c 100644
19--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
20+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
21@@ -21,3 +21,9 @@ ASFLAGS-pt-vfork.S = -marm
22 CFLAGS-OMIT-pt-vfork.S = -mthumb
23 ASFLAGS-vfork.S = -marm
24 CFLAGS-OMIT-vfork.S = -mthumb
25+
26+# For arm fork.c does not compile with -Os when compiling
27+# in thumb1 mode
28+ifeq ($(COMPILE_IN_THUMB_MODE),y)
29+CFLAGS-fork.c = -O2
30+endif
31--
322.1.4
33
diff --git a/meta/recipes-core/uclibc/uclibc-git/0006-ldso-limited-support-for-ORIGIN-in-rpath.patch b/meta/recipes-core/uclibc/uclibc-git/0006-ldso-limited-support-for-ORIGIN-in-rpath.patch
deleted file mode 100644
index f0d87371bc..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0006-ldso-limited-support-for-ORIGIN-in-rpath.patch
+++ /dev/null
@@ -1,233 +0,0 @@
1From b40c129ed2d53b69463883a5422dd4a012a398f9 Mon Sep 17 00:00:00 2001
2From: Junling Zheng <zhengjunling@huawei.com>
3Date: Fri, 3 Apr 2015 05:02:27 +0000
4Subject: [PATCH 6/7] ldso: limited support for $ORIGIN in rpath
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Derived from:
10http://lists.busybox.net/pipermail/uclibc/2011-March/045003.html
11
12However, the above patch introduced '_dl_strchr' in ldso/ldso/dl-elf.c,
13and caused the following undefined referencing compiling error:
14
15 | .../libdl.a(libdl.os): In function `search_for_named_library':
16 | .../dl-elf.c:156: undefined reference to `_dl_strchr'
17 | collect2: error: ld returned 1 exit status
18
19This problem would be reproduced through compiling gdb in static mode
20using uclibc.
21
22So, add the definition of '_dl_strchr' to fix it. The '_dl_strstr' is
23added as well.
24
25Upstream-Status: Submitted
26
27Signed-off-by: Timo Teräs <timo.teras at iki.fi>
28Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
29Signed-off-by: Khem Raj <raj.khem@gmail.com>
30---
31Upstream-Status: Pending
32
33 ldso/include/dl-string.h | 2 ++
34 ldso/ldso/dl-elf.c | 79 +++++++++++++++++++++++++-----------------------
35 ldso/ldso/ldso.c | 18 +++++++++--
36 3 files changed, 59 insertions(+), 40 deletions(-)
37
38diff --git a/ldso/include/dl-string.h b/ldso/include/dl-string.h
39index aacad10..14ae617 100644
40--- a/ldso/include/dl-string.h
41+++ b/ldso/include/dl-string.h
42@@ -204,7 +204,9 @@ static __always_inline char * _dl_get_last_path_component(char *path)
43 # define _dl_strcat strcat
44 # define _dl_strcpy strcpy
45 # define _dl_strcmp strcmp
46+# define _dl_strchr strchr
47 # define _dl_strrchr strrchr
48+# define _dl_strstr strstr
49 # define _dl_memcpy memcpy
50 # define _dl_memcmp memcmp
51 # define _dl_memset memset
52diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
53index 5631905..6ab7afe 100644
54--- a/ldso/ldso/dl-elf.c
55+++ b/ldso/ldso/dl-elf.c
56@@ -133,56 +133,60 @@ _dl_protect_relro (struct elf_resolve *l)
57 * in uClibc/ldso/util/ldd.c */
58 static struct elf_resolve *
59 search_for_named_library(const char *name, unsigned rflags, const char *path_list,
60- struct dyn_elf **rpnt)
61+ struct dyn_elf **rpnt, const char* origin)
62 {
63- char *path, *path_n, *mylibname;
64+ char *mylibname;
65+ const char *p, *pn;
66 struct elf_resolve *tpnt;
67- int done;
68+ int plen;
69
70 if (path_list==NULL)
71 return NULL;
72
73- /* We need a writable copy of this string, but we don't
74- * need this allocated permanently since we don't want
75- * to leak memory, so use alloca to put path on the stack */
76- done = _dl_strlen(path_list);
77- path = alloca(done + 1);
78-
79 /* another bit of local storage */
80 mylibname = alloca(2050);
81
82- _dl_memcpy(path, path_list, done+1);
83-
84 /* Unlike ldd.c, don't bother to eliminate double //s */
85
86 /* Replace colons with zeros in path_list */
87 /* : at the beginning or end of path maps to CWD */
88 /* :: anywhere maps CWD */
89 /* "" maps to CWD */
90- done = 0;
91- path_n = path;
92- do {
93- if (*path == 0) {
94- *path = ':';
95- done = 1;
96+ for (p = path_list; p != NULL; p = pn) {
97+ pn = _dl_strchr(p + 1, ':');
98+ if (pn != NULL) {
99+ plen = pn - p;
100+ pn++;
101+ } else
102+ plen = _dl_strlen(p);
103+
104+ if (plen >= 7 && _dl_memcmp(p, "$ORIGIN", 7) == 0) {
105+ int olen;
106+ if (rflags && plen != 7)
107+ continue;
108+ if (origin == NULL)
109+ continue;
110+ for (olen = _dl_strlen(origin) - 1; olen >= 0 && origin[olen] != '/'; olen--)
111+ ;
112+ if (olen <= 0)
113+ continue;
114+ _dl_memcpy(&mylibname[0], origin, olen);
115+ _dl_memcpy(&mylibname[olen], p + 7, plen - 7);
116+ mylibname[olen + plen - 7] = 0;
117+ } else if (plen != 0) {
118+ _dl_memcpy(mylibname, p, plen);
119+ mylibname[plen] = 0;
120+ } else {
121+ _dl_strcpy(mylibname, ".");
122 }
123- if (*path == ':') {
124- *path = 0;
125- if (*path_n)
126- _dl_strcpy(mylibname, path_n);
127- else
128- _dl_strcpy(mylibname, "."); /* Assume current dir if empty path */
129- _dl_strcat(mylibname, "/");
130- _dl_strcat(mylibname, name);
131+ _dl_strcat(mylibname, "/");
132+ _dl_strcat(mylibname, name);
133 #ifdef __LDSO_SAFE_RUNPATH__
134- if (*mylibname == '/')
135+ if (*mylibname == '/')
136 #endif
137- if ((tpnt = _dl_load_elf_shared_library(rflags, rpnt, mylibname)) != NULL)
138- return tpnt;
139- path_n = path+1;
140- }
141- path++;
142- } while (!done);
143+ if ((tpnt = _dl_load_elf_shared_library(rflags, rpnt, mylibname)) != NULL)
144+ return tpnt;
145+ }
146 return NULL;
147 }
148
149@@ -234,7 +238,8 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp
150 if (pnt) {
151 pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB];
152 _dl_if_debug_dprint("\tsearching RPATH='%s'\n", pnt);
153- if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt)) != NULL)
154+ if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt,
155+ tpnt->libname)) != NULL)
156 return tpnt1;
157 }
158 #endif
159@@ -243,7 +248,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp
160 /* Check in LD_{ELF_}LIBRARY_PATH, if specified and allowed */
161 if (_dl_library_path) {
162 _dl_if_debug_dprint("\tsearching LD_LIBRARY_PATH='%s'\n", _dl_library_path);
163- if ((tpnt1 = search_for_named_library(libname, rflags, _dl_library_path, rpnt)) != NULL)
164+ if ((tpnt1 = search_for_named_library(libname, rflags, _dl_library_path, rpnt, NULL)) != NULL)
165 {
166 return tpnt1;
167 }
168@@ -257,7 +262,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp
169 if (pnt) {
170 pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB];
171 _dl_if_debug_dprint("\tsearching RUNPATH='%s'\n", pnt);
172- if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt)) != NULL)
173+ if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt, NULL)) != NULL)
174 return tpnt1;
175 }
176 #endif
177@@ -291,7 +296,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp
178 /* Look for libraries wherever the shared library loader
179 * was installed */
180 _dl_if_debug_dprint("\tsearching ldso dir='%s'\n", _dl_ldsopath);
181- tpnt1 = search_for_named_library(libname, rflags, _dl_ldsopath, rpnt);
182+ tpnt1 = search_for_named_library(libname, rflags, _dl_ldsopath, rpnt, NULL);
183 if (tpnt1 != NULL)
184 return tpnt1;
185 #endif
186@@ -304,7 +309,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp
187 #ifndef __LDSO_CACHE_SUPPORT__
188 ":" UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib"
189 #endif
190- , rpnt);
191+ , rpnt, NULL);
192 if (tpnt1 != NULL)
193 return tpnt1;
194
195diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
196index f38f9e3..3812908 100644
197--- a/ldso/ldso/ldso.c
198+++ b/ldso/ldso/ldso.c
199@@ -402,6 +402,20 @@ static ptrdiff_t _dl_build_local_scope (struct elf_resolve **list,
200 p += _dl_build_local_scope (p, q->tpnt);
201 return p - list;
202 }
203+
204+static void _dl_setup_progname(const char *argv0)
205+{
206+ char image[PATH_MAX];
207+ ssize_t s;
208+
209+ s = _dl_readlink("/proc/self/exe", image, sizeof(image));
210+ if (s > 0 && image[0] == '/') {
211+ image[s] = 0;
212+ _dl_progname = _dl_strdup(image);
213+ } else if (argv0) {
214+ _dl_progname = argv0;
215+ }
216+}
217
218 void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
219 ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv
220@@ -454,9 +468,7 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
221 * been fixed up by now. Still no function calls outside of this
222 * library, since the dynamic resolver is not yet ready.
223 */
224- if (argv[0]) {
225- _dl_progname = argv[0];
226- }
227+ _dl_setup_progname(argv[0]);
228
229 #ifdef __DSBT__
230 _dl_ldso_dsbt = (void *)tpnt->dynamic_info[DT_DSBT_BASE_IDX];
231--
2322.1.4
233
diff --git a/meta/recipes-core/uclibc/uclibc-git/0007-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch b/meta/recipes-core/uclibc/uclibc-git/0007-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch
deleted file mode 100644
index ee932c3803..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0007-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From 90516af9f776f9c2835b47fc52775dcb307a85ac Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 23 Jun 2012 15:59:01 -0700
4Subject: [PATCH 7/7] nptl/atfork: Hide pthread_atfork in shared versions
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Upstream-Status: Pending
8---
9 libpthread/nptl/Makefile.in | 3 ++-
10 1 file changed, 2 insertions(+), 1 deletion(-)
11
12diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
13index 55eeba2..8cb8fa9 100644
14--- a/libpthread/nptl/Makefile.in
15+++ b/libpthread/nptl/Makefile.in
16@@ -16,6 +16,7 @@ libc-shared-routines-y = forward.c libc-cancellation.c
17 libc-static-routines-y = alloca_cutoff.c libc-cancellation.c
18 libpthread-shared-only-routines-y = version.c
19 libpthread-static-only-routines-y = pthread_atfork.c
20+
21 libpthread-routines- += $(notdir $(wildcard $(libpthread_DIR)/gen_*.c)) # dummy generated files
22 libpthread-routines- += allocatestack.c # dummy included by pthread_create.c
23 libpthread-routines- += pthread_mutex_getprioceiling.c pthread_mutex_setprioceiling.c # XXX: delete those or use them!
24@@ -201,7 +202,7 @@ CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables
25 CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
26
27 CFLAGS-pt-system.c = -fexceptions -I$(top_srcdir)libc/stdlib
28-
29+CFLAGS-pthread_atfork.c = -DNOT_IN_libc
30 #
31 # The rest of this file is uClibc specific.
32 #
33--
342.1.4
35
diff --git a/meta/recipes-core/uclibc/uclibc-git/libc-stdlib-canonicalize_file_name-memory-leak.patch b/meta/recipes-core/uclibc/uclibc-git/libc-stdlib-canonicalize_file_name-memory-leak.patch
new file mode 100644
index 0000000000..83d21e2ec7
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/libc-stdlib-canonicalize_file_name-memory-leak.patch
@@ -0,0 +1,95 @@
1From patchwork Wed Oct 21 06:02:30 2015
2Content-Type: text/plain; charset="utf-8"
3MIME-Version: 1.0
4Content-Transfer-Encoding: 7bit
5Subject: libc/stdlib: canonicalize_file_name() memory leak
6From: =?utf-8?q?Wojciech_Nizi=C5=84ski?= <niziak@spox.org>
7X-Patchwork-Id: 533608
8Message-Id: <loom.20151021T080015-833@post.gmane.org>
9To: uclibc@uclibc.org
10Date: Wed, 21 Oct 2015 06:02:30 +0000 (UTC)
11
12System based on Buildroot 2014.11
13 Linux 3.10.88
14 uclibc 0.9.33.2 (also with 1.0.2)
15 systemd 216
16 gcc 4.8.3 (also with 4.9.2)
17
18Bug:
19 After 2 days system is out of memory. PID 1 (systemd) is allocating.
20 over 120MB od RAM..
21 Just after reboot PID 1 is taking only about 600kB.
22
23How to reproduce:
24 With every systemd service reload or restart, heap of PID 1 grows.
25 Try with command:
26 watch -n1 \
27 'systemctl stop systemd-sysctl ; grep heap /proc/1/smaps -A15; free'
28
29Source of bug:
30
31 Uclibc's canonicalize_file_name() is allocating temprary buffer of.
32 4kB (PATH_MAX), and passing it to realpath() as second argument..
33 Function canonicalize... is not checking if realpath() fails and.
34 memory is lost.
35
36 Backtrace:
37 #0 malloc (bytes=4096) at libc/stdlib/malloc-standard/malloc.c:844
38 #1 canonicalize_file_name.
39 (name="/etc/systemd/system/systemd-sysctl.service.d") at.
40 libc/stdlib/canonicalize.c:30
41 #2 path_strv_resolve (...) at src/shared/path-util.c:275
42
43Solution:
44 Do not use temporary buffer like in eglibc.
45 Function realpath() will be responsible for allocation.
46
47From: Wojciech Nizinski <w.nizinski@grinn-global.com>
48Date: Tue, 20 Oct 2015 14:08:09 +0200
49Subject: [PATCH]libc/stdlib: canonicalize_file_name() memory leak
50
51Uclibc's canonicalize_file_name() is allocating temprary buffer of 4kB
52(PATH_MAX), and passing it to realpath() as second argument. Function is
53not checking if realpath() fails and memory is lost.
54---
55Upstream-Status: Submitted
56
57 libc/stdlib/canonicalize.c | 21 +--------------------
58 1 file changed, 1 insertion(+), 20 deletions(-)
59
60diff --git a/libc/stdlib/canonicalize.c b/libc/stdlib/canonicalize.c
61index 06e710a..da09d58 100644
62--- a/libc/stdlib/canonicalize.c
63+++ b/libc/stdlib/canonicalize.c
64@@ -9,30 +9,11 @@
65 */
66
67 #include <stdlib.h>
68-#include <limits.h>
69
70 #ifdef __USE_GNU
71
72-#ifndef PATH_MAX
73-# ifdef _POSIX_VERSION
74-# define PATH_MAX _POSIX_PATH_MAX
75-# else
76-# ifdef MAXPATHLEN
77-# define PATH_MAX MAXPATHLEN
78-# else
79-# define PATH_MAX 1024
80-# endif
81-# endif
82-#endif
83-
84 char * canonicalize_file_name (const char *name)
85 {
86- char *buf = (char *) malloc(PATH_MAX);
87-
88- if(unlikely(buf == NULL))
89- return NULL;
90-
91- *buf='\0';
92- return realpath (name, buf);
93+ return realpath (name, NULL);
94 }
95 #endif
diff --git a/meta/recipes-core/uclibc/uclibc-git/uClibc.distro b/meta/recipes-core/uclibc/uclibc-git/uClibc.distro
index 3827b66e9e..7785ce8bfc 100644
--- a/meta/recipes-core/uclibc/uclibc-git/uClibc.distro
+++ b/meta/recipes-core/uclibc/uclibc-git/uClibc.distro
@@ -79,11 +79,11 @@ UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
79UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9 79UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
80UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y 80UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
81# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set 81# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
82UCLIBC_HAS_STDIO_BUFSIZ_256=y 82# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
83# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set 83# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
84# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set 84# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
85# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set 85# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
86# UCLIBC_HAS_STDIO_BUFSIZ_4096 is not set 86UCLIBC_HAS_STDIO_BUFSIZ_4096=y
87# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set 87# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
88UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y 88UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
89# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set 89# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
diff --git a/meta/recipes-core/uclibc/uclibc.inc b/meta/recipes-core/uclibc/uclibc.inc
index 533aa3d95e..ff7d7448f4 100644
--- a/meta/recipes-core/uclibc/uclibc.inc
+++ b/meta/recipes-core/uclibc/uclibc.inc
@@ -13,7 +13,6 @@ SECTION = "libs"
13LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \ 13LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \
14 file://COPYING.LIB.boilerplate;md5=aaddeadcddeb918297e0e4afc52ce46f \ 14 file://COPYING.LIB.boilerplate;md5=aaddeadcddeb918297e0e4afc52ce46f \
15file://${S}/test/regex/testregex.c;beginline=1;endline=31;md5=234efb227d0a40677f895e4a1e26e960" 15file://${S}/test/regex/testregex.c;beginline=1;endline=31;md5=234efb227d0a40677f895e4a1e26e960"
16PR = "r9"
17 16
18require uclibc-config.inc 17require uclibc-config.inc
19 18
@@ -60,18 +59,13 @@ export V="2"
60CFLAGS_arm := "${@oe_filter_out('-fno-omit-frame-pointer', '${CFLAGS}', d)}" 59CFLAGS_arm := "${@oe_filter_out('-fno-omit-frame-pointer', '${CFLAGS}', d)}"
61UCLIBC_EXTRA_CFLAGS := "${@oe_filter_out('(-I\S+|-i\S+)', '${CFLAGS}', d)}" 60UCLIBC_EXTRA_CFLAGS := "${@oe_filter_out('(-I\S+|-i\S+)', '${CFLAGS}', d)}"
62 61
63do_compile_prepend () {
64 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
65 oe_runmake pregen
66}
67
68configmangle = '/^KERNEL_HEADERS/d; \ 62configmangle = '/^KERNEL_HEADERS/d; \
69 /^RUNTIME_PREFIX/d; \ 63 /^RUNTIME_PREFIX/d; \
70 /^DEVEL_PREFIX/d; \ 64 /^DEVEL_PREFIX/d; \
71 /^SHARED_LIB_LOADER_PREFIX/d; \ 65 /^SHARED_LIB_LOADER_PREFIX/d; \
72 /^UCLIBC_EXTRA_CFLAGS/d; \ 66 /^UCLIBC_EXTRA_CFLAGS/d; \
73 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \ 67 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
74 ${@["","s,.*COMPILE_IN_THUMB_MODE.*,COMPILE_IN_THUMB_MODE=y,;"][d.getVar("ARM_INSTRUCTION_SET", True) != "arm"]} \ 68 ${@["","s,.*COMPILE_IN_THUMB_MODE.*,COMPILE_IN_THUMB_MODE=y,;"][d.getVar("ARM_INSTRUCTION_SET", True) == "thumb"]} \
75 ${@["","s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,;"][d.getVar("USE_NLS", True) == "yes"]} \ 69 ${@["","s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,;"][d.getVar("USE_NLS", True) == "yes"]} \
76 ${@["","s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,;"][d.getVar("TARGET_ARCH", True) in ['mips', 'mipsel', 'mips64', 'mips64el', 'avr32']]} \ 70 ${@["","s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,;"][d.getVar("TARGET_ARCH", True) in ['mips', 'mipsel', 'mips64', 'mips64el', 'avr32']]} \
77 /^CROSS/d; \ 71 /^CROSS/d; \