I use objcopy
to extract/replace some section is an ELF file on a windows system.
>objcopy.exe -V
GNU objcopy 2.17.50 20060824
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.
This works in general.
But my elf file contains debug information which I need to remove before delivery to decrese the filesize.
I found tht option -g
or --strip-debug
should do what I want:
>"objcopy.exe" --strip-debug -I elf32-big -O elf32-big with-debug.elf without-debug.elf
But it fails miserably. instead of making the file smaller it blows up the file size from ~20MB to 3GB before failing with:
objcopy.exe: without-debug.elf: File truncated
objcopy.exe: without-debug.elf: No space left on device
how do I corectly remove debug information from ELF using objcopy?
Don't know if this is important but objcopy issues some warnings for most ot the sections in the ELF like this:
BFD: without-debug.elf: warning: allocated section `.sdata' not in segment