This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: MIPS, strip --only-keep-debug & an infinite loop
On Fri, Apr 29, 2005 at 02:47:51PM +0100, Maciej W. Rozycki wrote:
> On Fri, 29 Apr 2005, Daniel Jacobowitz wrote:
>
> > objcopy --only-keep-debug does the same thing to _every_ non-debug
> > section. Take a look at the resulting files.
>
> Hard to do actually, as `objdump -h' hangs similarly... ;-)
Readelf will be of more use.
> But I've tried with a different target and the result is weird -- all
> non-debugging sections are merged to overlap starting from the same file
> offset, keeping their sizes, VMA, etc. intact... Program headers, if
> present, get adjusted accordingly.
You missed the vital bit. They all become NOBITS sections. The
original file still has their original contents; they are only in this
file because .symtab will have contents, and it references section
numbers.
> > I would not expect --keep-debug to remove non-debug sections, unlike
> > --only-keep-debug :-)
>
> Well, I'm confused about what to expect, especially as documentation
> further states:
>
> `--only-keep-debug'
> Strip a file, removing any sections that would be stripped by
> `--strip-debug' and leaving the debugging sections.
>
> Given what you write, I suppose s/would/would not/ should be applied to
> above. Am I right?
Yes.
> Then the affected sections should get completely
> removed and not mangled like currently, avoiding the problem altogether.
> Removing ".MIPS.options" alongside ".text", ".data", etc. is of course
> something that's beyond the MIPS64 ELF spec and would be quite a
> reasonable action to perform.
Not at all, because then we could not define debugging symbols in
.text.
--
Daniel Jacobowitz
CodeSourcery, LLC