PowerPC64 DT_RELR local GOT
authorAlan Modra <amodra@gmail.com>
Wed, 19 Jan 2022 00:23:53 +0000 (10:53 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 19 Jan 2022 06:15:45 +0000 (16:45 +1030)
Fixes another case where we end up with superfluous R_PPC64_NONE.

* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate
space for GOT relocs against non-TLS local syms when enable_dt_relr.
(ppc64_elf_layout_multitoc): Likewise.

bfd/elf64-ppc.c

index aeae3b7e640556b9f943eecd45da2be704ac0e76..0ac96afe5a3c6723b2467e32385a12a7d7510c08 100644 (file)
@@ -10318,8 +10318,9 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
                        htab->got_reli_size += rel_size;
                      }
                    else if (bfd_link_pic (info)
-                            && !(ent->tls_type != 0
-                                 && bfd_link_executable (info)))
+                            && (ent->tls_type == 0
+                                ? !info->enable_dt_relr
+                                : !bfd_link_executable (info)))
                      {
                        asection *srel = ppc64_elf_tdata (ibfd)->relgot;
                        srel->size += rel_size;
@@ -12815,8 +12816,9 @@ ppc64_elf_layout_multitoc (struct bfd_link_info *info)
                  htab->got_reli_size += rel_size;
                }
              else if (bfd_link_pic (info)
-                      && !(ent->tls_type != 0
-                           && bfd_link_executable (info)))
+                      && (ent->tls_type == 0
+                          ? !info->enable_dt_relr
+                          : !bfd_link_executable (info)))
                {
                  asection *srel = ppc64_elf_tdata (ibfd)->relgot;
                  srel->size += rel_size;