[PATCH 0/2] Add --update-section option to objcopy.
Andrew Burgess
andrew.burgess@embecosm.com
Mon Feb 23 13:26:00 GMT 2015
A new `--update-section' option for objcopy allows the contents of a
section to be replaced without having to do `--remove-section' then
`--add-section'.
The problem with the remove then add strategy is that, the flags and
addresses for section being added back are lost, and need to be
restored using `--set-section-flags' and `--change-section-vma'.
However, for ELF format files the section to segment mapping is also
lost by removing the section, and there's currently no way to restore
the mapping.
The new `--update-section' changes the contents, and size of a section
"in-place", maintaining the address, flags, and for ELF files the
section to segment mapping.
The first patch is just a small refactor to allow some code to be
reused in the second patch.
The second patch adds the new option along with a test.
---
Andrew Burgess (2):
objcopy: Factor out some of the option parsing code.
objcopy: Add --update-section option.
binutils/ChangeLog | 19 ++
binutils/doc/binutils.texi | 10 +
binutils/objcopy.c | 222 +++++++++++++++------
binutils/testsuite/ChangeLog | 7 +
binutils/testsuite/binutils-all/update-1.s | 2 +
binutils/testsuite/binutils-all/update-2.s | 2 +
binutils/testsuite/binutils-all/update-3.s | 3 +
binutils/testsuite/binutils-all/update-section.exp | 84 ++++++++
8 files changed, 283 insertions(+), 66 deletions(-)
create mode 100644 binutils/testsuite/binutils-all/update-1.s
create mode 100644 binutils/testsuite/binutils-all/update-2.s
create mode 100644 binutils/testsuite/binutils-all/update-3.s
create mode 100644 binutils/testsuite/binutils-all/update-section.exp
--
2.2.2
More information about the Binutils
mailing list