diff options
author | Alan Modra <amodra@gmail.com> | 2018-10-06 00:05:51 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2018-10-08 20:26:08 +1030 |
commit | 1b9e270b09c140464a7892c95c28eafa812c6b08 (patch) | |
tree | c1326aba9138b6b7a19591010f6e272fc63149e1 /bfd | |
parent | e0c3dfa2eebcf862d45b05f363a81f57ca30dead (diff) | |
download | gdb-1b9e270b09c140464a7892c95c28eafa812c6b08.zip gdb-1b9e270b09c140464a7892c95c28eafa812c6b08.tar.gz gdb-1b9e270b09c140464a7892c95c28eafa812c6b08.tar.bz2 |
No PT_INTERP when .interp is zero size
Some targets don't set a default interpreter, resulting in an empty
.interp section unless --dynamic-linker is passed to ld. A PT_INTERP
without a path is rather useless.
The testsuite change fixes a failure on microblaze-linux.
bfd/
* elf.c (get_program_header_size): Don't count PT_INTERP if
.interp is empty.
(_bfd_elf_map_sections_to_segments): Don't create PT_INTERP if
.interp is empty.
ld/
* testsuite/ld-elf/pr22423.d: Pass --dynamic-linker to ld.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elf.c | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1b51db7..3d6796b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,12 @@ 2018-10-08 Alan Modra <amodra@gmail.com> + * elf.c (get_program_header_size): Don't count PT_INTERP if + .interp is empty. + (_bfd_elf_map_sections_to_segments): Don't create PT_INTERP if + .interp is empty. + +2018-10-08 Alan Modra <amodra@gmail.com> + * elf32-spu.c (spu_elf_modify_segment_map): Don't insert overlays before segment containing headers. @@ -4335,7 +4335,7 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info) segs = 2; s = bfd_get_section_by_name (abfd, ".interp"); - if (s != NULL && (s->flags & SEC_LOAD) != 0) + if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->size != 0) { /* If we have a loadable interpreter section, we need a PT_INTERP segment. In this case, assume we also need a @@ -4647,7 +4647,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info) the program headers and a PT_INTERP segment for the .interp section. */ s = bfd_get_section_by_name (abfd, ".interp"); - if (s != NULL && (s->flags & SEC_LOAD) != 0) + if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->size != 0) { amt = sizeof (struct elf_segment_map); m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); |