Can I strip some debug section and why we need to cross-compile readelf

Alan Modra
Tue Mar 10 04:06:00 GMT 2009

On Sun, Mar 08, 2009 at 09:42:29PM +0800, loody wrote:
> When I try to strip "debug_info" section in my program, I find all
> debug sections are striped.

objcopy -R .debug_info will just remove the section.

> Does that mean it is impossible to strip any debug section, since they
> have some connection?

They certainly are connected, and stripping .debug_info renders some
of the other sections useless.  You can find versions of the dwarf
standard on the web, which will show you the relationship between

> BTW, why we need to cross-compile readelf?
> In my opinion, readelf is platform independent, since it is used to
> parse ELF format, which is a standard, instead of reading the content
> of each section like objdump does.
> If my assumption is wrong, please correct me.

You might want to run readelf on the target.

Alan Modra
Australia Development Lab, IBM

More information about the Binutils mailing list