diff --git a/scripts/process-debuginfo.in b/scripts/process-debuginfo.in index 1d35a44..1e4a2a6 100755 --- a/scripts/process-debuginfo.in +++ b/scripts/process-debuginfo.in @@ -60,6 +60,25 @@ done timestamp=$(date --iso-8601=ns --reference="$f") @RPMCONFIGDIR@/debugedit -b "$RPM_BUILD_DIR" -d /usr/src/debug -l .tmp/src.$$ "$f" +if [ ! -s .tmp/src.$$ ]; then + # debugedit has failed to extract sources list, possibly + # due to ELF compression - uncompress and try again. + LD_ORIGIN_PATH=/usr/bin eu-readelf -S "$f" > .tmp/sections.$$ + if grep -q ' \.debug_info .* PROGBITS .*C' .tmp/sections.$$; then + # Have SHF_COMPRESSED flag. + zmode=zlib-gabi + elif grep -q ' \.zdebug_info .* PROGBITS ' .tmp/sections.$$; then + zmode=zlib-gnu + else + zmode= + fi + rm .tmp/sections.$$ + if [ -n "$zmode" ]; then + LD_ORIGIN_PATH=/usr/bin eu-elfcompress --type=none "$f" + @RPMCONFIGDIR@/debugedit -b "$RPM_BUILD_DIR" -d /usr/src/debug -l .tmp/src.$$ "$f" + LD_ORIGIN_PATH=/usr/bin eu-elfcompress --type=$zmode "$f" + fi +fi if [ -n "$strip" ]; then mkdir -p "${debugf%/*}" LD_ORIGIN_PATH=/usr/bin eu-strip $strip --remove-comment -f "$debugf" "$f"