This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix arm-pe reloc generations for redefined symbols


Hi Richard,

+       for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym))
+ 	if (sym == fixP->fx_addsy)
+ 	  break;
+       if (sym == NULL)
+ 	return 1;

Surely there's a better way of doing this.  This test is O(S*F) which is
really going to slow up assembly on large files, for a nasty corner
case.

Good point. There is a better way. The original of a cloned, replaced symbol will not be on any list, so we can just check its next and previous pointers. So I am going to check in this revision to my original patch.


Cheers
  Nick



Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.266
diff -c -3 -p -r1.266 tc-arm.c
*** gas/config/tc-arm.c	9 May 2006 11:47:48 -0000	1.266
--- gas/config/tc-arm.c	9 May 2006 14:56:30 -0000
*************** arm_fix_adjustable (fixS * fixP)
*** 17016,17036 ****
  
    /* This is a hack for the gas/all/redef2.s test.  This test causes symbols
       to be cloned, and without this test relocs would still be generated
!      against the original pre-cloned symbol.  Such symbols would not appear
       in the symbol table however, and so a valid reloc could not be
       generated.  So check to see if the fixup is against a symbol which has
       been removed from the symbol chain, and if it is, then allow it to be
       adjusted into a reloc against a section symbol. */
!   if (fixP->fx_addsy != NULL)
!     {
!       symbolS * sym;
! 
!       for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym))
! 	if (sym == fixP->fx_addsy)
! 	  break;
!       if (sym == NULL)
! 	return 1;
!     }
    
    return 0;
  }
--- 17016,17031 ----
  
    /* This is a hack for the gas/all/redef2.s test.  This test causes symbols
       to be cloned, and without this test relocs would still be generated
!      against the original, pre-cloned symbol.  Such symbols would not appear
       in the symbol table however, and so a valid reloc could not be
       generated.  So check to see if the fixup is against a symbol which has
       been removed from the symbol chain, and if it is, then allow it to be
       adjusted into a reloc against a section symbol. */
!   if (fixP->fx_addsy != NULL
!       && ! S_IS_LOCAL (fixP->fx_addsy)
!       && symbol_next (fixP->fx_addsy) == NULL
!       && symbol_next (fixP->fx_addsy) == symbol_previous (fixP->fx_addsy))
!     return 1;
    
    return 0;
  }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]