ELF: Consolidate maybe_set_textrel
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 3 Jun 2020 14:07:09 +0000 (07:07 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 3 Jun 2020 14:07:24 +0000 (07:07 -0700)
All maybe_set_textrel implementations are the same.  Consolidate them
to a single _bfd_elf_maybe_set_textrel.

* elf-bfd.h (_bfd_elf_maybe_set_textrel): New
* elf32-arm.c (maybe_set_textrel): Removed.
(elf32_arm_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-csky.c (maybe_set_textrel): Removed.
(csky_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-hppa.c (maybe_set_textrel): Removed.
(elf32_hppa_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-lm32.c (maybe_set_textrel): Removed.
(lm32_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-m32r.c (maybe_set_textrel): Removed.
(m32r_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-metag.c (maybe_set_textrel): Removed.
(elf_metag_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-nds32.c (maybe_set_textrel): Removed.
(nds32_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-or1k.c (maybe_set_textrel): Removed.
(or1k_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-ppc.c (maybe_set_textrel): Removed.
(ppc_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-s390.c (maybe_set_textrel): Removed.
(elf_s390_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-sh.c (maybe_set_textrel): Removed.
(sh_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-tic6x.c (maybe_set_textrel): Removed.
(elf32_tic6x_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf32-tilepro.c (maybe_set_textrel): Removed.
(tilepro_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf64-ppc.c (maybe_set_textrel): Removed.
(ppc64_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elf64-s390.c (maybe_set_textrel): Removed.
(elf_s390_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elfnn-aarch64.c (maybe_set_textrel): Removed.
(elfNN_aarch64_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elfnn-riscv.c (maybe_set_textrel): Removed.
(riscv_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elfxx-sparc.c (maybe_set_textrel): Removed.
(_bfd_sparc_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elfxx-tilegx.c (maybe_set_textrel): Removed.
(tilegx_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elfxx-x86.c (maybe_set_textrel): Removed.
(_bfd_x86_elf_size_dynamic_sections): Replace maybe_set_textrel
with _bfd_elf_maybe_set_textrel.
* elflink.c (_bfd_elf_maybe_set_textrel): New.

23 files changed:
bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf32-arm.c
bfd/elf32-csky.c
bfd/elf32-hppa.c
bfd/elf32-lm32.c
bfd/elf32-m32r.c
bfd/elf32-metag.c
bfd/elf32-nds32.c
bfd/elf32-or1k.c
bfd/elf32-ppc.c
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf32-tic6x.c
bfd/elf32-tilepro.c
bfd/elf64-ppc.c
bfd/elf64-s390.c
bfd/elflink.c
bfd/elfnn-aarch64.c
bfd/elfnn-riscv.c
bfd/elfxx-sparc.c
bfd/elfxx-tilegx.c
bfd/elfxx-x86.c

index 0bafecef2fa6c50c8e65eb35806d1bffd79732b0..d215113495f33d77a9b1795b2fb734b1507b75ed 100644 (file)
@@ -1,3 +1,68 @@
+2020-06-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf-bfd.h (_bfd_elf_maybe_set_textrel): New
+       * elf32-arm.c (maybe_set_textrel): Removed.
+       (elf32_arm_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-csky.c (maybe_set_textrel): Removed.
+       (csky_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-hppa.c (maybe_set_textrel): Removed.
+       (elf32_hppa_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-lm32.c (maybe_set_textrel): Removed.
+       (lm32_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-m32r.c (maybe_set_textrel): Removed.
+       (m32r_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-metag.c (maybe_set_textrel): Removed.
+       (elf_metag_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-nds32.c (maybe_set_textrel): Removed.
+       (nds32_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-or1k.c (maybe_set_textrel): Removed.
+       (or1k_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-ppc.c (maybe_set_textrel): Removed.
+       (ppc_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-s390.c (maybe_set_textrel): Removed.
+       (elf_s390_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-sh.c (maybe_set_textrel): Removed.
+       (sh_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-tic6x.c (maybe_set_textrel): Removed.
+       (elf32_tic6x_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf32-tilepro.c (maybe_set_textrel): Removed.
+       (tilepro_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf64-ppc.c (maybe_set_textrel): Removed.
+       (ppc64_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elf64-s390.c (maybe_set_textrel): Removed.
+       (elf_s390_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elfnn-aarch64.c (maybe_set_textrel): Removed.
+       (elfNN_aarch64_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elfnn-riscv.c (maybe_set_textrel): Removed.
+       (riscv_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elfxx-sparc.c (maybe_set_textrel): Removed.
+       (_bfd_sparc_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elfxx-tilegx.c (maybe_set_textrel): Removed.
+       (tilegx_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elfxx-x86.c (maybe_set_textrel): Removed.
+       (_bfd_x86_elf_size_dynamic_sections): Replace maybe_set_textrel
+       with _bfd_elf_maybe_set_textrel.
+       * elflink.c (_bfd_elf_maybe_set_textrel): New.
+
 2020-06-03  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/26067
index 6b8b5660fb77c8d19fd9c128b2b0ea45cd5aeb61..fbdd19ba21e35fbbe15da230c3ad5ce7ecb94b6d 100644 (file)
@@ -2876,6 +2876,8 @@ extern unsigned int _bfd_elf_symbol_section_index
 
 extern asection *_bfd_elf_readonly_dynrelocs
   (struct elf_link_hash_entry *);
+extern bfd_boolean _bfd_elf_maybe_set_textrel
+  (struct elf_link_hash_entry *, void *);
 
 /* Large common section.  */
 extern asection _bfd_elf_large_com_section;
index fc67ca5207772d5f9d803d92a372ec7b8cd9ad48..8d184b5a094ddd1f85ecb8b506104bfe3a38526b 100644 (file)
@@ -16671,34 +16671,6 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-
-  return TRUE;
-}
-
 void
 bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *info,
                                 int byteswap_code)
@@ -17142,7 +17114,8 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
       /* If any dynamic relocs apply to a read-only section,
         then we need a DT_TEXTREL entry.  */
       if ((info->flags & DF_TEXTREL) == 0)
-       elf_link_hash_traverse (&htab->root, maybe_set_textrel, info);
+       elf_link_hash_traverse (&htab->root,
+                               _bfd_elf_maybe_set_textrel, info);
 
       if ((info->flags & DF_TEXTREL) != 0)
        {
index 03e83d53a50f568ba518a1800e28aa605e30277b..43828beed03296c5847729a45a2f531a60d612ed 100644 (file)
@@ -1893,33 +1893,6 @@ csky_allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -2152,7 +2125,8 @@ csky_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->elf,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0
              && !add_dynamic_entry (DT_TEXTREL, 0))
index 106b5c83159c66ceb0613ba011ff9e89d0dbf8a4..d131f1a0794a26a752d3aee72a8fb2719911e2b2 100644 (file)
@@ -2042,33 +2042,6 @@ clobber_millicode_symbols (struct elf_link_hash_entry *eh,
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *eh, void *inf)
-{
-  asection *sec;
-
-  if (eh->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (eh);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) inf;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, eh->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -2346,7 +2319,8 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->etab, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->etab,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index 5d09f2d350d0a475472baa6d898c727522ab68cb..3c31dd44c853d91a3cb058c4a7d118f40d9dd8e4 100644 (file)
@@ -1914,33 +1914,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -2132,7 +2105,8 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->root, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->root,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index afe0ee899cd724262078afc4445069ec9ffa0878..931e138b37a04ad5ed67b99412f4c59b976a3ad2 100644 (file)
@@ -1978,33 +1978,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -2200,7 +2173,8 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->root, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->root,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index d5e9a9d034e5eacdc8bda7d32dd9a0bb6e376135..7938b24d2a5fd3517b916913a5924693f2731aed 100644 (file)
@@ -2715,33 +2715,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -2966,7 +2939,8 @@ elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->etab, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->etab,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index 4f7ea764691f81408cc50c78e471cf7d4c8e56dd..01ea277426fb345bb5aad237edc899ab86369bfd 100644 (file)
@@ -4252,33 +4252,6 @@ elf32_nds32_add_dynreloc (bfd *output_bfd,
   bfd_elf32_swap_reloca_out (output_bfd, rel, loc);
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -4552,7 +4525,8 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->root, maybe_set_textrel,
+           elf_link_hash_traverse (&htab->root,
+                                   _bfd_elf_maybe_set_textrel,
                                    (void *) info);
 
          if ((info->flags & DF_TEXTREL) != 0)
index b141b45886d19d37abb301d580d3781512effdd3..ac62d630ab34b2d59a62eee813f0789075c4ca15 100644 (file)
@@ -2919,33 +2919,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -3150,7 +3123,8 @@ or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
         /* If any dynamic relocs apply to a read-only section,
            then we need a DT_TEXTREL entry.  */
         if ((info->flags & DF_TEXTREL) == 0)
-          elf_link_hash_traverse (&htab->root, maybe_set_textrel, info);
+          elf_link_hash_traverse (&htab->root,
+                                  _bfd_elf_maybe_set_textrel, info);
 
         if ((info->flags & DF_TEXTREL) != 0)
           {
index 588b79781d80acc85be4f9105781ecdf3625bbb5..0cb7f67504d4d4f56a4272f37d65f4f604a0f12c 100644 (file)
@@ -5423,33 +5423,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 static const unsigned char glink_eh_frame_cie[] =
 {
   0, 0, 0, 16,                         /* length.  */
@@ -5900,7 +5873,8 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
       /* If any dynamic relocs apply to a read-only section, then we
         need a DT_TEXTREL entry.  */
       if ((info->flags & DF_TEXTREL) == 0)
-       elf_link_hash_traverse (elf_hash_table (info), maybe_set_textrel,
+       elf_link_hash_traverse (elf_hash_table (info),
+                               _bfd_elf_maybe_set_textrel,
                                info);
 
       if ((info->flags & DF_TEXTREL) != 0)
index 42f230d9b14c0d8029fc2d54426765d4792687a4..5bd63fe1c942a7aa48a1c8c514312662d684845d 100644 (file)
@@ -1777,33 +1777,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -2027,7 +2000,8 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->elf,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index 0428829757f9de859190e4b60b5f52a9a73ea366..9ec745be199388b3183f0e67b1b6b06d5989d97d 100644 (file)
@@ -2926,33 +2926,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* This function is called after all the input files have been read,
    and the input sections have been assigned to output sections.
    It's a convenient place to determine the PLT style.  */
@@ -3268,7 +3241,8 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->root, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->root,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index f673fe191a68b162fa511f28935a90993101431b..d1ba4c2a93f12979e6216b0a0c37adb3d63c0b02 100644 (file)
@@ -3170,33 +3170,6 @@ elf32_tic6x_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -3410,7 +3383,8 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->elf,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index 9707a9e18e5b4cda77142b2e72c3bbf2e104a8b0..2d78f3c9c89c1ef0c0e372af28d40156f2608cab 100644 (file)
@@ -2168,33 +2168,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Return true if the dynamic symbol for a given section should be
    omitted when creating a shared library.  */
 
@@ -2441,7 +2414,8 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
       /* If any dynamic relocs apply to a read-only section,
         then we need a DT_TEXTREL entry.  */
       if ((info->flags & DF_TEXTREL) == 0)
-       elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info);
+       elf_link_hash_traverse (&htab->elf,
+                               _bfd_elf_maybe_set_textrel, info);
 
       if (info->flags & DF_TEXTREL)
        {
index 49fda96be7a3f8222478995169bd1c8addc68419..5f99d4344b7623c8d29c733a5f5d26a935093f5d 100644 (file)
@@ -9862,33 +9862,6 @@ size_global_entry_stubs (struct elf_link_hash_entry *h, void *inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *inf)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) inf;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo (_("%pB: dynamic relocation against `%pT'"
-                               " in read-only section `%pA'\n"),
-                             sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -10264,7 +10237,8 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->elf,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index 197e9bc68c7ac4e8b436a9c6304f70585020748a..5b95b5f814ad239752452d9b60fbb1e7dcb15e4d 100644 (file)
@@ -1713,33 +1713,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h,
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -1981,7 +1954,8 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->elf,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index a2b40ccb046bbd32ae811395f3294026a5388f08..ce6282a9dcfc0691ff05979222adba6e816d1c2f 100644 (file)
@@ -14841,3 +14841,37 @@ _bfd_elf_readonly_dynrelocs (struct elf_link_hash_entry *h)
     }
   return NULL;
 }
+
+/* Set DF_TEXTREL if we find any dynamic relocs that apply to
+   read-only sections.  */
+
+bfd_boolean
+_bfd_elf_maybe_set_textrel (struct elf_link_hash_entry *h, void *inf)
+{
+  asection *sec;
+
+  if (h->root.type == bfd_link_hash_indirect)
+    return TRUE;
+
+  sec = _bfd_elf_readonly_dynrelocs (h);
+  if (sec != NULL)
+    {
+      struct bfd_link_info *info = (struct bfd_link_info *) inf;
+
+      info->flags |= DF_TEXTREL;
+      /* xgettext:c-format */
+      info->callbacks->minfo (_("%pB: dynamic relocation against `%pT' "
+                               "in read-only section `%pA'\n"),
+                             sec->owner, h->root.root.string, sec);
+
+      if (bfd_link_textrel_check (info))
+       /* xgettext:c-format */
+       info->callbacks->einfo (_("%P: %pB: warning: relocation against `%s' "
+                                 "in read-only section `%pA'\n"),
+                               sec->owner, h->root.root.string, sec);
+
+      /* Not an error, just cut short the traversal.  */
+      return FALSE;
+    }
+  return TRUE;
+}
index 71634ffba773b63d58dc0242b3ed1d21a3ee5e64..64215f718500c24eb5df15921d57f086eec23097 100644 (file)
@@ -8856,33 +8856,6 @@ elfNN_aarch64_allocate_local_ifunc_dynrelocs (void **slot, void *inf)
   return elfNN_aarch64_allocate_ifunc_dynrelocs (h, inf);
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* This is the most important function of all . Innocuosly named
    though !  */
 
@@ -9186,7 +9159,8 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->root, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->root,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index 3c972e20ab59aa962b7641e81f6874cca1498f97..163c4d9f7450f85d128966ba81668e99c8809095 100644 (file)
@@ -1088,33 +1088,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 static bfd_boolean
 riscv_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
 {
@@ -1321,7 +1294,8 @@ riscv_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
       /* If any dynamic relocs apply to a read-only section,
         then we need a DT_TEXTREL entry.  */
       if ((info->flags & DF_TEXTREL) == 0)
-       elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info);
+       elf_link_hash_traverse (&htab->elf,
+                               _bfd_elf_maybe_set_textrel, info);
 
       if (info->flags & DF_TEXTREL)
        {
index e4700e31069daf489f6d0ddadfafd90a5337c183..5ef29eac28382bcd1937800573ab02814125cd71 100644 (file)
@@ -2359,33 +2359,6 @@ allocate_local_dynrelocs (void **slot, void *inf)
   return allocate_dynrelocs (h, inf);
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Return true if the dynamic symbol for a given section should be
    omitted when creating a shared library.  */
 
@@ -2640,7 +2613,8 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
       /* If any dynamic relocs apply to a read-only section,
         then we need a DT_TEXTREL entry.  */
       if ((info->flags & DF_TEXTREL) == 0)
-       elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info);
+       elf_link_hash_traverse (&htab->elf,
+                               _bfd_elf_maybe_set_textrel, info);
 
       if (info->flags & DF_TEXTREL)
        {
index 07288a13e8c9510b0fd98ec7e74dbb6bd37a15ac..9d8b42e1de0804fd93c7b33694a90f20438e6a70 100644 (file)
@@ -2414,33 +2414,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Return true if the dynamic symbol for a given section should be
    omitted when creating a shared library.  */
 
@@ -2681,7 +2654,8 @@ tilegx_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* If any dynamic relocs apply to a read-only section,
         then we need a DT_TEXTREL entry.  */
       if ((info->flags & DF_TEXTREL) == 0)
-       elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info);
+       elf_link_hash_traverse (&htab->elf,
+                               _bfd_elf_maybe_set_textrel, info);
 
       if (info->flags & DF_TEXTREL)
        {
index b8c616f4d84ec09a0e381480a130ca9a3fce857a..035b5c5c64c4207018accb279d7957064336700c 100644 (file)
@@ -532,44 +532,6 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
   return TRUE;
 }
 
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *inf)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  /* Skip local IFUNC symbols. */
-  if (h->forced_local && h->type == STT_GNU_IFUNC)
-    return TRUE;
-
-  sec = _bfd_elf_readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) inf;
-
-      info->flags |= DF_TEXTREL;
-      /* xgettext:c-format */
-      info->callbacks->minfo (_("%pB: dynamic relocation against `%pT' "
-                               "in read-only section `%pA'\n"),
-                             sec->owner, h->root.root.string, sec);
-
-      if (bfd_link_textrel_check (info))
-       /* xgettext:c-format */
-       info->callbacks->einfo (_("%P: %pB: warning: relocation against `%s' "
-                                 "in read-only section `%pA'\n"),
-                               sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
-}
-
 /* Allocate space in .plt, .got and associated reloc sections for
    local dynamic relocs.  */
 
@@ -1450,7 +1412,8 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd,
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
          if ((info->flags & DF_TEXTREL) == 0)
-           elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info);
+           elf_link_hash_traverse (&htab->elf,
+                                   _bfd_elf_maybe_set_textrel, info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
This page took 0.057802 seconds and 4 git commands to generate.