diff options
author | Alan Modra <amodra@gmail.com> | 2022-01-31 09:38:17 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-01-31 14:09:34 +1030 |
commit | 9ff8aa7d418bc508dbd429576b93e30ed9dc5891 (patch) | |
tree | b3824081c322e03acf00fe47eac23da0e07bf6bb /bfd/elf64-ppc.c | |
parent | a634f5af2f57db8028d75ccebc478146d42e3151 (diff) | |
download | gdb-9ff8aa7d418bc508dbd429576b93e30ed9dc5891.zip gdb-9ff8aa7d418bc508dbd429576b93e30ed9dc5891.tar.gz gdb-9ff8aa7d418bc508dbd429576b93e30ed9dc5891.tar.bz2 |
Re: PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu
In trying to find a testcase for PR28827, I managed to hit a linker
error in bfd_set_section_contents with a .branch_lt input section
being too large for the output .branch_lt.
bfd/
PR 28827
* elf64-ppc.c (ppc64_elf_size_stubs): Set section size to
maxsize past STUB_SHRINK_ITER before laying out. Remove now
unnecessary conditional setting of maxsize at start of loop.
ld/
* testsuite/ld-powerpc/pr28827-2.d,
* testsuite/ld-powerpc/pr28827-2.lnk,
* testsuite/ld-powerpc/pr28827-2.s: New test.
* testsuite/ld-powerpc/powerpc.exp: Run it.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r-- | bfd/elf64-ppc.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index d53128d..b4fa4ae 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -14093,10 +14093,7 @@ ppc64_elf_size_stubs (struct bfd_link_info *info) { asection *stub_sec = group->stub_sec; - if (htab->stub_iteration <= STUB_SHRINK_ITER - || stub_sec->rawsize < stub_sec->size) - /* Past STUB_SHRINK_ITER, rawsize is the max size seen. */ - stub_sec->rawsize = stub_sec->size; + stub_sec->rawsize = stub_sec->size; stub_sec->size = 0; stub_sec->reloc_count = 0; stub_sec->flags &= ~SEC_RELOC; @@ -14111,9 +14108,7 @@ ppc64_elf_size_stubs (struct bfd_link_info *info) htab->tga_group->stub_sec->size = 24 * 4; } - if (htab->stub_iteration <= STUB_SHRINK_ITER - || htab->brlt->rawsize < htab->brlt->size) - htab->brlt->rawsize = htab->brlt->size; + htab->brlt->rawsize = htab->brlt->size; htab->brlt->size = 0; htab->brlt->reloc_count = 0; htab->brlt->flags &= ~SEC_RELOC; @@ -14122,9 +14117,7 @@ ppc64_elf_size_stubs (struct bfd_link_info *info) if (htab->elf.srelrdyn != NULL) { - if (htab->stub_iteration <= STUB_SHRINK_ITER - || htab->elf.srelrdyn->rawsize < htab->elf.srelrdyn->size) - htab->elf.srelrdyn->rawsize = htab->elf.srelrdyn->size; + htab->elf.srelrdyn->rawsize = htab->elf.srelrdyn->size; htab->elf.srelrdyn->size = 0; } @@ -14240,6 +14233,21 @@ ppc64_elf_size_stubs (struct bfd_link_info *info) || htab->stub_iteration > 1)) break; + if (htab->stub_iteration > STUB_SHRINK_ITER) + { + for (group = htab->group; group != NULL; group = group->next) + if (group->stub_sec != NULL + && group->stub_sec->size < group->stub_sec->rawsize) + group->stub_sec->size = group->stub_sec->rawsize; + + if (htab->brlt->size < htab->brlt->rawsize) + htab->brlt->size = htab->brlt->rawsize; + + if (htab->elf.srelrdyn != NULL + && htab->elf.srelrdyn->size < htab->elf.srelrdyn->rawsize) + htab->elf.srelrdyn->size = htab->elf.srelrdyn->rawsize; + } + /* Ask the linker to do its stuff. */ (*htab->params->layout_sections_again) (); } |