Properly warn relocation in readonly section in a shared object.
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 1 Jun 2011 19:42:01 +0000 (19:42 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 1 Jun 2011 19:42:01 +0000 (19:42 +0000)
2011-06-01  H.J. Lu  <hongjiu.lu@intel.com>

* elf32-i386.c (elf_i386_size_dynamic_sections): Properly warn
relocation in readonly section in a shared object.
* elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c

index 2591ab87569879e0e76514cedd2bca550a7af3cc..a3ca64b21d66b2a706f94c7a85d398fe4d167240 100644 (file)
@@ -1,3 +1,9 @@
+2011-06-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf32-i386.c (elf_i386_size_dynamic_sections): Properly warn
+       relocation in readonly section in a shared object.
+       * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise.
+
 2011-05-31  Nick Clifton  <nickc@redhat.com>
 
        * archive.c (adjust_relative_path): Fix comment to prevent it
index ee1511f216b3c6aa2a7124c5b49925a0adc1747a..eea22633a5ead970d96097333b06c87f26008279 100644 (file)
@@ -2488,13 +2488,13 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
                {
                  srel = elf_section_data (p->sec)->sreloc;
                  srel->size += p->count * sizeof (Elf32_External_Rel);
-                 if ((p->sec->output_section->flags & SEC_READONLY) != 0)
+                 if ((p->sec->output_section->flags & SEC_READONLY) != 0
+                     && (info->flags & DF_TEXTREL) == 0)
                    {
                      info->flags |= DF_TEXTREL;
                      if (info->warn_shared_textrel && info->shared)
                        info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'.\n"),
                                                p->sec->owner, p->sec);
-                     break;
                    }
                }
            }
index 5cbaff87047391b9b28fac77c745133f4203682e..9d6d4a401aa5caf38c8f71ea87425f8b8c58b97f 100644 (file)
@@ -2399,13 +2399,13 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
                {
                  srel = elf_section_data (p->sec)->sreloc;
                  srel->size += p->count * bed->s->sizeof_rela;
-                 if ((p->sec->output_section->flags & SEC_READONLY) != 0)
+                 if ((p->sec->output_section->flags & SEC_READONLY) != 0
+                     && (info->flags & DF_TEXTREL) == 0)
                    {
                      info->flags |= DF_TEXTREL;
                      if (info->warn_shared_textrel && info->shared)
                        info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'.\n"),
                                                p->sec->owner, p->sec);
-                     break;
                    }
                }
            }