From b0d0d02bde06c61969160c0c5a3d7f48daa8b24a Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 3 Nov 2020 20:51:13 +1030 Subject: [PATCH] PowerPC problem building gold with clang * powerpc.cc (Target_powerpc::tocsave_loc): Return a pointer. (Target_powerpc::Relocate::relocate): Avoid -Wdangling-gsl error. --- gold/ChangeLog | 5 +++++ gold/powerpc.cc | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 48e315affeb..73a74190511 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2020-11-03 Alan Modra + + * powerpc.cc (Target_powerpc::tocsave_loc): Return a pointer. + (Target_powerpc::Relocate::relocate): Avoid -Wdangling-gsl error. + 2020-11-03 Nick Gasson PR 26827 diff --git a/gold/powerpc.cc b/gold/powerpc.cc index 476fb4e588d..b0d6a74bec5 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -757,10 +757,10 @@ class Target_powerpc : public Sized_target } // Accessor - const Tocsave_loc + const Tocsave_loc* tocsave_loc() const { - return this->tocsave_loc_; + return &this->tocsave_loc_; } void @@ -11946,8 +11946,8 @@ Target_powerpc::Relocate::relocate( loc.object = relinfo->object; loc.shndx = relinfo->data_shndx; loc.offset = rela.get_r_offset(); - Tocsave_loc::const_iterator p = target->tocsave_loc().find(loc); - if (p != target->tocsave_loc().end()) + const Tocsave_loc *tocsave = target->tocsave_loc(); + if (tocsave->find(loc) != tocsave->end()) { // If we've generated plt calls using this tocsave, then // the nop needs to be changed to save r2. -- 2.30.2