Skip to contentSkip to conversation

sysprof: avoid namesapace conflict with glibc headers

PATCH New Khem Raj 1 participant 5 messages Jan 16, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/5 sysprof: avoid namesapace conflict with glibc headers

---
 ...rof-ui-Rename-environ-to-sys_environ.patch | 63 +++++++++++++++++++
 .../recipes-kernel/sysprof/sysprof_3.34.1.bb  |  5 +-
 2 files changed, 66 insertions(+), 2 deletions(-)
 create mode 100644 meta-gnome/recipes-kernel/sysprof/files/0001-libsysprof-ui-Rename-environ-to-sys_environ.patch
meta-gnome/recipes-kernel/sysprof/files/0001-libsysprof-ui-Rename-environ-to-sys_environ.patch new file +63 -0
new file mode 100644
index 0000000000..1e2b3c92b4
@@ -0,0 +1,63 @@
+From 4bd0d5d5dd6841fbac8385527617d18e7731244d Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 15 Jan 2020 13:17:58 -0800
+Subject: [PATCH] libsysprof-ui: Rename environ to sys_environ
+
+This helps avoid namesapace conflict with glibc headers
+
+Fixes
+/usr/include/unistd.h:545:15: note: previous declaration is here
+
+extern char **environ;
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/libsysprof-ui/sysprof-profiler-assistant.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/libsysprof-ui/sysprof-profiler-assistant.c b/src/libsysprof-ui/sysprof-profiler-assistant.c
+index 22e3e24..c55d551 100644
+--- a/src/libsysprof-ui/sysprof-profiler-assistant.c
++++ b/src/libsysprof-ui/sysprof-profiler-assistant.c
+@@ -235,7 +235,7 @@ sysprof_profiler_assistant_record_clicked_cb (SysprofProfilerAssistant *self,
+     {
+       g_auto(GStrv) argv = NULL;
+       g_auto(GStrv) env = NULL;
+-      SysprofEnviron *environ;
++      SysprofEnviron *sys_environ;
+       const gchar *command;
+       gint argc;
+ 
+@@ -245,8 +245,8 @@ sysprof_profiler_assistant_record_clicked_cb (SysprofProfilerAssistant *self,
+       sysprof_profiler_set_spawn (profiler, TRUE);
+       sysprof_profiler_set_spawn_argv (profiler, (const gchar * const *)argv);
+ 
+-      environ = sysprof_environ_editor_get_environ (self->environ_editor);
+-      env = sysprof_environ_get_environ (environ);
++      sys_environ = sysprof_environ_editor_get_environ (self->environ_editor);
++      env = sysprof_environ_get_environ (sys_environ);
+       sysprof_profiler_set_spawn_env (profiler, (const gchar * const *)env);
+ 
+       sysprof_profiler_set_spawn_inherit_environ (profiler,
+@@ -405,7 +405,7 @@ sysprof_profiler_assistant_class_init (SysprofProfilerAssistantClass *klass)
+ static void
+ sysprof_profiler_assistant_init (SysprofProfilerAssistant *self)
+ {
+-  g_autoptr(SysprofEnviron) environ = sysprof_environ_new ();
++  g_autoptr(SysprofEnviron) sys_environ = sysprof_environ_new ();
+ 
+   gtk_widget_init_template (GTK_WIDGET (self));
+ 
+@@ -445,7 +445,7 @@ sysprof_profiler_assistant_init (SysprofProfilerAssistant *self)
+                            self,
+                            G_CONNECT_SWAPPED);
+ 
+-  sysprof_environ_editor_set_environ (self->environ_editor, environ);
++  sysprof_environ_editor_set_environ (self->environ_editor, sys_environ);
+ }
+ 
+ void
+-- 
+2.25.0
+
meta-gnome/recipes-kernel/sysprof/sysprof_3.34.1.bb +3 -2
index fd1b77eced..920bf10d65 100644
@@ -12,8 +12,9 @@ DEPENDS = "glib-2.0 libxml2-native glib-2.0-native"
 SRC_URI[archive.md5sum] = "cc32455277b31afb1965d627ae3e3629"
 SRC_URI[archive.sha256sum] = "844bbb8d8b65071b3bca96f8e921319ceef81f2d2c51fcc9da63a4b355c893d0"
 SRC_URI += "file://0001-sysprof-Define-NT_GNU_BUILD_ID-if-undefined.patch \
-           file://0001-meson.build-do-not-hardcode-linux-as-host_machine-.s.patch \
-           "
+            file://0001-meson.build-do-not-hardcode-linux-as-host_machine-.s.patch \
+            file://0001-libsysprof-ui-Rename-environ-to-sys_environ.patch \
+            "
 
 PACKAGECONFIG ?= "sysprofd libsysprof ${@bb.utils.contains_any('DISTRO_FEATURES', '${GTK3DISTROFEATURES}', 'gtk', '', d)}"
 PACKAGECONFIG[gtk] = "-Denable_gtk=true,-Denable_gtk=false,gtk+3 libdazzle"
Signature · 1 line
2.25.0
author
#1 lore raw

PATCH 2/5 jack: Use c++ compiler for programs which use c++ source files

---
 ...ts-Use-c-compiler-for-jack_simdtests.patch | 33 +++++++++++++++++++
 .../recipes-multimedia/jack/jack_1.19.14.bb   |  6 +++-
 2 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-multimedia/jack/jack/0001-example-clients-Use-c-compiler-for-jack_simdtests.patch
meta-oe/recipes-multimedia/jack/jack/0001-example-clients-Use-c-compiler-for-jack_simdtests.patch new file +33 -0
new file mode 100644
index 0000000000..dda21a32d8
@@ -0,0 +1,33 @@
+From 76b8a389268275cc13f3b4e61394d40b24ec56f1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 15 Jan 2020 20:21:58 -0800
+Subject: [PATCH] example-clients: Use c++ compiler for jack_simdtests
+
+It uses c++ sources and runtime therefore its best to use c++ compiler
+to build it so it can find the correct runtime, cross compiling with
+clang fails
+
+x86_64-yoe-linux-ld: example-clients/simdtests.cpp.28.o: undefined reference to symbol '__cxa_call_unexpected@@CXXABI_1.3'
+
+Upstream-Status: Submitted [https://github.com/jackaudio/jack2/pull/536]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ example-clients/wscript | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/example-clients/wscript b/example-clients/wscript
+index a8857aa7..df9435aa 100644
+--- a/example-clients/wscript
++++ b/example-clients/wscript
+@@ -69,6 +69,8 @@ def build(bld):
+ 
+         if bld.env['IS_MACOSX']:
+             prog = bld(features='c cprogram', framework = ['Foundation'])
++        elif example_program == 'jack_simdtests':
++            prog = bld(features='cxx cxxprogram')
+         else:
+             prog = bld(features='c cprogram')
+         prog.includes = os_incdir + ['../common/jack', '../common']
+-- 
+2.25.0
+
meta-oe/recipes-multimedia/jack/jack_1.19.14.bb +5 -1
index cebc952661..3f3d53f608 100644
@@ -14,7 +14,9 @@ LIC_FILES_CHKSUM = " \
 
 DEPENDS = "libsamplerate0 libsndfile1 readline"
 
-SRC_URI = "git://github.com/jackaudio/jack2.git"
+SRC_URI = "git://github.com/jackaudio/jack2.git \
+           file://0001-example-clients-Use-c-compiler-for-jack_simdtests.patch \
+          "
 SRCREV = "b54a09bf7ef760d81fdb8544ad10e45575394624"
 
 S = "${WORKDIR}/git"
@@ -30,6 +32,8 @@ PACKAGECONFIG[opus] = "--opus=yes,--opus=no,libopus"
 # portaudio is for windows builds only
 EXTRA_OECONF = "--portaudio=no"
 
+export CC = "${CXX}"
+
 do_install_append() {
 	if ! ${@bb.utils.contains('PACKAGECONFIG', 'dbus', True, False, d)}; then
 		rm -f ${D}${bindir}/jack_control
Signature · 1 line
2.25.0
author
#2 lore raw

PATCH 3/5 iozone3: Do not define prototype for pread64()

In reply to Khem Raj

Use the one from system headers

---
 ...1-let-system-headers-provide-pread64.patch | 34 +++++++++++++++++++
 .../recipes-benchmark/iozone3/iozone3_488.bb  |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta-oe/recipes-benchmark/iozone3/iozone3/0001-let-system-headers-provide-pread64.patch
meta-oe/recipes-benchmark/iozone3/iozone3/0001-let-system-headers-provide-pread64.patch new file +34 -0
new file mode 100644
index 0000000000..a61a56a71d
@@ -0,0 +1,34 @@
+From 64389a67b93a53b9fb7e9e20e905a5ee4613606b Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 15 Jan 2020 17:10:42 -0800
+Subject: [PATCH] let system headers provide pread64()
+
+The signature does not match with system headers anyway
+
+Fixes
+
+iozone.c:1270:9: error: redeclaration of 'pread64' must have the 'overloadable' attribute                                                                       ssize_t pread64();                                                                      ^                                                                       /mnt/b/yoe/build/tmp/work/core2-64-yoe-linux/iozone3/488-r0/recipe-sysroot/usr/include/bits/unistd.h:83:1: note: previous overload of function is here          pread64 (int __fd, void *const __clang_pass_object_size0 __buf,                 ^
+1 error generated.
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ iozone.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/iozone.c b/iozone.c
+index 090dd5f..fdea400 100644
+--- a/iozone.c
++++ b/iozone.c
+@@ -1267,7 +1267,6 @@ int pit_gettimeofday();
+ #ifdef HAVE_ANSIC_C
+ #if defined (HAVE_PREAD) && defined(_LARGEFILE64_SOURCE)
+ ssize_t pwrite64(); 
+-ssize_t pread64(); 
+ #endif
+ #if !defined(linux)
+ char *getenv();
+-- 
+2.25.0
+
meta-oe/recipes-benchmark/iozone3/iozone3_488.bb +1 -0
index 5885b145e9..4d9e07765f 100644
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://iozone.c;beginline=37;endline=48;md5=7331260091868dca
 "
 SRC_URI = "http://www.iozone.org/src/current/${BPN}_${PV}.tar \
     file://parallelism.patch \
+    file://0001-let-system-headers-provide-pread64.patch \
     file://copyright.txt \
 "
 SRC_URI[md5sum] = "d60a69e44cda8436f4f94d860958efc2"
Signature · 1 line
2.25.0
author
#3 lore raw

PATCH 4/5 libhugetlbfs: Fix missing file mode in create() API

In reply to Khem Raj
---
 ...dd-explicit-permissions-to-open-call.patch | 41 +++++++++++++++++++
 .../libhugetlbfs/libhugetlbfs_git.bb          |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/0001-tests-add-explicit-permissions-to-open-call.patch
meta-oe/recipes-benchmark/libhugetlbfs/files/0001-tests-add-explicit-permissions-to-open-call.patch new file +41 -0
new file mode 100644
index 0000000000..9d52b908e9
@@ -0,0 +1,41 @@
+From d07d2f9601b49bb72cd4b36838f0c238bd1b0fc1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 15 Jan 2020 18:45:09 -0800
+Subject: [PATCH] tests: add explicit permissions to open() call
+
+Fixes
+gethugepagesizes.c:227:35: error: open with O_CREAT in second argument needs 3 arguments
+|         fd = open(fname, O_WRONLY|O_CREAT);
+|                                          ^
+
+Upstream-Status: Submitted [https://groups.google.com/forum/#!topic/libhugetlbfs/anNtDXbQKro]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ tests/gethugepagesizes.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tests/gethugepagesizes.c b/tests/gethugepagesizes.c
+index 9551b38..5777265 100644
+--- a/tests/gethugepagesizes.c
++++ b/tests/gethugepagesizes.c
+@@ -223,7 +223,7 @@ void setup_fake_data(long sizes[], int n_elem)
+ 		FAIL("mkdtemp: %s", strerror(errno));
+ 
+ 	sprintf(fname, "%s/meminfo-none", fake_meminfo);
+-	fd = open(fname, O_WRONLY|O_CREAT);
++	fd = open(fname, O_WRONLY|O_CREAT, 0600);
+ 	if (fd < 0)
+ 		FAIL("open: %s", strerror(errno));
+ 	if (write(fd, meminfo_base,
+@@ -233,7 +233,7 @@ void setup_fake_data(long sizes[], int n_elem)
+ 		FAIL("close: %s", strerror(errno));
+ 
+ 	sprintf(fname, "%s/meminfo-hugepages", fake_meminfo);
+-	fd = open(fname, O_WRONLY|O_CREAT);
++	fd = open(fname, O_WRONLY|O_CREAT, 0600);
+ 	if (fd < 0)
+ 		FAIL("open: %s", strerror(errno));
+ 	if (write(fd, meminfo_base,
+-- 
+2.25.0
+
meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb +1 -0
index f258122790..e66db1a090 100644
@@ -24,6 +24,7 @@ SRC_URI = " \
     file://0004-shm.c-Mark-glibc-specific-changes-so.patch \
     file://0005-Include-dirent.h-for-ino_t.patch \
     file://0006-include-limits.h-for-PATH_MAX.patch \
+    file://0001-tests-add-explicit-permissions-to-open-call.patch \
 "
 
 UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
Signature · 1 line
2.25.0
author
#4 lore raw

PATCH 5/5 rdma-core: Use overloadable attribute with clang

In reply to Khem Raj

This ensures that clang is not fussy about overloading recvfrom()

---
 ...se-overloadable-attribute-with-clang.patch | 42 +++++++++++++++++++
 .../rdma-core/rdma-core_27.0.bb               |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta-networking/recipes-support/rdma-core/rdma-core/0001-Use-overloadable-attribute-with-clang.patch
meta-networking/recipes-support/rdma-core/rdma-core/0001-Use-overloadable-attribute-with-clang.patch new file +42 -0
new file mode 100644
index 0000000000..1ba6847d2f
@@ -0,0 +1,42 @@
+From 42976ed0a0160864b41680604ea9cdb3c175cb94 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 15 Jan 2020 17:48:28 -0800
+Subject: [PATCH] Use overloadable attribute with clang
+
+This is overriding the libc implementation
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ librdmacm/preload.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/librdmacm/preload.c b/librdmacm/preload.c
+index d46beb1b..b451de50 100644
+--- a/librdmacm/preload.c
++++ b/librdmacm/preload.c
+@@ -59,6 +59,12 @@
+ #include "cma.h"
+ #include "indexer.h"
+ 
++#ifdef __clang__
++#define OVERLOAD  __attribute__((overloadable)) 
++#else
++#define OVERLOAD
++#endif
++
+ struct socket_calls {
+ 	int (*socket)(int domain, int type, int protocol);
+ 	int (*bind)(int socket, const struct sockaddr *addr, socklen_t addrlen);
+@@ -793,7 +799,7 @@ ssize_t recv(int socket, void *buf, size_t len, int flags)
+ 		rrecv(fd, buf, len, flags) : real.recv(fd, buf, len, flags);
+ }
+ 
+-ssize_t recvfrom(int socket, void *buf, size_t len, int flags,
++ssize_t OVERLOAD recvfrom(int socket, void *buf, size_t len, int flags,
+ 		 struct sockaddr *src_addr, socklen_t *addrlen)
+ {
+ 	int fd;
+-- 
+2.25.0
+
meta-networking/recipes-support/rdma-core/rdma-core_27.0.bb +1 -0
index 361d69b337..417979dc33 100644
@@ -9,6 +9,7 @@ BRANCH = "stable-v${@d.getVar('PV').split('.')[0]}"
 SRC_URI = "git://github.com/linux-rdma/rdma-core.git;branch=${BRANCH} \
            file://0001-Remove-man-files-which-cant-be-built.patch \
            file://0001-librdmacm-Use-sched_yield-instead-of-pthread_yield.patch \
+           file://0001-Use-overloadable-attribute-with-clang.patch \
            "
 SRCREV = "84caf035ae6123e2296b72006cd2cf698c65eb46"
 S = "${WORKDIR}/git"
Signature · 1 line
2.25.0