PowerPC problem building gold with clang
authorAlan Modra <amodra@gmail.com>
Tue, 3 Nov 2020 10:21:13 +0000 (20:51 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 3 Nov 2020 14:18:51 +0000 (00:48 +1030)
* powerpc.cc (Target_powerpc::tocsave_loc): Return a pointer.
(Target_powerpc::Relocate::relocate): Avoid -Wdangling-gsl error.

gold/ChangeLog
gold/powerpc.cc

index 48e315affeb24b771746589b9e9d07d99c0ccae6..73a741905114d62c417b7e87ce9e35db88c51b44 100644 (file)
@@ -1,3 +1,8 @@
+2020-11-03  Alan Modra  <amodra@gmail.com>
+
+       * powerpc.cc (Target_powerpc::tocsave_loc): Return a pointer.
+       (Target_powerpc::Relocate::relocate): Avoid -Wdangling-gsl error.
+
 2020-11-03  Nick Gasson  <nick.gasson@arm.com>
 
        PR 26827
index 476fb4e588d85f383b4d68bd9746d9ebb6be4bba..b0d6a74bec5ac477918091190ff906d1a417fbbc 100644 (file)
@@ -757,10 +757,10 @@ class Target_powerpc : public Sized_target<size, big_endian>
   }
 
   // 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<size, big_endian>::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.