Bug 4888 - [regression] objcopy -R .debug_* --only-keep-debug broken
Summary: [regression] objcopy -R .debug_* --only-keep-debug broken
Status: VERIFIED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-03 08:53 IST by Matthias Klose
Modified: 2007-08-04 13:29 IST (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
test binary (13.41 KB, application/octet-stream)
2007-08-03 08:55 IST, Matthias Klose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2007-08-03 08:53:46 IST
[forwarded from http://bugs.debian.org/435444]

running on the attached ix86 shared object, seen on powerpc and x86_64 as well.

objcopy --only-keep-debug puzzle puzzle.debug_ok
objcopy -R .debug_info -R .debug_aranges -R .debug_pubnames -R .debug_abbrev -R
.debug_line -R .debug_str -R .debug_ranges -R .debug_loc --only-keep-debug
puzzle puzzle.debug_broken

not seen with cvs 20070426, seen with cvs 20070713 and cvs 20070801
Comment 1 Matthias Klose 2007-08-03 08:55:51 IST
Created attachment 1944 [details]
test binary

 readelf -s puzzle.debug_broken shows garbled symbols.
Comment 2 Matthias Klose 2007-08-03 09:45:43 IST
omitting -R .debug_aranges avoids the garbled symbols
Comment 3 Matthias Klose 2007-08-03 10:59:40 IST
seen with cvs 20070529
Comment 4 H.J. Lu 2007-08-04 01:54:43 IST
This patch

http://sourceware.org/ml/binutils-cvs/2007-05/msg00158.html

causes this regression. Alan, I couldn't find where it was discussed.
Can you look into it? Thanks.
Comment 5 Alan Modra 2007-08-04 06:44:46 IST
The problem was introduced here:
http://sourceware.org/ml/binutils/2007-05/msg00433.html

"my change
to assign_file_positions_for_load_sections means that we can leave
bfd section flags unchanged."

Except that we can't without further modifying objcopy to stop section contents
being copied.
Comment 7 Matthias Klose 2007-08-04 13:29:01 IST
thanks!