objcopy renaming section with explicit flags
authorAlan Modra <amodra@gmail.com>
Sun, 13 Nov 2022 21:55:16 +0000 (08:25 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 14 Nov 2022 01:06:46 +0000 (11:36 +1030)
commit4f5c4fce8878830d8e4e928fa0dbe3f4ee2eb2cd
tree85d0c7efd9d38d9fb3caf11b5c1ee0e9e754183a
parentf31e4e02eed3a758d757c7ede855b7aec1dd3850
objcopy renaming section with explicit flags

This tidies SEC_RELOC handling in bfd, in the process fixing a bug
with objcopy when renaming sections.

bfd/
* reloc.c (_bfd_generic_set_reloc): Set/clear SEC_RELOC depending
on reloc count.
* elf64-sparc.c (elf64_sparc_set_reloc): Likewise.
binutils/
* objcopy.c (copy_relocations_in_section): Remove now unnecessary
clearing of SEC_RELOC.
* testsuite/binutils-all/rename-section-01.d: New test.
* testsuite/binutils-all/objcopy.exp: Run it.
gas/
* write.c (size_seg): Remove unneccesary twiddle of SEC_RELOC.
(write_relocs): Likewise.  Always call bfd_set_reloc.
bfd/elf64-sparc.c
bfd/reloc.c
binutils/objcopy.c
binutils/testsuite/binutils-all/objcopy.exp
binutils/testsuite/binutils-all/rename-section-01.d [new file with mode: 0644]
gas/write.c