Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH 1/2] prepstrip: extract buildid with readelf to avoid debugedit when possible
Date: Tue, 11 Oct 2011 07:23:21
Message-Id: 4E93EECD.4090006@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 1/2] prepstrip: extract buildid with readelf to avoid debugedit when possible by Mike Frysinger
1 On 10/10/2011 09:50 PM, Mike Frysinger wrote:
2 > + # if we don't already have build-id from debugedit, look it up
3 > + if [[ -z ${buildid} ]] ; then
4 > + # convert the readelf output to something useful
5 > + buildid=$(${READELF} -x .note.gnu.build-id "${x}" 2>/dev/null \
6 > + | awk '$NF ~ /GNU/ { getline; printf $2$3$4$5; getline; print $2 }')
7 > + fi
8
9 LGTM.
10
11 In case anyone is curious about what that readelf output looks like,
12 here's an example from util-linux built with -Wl,--build-id in LDFLAGS:
13
14 # readelf -x .note.gnu.build-id
15 /var/tmp/portage/sys-apps/util-linux-2.20/image/usr/lib/debug/.build-id/ff/596c6113f72075beb4a40899b940750f872e72.debug
16
17 Hex dump of section '.note.gnu.build-id':
18 0x08048188 04000000 14000000 03000000 474e5500 ............GNU.
19 0x08048198 ff596c61 13f72075 beb4a408 99b94075 .Yla.. u......@u
20 0x080481a8 0f872e72 ...r
21
22 --
23 Thanks,
24 Zac