1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 00:39:46 +00:00

package.bbclass: replace rpm/debugedit with dwarfsrcfiles

Debugedit provided by rpm 4.14 is rewriting binaries in-place, and was
found to produce broken output at least for grub:
http://lists.openembedded.org/pipermail/openembedded-core/2017-November/143989.html

A replacement utility was suggested via private mail:
https://lists.fedorahosted.org/archives/list/elfutils-devel@lists.fedorahosted.org/message/VZP4G5N2ELYZEDAB3QYLXYHDGX4WMCUF/

(From OE-Core rev: f2e6e1d3bfd4c92ef0f5ed4721fd9050c59dafca)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexander Kanavin
2017-11-10 17:38:59 +02:00
committed by Richard Purdie
parent b09bad9de0
commit 0d5475a3b2
3 changed files with 156 additions and 6 deletions
+23 -6
View File
@@ -52,7 +52,8 @@ LOCALE_SECTION ?= ''
ALL_MULTILIB_PACKAGE_ARCHS = "${@all_multilib_tune_values(d, 'PACKAGE_ARCHS')}"
# rpm is used for the per-file dependency identification
PACKAGE_DEPENDS += "rpm-native"
# dwarfsrcfiles is used to determine the list of debug source files
PACKAGE_DEPENDS += "rpm-native dwarfsrcfiles-native"
# If your postinstall can execute at rootfs creation time rather than on
@@ -334,6 +335,16 @@ def checkbuildpath(file, d):
return False
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 splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
# Function to split a single file into two components, one is the stripped
# target system binary, the other contains any debugging information. The
@@ -345,7 +356,6 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
dvar = d.getVar('PKGD')
objcopy = d.getVar("OBJCOPY")
debugedit = d.expand("${STAGING_LIBDIR_NATIVE}/rpm/debugedit")
# We ignore kernel modules, we don't generate debug info files.
if file.find("/lib/modules/") != -1 and file.endswith(".ko"):
@@ -359,10 +369,18 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
# We need to extract the debug src information here...
if debugsrcdir:
cmd = "'%s' -i -l '%s' '%s'" % (debugedit, sourcefile, file)
cmd = "'dwarfsrcfiles' '%s'" % (file)
(retval, output) = oe.utils.getstatusoutput(cmd)
if retval:
bb.fatal("debugedit failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
# 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:
bb.fatal("dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
debugsources = parse_debugsources_from_dwarfsrcfiles_output(output)
# filenames are null-separated - this is an artefact of the previous use
# of rpm's debugedit, which was writing them out that way, and the code elsewhere
# is still assuming that.
debuglistoutput = '\0'.join(debugsources) + '\0'
open(sourcefile, 'a').write(debuglistoutput)
bb.utils.mkdirhier(os.path.dirname(debugfile))
@@ -393,7 +411,6 @@ def copydebugsources(debugsrcdir, d):
dvar = d.getVar('PKGD')
strip = d.getVar("STRIP")
objcopy = d.getVar("OBJCOPY")
debugedit = d.expand("${STAGING_LIBDIR_NATIVE}/rpm/bin/debugedit")
workdir = d.getVar("WORKDIR")
workparentdir = os.path.dirname(os.path.dirname(workdir))
workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir)