From 7b5f66a118a6e252a56c472c082a29d39ede68c6 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 6 Dec 2022 14:40:10 +1030 Subject: Get rid of SEC_ELF_RENAME SEC_ELF_RENAME is a flag used to effect section name changes when compressing/decompressing zlib-gnu debug sections. This can be accomplished more directly in one of the objcopy specific bfd functions. Renaming for ld input is simplified too. Ld input object files always have BFD_DECOMPRESS set. bfd/ * compress.c (bfd_convert_section_size): Rename to.. (bfd_convert_section_setup): ..this. Handle objcopy renaming of compressed/decompressed debug sections. * elf.c (_bfd_elf_make_section_from_shdr): Only rename zdebug input for linker. (elf_fake_sections): Don't handle renaming of debug sections for objcopy here. * section.c (SEC_ELF_RENAME): Delete. * bfd-in2.h: Regenerate. binutils/ * objcopy.c (setup_section): Call bfd_convert_section_setup. Don't call bfd_convert_section_size. --- binutils/objcopy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'binutils') diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 6814e20..19dbb50 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -4118,6 +4118,13 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) flags &= ~clr; } + if (!bfd_convert_section_setup (ibfd, isection, obfd, &name, &size)) + { + osection = NULL; + err = _("failed to create output section"); + goto loser; + } + osection = bfd_make_section_anyway_with_flags (obfd, name, flags); if (osection == NULL) @@ -4126,8 +4133,6 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) goto loser; } - size = bfd_section_size (isection); - size = bfd_convert_section_size (ibfd, isection, obfd, size); if (copy_byte >= 0) size = (size + interleave - 1) / interleave * copy_width; else if (extract_symbol) -- cgit v1.1