This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MIPS, strip --only-keep-debug & an infinite loop


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.

 Indeed.

> >  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.

 That makes sense.  And with readelf I can see the problem now -- 
".MIPS.options" is left marked as SHT_MIPS_OPTIONS as opposed to 
SHT_NOBITS.  Since that section no longer contains anything relevant, it 
should be considered a bug.

> >  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.

 So again it's bad wording.  How about this patch?

2005-04-29  Maciej W. Rozycki  <macro@linux-mips.org>

	* doc/binutils.texi (strip, objcopy): Clarify the description of 
	the "--strip-debug" option.  Fix a typo.

  Maciej

binutils-2.16.90-20050429-only-keep-debug.patch
Index: binutils/doc/binutils.texi
===================================================================
RCS file: /cvs/src/src/binutils/doc/binutils.texi,v
retrieving revision 1.73
diff -u -p -r1.73 binutils.texi
--- binutils/doc/binutils.texi	25 Apr 2005 09:23:24 -0000	1.73
+++ binutils/doc/binutils.texi	29 Apr 2005 14:54:00 -0000
@@ -1428,8 +1428,9 @@ Creates a .gnu_debuglink section which c
 and adds it to the output file.
 
 @item --only-keep-debug
-Strip a file, removing any sections that would be stripped by
-@option{--strip-debug} and leaving the debugging sections.
+Strip a file, removing contents of any sections that would not be
+stripped by @option{--strip-debug} and leaving the debugging sections
+intact.
 
 The intention is that this option will be used in conjunction with
 @option{--add-gnu-debuglink} to create a two part executable.  One a
@@ -1460,7 +1461,7 @@ optional.  You could instead do this:
 @item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
 @end enumerate
 
-ie the file pointed to by the @option{--add-gnu-debuglink} can be the
+i.e. the file pointed to by the @option{--add-gnu-debuglink} can be the
 full executable.  It does not have to be a file created by the
 @option{--only-keep-debug} switch.
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]