From patchwork Thu Sep 24 15:57:25 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 99186 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07130C98324 for ; Thu, 24 Sep 2026 15:57:38 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1756.1790265453431256870 for ; Thu, 24 Sep 2026 08:57:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=AyGQzLTw; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B8271E4D for ; Thu, 24 Sep 2026 08:57:29 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 73C853F86F for ; Thu, 24 Sep 2026 08:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1790265452; bh=/qVjxrvD9NZah2XBudSbnDd5ERwEAkKpvTD1e+va82c=; h=From:To:Subject:Date:From; b=AyGQzLTwQbDFiPJ2DJPJ6YW4lOchvNRL/KCyAox03njEMd4JstX4GbNW+NY65pI67 VpN3SqhyIAd6gKItpdAS2xHfZ9YBSVXAkQzq56Apc10WgfEumtHU6ZW0S4NE0dI00L rHLynPAdFbYOgvc8EAMj62DRQI2uIv+6sAGm6nr4= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/4] lib/oe/package: remove unused and optional fatal argument to source_info() Date: Thu, 24 Sep 2026 16:57:25 +0100 Message-ID: <20260924155728.295458-1-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 24 Sep 2026 15:57:38 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/246590 Nothing uses this, so clean up the code slightly. Signed-off-by: Ross Burton --- meta/lib/oe/package.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index b7030643d2b..777bf99331c 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -755,7 +755,7 @@ def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output): return debugfiles.keys() -def source_info(file, d, fatal=True): +def source_info(file, d): # Skip static libraries when using Clang toolchain with LTO enabled. # In this case, .a files contain LLVM bitcode instead of ELF objects, # and dwarfsrcfiles cannot process them. @@ -775,9 +775,7 @@ def source_info(file, d, fatal=True): # 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure if retval != 0 and retval != 255: msg = "dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else "") - if fatal: - bb.fatal(msg) - bb.note(msg) + bb.fatal(msg) debugsources = parse_debugsources_from_dwarfsrcfiles_output(output) From patchwork Thu Sep 24 15:57:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 99189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24613C9830E for ; Thu, 24 Sep 2026 15:57:38 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1757.1790265453974712009 for ; Thu, 24 Sep 2026 08:57:34 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=hrlu2XHF; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D4C3B1E5E for ; Thu, 24 Sep 2026 08:57:29 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 12AD23F86F for ; Thu, 24 Sep 2026 08:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1790265453; bh=1ENF1BSai5ceLiQFgsY1I0TgLJO22KCrEbkcnWepRXU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hrlu2XHFboWkFtnH9H5x5b1se62VUTP8Cq7gc955+zSmIp/E2itVm9fEROkNqPrOq Wz/ICE2e021Op9xeJGlFFcYYkcAxrDvHRW0FEMWYGG3q84uHuSnFAcAYkdcOCd98x0 VG5peVEA7YOKrPNwDYUItGrDOBTPgNVnueSoPxCo= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 2/4] elfutils: fix handling of DWARF5 compilation units Date: Thu, 24 Sep 2026 16:57:26 +0100 Message-ID: <20260924155728.295458-2-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260924155728.295458-1-ross.burton@arm.com> References: <20260924155728.295458-1-ross.burton@arm.com> MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 24 Sep 2026 15:57:38 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/246591 If a source file doesn't contain any functions or variable then it won't appear in the source file list for the generated object if the debug information is DWARF5. Details of why this is are in the patch header. Backport a patch from upstream to fix this oversight, adding files to the -src packages that were previously missing. Signed-off-by: Ross Burton --- .../elfutils/elfutils_0.196.bb | 1 + .../elfutils/files/srcfiles.patch | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 meta/recipes-devtools/elfutils/files/srcfiles.patch diff --git a/meta/recipes-devtools/elfutils/elfutils_0.196.bb b/meta/recipes-devtools/elfutils/elfutils_0.196.bb index c2466134cdc..4541000840b 100644 --- a/meta/recipes-devtools/elfutils/elfutils_0.196.bb +++ b/meta/recipes-devtools/elfutils/elfutils_0.196.bb @@ -20,6 +20,7 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \ file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \ file://0001-config-eu.am-do-not-force-Werror.patch \ file://0001-backends-use-sys-uio.h-instead-of-linux-uio.h-for-s.patch \ + file://srcfiles.patch \ " SRC_URI:append:libc-musl = " \ file://0003-musl-utils.patch \ diff --git a/meta/recipes-devtools/elfutils/files/srcfiles.patch b/meta/recipes-devtools/elfutils/files/srcfiles.patch new file mode 100644 index 00000000000..abd0226b0fd --- /dev/null +++ b/meta/recipes-devtools/elfutils/files/srcfiles.patch @@ -0,0 +1,65 @@ +From: Mark Wielaard +To: elfutils-devel@sourceware.org +Cc: ross@burtonini.com, Mark Wielaard +Subject: [PATCH] srcfiles: Always process the "zero" file table entry (CU comp_dir/name) +Date: Tue, 22 Sep 2026 13:46:06 +0200 +Message-ID: <20260922114606.2865660-1-mark@klomp.org> +X-Mailer: git-send-email 2.55.0 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Spam-Flag: NO +X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on gnu.wildebeest.org + +If the main CU file doesn't contain any references to the file table +it wouldn't show up in the src files list (except if --cu-only was +given). This is because file entry "zero" is special. It cannot be +referred to by DW_AT file attributes (because zero means, no +file). But technically it should be equal to (implicitly before +DWARF5) the DW_AT_name of the main CU DIE (using a zero directory +entry, equal to DW_AT_comp_dir). collect_sourcefiles skipped this +implicit zero entry unless --cu-only was given. + +Fix this by always handling the zero file table entry. And for +--cu-only to just exit the loop early, so no other entries are handled +This is also an optimization, before --cu-only would go through all +indexes, but always added the CU name. Which worked, because +duplicates were removed, but was somewhat inefficient. + + * src/srcfiles.cxx (collect_sourcefiles): Go from index + zero, exit after zero index for CU_only, always handle + index zero specially. + +https://sourceware.org/bugzilla/show_bug.cgi?id=34666 + +Signed-off-by: Mark Wielaard + +Upstream-Status: Backport [7b675cbdb0d1f216938b4b33aea30fd35fb1ae0a] +Signed-off-by: Ross Burton +--- + src/srcfiles.cxx | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/srcfiles.cxx b/src/srcfiles.cxx +index 9bbb6ef10473..e2fc0f128d71 100644 +--- a/src/srcfiles.cxx ++++ b/src/srcfiles.cxx +@@ -273,10 +273,14 @@ collect_sourcefiles (Dwfl_Module *dwflmod, + clog << "skipping cu=" << cuname << " due to empty comp_dir" << endl; + continue; + } +- for (size_t f = 1; f < nfiles; ++f) ++ for (size_t f = 0; f < nfiles; ++f) + { ++ /* For --cu-only we are only interested in the "zero" entry. */ ++ if (CU_only && f != 0) ++ break; ++ + const char *hat; +- if (CU_only) ++ if (f == 0) + { + if (strcmp(cuname, "") == 0 || strcmp(cuname, "") == 0 ) + continue; +-- +2.55.0 From patchwork Thu Sep 24 15:57:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 99188 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3149FC98325 for ; Thu, 24 Sep 2026 15:57:38 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.1731.1790265454512144601 for ; Thu, 24 Sep 2026 08:57:34 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=Qk77VxOL; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 68B931E4D for ; Thu, 24 Sep 2026 08:57:30 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9C0083F86F for ; Thu, 24 Sep 2026 08:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1790265453; bh=XfQi1MbTOwCJZq+4iV4tYEmkFKAyHa2jWQWuNnsgHG0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Qk77VxOLkKxeqOL8W/Gdt9GTrGVJMZmV7luUfhwZ9Pkki44O6kQf+7rfYfXXEUQzU O+Kck3UFtg5nYPE6TzIliVaeIjOs5dVDKS8DwqOyaCmIWN9BwlYgVGdXRfRK4a/uBr GWSgTEupC+h1kv2wOQ7cIbzELgCNbC4XRr8prHLA= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 3/4] classes/package: use eu-srcfiles instead of dwarfsrcfiles Date: Thu, 24 Sep 2026 16:57:27 +0100 Message-ID: <20260924155728.295458-3-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260924155728.295458-1-ross.burton@arm.com> References: <20260924155728.295458-1-ross.burton@arm.com> MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 24 Sep 2026 15:57:38 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/246592 elfutils gained a srcfiles command in 0.190[1], which is essentially the same as our dwarfsrcfiles. This obsoletes our dwarfsrcfiles, so change the packaging class to use it instead of dwarfsrcfiles. Apart from removing code we need to maintain, eu-srcfiles also has better output and results in some more source files being identified. Across a core-image-sato, the following changes occur from more source files being added to the -src packages: curl-src: PKGSIZE changed from 6198005 to 8919864 (+44%) flac-src: PKGSIZE changed from 2282162 to 2526447 (+11%) libjpeg-turbo-src: PKGSIZE changed from 2673297 to 2977880 (+11%) libseccomp-src: PKGSIZE changed from 716039 to 1048204 (+46%) sbc-src: PKGSIZE changed from 110274 to 176011 (+60%) [1] elfutils cb4f0e0f ("PR 30000: debuginfod-find should have a source-list verb") Signed-off-by: Ross Burton --- meta/classes-global/package.bbclass | 4 ++-- meta/lib/oe/package.py | 28 +++------------------------- 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/meta/classes-global/package.bbclass b/meta/classes-global/package.bbclass index e21350a06f4..b54f4c0063a 100644 --- a/meta/classes-global/package.bbclass +++ b/meta/classes-global/package.bbclass @@ -57,8 +57,8 @@ LOCALE_SECTION ?= '' ALL_MULTILIB_PACKAGE_ARCHS = "${@oe.utils.all_multilib_tune_values(d, 'PACKAGE_ARCHS')}" # rpm is used for the per-file dependency identification -# dwarfsrcfiles is used to determine the list of debug source files -PACKAGE_DEPENDS += "rpm-native dwarfsrcfiles-native" +# elfutils is used to determine the list of debug source files (eu-srcfiles) +PACKAGE_DEPENDS += "rpm-native elfutils-native" # If your postinstall can execute at rootfs creation time rather than on # target but depends on a native/cross tool in order to execute, you need to diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index 777bf99331c..5d4966be295 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -746,15 +746,6 @@ def package_debug_vars(d): return debug_vars -def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output): - debugfiles = {} - - for line in dwarfsrcfiles_output.splitlines(): - if line.startswith("\t"): - debugfiles[os.path.normpath(line.split()[0])] = "" - - return debugfiles.keys() - def source_info(file, d): # Skip static libraries when using Clang toolchain with LTO enabled. # In this case, .a files contain LLVM bitcode instead of ELF objects, @@ -764,22 +755,9 @@ def source_info(file, d): bb.debug(1, "Skipping dwarfsrcfiles for Clang LTO archive: %s" % file) return [] - cmd = ["dwarfsrcfiles", file] - try: - output = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT) - retval = 0 - except subprocess.CalledProcessError as exc: - output = exc.output - retval = exc.returncode - - # 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure - if retval != 0 and retval != 255: - msg = "dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else "") - bb.fatal(msg) - - debugsources = parse_debugsources_from_dwarfsrcfiles_output(output) - - return list(debugsources) + cmd = ["eu-srcfiles", "--null", "--debuginfo-path=/not/exist", "--executable", file] + output = subprocess.check_output(cmd, text=True, stderr=subprocess.STDOUT) + return output.split("\0") def splitdebuginfo(file, dvar, dv, d): # Function to split a single file into two components, one is the stripped From patchwork Thu Sep 24 15:57:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 99187 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C537EC98321 for ; Thu, 24 Sep 2026 15:57:37 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.1731.1790265454512144601 for ; Thu, 24 Sep 2026 08:57:35 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=SDKsF5uv; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0211B1E5E for ; Thu, 24 Sep 2026 08:57:31 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 31D853F86F for ; Thu, 24 Sep 2026 08:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1790265454; bh=ljYwY0tCdMoVANkUU4dWzaIxQzmGEKASnyB+Ncg0+Kk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SDKsF5uvFZDrQtu7W8CoG/V643sfWqSoLSeXFgcFMGLsAIDDBmgPs+V68aXRwIfCI agjVOL8wIYtLXcUy3rIjsR62qrz+yoEOJlJeVy/cLXquOqv9csj8p/CZor6gtToej7 8g6eA9zikQik+bUYFe9IbMKgmvBwh65AqZ3zD8UQ= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 4/4] dwarfsrcfiles: remove Date: Thu, 24 Sep 2026 16:57:28 +0100 Message-ID: <20260924155728.295458-4-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260924155728.295458-1-ross.burton@arm.com> References: <20260924155728.295458-1-ross.burton@arm.com> MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 24 Sep 2026 15:57:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/246593 We now use srcfiles from elfutils, so we can delete this. Signed-off-by: Ross Burton --- meta/conf/distro/include/maintainers.inc | 1 - .../dwarfsrcfiles/dwarfsrcfiles.bb | 25 ---- .../dwarfsrcfiles/files/dwarfsrcfiles.c | 118 ------------------ 3 files changed, 144 deletions(-) delete mode 100644 meta/recipes-devtools/dwarfsrcfiles/dwarfsrcfiles.bb delete mode 100644 meta/recipes-devtools/dwarfsrcfiles/files/dwarfsrcfiles.c diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index 53f5e6bf92a..3b2342527c3 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc @@ -165,7 +165,6 @@ RECIPE_MAINTAINER:pn-dosfstools = "Yi Zhao " RECIPE_MAINTAINER:pn-dpkg = "Unassigned " RECIPE_MAINTAINER:pn-dropbear = "Yi Zhao " RECIPE_MAINTAINER:pn-dtc = "Wang Mingyu " -RECIPE_MAINTAINER:pn-dwarfsrcfiles = "Unassigned " RECIPE_MAINTAINER:pn-e2fsprogs = "Robert Yang " RECIPE_MAINTAINER:pn-ed = "Unassigned " RECIPE_MAINTAINER:pn-efibootmgr = "Ross Burton " diff --git a/meta/recipes-devtools/dwarfsrcfiles/dwarfsrcfiles.bb b/meta/recipes-devtools/dwarfsrcfiles/dwarfsrcfiles.bb deleted file mode 100644 index c1eca13107b..00000000000 --- a/meta/recipes-devtools/dwarfsrcfiles/dwarfsrcfiles.bb +++ /dev/null @@ -1,25 +0,0 @@ -SUMMARY = "A small utility for printing debug source file locations embedded in binaries" -DESCRIPTION = "${SUMMARY}" -LICENSE = "GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://dwarfsrcfiles.c;md5=31483894e453a77acbb67847565f1b5c;beginline=1;endline=8" - -SRC_URI = "file://dwarfsrcfiles.c" -BBCLASSEXTEND = "native" -DEPENDS = "elfutils" -DEPENDS:append:libc-musl = " argp-standalone" - -S = "${UNPACKDIR}" - -do_compile () { - ${CC} ${CFLAGS} ${LDFLAGS} -o dwarfsrcfiles ${S}/dwarfsrcfiles.c -lelf -ldw -} - -do_compile:libc-musl () { - ${CC} ${CFLAGS} ${LDFLAGS} -o dwarfsrcfiles ${S}/dwarfsrcfiles.c -lelf -ldw -largp -} - -do_install () { - install -d ${D}${bindir} - install -t ${D}${bindir} dwarfsrcfiles -} - diff --git a/meta/recipes-devtools/dwarfsrcfiles/files/dwarfsrcfiles.c b/meta/recipes-devtools/dwarfsrcfiles/files/dwarfsrcfiles.c deleted file mode 100644 index 9eb5ca807ad..00000000000 --- a/meta/recipes-devtools/dwarfsrcfiles/files/dwarfsrcfiles.c +++ /dev/null @@ -1,118 +0,0 @@ -// dwarfsrcfiles.c - Get source files associated with the dwarf in a elf file. -// gcc -Wall -g -O2 -lelf -ldw -o dwarfsrcfiles dwarfsrcfiles.c -// -// Copyright (C) 2011, Mark Wielaard -// -// This file is free software. You can redistribute it and/or modify -// it under the terms of the GNU General Public License (GPL); either -// version 2, or (at your option) any later version. - -#include -#include -#include - -#include -#include -#include - -static int -process_cu (Dwarf_Die *cu_die) -{ - Dwarf_Attribute attr; - const char *name; - const char *dir = NULL; - - Dwarf_Files *files; - size_t n; - int i; - - if (dwarf_tag (cu_die) != DW_TAG_compile_unit) - { - fprintf (stderr, "DIE isn't a compile unit"); - return -1; - } - - if (dwarf_attr (cu_die, DW_AT_name, &attr) == NULL) - { - fprintf(stderr, "CU doesn't have a DW_AT_name"); - return -1; - } - - name = dwarf_formstring (&attr); - if (name == NULL) - { - fprintf(stderr, "Couldn't get DW_AT_name as string, %s", - dwarf_errmsg (-1)); - return -1; - } - - if (dwarf_attr (cu_die, DW_AT_comp_dir, &attr) != NULL) - { - dir = dwarf_formstring (&attr); - if (dir == NULL) - { - fprintf(stderr, "Couldn't get DW_AT_comp_die as string, %s", - dwarf_errmsg (-1)); - return -1; - } - } - - if (dir == NULL) - printf ("%s\n", name); - else - printf ("%s/%s\n", dir, name); - - if (dwarf_getsrcfiles (cu_die, &files, &n) != 0) - { - fprintf(stderr, "Couldn't get CU file table, %s", - dwarf_errmsg (-1)); - return -1; - } - - for (i = 1; i < n; i++) - { - const char *file = dwarf_filesrc (files, i, NULL, NULL); - if (dir != NULL && file[0] != '/') - printf ("\t%s/%s\n", dir, file); - else - printf ("\t%s\n", file); - } - - return 0; -} - -int -main (int argc, char **argv) -{ - char* args[5]; - int res = 0; - Dwfl *dwfl; - Dwarf_Addr bias; - - if (argc != 2) { - fprintf(stderr, "Usage %s ", argv[0]); - exit(EXIT_FAILURE); - } - - // Pretend "dwarfsrcfiles -e " was given, so we can use standard - // dwfl argp parser to open the file for us and get our Dwfl. Useful - // in case argument is an ET_REL file (like kernel modules). libdwfl - // will fix up relocations for us. - args[0] = argv[0]; - args[1] = "-e"; - args[2] = argv[1]; - // We don't want to follow debug linked files due to the way OE processes - // files, could race against changes in the linked binary (e.g. objcopy on it) - args[3] = "--debuginfo-path"; - args[4] = "/not/exist"; - - argp_parse (dwfl_standard_argp (), 5, args, 0, NULL, &dwfl); - - Dwarf_Die *cu = NULL; - while ((cu = dwfl_nextcu (dwfl, cu, &bias)) != NULL) - res |= process_cu (cu); - - dwfl_end (dwfl); - - return res; -}