diff mbox series

[V2] debugedit: fix build failure when enabling DEBUG_BUILD

Message ID 20250220043120.2347746-1-Qi.Chen@windriver.com
State New
Headers show
Series [V2] debugedit: fix build failure when enabling DEBUG_BUILD | expand

Commit Message

Chen, Qi Feb. 20, 2025, 4:31 a.m. UTC
From: Chen Qi <Qi.Chen@windriver.com>

When DEBUG_BUILD is enabled, we use "-Og" gcc options. In such
case, the xxhash functions are considered not inline, yet debugedit.c
defined XXH_INLINE_ALL to force inline, thus causing build failure.

Backport a patch which add "--disable-inlined-xxhash" option and
make debugedit use that option when DEBUG_BUILD is enabled.

The 0003-Makefile.am-do-not-update-manual.patch is moved from musl
specific patch to SRC_URI, because we now have a patch to modify debugedit.c
and this will cause manual to be generated again. This is unnecessary and
will report help2man missing.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 .../debugedit/debugedit_5.1.bb                |  6 +-
 ...on-to-allow-disabling-inlined-xxhash.patch | 81 +++++++++++++++++++
 2 files changed, 84 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-devtools/debugedit/files/0001-Add-option-to-allow-disabling-inlined-xxhash.patch

Comments

Alexander Kanavin Feb. 20, 2025, 10:28 a.m. UTC | #1
On Thu, 20 Feb 2025 at 05:31, Chen Qi via lists.openembedded.org
<Qi.Chen=windriver.com@lists.openembedded.org> wrote:
> +Upstream-Status: Backport [820498e881401a6f4b1715dc6831da965f6e1d69]

This doesn't say where the commit can be found. It's better to point
to the git web ui:

https://sourceware.org/cgit/debugedit/commit/?id=820498e881401a6f4b1715dc6831da965f6e1d69

Alex
Chen, Qi Feb. 20, 2025, 12:45 p.m. UTC | #2
Got it. I'll send out V3.

Regards,
Qi

-----Original Message-----
From: Alexander Kanavin <alex.kanavin@gmail.com> 
Sent: Thursday, February 20, 2025 6:28 PM
To: Chen, Qi <Qi.Chen@windriver.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core][PATCH V2] debugedit: fix build failure when enabling DEBUG_BUILD

On Thu, 20 Feb 2025 at 05:31, Chen Qi via lists.openembedded.org <Qi.Chen=windriver.com@lists.openembedded.org> wrote:
> +Upstream-Status: Backport [820498e881401a6f4b1715dc6831da965f6e1d69]

This doesn't say where the commit can be found. It's better to point to the git web ui:

https://sourceware.org/cgit/debugedit/commit/?id=820498e881401a6f4b1715dc6831da965f6e1d69

Alex
diff mbox series

Patch

diff --git a/meta/recipes-devtools/debugedit/debugedit_5.1.bb b/meta/recipes-devtools/debugedit/debugedit_5.1.bb
index 00c40473c4..384909a36f 100644
--- a/meta/recipes-devtools/debugedit/debugedit_5.1.bb
+++ b/meta/recipes-devtools/debugedit/debugedit_5.1.bb
@@ -10,9 +10,7 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
                     file://COPYING3;md5=d32239bcb673463ab874e80d47fae504"
 
 SRC_URI = "https://sourceware.org/ftp/debugedit/${PV}/debugedit-${PV}.tar.xz \
-           "
-
-SRC_URI:append:libc-musl = "\
+           file://0001-Add-option-to-allow-disabling-inlined-xxhash.patch \
            file://0003-Makefile.am-do-not-update-manual.patch \
            "
 
@@ -25,6 +23,8 @@  inherit pkgconfig autotools multilib_script
 
 RDEPENDS:${PN} += "bash elfutils-binutils"
 
+EXTRA_OECONF = "${@oe.utils.vartrue('DEBUG_BUILD', '--disable-inlined-xxhash', '', d)}"
+
 BBCLASSEXTEND = "native nativesdk"
 
 MULTILIB_SCRIPTS = "${PN}:${bindir}/find-debuginfo"
