PR 354
authorAlan Modra <amodra@gmail.com>
Mon, 11 Oct 2004 04:54:27 +0000 (04:54 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 11 Oct 2004 04:54:27 +0000 (04:54 +0000)
* elflink.c (elf_link_input_bfd): Check that relocs in SEC_ALLOC
sections do not reference symbols in non-SEC_ALLOC sections.

bfd/ChangeLog
bfd/elflink.c

index cc79ca5221e8f070890aa70ce8e4f72a9e2da0a2..206f16be520a619a6d71fdfbaf2cb6f89dbc2ed6 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-11  Alan Modra  <amodra@bigpond.net.au>
+
+       PR 354
+       * elflink.c (elf_link_input_bfd): Check that relocs in SEC_ALLOC
+       sections do not reference symbols in non-SEC_ALLOC sections.
+
 2004-10-11  Alan Modra  <amodra@bigpond.net.au>
 
        PR 437
index 08c0aee6f1d880cc6f0823fb865b1b476fe596e3..f47d4646f4696147973e251ebff93a8403a1bae6 100644 (file)
@@ -6788,6 +6788,21 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
                      rel->r_info &= r_type_mask;
                      rel->r_addend = 0;
                    }
+
+                 /* Check that loaded segments don't reference symbols
+                    in non-loaded segments.  */
+                 if ((o->flags & SEC_ALLOC) != 0
+                     && sec != NULL
+                     && !bfd_is_abs_section (sec)
+                     && !elf_discarded_section (sec)
+                     && sec->output_section != NULL
+                     && (sec->output_section->flags & SEC_ALLOC) == 0)
+                   {
+                     (*_bfd_error_handler)
+                       (_("`%s' referenced in section `%A' of %B: "
+                          "defined in non-loaded section `%A' of %B\n"),
+                        o, input_bfd, sec, sec->owner, sym_name);
+                   }
                }
            }