diff options
author | Ian Lance Taylor <ian@airs.com> | 1996-12-15 20:27:08 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1996-12-15 20:27:08 +0000 |
commit | 6259c65f733b8030324db077d09aaabf07707e8b (patch) | |
tree | c9d3cacd605ed4ea2053924d41c773bf324ee664 /gas/write.c | |
parent | c8f580cec6f4da926617aec2f21ca9e90868efba (diff) | |
download | gdb-6259c65f733b8030324db077d09aaabf07707e8b.zip gdb-6259c65f733b8030324db077d09aaabf07707e8b.tar.gz gdb-6259c65f733b8030324db077d09aaabf07707e8b.tar.bz2 |
* write.c (adjust_reloc_syms): Fix linkonce check for ELF.
Diffstat (limited to 'gas/write.c')
-rw-r--r-- | gas/write.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/gas/write.c b/gas/write.c index daf8738..ab026f1 100644 --- a/gas/write.c +++ b/gas/write.c @@ -718,23 +718,39 @@ adjust_reloc_syms (abfd, sec, xxx) goto done; } -#ifdef BFD_ASSEMBLER /* Don't try to reduce relocs which refer to .linkonce sections. It can lead to confusion when a debugging section refers to a .linkonce section. I hope this will always be correct. */ - if (symsec != sec - && ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE) - != 0)) + if (symsec != sec) { - fixp->fx_addsy->sy_used_in_reloc = 1; + boolean linkonce; + + linkonce = false; +#ifdef BFD_ASSEMBLER + if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE) + != 0) + linkonce = true; +#endif +#ifdef OBJ_ELF + /* The GNU toolchain uses an extension for ELF: a section + beginning with the magic string .gnu.linkonce is a + linkonce section. */ + if (strncmp (segment_name (symsec), ".gnu.linkonce", + sizeof ".gnu.linkonce" - 1) == 0) + linkonce = true; +#endif + + if (linkonce) + { + fixp->fx_addsy->sy_used_in_reloc = 1; #ifdef UNDEFINED_DIFFERENCE_OK - if (fixp->fx_subsy != NULL) - fixp->fx_subsy->sy_used_in_reloc = 1; + if (fixp->fx_subsy != NULL) + fixp->fx_subsy->sy_used_in_reloc = 1; #endif - goto done; + goto done; + } } -#endif /* Since we're reducing to section symbols, don't attempt to reduce anything that's already using one. */ |