This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Clean up platform-specific code in gas/write.c
- To: law at cygnus dot com
- Subject: Re: Clean up platform-specific code in gas/write.c
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 19 Aug 2000 14:06:50 -0300
- Cc: binutils at sources dot redhat dot com
- Organization: GCC Team, Red Hat
- References: <26772.966555964@upchuck>
On Aug 17, 2000, Jeffrey A Law <law@cygnus.com> wrote:
> The long term plan is to grovel over those targets' definition of
> md_apply_fix and fix them up -- which would eventually allow
> TC_DONT_FIX_NON_ADJUSTABLE to go away. But for now we'll keep it to
> avoid accidentally breaking a lot of ports.
But meanwhile, it seems that we may need one more instance of it.
I've been playing with deferring PCREL relocations of non_adjustable
symbols to the linker on SH, and found not only a couple of
limitations in the SH linker (patch to follow), but also the need to
not apply the negative relocation of PC. I wonder if existing ports
compensate for it too, and we need yet another target-specific macro,
or we can just reuse TC_DONT_FIX_NON_ADJUSTABLE.
Another alternative would be to have TC_DONT_FIX_NON_ADJUSTABLE be
called as a macro to tell whether to apply the relocation. Then, it
could decide whether to apply it based on the relocation type.
Presumably, PC-relative relocations should not be deferred to the
linker, since they may be limited in range.
Here's the patch I'm currently playing with. I'm not sure I like it,
but maybe someone else does... :-)
Index: gas/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* write.c (fixup_segment) [TC_DONT_FIX_NON_ADJUSTABLE]: Don't
subtract MD_PCREL_FROM_SECTION() if relocation is deferred.
Index: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.16
diff -u -p -r1.16 write.c
--- gas/write.c 2000/08/18 18:45:05 1.16
+++ gas/write.c 2000/08/19 16:44:08
@@ -2723,7 +2723,17 @@ fixup_segment (fixP, this_segment_type)
if (pcrel)
{
- add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
+#ifdef TC_DONT_FIX_NON_ADJUSTABLE
+ if (1
+#ifdef obj_fix_adjustable
+ && obj_fix_adjustable (fixP)
+#endif
+#ifdef tc_fix_adjustable
+ && tc_fix_adjustable (fixP)
+#endif
+ )
+#endif
+ add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
if (add_symbolP == 0)
{
#ifndef BFD_ASSEMBLER
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me