Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 378559

Summary: sys-apps/portage-2.1.10.10 add support for stripping PE32
Product: Gentoo Linux Reporter: Bertrand Jacquin <bertrand>
Component: Current packagesAssignee: Portage team <dev-portage>
Status: UNCONFIRMED ---    
Severity: normal CC: bertrand
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 662714    
Attachments: prepstrip-BJA-mingw.diff

Description Bertrand Jacquin 2011-08-09 20:18:09 UTC
Here is a patch to allow stripping PE32 files (.exe and .dll)

Reproducible: Always
Comment 1 Bertrand Jacquin 2011-08-09 20:18:57 UTC
Created attachment 282753 [details, diff]
prepstrip-BJA-mingw.diff
Comment 2 Bertrand Jacquin 2011-08-09 20:19:57 UTC
(In reply to comment #1)
> Created attachment 282753 [details, diff]
> prepstrip-BJA-mingw.diff

This also include a simplification while handling `file' output
Comment 3 Bertrand Jacquin 2011-08-09 21:42:57 UTC
Hum, this have impact when you compile things like mono that generate PE32 binaries and libs as prepstrip doesn't check the EM_TYPE of found files.


This needs some tweak
Comment 4 Zac Medico gentoo-dev 2011-08-11 01:39:45 UTC
With find -or, you need parenthesis, like this:

  find "$@" -type f \( -name '*.a' -or -name '*.exe' -or -name '*.dll' \)

For testing purposes, I tried running strip on some of the *.dll files I have installed in /usr/lib/wine/fakedlls/ by wine, but strip says "File format not recognized" for these files. For the same files, file -b says "PE32 executable (DLL) Intel 80386, for MS Windows".
Comment 5 Bertrand Jacquin 2011-08-11 06:41:49 UTC
(In reply to comment #4)
> With find -or, you need parenthesis, like this:
> 
>   find "$@" -type f \( -name '*.a' -or -name '*.exe' -or -name '*.dll' \)
> 
> For testing purposes, I tried running strip on some of the *.dll files I have
> installed in /usr/lib/wine/fakedlls/ by wine, but strip says "File format not
> recognized" for these files. For the same files, file -b says "PE32 executable
> (DLL) Intel 80386, for MS Windows".

Oh yes, in my case I use {i686,x86_64}-w64-mingw32-strip in a crossdev env so binutils can detect the correct binary format.
Comment 6 Bertrand Jacquin 2011-08-11 06:43:49 UTC
(In reply to comment #4)
> but strip says "File format not
> recognized" for these files.

That's why prepstrip should detect only EM_MACHINE file. Isn't it ?
Comment 7 Zac Medico gentoo-dev 2011-08-11 07:25:46 UTC
(In reply to comment #6)
> That's why prepstrip should detect only EM_MACHINE file. Isn't it ?

Perhaps. I'm not familiar enough with this stuff.

(In reply to comment #3)
> Hum, this have impact when you compile things like mono that generate PE32
> binaries and libs as prepstrip doesn't check the EM_TYPE of found files.
> 
> 
> This needs some tweak

Are you working on an updated patch then? Or should we apply the existing patch as-is?
Comment 8 Bertrand Jacquin 2011-08-11 07:34:53 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > That's why prepstrip should detect only EM_MACHINE file. Isn't it ?
> 
> Perhaps. I'm not familiar enough with this stuff.
> 
> (In reply to comment #3)
> > Hum, this have impact when you compile things like mono that generate PE32
> > binaries and libs as prepstrip doesn't check the EM_TYPE of found files.
> > 
> > 
> > This needs some tweak
> 
> Are you working on an updated patch then ?

Yes I am with a low resolution delay, I'd like to add some PE detection to pax-utils first.

> Or should we apply the existing patch
> as-is?

No, not yet :) I'll keep this bug up to date