diff options
author | Alan Modra <amodra@gmail.com> | 2022-01-29 12:27:31 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-01-29 17:14:55 +1030 |
commit | 2405fc4016feadea33cb747d5654514f62b74ff4 (patch) | |
tree | 0f3b4abfddede1106b6680e3bad80fcc1112f19f /bfd | |
parent | 7c4643efe7befea8e5063e8b56c0400fd8cee2d5 (diff) | |
download | gdb-2405fc4016feadea33cb747d5654514f62b74ff4.zip gdb-2405fc4016feadea33cb747d5654514f62b74ff4.tar.gz gdb-2405fc4016feadea33cb747d5654514f62b74ff4.tar.bz2 |
Re: PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu
The previous patch wasn't quite correct. The size and padding depends
on offset used in the current iteration, and if we're fudging the
offset past STUB_SHRINK_ITER then we'd better use that offset. We
can't have plt_stub_pad using stub_sec->size as the offset.
PR 28827
* elf64-ppc.c (plt_stub_pad): Add stub_off param.
(ppc_size_one_stub): Set up stub_offset to value used in this
iteration before sizing the stub. Adjust plt_stub_pad calls.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elf64-ppc.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 92f6d0a..d53128d 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -11174,12 +11174,12 @@ plt_stub_size (struct ppc_link_hash_table *htab, static inline unsigned int plt_stub_pad (struct ppc_link_hash_table *htab, struct ppc_stub_hash_entry *stub_entry, + bfd_vma stub_off, bfd_vma plt_off, unsigned int odd) { int stub_align; unsigned stub_size; - bfd_vma stub_off = stub_entry->group->stub_sec->size; if (htab->params->plt_stub_align >= 0) { @@ -12205,6 +12205,9 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) /* Make a note of the offset within the stubs for this entry. */ stub_offset = stub_entry->group->stub_sec->size; + if (htab->stub_iteration > STUB_SHRINK_ITER + && stub_entry->stub_offset > stub_offset) + stub_offset = stub_entry->stub_offset; if (stub_entry->h != NULL && stub_entry->h->save_res @@ -12430,10 +12433,9 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) if (htab->params->plt_stub_align != 0) { - unsigned pad = plt_stub_pad (htab, stub_entry, off, odd); + unsigned pad = plt_stub_pad (htab, stub_entry, stub_offset, off, odd); - stub_entry->group->stub_sec->size += pad; - stub_offset = stub_entry->group->stub_sec->size; + stub_offset += pad; off -= pad; odd ^= pad & 4; } @@ -12505,10 +12507,9 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) if (htab->params->plt_stub_align != 0) { - unsigned pad = plt_stub_pad (htab, stub_entry, off, 0); + unsigned pad = plt_stub_pad (htab, stub_entry, stub_offset, off, 0); - stub_entry->group->stub_sec->size += pad; - stub_offset = stub_entry->group->stub_sec->size; + stub_offset += pad; } if (info->emitrelocations) @@ -12557,10 +12558,8 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) if (stub_entry->stub_offset != stub_offset) htab->stub_changed = true; - if (htab->stub_iteration <= STUB_SHRINK_ITER - || stub_entry->stub_offset < stub_offset) - stub_entry->stub_offset = stub_offset; - stub_entry->group->stub_sec->size = stub_entry->stub_offset + size; + stub_entry->stub_offset = stub_offset; + stub_entry->group->stub_sec->size = stub_offset + size; return true; } |