This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Fix SHF_MERGE on Alpha
- To: rth at redhat dot com
- Subject: [PATCH] Fix SHF_MERGE on Alpha
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Sat, 23 Jun 2001 22:05:01 +0200
- Cc: binutils at sources dot redhat dot com
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
Hi!
Without this patch SHF_MERGE support does not work on Alpha.
The issue is that when adding SHF_MERGE support, I've added
/* Never adjust a reloc against local symbol in a merge section. */
if (symsec->flags & SEC_MERGE)
{
symbol_mark_used_in_reloc (fixp->fx_addsy);
goto done;
}
snippet into gas/write.c (adjust_reloc_syms), so that relocations against
SEC_MERGE sections are deferred to link time, but apparently tc_gen_reloc's
hack needs to be kept in sync with that, since otherwise I get stuff like:
000000a4 00004 R_ALPHA_LITERAL 0000000000000016 $LC2 + 16
...
11: 0000000000000016 0 NOTYPE LOCAL DEFAULT 6 $LC2
(ie. 0x16 is added twice there, once in reloc's addend, once because it is
reloc against a non-STT_SECTION symbol).
Ok to commit?
2001-06-23 Jakub Jelinek <jakub@redhat.com>
* config/tc-alpha.c (tc_gen_reloc): Handle relocs against SEC_MERGE
section symbols the same way as externs.
--- gas/config/tc-alpha.c.jj Fri Mar 9 00:24:22 2001
+++ gas/config/tc-alpha.c Sat Jun 23 21:57:44 2001
@@ -1591,7 +1591,8 @@ tc_gen_reloc (sec, fixp)
* at assembly time. bfd_perform_reloc doesn't know about this sort
* of thing, and as a result we need to fake it out here.
*/
- if ((S_IS_EXTERN (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy))
+ if ((S_IS_EXTERN (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy)
+ || (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_MERGE))
&& !S_IS_COMMON (fixp->fx_addsy))
reloc->addend -= symbol_get_bfdsym (fixp->fx_addsy)->value;
#endif
Jakub