Skip to contentSkip to conversation

ltrace: Fix build with clang16

PATCH New Khem Raj 1 participant 2 messages Feb 7, 2023

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 ltrace: Fix build with clang16

---
 ...001-Fix-type-of-single-bit-bitfields.patch | 86 +++++++++++++++++++
 meta-oe/recipes-devtools/ltrace/ltrace_git.bb |  1 +
 2 files changed, 87 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/ltrace/ltrace/0001-Fix-type-of-single-bit-bitfields.patch
meta-oe/recipes-devtools/ltrace/ltrace/0001-Fix-type-of-single-bit-bitfields.patch new file +86 -0
new file mode 100644
index 0000000000..61932269bd
@@ -0,0 +1,86 @@
+From 491b3b153f6b5cbf2d23a9778e5676eb29a6705f Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 6 Feb 2023 16:37:19 -0800
+Subject: [PATCH] Fix type of single bit bitfields
+
+clang16 warns
+trace.c:311:22: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
+
+quash the warning by using an unsigned type to allow
+an assignment of 0 or 1 without implicit conversion.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ library.h                 |  6 +++---
+ prototype.h               |  2 +-
+ sysdeps/linux-gnu/trace.h | 10 +++++-----
+ 3 files changed, 9 insertions(+), 9 deletions(-)
+
+--- a/library.h
++++ b/library.h
+@@ -71,20 +71,20 @@ struct library_symbol {
+ 	 * looking up one in LIB->protolib.  */
+ 	struct prototype *proto;
+ 
+-	int own_name : 1;
++	unsigned int own_name : 1;
+ 
+ 	/* This is relevant for PLT symbols.  Latent PLT symbols are
+ 	 * those that don't match any of the -e rules, but that might
+ 	 * potentially become active if a library implementing them
+ 	 * appears that matches a -l rule.  Ltrace core is responsible
+ 	 * for clearing latent flag.  */
+-	int latent : 1;
++	unsigned latent : 1;
+ 
+ 	/* Delayed symbols are those for which a breakpoint shouldn't
+ 	 * be enabled yet.  They are similar to latent symbols, but
+ 	 * backend is responsible for clearing the delayed flag.  See
+ 	 * proc_activate_delayed_symbol.  */
+-	int delayed : 1;
++	unsigned int delayed : 1;
+ 
+ 	struct arch_library_symbol_data arch;
+ 	struct os_library_symbol_data os;
+--- a/prototype.h
++++ b/prototype.h
+@@ -162,7 +162,7 @@ struct protolib_cache {
+ 
+ 	/* For tracking uses of cache during cache's own
+ 	 * initialization.  */
+-	int bootstrap : 1;
++	unsigned int bootstrap : 1;
+ };
+ 
+ /* Initialize CACHE.  Returns 0 on success or a negative value on
+--- a/sysdeps/linux-gnu/trace.h
++++ b/sysdeps/linux-gnu/trace.h
+@@ -33,11 +33,11 @@
+ struct pid_task {
+ 	pid_t pid;	/* This may be 0 for tasks that exited
+ 			 * mid-handling.  */
+-	int sigstopped : 1;
+-	int got_event : 1;
+-	int delivered : 1;
+-	int vforked : 1;
+-	int sysret : 1;
++	unsigned int sigstopped : 1;
++	unsigned int got_event : 1;
++	unsigned int delivered : 1;
++	unsigned int vforked : 1;
++	unsigned int sysret : 1;
+ };
+ 
+ struct pid_set {
+--- a/sysdeps/linux-gnu/trace.c
++++ b/sysdeps/linux-gnu/trace.c
+@@ -1043,7 +1043,7 @@ ltrace_exiting_install_handler(struct pr
+ struct process_vfork_handler
+ {
+ 	struct event_handler super;
+-	int vfork_bp_refd:1;
++	unsigned int vfork_bp_refd:1;
+ };
+ 
+ static Event *
meta-oe/recipes-devtools/ltrace/ltrace_git.bb +1 -0
index 72bec301fb..976bb482aa 100644
@@ -31,6 +31,7 @@ SRC_URI = "git://github.com/sparkleholic/ltrace.git;branch=master;protocol=http;
            file://0001-ppc-Remove-unused-host_powerpc64-function.patch \
            file://0001-mips-Use-hardcodes-values-for-ABI-syscall-bases.patch \
            file://0001-ppc-plt-do-not-free-symbol-libsym.patch \
+           file://0001-Fix-type-of-single-bit-bitfields.patch \
            "
 SRC_URI:append:libc-musl = " file://add_ppc64le.patch"
 
Signature · 1 line
2.39.1
author
#1 lore raw

PATCH 2/2 oprofile: Do not use std::bind2nd

std::bind2nd is removed from c++17, therefore re-implement with generic lambda

---
 ...lace-std-bind2nd-with-generic-lambda.patch | 34 +++++++++++++++++++
 .../recipes-kernel/oprofile/oprofile_1.4.0.bb |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta-oe/recipes-kernel/oprofile/oprofile/0001-Replace-std-bind2nd-with-generic-lambda.patch
meta-oe/recipes-kernel/oprofile/oprofile/0001-Replace-std-bind2nd-with-generic-lambda.patch new file +34 -0
new file mode 100644
index 0000000000..930b90e289
@@ -0,0 +1,34 @@
+From 5d879cb4f23c613e16b3f479ab09bbb5ff340201 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 6 Feb 2023 17:02:41 -0800
+Subject: [PATCH] Replace std::bind2nd with generic lambda
+
+std::bind2nd is gone in c++17, therefore stop using it and replace it
+with generic lambda from c++14 onwards
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ libutil++/growable_vector.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libutil++/growable_vector.h b/libutil++/growable_vector.h
+index 350246a..9846e1e 100644
+--- a/libutil++/growable_vector.h
++++ b/libutil++/growable_vector.h
+@@ -93,9 +93,9 @@ public:
+ 
+ 	/// return true if all elements have the default constructed value
+ 	bool zero() const {
+-		return std::find_if(container.begin(), container.end(),
+-	                            std::bind2nd(std::not_equal_to<T>(), T()))
+-					== container.end();
++		return std::find_if(begin(container), end(container),
++				[&](auto const& elem) {return elem != T();})
++			== end(container);
+ 	}
+ 
+ private:
+-- 
+2.39.1
+
meta-oe/recipes-kernel/oprofile/oprofile_1.4.0.bb +1 -0
index e6eec0ab05..335ab48bb2 100644
@@ -31,6 +31,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \
            file://0009-Prevent-running-check-tests-on-host-if-cross-compili.patch \
            file://0010-oprofile-Determine-the-root-home-directory-dynamical.patch \
            file://0001-configure-Include-unistd.h-for-getpid-API.patch \
+           file://0001-Replace-std-bind2nd-with-generic-lambda.patch \
 "
 SRC_URI[sha256sum] = "7ba06f99d7c188389d20d1d5e53ee690c7733f87aa9af62bd664fa0ca235a412"
 
Signature · 1 line
2.39.1