summaryrefslogtreecommitdiffstats
path: root/package/systemd/systemd-03-uclibc-fix.patch
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-02-12 23:13:00 +0100
committerPeter Korsgaard <peter@korsgaard.com>2014-02-13 21:51:08 +0100
commit55ad3cfd3f9809f4a1f0210fe7c7110d147c54f6 (patch)
tree7ef032528fbed74bbdf918d32ba8c920f56cea53 /package/systemd/systemd-03-uclibc-fix.patch
parent2f78767bb84a5c536a7fc3129b9460acada7426e (diff)
downloadbuildroot-55ad3cfd3f9809f4a1f0210fe7c7110d147c54f6.tar.gz
buildroot-55ad3cfd3f9809f4a1f0210fe7c7110d147c54f6.zip
systemd: fix build with uClibc toolchains
Currently, the build of systemd is broken with the internal toolchain backend, because we have uClibc patches that add support for execvpe(), but we also have a patch for systemd that adds execvpe(), which was added when the internal uClibc didn't support execvpe(). However, simply dropping the patch is not a solution, as it would break the build of systemd with any other uClibc than the ones built with Buildroot. For example, a Crosstool-NG uClibc toolchain would fail. Beyond this execvpe() problem, there are also other problems that prevented systemd from being built with unpatched uClibc. This patch does the following: * Add sequence numbers of systemd patches. * Regenerate them to avoid fuzz. * Improve the uClibc compatibility patch so that it: - Detects whether execvpe() is available or not, and if not available provide an implementation. - Detects if dup3() is available or not, and if not available provide an implementation. - Detects if MSG_CMSG_CLOEXEC is defined or not, and if not, define it to the appropriate value. This has been tested with uClibc internal toolchain, uClibc external toolchain built with Buildroot, uClibc external toolchain built with Crosstool-NG, and glibc external toolchain. Fixes bug #6776. Fixes: http://autobuild.buildroot.org/results/591/591c6055430da334bd1e46e7d01497add45da837/build-end.log http://autobuild.buildroot.org/results/e58/e5851939d2837d4e35a4c1d9ca6df3c93ed5a34b/build-end.log http://autobuild.buildroot.org/results/92e/92e4c40c69a3feb4046b2fe5a0d8c69d5a44a157/build-end.log Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'package/systemd/systemd-03-uclibc-fix.patch')
-rw-r--r--package/systemd/systemd-03-uclibc-fix.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/package/systemd/systemd-03-uclibc-fix.patch b/package/systemd/systemd-03-uclibc-fix.patch
new file mode 100644
index 0000000000..f3b41c1a64
--- /dev/null
+++ b/package/systemd/systemd-03-uclibc-fix.patch
@@ -0,0 +1,84 @@
+[PATCH] fix build with uClibc
+
+Based on OE patch from Khem Raj:
+
+http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch
+
+But extended to also cover execvpe (OE carries a patch adding execvpe
+support to uClibc).
+
+Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
+---
+ src/journal/journal-file.c | 2 ++
+ src/macro.h | 15 +++++++++++++++
+ 2 files changed, 17 insertions(+)
+
+Index: b/src/macro.h
+===================================================================
+--- a/src/macro.h
++++ b/src/macro.h
+@@ -28,6 +28,33 @@
+ #include <sys/uio.h>
+ #include <inttypes.h>
+
++#ifdef __UCLIBC__
++/* uclibc does not implement mkostemp GNU extension */
++#define mkostemp(x,y) mkstemp(x)
++/* uclibc may not define MSG_CMSG_CLOEXEC */
++#if defined HAVE_DECL_MSG_CMSG_CLOEXEC && !HAVE_DECL_MSG_CMSG_CLOEXEC
++#define MSG_CMSG_CLOEXEC 0x40000000
++#endif
++/* uclibc does not implement execvpe GNU extension */
++#ifndef HAVE_EXECVPE
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE
++#endif
++#include <unistd.h>
++static inline int execvpe(const char *file, char *const argv[],
++ char *const envp[])
++{
++ environ = (char **)envp;
++ return execvp(file, argv);
++}
++#endif /* HAVE_EXECVPE */
++#ifndef HAVE_DUP3
++#include <asm/unistd.h>
++static inline int dup3(int oldfd, int newfd, int flags) {
++ return syscall(__NR_dup3, oldfd, newfd, flags);
++}
++#endif /* HAVE_DUP3 */
++#endif /* __UCLIBC__ */
+ #define _printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
+ #define _sentinel_ __attribute__ ((sentinel))
+ #define _noreturn_ __attribute__((noreturn))
+Index: b/src/journal/journal-file.c
+===================================================================
+--- a/src/journal/journal-file.c
++++ b/src/journal/journal-file.c
+@@ -229,11 +229,13 @@
+ }
+ }
+
++#ifndef __UCLIBC__
+ /* Note that the glibc fallocate() fallback is very
+ inefficient, hence we try to minimize the allocation area
+ as we can. */
+ if (posix_fallocate(f->fd, old_size, new_size - old_size) < 0)
+ return -errno;
++#endif
+
+ if (fstat(f->fd, &f->last_stat) < 0)
+ return -errno;
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -111,6 +111,8 @@
+
+ AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
+ AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
++AC_CHECK_FUNCS([execvpe dup3])
++AC_CHECK_DECLS([MSG_CMSG_CLOEXEC], [], [], [#include <sys/socket.h>])
+
+ save_LIBS="$LIBS"
+ LIBS=
OpenPOWER on IntegriCloud