diff options
author | Alan Modra <amodra@bigpond.net.au> | 2008-08-20 13:43:32 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2008-08-20 13:43:32 +0000 |
commit | fb7894c4911abb6ac3f1c01573e239e4c748f51b (patch) | |
tree | 891c1939d4166c3b2a9296cd4de44aa21f7e5d0e /gas/write.c | |
parent | cf88814ffcbf55f41236958f7aa8f592d79c26a9 (diff) | |
download | binutils-redhat-fb7894c4911abb6ac3f1c01573e239e4c748f51b.tar.gz |
PR 6848
* write.c (install_reloc): Check that reloc symbols have been
written.
(set_symtab): Mark symbols with BSF_KEEP.
Diffstat (limited to 'gas/write.c')
-rw-r--r-- | gas/write.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gas/write.c b/gas/write.c index 660df811b6..55c757d356 100644 --- a/gas/write.c +++ b/gas/write.c @@ -1084,6 +1084,15 @@ install_reloc (asection *sec, arelent *reloc, fragS *fragp, { char *err; bfd_reloc_status_type s; + asymbol *sym; + + if (reloc->sym_ptr_ptr != NULL + && (sym = *reloc->sym_ptr_ptr) != NULL + && (sym->flags & BSF_KEEP) == 0 + && ((sym->flags & BSF_SECTION_SYM) == 0 + || !EMIT_SECTION_SYMBOLS + || !bfd_is_abs_section (sym->section))) + as_bad_where (file, line, _("redefined symbol cannot be used on reloc")); s = bfd_install_relocation (stdoutput, reloc, fragp->fr_literal, fragp->fr_address, @@ -1377,6 +1386,10 @@ set_symtab (void) for (i = 0; i < nsyms; i++, symp = symbol_next (symp)) { asympp[i] = symbol_get_bfdsym (symp); + if (asympp[i]->flags != BSF_SECTION_SYM + || !(bfd_is_const_section (asympp[i]->section) + && asympp[i]->section->symbol == asympp[i])) + asympp[i]->flags |= BSF_KEEP; symbol_mark_written (symp); } } |