]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - bfd/elf.c
ELF: Discard non-alloc sections without section header
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 31 May 2023 19:36:49 +0000 (12:36 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 29 Jun 2023 17:29:47 +0000 (10:29 -0700)
commit02c1ba6c94d4bb3f53dfeeb4401c8434c7834a32
treece4597e2f5a7655696bba81191743e16d2ef1d5a
parent96cc7918c18cdb7bd0331d836fa7f05341732580
ELF: Discard non-alloc sections without section header

Discard non-alloc sections when section headers are stripped.

bfd/

PR ld/25617
* elf.c (_bfd_elf_assign_file_positions_for_non_load): Skip
non-load sections without section header.
(_bfd_elf_write_object_contents): Don't set the sh_name field
without section header.  Write out the .shstrtab section only
if its sh_offset field isn't -1.

binutils/

PR ld/25617
* objcopy.c (is_strip_section_1): Remove non-alloc sections for
--strip-section-headers.

ld/

PR ld/25617
* ldlang.c (lang_discard_section_p): Discard non-alloc sections
if we are stripping section headers.
bfd/elf.c
binutils/objcopy.c
ld/ldlang.c