aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-06-21 22:44:09 +0930
committerAlan Modra <amodra@gmail.com>2023-06-21 23:04:24 +0930
commit03f49a0619c5598eea80511efef5a88c4f7bb293 (patch)
tree79926b45944220392956caccc5b3d66d2a79232f /gold
parent756b006e0db6bc0ea7013b790d98c12734fc0c77 (diff)
downloadfsf-binutils-gdb-03f49a0619c5598eea80511efef5a88c4f7bb293.zip
fsf-binutils-gdb-03f49a0619c5598eea80511efef5a88c4f7bb293.tar.gz
fsf-binutils-gdb-03f49a0619c5598eea80511efef5a88c4f7bb293.tar.bz2
PR30536, ppc64el gold linker produces unusable clang-16 binary
In commit 0961e631575b, the fix for PR30217, make_lplt_section and make_brlt_section were changed to use rela_dyn_ rather than their own separate dynamic reloc sections. This fails miserably whenever brlt_ is needed for long branches, due to needing to iterate sizing and thus reset brlt_ sizes. PR 30536 PR 30217 * powerpc.cc (Target_powerpc::make_brlt_section): Don't use rela_dyn_. (cherry picked from commit dc808a2ebab337b5517add4c1aad298cf836c239)
Diffstat (limited to 'gold')
-rw-r--r--gold/powerpc.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index a847dad..aa2d9a1 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -4632,7 +4632,15 @@ Target_powerpc<size, big_endian>::make_brlt_section(Layout* layout)
{
// When PIC we can't fill in .branch_lt but must initialise at
// runtime via dynamic relocations.
- brlt_rel = this->rela_dyn_section(layout);
+ this->rela_dyn_section(layout);
+ // FIXME: This reloc section won't have its relative relocs
+ // sorted properly among the other relative relocs in rela_dyn_
+ // but it must be a separate section due to needing to call
+ // reset_data_size().
+ brlt_rel = new Reloc_section(false);
+ if (this->rela_dyn_->output_section())
+ this->rela_dyn_->output_section()
+ ->add_output_section_data(brlt_rel);
}
this->brlt_section_
= new Output_data_brlt_powerpc<size, big_endian>(this, brlt_rel);