* objcopy.c (dump_sections): New list.

(command_line_switch): Add OPTION_DUMP_SECTION.
	(copy_options): Add dump-section.
	(copy_usage): Document new option.
	(copy_object): Dump requested sections.
	(copy_main): Handle --dump-section.
	* doc/binutils.texi: Document --dump-section option.
	* NEWS: Mention new feature.
This commit is contained in:
Nick Clifton 2013-12-31 09:52:24 +00:00
parent 4023334654
commit bbad633bb8
4 changed files with 103 additions and 0 deletions

View file

@ -1089,6 +1089,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
[@option{--change-warnings}] [@option{--no-change-warnings}]
[@option{--set-section-flags} @var{sectionpattern}=@var{flags}]
[@option{--add-section} @var{sectionname}=@var{filename}]
[@option{--dump-section} @var{sectionname}=@var{filename}]
[@option{--rename-section} @var{oldname}=@var{newname}[,@var{flags}]]
[@option{--long-section-names} @{enable,disable,keep@}]
[@option{--change-leading-char}] [@option{--remove-leading-char}]
@ -1475,6 +1476,17 @@ Add a new section named @var{sectionname} while copying the file. The
contents of the new section are taken from the file @var{filename}. The
size of the section will be the size of the file. This option only
works on file formats which can support sections with arbitrary names.
Note - it may be necessary to use the @option{--set-section-flags}
option to set the attributes of the newly created section.
@item --dump-section @var{sectionname}=@var{filename}
Place the contents of section named @var{sectionname} into the file
@var{filename}, overwriting any contents that may have been there
previously. This option is the inverse of @option{--add-section}.
This option is similar to the @option{--only-section} option except
that it does not create a formatted file, it just dumps the contents
as raw binary data, without applying any relocations. The option can
be specified more than once.
@item --rename-section @var{oldname}=@var{newname}[,@var{flags}]
Rename a section from @var{oldname} to @var{newname}, optionally