From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RDdG8-00034W-EU for garchives@archives.gentoo.org; Tue, 11 Oct 2011 14:24:44 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7DB5521C175; Tue, 11 Oct 2011 14:24:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3B1D121C110 for ; Tue, 11 Oct 2011 14:24:32 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BDE4C1B4009 for ; Tue, 11 Oct 2011 14:24:31 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 044BF80042 for ; Tue, 11 Oct 2011 14:24:31 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/ X-VCS-Repository: proj/portage X-VCS-Files: bin/ebuild-helpers/prepstrip X-VCS-Directories: bin/ebuild-helpers/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: d4fdc3f5c04e556ce217e004ed461c9f05146c0f Date: Tue, 11 Oct 2011 14:24:31 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 20cafd016fa4d22019c9a474f94813d2 commit: d4fdc3f5c04e556ce217e004ed461c9f05146c0f Author: Mike Frysinger gentoo org> AuthorDate: Tue Oct 11 04:40:09 2011 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Tue Oct 11 04:47:47 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dd4fdc3f5 prepstrip: extract buildid with readelf to avoid debugedit when possible The readelf utility is much more common than debugedit. Signed-off-by: Mike Frysinger gentoo.org> --- bin/ebuild-helpers/prepstrip | 32 +++++++++++++++++++++++--------- 1 files changed, 23 insertions(+), 9 deletions(-) diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip index 67ceead..7a08aba 100755 --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@ -26,10 +26,13 @@ if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then ${FEATURES_installsources} || exit 0 fi =20 -STRIP=3D${STRIP:-${CHOST}-strip} -type -P -- ${STRIP} > /dev/null || STRIP=3Dstrip -OBJCOPY=3D${OBJCOPY:-${CHOST}-objcopy} -type -P -- ${OBJCOPY} > /dev/null || OBJCOPY=3Dobjcopy +# look up the tools we might be using +for t in STRIP:strip OBJCOPY:objcopy READELF:readelf ; do + v=3D${t%:*} # STRIP + t=3D${t#*:} # strip + eval ${v}=3D\"${!v:-${CHOST}-${t}}\" + type -P -- ${!v} >/dev/null || eval ${v}=3D${t} +done =20 # We'll leave out -R .note for now until we can check out the relevance # of the section when it has the ALLOC flag set on it ... @@ -65,8 +68,15 @@ save_elf_sources() { local x=3D$1 local inode=3D$(inode_var_name "$x") [[ -n ${!inode} ]] && return 0 - debugedit -b "${WORKDIR}" -d "${prepstrip_sources_dir}" \ - -l "${T}"/debug.sources "${x}" + + # since we're editing the ELF here, we should recompute the build-id + # (the -i flag below). save that output so we don't need to recompute + # it later on in the save_elf_debug step. + buildid=3D$(debugedit -i \ + -b "${WORKDIR}" \ + -d "${prepstrip_sources_dir}" \ + -l "${T}"/debug.sources \ + "${x}") } =20 save_elf_debug() { @@ -78,9 +88,6 @@ save_elf_debug() { # dont save debug info twice [[ ${x} =3D=3D *".debug" ]] && return 0 =20 - # this will recompute the build-id, but for now that's ok - local buildid=3D"$( ${debugedit_found} && debugedit -i "${x}" )" - mkdir -p "${y%/*}" =20 local inode=3D$(inode_var_name "$x") @@ -95,6 +102,12 @@ save_elf_debug() { chmod ${args} "${y}" fi =20 + # if we don't already have build-id from debugedit, look it up + if [[ -z ${buildid} ]] ; then + # convert the readelf output to something useful + buildid=3D$(${READELF} -x .note.gnu.build-id "${x}" 2>/dev/null \ + | awk '$NF ~ /GNU/ { getline; printf $2$3$4$5; getline; print $2 }') + fi if [[ -n ${buildid} ]] ; then local buildid_dir=3D"${D}usr/lib/debug/.build-id/${buildid:0:2}" local buildid_file=3D"${buildid_dir}/${buildid:2}" @@ -165,6 +178,7 @@ do # actually causes problems. install sources for all # elf types though cause that stuff is good. =20 + buildid=3D if [[ ${f} =3D=3D *"current ar archive"* ]] ; then vecho " ${x:${#D}}" if ${strip_this} ; then