$ i486-gnu-linux-strip --only-keep-debug libau.a -o libau.a.debuginfo BFD: BFD 2.17.50.0.3 20060715 internal error, aborting at elf.c line 2971 in bfd_elf_set_group_contents BFD: Please report this bug.
Created attachment 1271 [details] compressed testcase.
Here is a simple testcase: [hjl@gnu-13 strip-9]$ cat group.s .section .text,"axG",%progbits,foo_group,comdat .global foo foo: .word 0 .section .data,"awG",%progbits,foo_group,comdat .global bar bar: .word 0 [hjl@gnu-13 strip-9]$ make as -o group.o group.s ./strip --only-keep-debug group.o -o xxx.o BFD: BFD 2.17.50 20060823 internal error, aborting at /export/gnu/src/binutils-import/binutils/bfd/elf.c line 2976 in bfd_elf_set_group_contents BFD: Please report this bug. make: *** [xxx.o] Error 1 I will look into it.
Nick, you added --only-keep-debug. Is --only-keep-debug supposed to work on .o files? Can you look into it? Thanks.
Hi Pawel, Hi H.J. The --only-keep-debug switch is not intended to work on object files (or static libraries containing object files). At least not those that contain relocations that point into the debug sections (and which hence have incomplete debugging information). This particular problem however appears to arise because strip thinks that the group sections contain debugging information. (The test for a debugging section is basically one that contains information, but which is not allocated space in the memory map at runtime). The uploaded patch should resolve this. Please could you try it out and let me know if it works for you. Cheers Nick
Created attachment 1277 [details] Do not treat group sections as debugging sections
(In reply to comment #4) > The uploaded patch should resolve this. Please > could you try it out and let me know if it works for you. it works for me. thank you very much. ps). i've filled one more bug about stripping debug from static libs -> PR3110 ;)
hmm, with this patch i get an error on shared libs. i486-gnu-linux-objcopy --only-keep-debug \ ../../build-stlport-release-i486-gnu-linux/libArmInstanceAdder.so \ ../../build-stlport-release-i486-gnu-linux/libArmInstanceAdder.so.debuginfo i486-gnu-linux-objcopy \ --add-gnu-debuglink=../../build-stlport-release-i486-gnu-linux/libArmInstanceAdder.so.debuginfo ../../build-stlport-release-i486-gnu-linux/libArmInstanceAdder.so i486-gnu-linux-objcopy: ../../build-stlport-release-i486-gnu-linux/libArmInstanceAdder.so.debuginfo: Invalid operation can you confirm that?
please ignore last comment. my buildsystem was buggy :)
If --only-keep-debug isn't supposed to be used on .o, we shouldn't try. As for group, a group can contain a debug section. I will open a new bug. The problem is when we strip a section, we don't ajust the section group when the stripped section is a member of the section group.
Hi Guys, I have checked in the patch, as well as an update to the documentation specifiying that the --only-keep-debug switch is only intended to be used on fully linked files. (I could not see any reasonable way of enforcing this restriction on the code however). Cheers Nick
Subject: Bug 3166 CVSROOT: /cvs/src Module name: src Changes by: amodra@sourceware.org 2010-06-29 08:47:40 Modified files: binutils : ChangeLog objcopy.c Log message: PR binutils/3166 * objcopy.c (is_strip_section): Revert 2006-09-05. (setup_section): Make SHT_GROUP section nobits. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1655&r2=1.1656 http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/objcopy.c.diff?cvsroot=src&r1=1.142&r2=1.143