Re: [gentoo-portage-dev] [PATCH 2/2] prepstrip: add support for elfutils strip

2011-10-11 Thread Mike Frysinger
On Tuesday 11 October 2011 10:55:32 Fabian Groffen wrote:
> On 11-10-2011 10:18:16 -0400, Mike Frysinger wrote:
> > > For the sake of it, can we try to detect GNU binutils here?  Our
> > > profiles restrict strip, so no immediate problem here if not.
> > 
> > adding detection here will fix most, but i don't think all, of your
> > troubles
> > 
> > the code still unconditionally runs `strip -g` which i'm guessing won't
> > work for you ...
> > 
> > also, we only run strip on ELF files.  so if you aren't an ELF system,
> > even fixing the -g won't help.
> 
> Actually, on Solaris (ELF) the way Portage uses strip will damage the
> files in such a way that they become unusable.  And we're using GNU
> binutils there.  So I guess it's ok to assume here.  In the profiles
> stripping is just disabled everywhere it breaks.

so GNU binutils is broken on Solaris ?  the flags that portage uses should be 
safe (by design) when stripping ELF files.
-mike


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-portage-dev] [PATCH 2/2] prepstrip: add support for elfutils strip

2011-10-11 Thread Fabian Groffen
On 11-10-2011 10:18:16 -0400, Mike Frysinger wrote:
> > For the sake of it, can we try to detect GNU binutils here?  Our
> > profiles restrict strip, so no immediate problem here if not.
> > 
> adding detection here will fix most, but i don't think all, of your troubles
> 
> the code still unconditionally runs `strip -g` which i'm guessing won't work 
> for you ...
> 
> also, we only run strip on ELF files.  so if you aren't an ELF system, even 
> fixing the -g won't help.

Actually, on Solaris (ELF) the way Portage uses strip will damage the
files in such a way that they become unusable.  And we're using GNU
binutils there.  So I guess it's ok to assume here.  In the profiles
stripping is just disabled everywhere it breaks.


-- 
Fabian Groffen
Gentoo on a different level


signature.asc
Description: Digital signature


Re: [gentoo-portage-dev] [PATCH 2/2] prepstrip: add support for elfutils strip

2011-10-11 Thread Mike Frysinger
On Tuesday 11 October 2011 03:11:03 Fabian Groffen wrote:
> On 11-10-2011 00:50:54 -0400, Mike Frysinger wrote:
> > If people use strip from the elfutils package, take advantage of some of
> > its neat features (like splitting + stripping in one step).
> > 
> > +# See if we're using GNU binutils or elfutils for stripping
> > +case $(${STRIP} --version) in
> > +*elfutils*) # dev-libs/elfutils
> > +   # elfutils default behavior is always safe, so don't need to specify
> > +   # any flags at all
> > +   SAFE_STRIP_FLAGS=""
> > +   DEF_STRIP_FLAGS="--remove-comment"
> > +   SPLIT_STRIP_FLAGS="-f"
> > +   ;;
> > +*) # assume binutils
> 
> For the sake of it, can we try to detect GNU binutils here?  Our
> profiles restrict strip, so no immediate problem here if not.
> 
> % strip --version
> strip: unrecognized option: --version
> Usage: strip [-AnuSXx] [-] [-d filename] [-s filename] [-R filename] [-o
> output] file [...]

adding detection here will fix most, but i don't think all, of your troubles

the code still unconditionally runs `strip -g` which i'm guessing won't work 
for you ...

also, we only run strip on ELF files.  so if you aren't an ELF system, even 
fixing the -g won't help.
-mike


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-portage-dev] [PATCH 2/2] prepstrip: add support for elfutils strip

2011-10-11 Thread Zac Medico
On 10/11/2011 12:11 AM, Fabian Groffen wrote:
> On 11-10-2011 00:50:54 -0400, Mike Frysinger wrote:
>> If people use strip from the elfutils package, take advantage of some of
>> its neat features (like splitting + stripping in one step).
> 
>> +# See if we're using GNU binutils or elfutils for stripping
>> +case $(${STRIP} --version) in
>> +*elfutils*) # dev-libs/elfutils
>> +# elfutils default behavior is always safe, so don't need to specify
>> +# any flags at all
>> +SAFE_STRIP_FLAGS=""
>> +DEF_STRIP_FLAGS="--remove-comment"
>> +SPLIT_STRIP_FLAGS="-f"
>> +;;
>> +*) # assume binutils
> 
> For the sake of it, can we try to detect GNU binutils here?  Our
> profiles restrict strip, so no immediate problem here if not.

Sounds like a good idea. Otherwise, the rest of the patch LGTM.
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH 1/2] prepstrip: extract buildid with readelf to avoid debugedit when possible

2011-10-11 Thread Zac Medico
On 10/10/2011 09:50 PM, Mike Frysinger wrote:
> + # 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=$(${READELF} -x .note.gnu.build-id "${x}" 2>/dev/null \
> + | awk '$NF ~ /GNU/ { getline; printf $2$3$4$5; getline; 
> print $2 }')
> + fi

LGTM.

In case anyone is curious about what that readelf output looks like,
here's an example from util-linux built with -Wl,--build-id in LDFLAGS:

# readelf -x .note.gnu.build-id
/var/tmp/portage/sys-apps/util-linux-2.20/image/usr/lib/debug/.build-id/ff/596c6113f72075beb4a40899b940750f872e72.debug

Hex dump of section '.note.gnu.build-id':
  0x08048188 0400 1400 0300 474e5500 GNU.
  0x08048198 ff596c61 13f72075 beb4a408 99b94075 .Yla.. u..@u
  0x080481a8 0f872e72...r

-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH 2/2] prepstrip: add support for elfutils strip

2011-10-11 Thread Fabian Groffen
On 11-10-2011 00:50:54 -0400, Mike Frysinger wrote:
> If people use strip from the elfutils package, take advantage of some of
> its neat features (like splitting + stripping in one step).

> +# See if we're using GNU binutils or elfutils for stripping
> +case $(${STRIP} --version) in
> +*elfutils*) # dev-libs/elfutils
> + # elfutils default behavior is always safe, so don't need to specify
> + # any flags at all
> + SAFE_STRIP_FLAGS=""
> + DEF_STRIP_FLAGS="--remove-comment"
> + SPLIT_STRIP_FLAGS="-f"
> + ;;
> +*) # assume binutils

For the sake of it, can we try to detect GNU binutils here?  Our
profiles restrict strip, so no immediate problem here if not.

% strip --version
strip: unrecognized option: --version
Usage: strip [-AnuSXx] [-] [-d filename] [-s filename] [-R filename] [-o
output] file [...] 


-- 
Fabian Groffen
Gentoo on a different level


signature.asc
Description: Digital signature