[prev in list] [next in list] [prev in thread] [next in thread]
List: mingw-users
Subject: [Mingw-users] Minidebuginfos in PE binaries
From: Sandro Mani <manisandro () gmail ! com>
Date: 2017-09-08 15:21:07
Message-ID: 2fe8cb3e-ef9e-6dc3-f032-3e7b19ec42dd () gmail ! com
[Download RAW message or body]
Hi
I'd like to include minidebuginfos in PE binaries analogously to what
was done for ELF binaries in Fedora [1]. The interesting part for the
ELF-minidebuginfo extractor is [2]. I'm trying to replicate this for PE
binaries.
The easy variant is just keeping the uncompressed symbol names in the
main binary:
keep_symbols=`mktemp`
mingw-objcopy --only-keep-debug "$binary" "$binary.debug"
x86_64-w64-mingw32-nm "$binary.debug" --format=sysv --defined-only | awk
-F \| '{ if ($4 ~ "Function") print $1 }' | sort > "$keep_symbols"
mingw-objcopy --add-gnu-debuglink=$(basename "$binary.debug")
--strip-unneeded "$binary" --keep-symbols="$keep_symbols"
This works well, but experiments show the size increase can be up to 35%
(on average 17%).
To reduce the size I'm trying to inject the compressed symbols.
Replicating [2], I'm currently experimenting with
local keep_symbols=`mktemp`
local mini_debuginfo=`mktemp`
mingw-objcopy --only-keep-debug "$binary" "$binary.debug"
mingw-nm "$binary.debug" --format=sysv --defined-only | awk -F \| '{ if
($4 ~ "Function") print $1 }' | sort > "$keep_symbols"
mingw-objcopy -S --keep-symbols="$keep_symbols" "$binary.debug"
"$mini_debuginfo"
xz "$mini_debuginfo"
mingw-objcopy --add-gnu-debuglink=$(basename "$binary.debug")
--strip-unneeded "$binary"
mingw-objcopy --add-section .gnu_debugdata="$mini_debuginfo.xz" "$binary"
But as soon as I add the .gnu_debugdata section to the binary, it won't
run anymore (<application> is not a valid Win32 application).
Any ideas whether I'm doing something wrong or whether it's simply not
possible to add the .gnu_debugdata section to the PE binary?
P.s.: I'm not really all that familiar with the PE internals, just
experimenting...
Thanks
Sandro
[1] https://fedoraproject.org/wiki/Features/MiniDebugInfo
[2]
https://github.com/rpm-software-management/rpm/blob/master/scripts/find-debuginfo.sh#L241
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-users@lists.sourceforge.net
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list etiquette may \
cause your account to be moderated.
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@lists.sourceforge.net?subject=unsubscribe
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic