This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/2] Add --update-section option to objcopy.

A new `--update-section' option for objcopy allows the contents of a
section to be replaced without having to do `--remove-section' then

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]