[PATCH 2/2] objcopy: Add --update-section option.
Richard Sandiford
rdsandiford@googlemail.com
Thu Feb 26 02:57:00 GMT 2015
Andrew Burgess <andrew.burgess@embecosm.com> writes:
> New option for objcopy --update-section allows the contents of a section
> to be updated while maintaining the section flags, and, for ELF files,
> the section to segment mapping.
>
> New test uses --dump-section and --update-section to check that a
> section can be made larger and smaller with an update.
Thanks for doing this. Looks like a very nice feature.
> + --update-section <name>=<file>\n\
> + Update contents of section <name> with\n\
> + contents found in <file>.\n\
Nit: Other options don't have a "." at the end of the explanation.
This might seem like feature creep, sorry, but it'd be nice to have
a specific error message for the case where the user tries to both
update and remove a section, like we do for the case where the user
tries to remove and keep a section (via --only-section). At the moment
we get the generic:
can't update section '.text': File in wrong format
I think this can be done by adding a specific error to
is_strip_section_1. (Adding a new SECTION_CONTEXT_* doesn't seem
appropriate since the new option doesn't accept wildcards.)
It'd also be nice to have the option work with --rename-section, e.g.
--update-section .foo=/file --rename-section .foo=.bar
At the moment this fails in the same way as above. I think this is just
a case of applying the rename list before calling bfd_get_section_by_name.
Thanks,
Richard
More information about the Binutils
mailing list