* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Check for relocs
authorAlan Modra <amodra@gmail.com>
Tue, 5 Feb 2002 00:00:23 +0000 (00:00 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 5 Feb 2002 00:00:23 +0000 (00:00 +0000)
against section syms in readonly sections.  Don't do the global
sym check if we find one.
* elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
* elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
(elf_s390_grok_prstatus): Add missing prototype.

bfd/ChangeLog
bfd/elf32-hppa.c
bfd/elf32-i386.c
bfd/elf32-s390.c
bfd/elf64-ppc.c
bfd/elf64-s390.c

index 9ab871447ef557b88b2ae21abbe8431a95f9899c..0c9cbd692019e25979d0d6fc0fe9e928b96c1f04 100644 (file)
@@ -1,3 +1,13 @@
+2002-02-05  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Check for relocs
+       against section syms in readonly sections.  Don't do the global
+       sym check if we find one.
+       * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
+       * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
+       * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
+       (elf_s390_grok_prstatus): Add missing prototype.
+
 2002-02-04  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * elf64-mmix.c (mmix_dump_bpo_gregs): New function.
index 0acfb195280dc2b1ff5b3677e65a5165e063c7e0..41ec0ce60bdab11fffa77b1cba60e5d0e5d8e5ef 100644 (file)
@@ -2329,10 +2329,12 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
                     linker script /DISCARD/, so we'll be discarding
                     the relocs too.  */
                }
-             else
+             else if (p->count != 0)
                {
                  srel = elf_section_data (p->sec)->sreloc;
                  srel->_raw_size += p->count * sizeof (Elf32_External_Rela);
+                 if ((p->sec->output_section->flags & SEC_READONLY) != 0)
+                   info->flags |= DF_TEXTREL;
                }
            }
        }
@@ -2505,7 +2507,9 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
 
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
-         elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info);
+         if ((info->flags & DF_TEXTREL) == 0)
+           elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
+                                   (PTR) info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index 6e79199e0999364444170adf397d6ade248c57e7..a1a7b5ca5d2c309fe55f7b0f50b3ff0dbfded078 100644 (file)
@@ -1500,10 +1500,12 @@ elf_i386_size_dynamic_sections (output_bfd, info)
                     linker script /DISCARD/, so we'll be discarding
                     the relocs too.  */
                }
-             else
+             else if (p->count != 0)
                {
                  srel = elf_section_data (p->sec)->sreloc;
                  srel->_raw_size += p->count * sizeof (Elf32_External_Rel);
+                 if ((p->sec->output_section->flags & SEC_READONLY) != 0)
+                   info->flags |= DF_TEXTREL;
                }
            }
        }
@@ -1625,7 +1627,9 @@ elf_i386_size_dynamic_sections (output_bfd, info)
 
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
-         elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info);
+         if ((info->flags & DF_TEXTREL) == 0)
+           elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
+                                   (PTR) info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index 0e7792fb022001b00649980a31d008f36f06819f..0a913ef81f16b7edb9ede9403d9be122a833fb1d 100644 (file)
@@ -69,6 +69,7 @@ static enum elf_reloc_type_class elf_s390_reloc_type_class
 static boolean elf_s390_finish_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 static boolean elf_s390_object_p PARAMS ((bfd *));
+static boolean elf_s390_grok_prstatus PARAMS ((bfd *, Elf_Internal_Note *));
 
 #define USE_RELA 1             /* We want RELA relocations, not REL.  */
 
@@ -1439,10 +1440,12 @@ elf_s390_size_dynamic_sections (output_bfd, info)
                     linker script /DISCARD/, so we'll be discarding
                     the relocs too.  */
                }
-             else
+             else if (p->count != 0)
                {
                  srela = elf_section_data (p->sec)->sreloc;
                  srela->_raw_size += p->count * sizeof (Elf32_External_Rela);
+                 if ((p->sec->output_section->flags & SEC_READONLY) != 0)
+                   info->flags |= DF_TEXTREL;
                }
            }
        }
@@ -1564,7 +1567,9 @@ elf_s390_size_dynamic_sections (output_bfd, info)
 
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
-         elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info);
+         if ((info->flags & DF_TEXTREL) == 0)
+           elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
+                                   (PTR) info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index 3e24e9994d1a1bf54dad7a6358214598635433a3..a945f5ca431dee81cbc621d9e3b0ed506f61a74c 100644 (file)
@@ -2995,10 +2995,12 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
                     linker script /DISCARD/, so we'll be discarding
                     the relocs too.  */
                }
-             else
+             else if (p->count != 0)
                {
                  srel = elf_section_data (p->sec)->sreloc;
                  srel->_raw_size += p->count * sizeof (Elf64_External_Rela);
+                 if ((p->sec->output_section->flags & SEC_READONLY) != 0)
+                   info->flags |= DF_TEXTREL;
                }
            }
        }
@@ -3135,7 +3137,9 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
 
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
-         elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info);
+         if ((info->flags & DF_TEXTREL) == 0)
+           elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
+                                   (PTR) info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
index 210e152b05826c3603ba7b8b05a41a8f4a544032..efdf194c996f479e8028176e49266cc45705d470 100644 (file)
@@ -1418,10 +1418,12 @@ elf_s390_size_dynamic_sections (output_bfd, info)
                     linker script /DISCARD/, so we'll be discarding
                     the relocs too.  */
                }
-             else
+             else if (p->count != 0)
                {
                  srela = elf_section_data (p->sec)->sreloc;
                  srela->_raw_size += p->count * sizeof (Elf64_External_Rela);
+                 if ((p->sec->output_section->flags & SEC_READONLY) != 0)
+                   info->flags |= DF_TEXTREL;
                }
            }
        }
@@ -1543,7 +1545,9 @@ elf_s390_size_dynamic_sections (output_bfd, info)
 
          /* If any dynamic relocs apply to a read-only section,
             then we need a DT_TEXTREL entry.  */
-         elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info);
+         if ((info->flags & DF_TEXTREL) == 0)
+           elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
+                                   (PTR) info);
 
          if ((info->flags & DF_TEXTREL) != 0)
            {
This page took 0.034366 seconds and 4 git commands to generate.