diff --git a/meta/recipes-devtools/debugedit/files/0001-Add-option-to-allow-disabling-inlined-xxhash.patch b/meta/recipes-devtools/debugedit/files/0001-Add-option-to-allow-disabling-inlined-xxhash.patch
new file mode 100644
index 0000000000..bd03ea278f
--- /dev/null
+++ b/meta/recipes-devtools/debugedit/files/0001-Add-option-to-allow-disabling-inlined-xxhash.patch
@@ -0,0 +1,81 @@ 
+From 820498e881401a6f4b1715dc6831da965f6e1d69 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 18 Feb 2025 18:50:46 -0800
+Subject: [PATCH] Add option to allow disabling inlined xxhash
+
+xxhash cannot always inline. For example, when using gcc14 and
+'-Og' option, xxhash cannot inline. See links below:
+https://github.com/Cyan4973/xxHash/commit/574aabad87b2ab9440403e92e1075ef48554eb87
+https://github.com/Cyan4973/xxHash/issues/943#issuecomment-2563205130
+
+To allow users successfully build debugedit with gcc14 and "-Og" option,
+add an option to allow disabling inlined xxhash.
+
+This patch refers to a similar patch for libabigail:
+https://sourceware.org/cgit/libabigail/commit/?id=50497911e2590c21270e0763d277457cf7752c3f
+
+Note that the default remains using inlined xxhash.
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+Upstream-Status: Backport [820498e881401a6f4b1715dc6831da965f6e1d69]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ Makefile.am       |  4 ++--
+ configure.ac      | 11 +++++++++++
+ tools/debugedit.c |  1 -
+ 3 files changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index c590edf..35fd947 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -42,8 +42,8 @@ find-debuginfo: $(top_srcdir)/scripts/find-debuginfo.in Makefile
+ 
+ debugedit_SOURCES = tools/debugedit.c \
+ 		    tools/hashtab.c 
+-debugedit_CFLAGS = @LIBELF_CFLAGS@ @LIBDW_CFLAGS@ $(AM_CFLAGS)
+-debugedit_LDADD = @LIBELF_LIBS@ @LIBDW_LIBS@
++debugedit_CFLAGS = @LIBELF_CFLAGS@ @LIBDW_CFLAGS@ @XXHASH_CFLAGS@ $(AM_CFLAGS)
++debugedit_LDADD = @LIBELF_LIBS@ @LIBDW_LIBS@ @XXHASH_LIBS@
+ 
+ sepdebugcrcfix_SOURCES = tools/sepdebugcrcfix.c
+ sepdebugcrcfix_CFLAGS = @LIBELF_CFLAGS@ $(AM_CFLAGS)
+diff --git a/configure.ac b/configure.ac
+index a5a6e28..32dd27d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -181,6 +181,17 @@ else
+ fi
+ AC_SUBST([READELF_VERSION_OK])
+ 
++ENABLE_INLINED_XXHASH=yes
++AC_ARG_ENABLE(inlined-xxhash,
++	AS_HELP_STRING([--disable-inlined-xxhash], [disable the inlined-only version of xxhash library]),
++	ENABLE_INLINED_XXHASH=$enableval,
++	ENABLE_INLINED_XXHASH=yes)
++
++if test x$ENABLE_INLINED_XXHASH = xyes; then
++	XXHASH_CFLAGS="$XXHASH_CFLAGS -DXXH_INLINE_ALL"
++	XXHASH_LIBS=""
++fi
++
+ # And generate the output files.
+ AC_CONFIG_FILES([Makefile])
+ AC_OUTPUT
+diff --git a/tools/debugedit.c b/tools/debugedit.c
+index beefd65..43f9cee 100644
+--- a/tools/debugedit.c
++++ b/tools/debugedit.c
+@@ -82,7 +82,6 @@ typedef struct Ebl_Strtab	Strtab;
+ 
+ #include "tools/hashtab.h"
+ 
+-#define XXH_INLINE_ALL
+ #include "xxhash.h"
+ 
+ #define DW_TAG_partial_unit 0x3c
+-- 
+2.25.1
+