This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 2/2] objcopy: Add --update-section option.
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 25 Feb 2015 21:19:37 +0000
- Subject: Re: [PATCH 2/2] objcopy: Add --update-section option.
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1424695434 dot git dot andrew dot burgess at embecosm dot com> <859c6e200964a22c09690c6cc3861f8ed010d9b4 dot 1424695434 dot git dot andrew dot burgess at embecosm dot com>
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