diff options
author | Nick Clifton <nickc@redhat.com> | 2020-02-07 12:55:05 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-02-07 12:55:05 +0000 |
commit | 9984857cfd9a85a5d1b99162f9838aba099d20a0 (patch) | |
tree | 98153143a57fde9555c477105211a37693e4ef5c | |
parent | e1104d08fe2fbfabcfa98aa00525211e47548bd8 (diff) | |
download | gdb-9984857cfd9a85a5d1b99162f9838aba099d20a0.zip gdb-9984857cfd9a85a5d1b99162f9838aba099d20a0.tar.gz gdb-9984857cfd9a85a5d1b99162f9838aba099d20a0.tar.bz2 |
Stop the BFD library from complaining if a segment has no sections attached to it.
PR 23932
* elf.c (rewrite_elf_program_header): Do not complain if no
sections are mapped to a segment.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf.c | 17 |
2 files changed, 15 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e1a8412..584dd7f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2020-02-07 Nick Clifton <nickc@redhat.com> + + PR 23932 + * elf.c (rewrite_elf_program_header): Do not complain if no + sections are mapped to a segment. + 2020-02-06 H.J. Lu <hongjiu.lu@intel.com> PR ld/25490 @@ -7360,14 +7360,9 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) /* PR 23932. A corrupt input file may contain sections that cannot be assigned to any segment - because for example they have a - negative size - or segments that do not contain any sections. */ - if (map->count == 0) - { - sorry: - bfd_set_error (bfd_error_sorry); - free (sections); - return FALSE; - } + negative size - or segments that do not contain any sections. + But there are also valid reasons why a segment can be empty. + So allow a count of zero. */ /* Add the current segment to the list of built segments. */ *pointer_to_map = map; @@ -7399,6 +7394,12 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) map->includes_filehdr = 0; map->includes_phdrs = 0; } + + continue; + sorry: + bfd_set_error (bfd_error_sorry); + free (sections); + return FALSE; } while (isec < section_count); |