* [Buildroot] [PATCH] trinity: fix build with glibc 2.27
@ 2018-03-13 7:19 Baruch Siach
2018-03-13 8:26 ` Peter Korsgaard
0 siblings, 1 reply; 2+ messages in thread
From: Baruch Siach @ 2018-03-13 7:19 UTC (permalink / raw)
To: buildroot
glibc 2.27 added a system call wrapper for memfd_create() which collides
with the local definition of the same symbol in trinity. Add a patch to
detect the presence of memfd_create(), and avoid collision.
Fixes:
http://autobuild.buildroot.net/results/fda/fda07327395921fdc79cbb4f24b662209fee1be1/
http://autobuild.buildroot.net/results/f98/f98f43657cbf519a626257af5a21c8c228423856/
http://autobuild.buildroot.net/results/575/57558c418ea5c5011ac22e5236beff4d823c825b/
Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
.../0002-memfd-fix-build-with-glibc-2.27.patch | 87 ++++++++++++++++++++++
1 file changed, 87 insertions(+)
create mode 100644 package/trinity/0002-memfd-fix-build-with-glibc-2.27.patch
diff --git a/package/trinity/0002-memfd-fix-build-with-glibc-2.27.patch b/package/trinity/0002-memfd-fix-build-with-glibc-2.27.patch
new file mode 100644
index 000000000000..9ea3634688ca
--- /dev/null
+++ b/package/trinity/0002-memfd-fix-build-with-glibc-2.27.patch
@@ -0,0 +1,87 @@
+From c93bb184ce996c4d77eefbae2ab0bf74f396ec45 Mon Sep 17 00:00:00 2001
+From: Baruch Siach <baruch@tkos.co.il>
+Date: Tue, 13 Mar 2018 06:53:06 +0200
+Subject: [PATCH] memfd: fix build with glibc 2.27
+
+glibc 2.27 added a wrapper for memfd_create(). This causes build
+failure:
+
+fds/memfd.c:19:12: error: static declaration of 'memfd_create' follows non-static declaration
+ static int memfd_create(__unused__ const char *uname, __unused__ unsigned int flag)
+ ^~~~~~~~~~~~
+
+Don't use the local definition when the libc provides one.
+
+Signed-off-by: Baruch Siach <baruch@tkos.co.il>
+---
+Upstream status: https://github.com/kernelslacker/trinity/pull/23
+
+ configure | 23 +++++++++++++++++++++++
+ fds/memfd.c | 3 +++
+ 2 files changed, 26 insertions(+)
+
+diff --git a/configure b/configure
+index dc0a87d8c1ad..c0166af33048 100755
+--- a/configure
++++ b/configure
+@@ -288,6 +288,29 @@ else
+ echo "#define USE_BTRFS 1" >> $CONFIGH
+ fi
+
++#############################################################################################
++# Does glibc provide memfd_create() syscall wrapper
++#
++echo -n "[*] Checking if glibc provides memfd_create.. "
++rm -f "$TMP" || exit 1
++
++cat >"$TMP.c" << EOF
++#include <sys/mman.h>
++
++void main()
++{
++ memfd_create();
++}
++EOF
++
++${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log"
++if [ ! -x "$TMP" ]; then
++ echo $RED "[NO]" $COL_RESET
++else
++ echo $GREEN "[YES]" $COL_RESET
++ echo "#define USE_MEMFD_CREATE 1" >> $CONFIGH
++fi
++
+ #############################################################################################
+
+ check_header linux/caif/caif_socket.h USE_CAIF
+diff --git a/fds/memfd.c b/fds/memfd.c
+index 210678e4571c..aaaac2f78f54 100644
+--- a/fds/memfd.c
++++ b/fds/memfd.c
+@@ -5,6 +5,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <sys/mman.h>
+
+ #include "fd.h"
+ #include "memfd.h"
+@@ -16,6 +17,7 @@
+ #include "trinity.h"
+ #include "udp.h"
+
++#ifndef USE_MEMFD_CREATE
+ static int memfd_create(__unused__ const char *uname, __unused__ unsigned int flag)
+ {
+ #ifdef SYS_memfd_create
+@@ -24,6 +26,7 @@ static int memfd_create(__unused__ const char *uname, __unused__ unsigned int fl
+ return -ENOSYS;
+ #endif
+ }
++#endif
+
+ static void memfd_destructor(struct object *obj)
+ {
+--
+2.16.1
+
--
2.16.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Buildroot] [PATCH] trinity: fix build with glibc 2.27
2018-03-13 7:19 [Buildroot] [PATCH] trinity: fix build with glibc 2.27 Baruch Siach
@ 2018-03-13 8:26 ` Peter Korsgaard
0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2018-03-13 8:26 UTC (permalink / raw)
To: buildroot
>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
> glibc 2.27 added a system call wrapper for memfd_create() which collides
> with the local definition of the same symbol in trinity. Add a patch to
> detect the presence of memfd_create(), and avoid collision.
> Fixes:
> http://autobuild.buildroot.net/results/fda/fda07327395921fdc79cbb4f24b662209fee1be1/
> http://autobuild.buildroot.net/results/f98/f98f43657cbf519a626257af5a21c8c228423856/
> http://autobuild.buildroot.net/results/575/57558c418ea5c5011ac22e5236beff4d823c825b/
> Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Committed, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-13 8:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 7:19 [Buildroot] [PATCH] trinity: fix build with glibc 2.27 Baruch Siach
2018-03-13 8:26 ` Peter Korsgaard
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.