diff options
author | Alan Modra <amodra@gmail.com> | 2004-10-11 04:54:27 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2004-10-11 04:54:27 +0000 |
commit | 2ad770c3805fe1546fb9ca004db785dcdc5966df (patch) | |
tree | d86b84fcd9da68f579ee1233d68d5f2bd7c48010 | |
parent | 6c0c5b1e5da52f6a3cb0fa3e1707fb9652459770 (diff) | |
download | gdb-2ad770c3805fe1546fb9ca004db785dcdc5966df.zip gdb-2ad770c3805fe1546fb9ca004db785dcdc5966df.tar.gz gdb-2ad770c3805fe1546fb9ca004db785dcdc5966df.tar.bz2 |
PR 354
* elflink.c (elf_link_input_bfd): Check that relocs in SEC_ALLOC
sections do not reference symbols in non-SEC_ALLOC sections.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elflink.c | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cc79ca5..206f16b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 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 * elflink.c (elf_link_sort_relocs): Don't bomb on unusual sections. (_bfd_elf_link_omit_section_dynsym): Formatting. diff --git a/bfd/elflink.c b/bfd/elflink.c index 08c0aee..f47d464 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -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); + } } } |