« Return to Thread: RE: PR 6848: Not all targets generate relocs against kept symbols.

Re: PR 6848: Not all targets generate relocs against kept symbols.

by Alan Modra :: Rate this Message:

Reply to Author | View in Thread

On Sun, Sep 14, 2008 at 10:10:34AM +0100, Nick Clifton wrote:
>   Your fix for PR 6848 has introduced new testsuite failures for
>   various ports, most notably the FRV:
[snip]
>   and the MMIX:
[snip]

Sigh.  I must have not run a multi-target test..  Oh well, I think we
can fix these closer to the point where the targets introduce the odd
symbols rather than weakening the reloc symbol check.  For FRV, I
don't see why expr_build_uconstant is needed.  The same is probably
true for the MMIX BFD_RELOC_MMIX_BASE_PLUS_OFFSET expresion symbol but
I couldn't convince myself of that so opted to mark the symbol.

        * config/tc-frv.c (md_apply_fix): Use abs_section_sym for
        relocs with no symbol.
        * config/tc-mmix.c (md_assemble): Mark fake symbol on
        BFD_RELOC_MMIX_BASE_PLUS_OFFSET as OK for use by relocs.
        (mmix_md_end): Likewise mark mmix reg contents section symbol.

Index: gas/config/tc-frv.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-frv.c,v
retrieving revision 1.25
diff -u -p -r1.25 tc-frv.c
--- gas/config/tc-frv.c 12 Aug 2008 23:39:30 -0000 1.25
+++ gas/config/tc-frv.c 15 Sep 2008 01:26:50 -0000
@@ -1475,7 +1475,7 @@ md_apply_fix (fixS *fixP, valueT *valP,
       case BFD_RELOC_FRV_TLSDESC_RELAX:
       case BFD_RELOC_FRV_GETTLSOFF_RELAX:
       case BFD_RELOC_FRV_TLSOFF_RELAX:
- fixP->fx_addsy = expr_build_uconstant (0);
+ fixP->fx_addsy = abs_section_sym;
  break;
       }
   else
Index: gas/config/tc-mmix.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mmix.c,v
retrieving revision 1.30
diff -u -p -r1.30 tc-mmix.c
--- gas/config/tc-mmix.c 16 Jun 2008 15:04:41 -0000 1.30
+++ gas/config/tc-mmix.c 15 Sep 2008 02:58:38 -0000
@@ -1365,6 +1365,9 @@ md_assemble (char *str)
      pass expressions as symbols and use fix_new, not fix_new_exp.  */
   sym = make_expr_symbol (exp + 1);
 
+  /* Mark the symbol as being OK for a reloc.  */
+  symbol_get_bfdsym (sym)->flags |= BSF_KEEP;
+
   /* Now we know it can be a "base address plus offset".  Add
      proper fixup types so we can handle this later, when we've
      parsed everything.  */
@@ -3448,6 +3451,7 @@ mmix_md_end (void)
 {
   fragS *fragP;
   symbolS *mainsym;
+  asection *regsec;
   int i;
 
   /* The first frag of GREG:s going into the register contents section.  */
@@ -3512,9 +3516,9 @@ mmix_md_end (void)
  and the same allocation order (within a file) as mmixal.  */
       segT this_segment = now_seg;
       subsegT this_subsegment = now_subseg;
-      asection *regsec
- = bfd_make_section_old_way (stdoutput,
-    MMIX_REG_CONTENTS_SECTION_NAME);
+
+      regsec = bfd_make_section_old_way (stdoutput,
+ MMIX_REG_CONTENTS_SECTION_NAME);
       subseg_set (regsec, 0);
 
       /* Finally emit the initialization-value.  Emit a variable frag, which
@@ -3541,6 +3545,11 @@ mmix_md_end (void)
       subseg_set (this_segment, this_subsegment);
     }
 
+  regsec = bfd_get_section_by_name (stdoutput, MMIX_REG_CONTENTS_SECTION_NAME);
+  /* Mark the section symbol as being OK for a reloc.  */
+  if (regsec != NULL)
+    regsec->symbol->flags |= BSF_KEEP;
+
   /* Iterate over frags resulting from GREGs and move those that evidently
      have the same value together and point one to another.
 
--
Alan Modra
Australia Development Lab, IBM

 « Return to Thread: RE: PR 6848: Not all targets generate relocs against kept symbols.