diff options
author | Alan Modra <amodra@gmail.com> | 2022-11-14 08:25:16 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-11-14 11:36:46 +1030 |
commit | 4f5c4fce8878830d8e4e928fa0dbe3f4ee2eb2cd (patch) | |
tree | 85d0c7efd9d38d9fb3caf11b5c1ee0e9e754183a /bfd | |
parent | f31e4e02eed3a758d757c7ede855b7aec1dd3850 (diff) | |
download | gdb-4f5c4fce8878830d8e4e928fa0dbe3f4ee2eb2cd.zip gdb-4f5c4fce8878830d8e4e928fa0dbe3f4ee2eb2cd.tar.gz gdb-4f5c4fce8878830d8e4e928fa0dbe3f4ee2eb2cd.tar.bz2 |
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.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elf64-sparc.c | 4 | ||||
-rw-r--r-- | bfd/reloc.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index fb4483d..c6d0d3e 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -322,6 +322,10 @@ elf64_sparc_set_reloc (bfd *abfd ATTRIBUTE_UNUSED, { asect->orelocation = location; canon_reloc_count (asect) = count; + if (count != 0) + asect->flags |= SEC_RELOC; + else + asect->flags &= ~SEC_RELOC; } /* Write out the relocs. */ diff --git a/bfd/reloc.c b/bfd/reloc.c index 89b6f7f..6446acc 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -8706,6 +8706,10 @@ _bfd_generic_set_reloc (bfd *abfd ATTRIBUTE_UNUSED, { section->orelocation = relptr; section->reloc_count = count; + if (count != 0) + section->flags |= SEC_RELOC; + else + section->flags &= ~SEC_RELOC; } /* |