From 8bec63bf92d8dd028aa88dbd5109c314cdb9ebea Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 30 Oct 2017 14:35:23 -0400 Subject: makepkg: tell the compiler to record debugging info for debug packages In commit 8b0d59b83a60eb504567590346119fe4cd891cad support was added for storing the source files of binaries in debug packages. This made use of the debugedit program which is part of the RPM package manager, which is not very standalone. The same effect can be achieved using -fdebug-prefix-map, an option accepted by both the gcc and clang compilers which modifies how the compiler itself stores the references to the source files rather than requiring us to later edit the produced binaries. This also removes the dependency on external programs like debugedit. As a result of this change, source files will only be effectively added for programs which actually use the exported CFLAGS. This is a reasonable tradeoff as we expect our CFLAGS to be used rather than ignored. Upstream software which do not produce useful debug packages are expected to fix their build systems to respect the environment CFLAGS. As a result of this change, the routine for extracting source filenames from binaries had to be modified to derive the source file from the final debug location, rather than the other way around. Signed-off-by: Eli Schwartz Signed-off-by: Allan McRae --- scripts/libmakepkg/tidy/strip.sh.in | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'scripts/libmakepkg/tidy') diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in index e88bde78..8a1d6096 100644 --- a/scripts/libmakepkg/tidy/strip.sh.in +++ b/scripts/libmakepkg/tidy/strip.sh.in @@ -57,15 +57,12 @@ strip_file() { # copy source files to debug directory local f t - while read -r f; do - t=${f/"$srcdir"/$dbgsrc} + while read -r t; do + f=${t/$dbgsrc/"$srcdir"} mkdir -p "${t%/*}" cp -- "$f" "$t" done < <(source_files "$binary") - # adjust debug symbols to point at sources - debugedit -b "${srcdir}" -d /usr/src/debug/ -i "$binary" &> /dev/null - # copy debug symbols to debug directory mkdir -p "$dbgdir/${binary%/*}" objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug" -- cgit v1.2.3-70-g09d2