From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id E3F303858D28; Wed, 21 Jun 2023 13:36:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3F303858D28 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb/binutils-2_40-branch] PR30536, ppc64el gold linker produces unusable clang-16 binary X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/binutils-2_40-branch X-Git-Oldrev: 756b006e0db6bc0ea7013b790d98c12734fc0c77 X-Git-Newrev: 03f49a0619c5598eea80511efef5a88c4f7bb293 Message-Id: <20230621133624.E3F303858D28@sourceware.org> Date: Wed, 21 Jun 2023 13:36:24 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jun 2023 13:36:25 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D03f49a0619c5= 598eea80511efef5a88c4f7bb293 commit 03f49a0619c5598eea80511efef5a88c4f7bb293 Author: Alan Modra Date: Wed Jun 21 22:44:09 2023 +0930 PR30536, ppc64el gold linker produces unusable clang-16 binary =20 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. =20 PR 30536 PR 30217 * powerpc.cc (Target_powerpc::make_brlt_section): Don't use rela_dyn_. =20 (cherry picked from commit dc808a2ebab337b5517add4c1aad298cf836c239) Diff: --- gold/powerpc.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gold/powerpc.cc b/gold/powerpc.cc index a847dadf900..aa2d9a18787 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -4632,7 +4632,15 @@ Target_powerpc::make_brlt_section(= Layout* layout) { // When PIC we can't fill in .branch_lt but must initialise at // runtime via dynamic relocations. - brlt_rel =3D 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 =3D new Reloc_section(false); + if (this->rela_dyn_->output_section()) + this->rela_dyn_->output_section() + ->add_output_section_data(brlt_rel); } this->brlt_section_ =3D new Output_data_brlt_powerpc(this, brlt_rel);