This is the mail archive of the binutils@sources.redhat.com 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: possible bug in coffcode.h


>Hi Guy,
>
>> There seems to be a bug in bfd/coffcode.h, in v2.12 and previous
>> versions.  If you compile the following program on a generic COFF
>> target:
>
>(Which COFF target are you using ?  The ones I tried did not support
>the weak attribute).

I'm working on a new target for an embedded MCU, the Microchip dsPIC30.

>> The problem seems to be with line 4455 in coffcode.h:
>> 
>>                 dst->symbol.flags = BSF_WEAK;
>> 
>> This over-writes the BSF_NOT_AT_END | BSF_FUNCTION flags set at line
>> 4404.  Consequently, symbol _f2 gets moved when it shouldn't.
>> 
>> To correct the problem, change line 4455 to OR in the BSF_WEAK flag.
>
>I agree that this does appear to be the case.  Since I cannot
>reproduce this bug myself, please could try applying the patch below
>to your sources and then rebuilding the linker and see if it really
>does fix the problem.  If it does, let me know, and I will check it
>in.

Sure thing. That patch does the trick!

>
>Cheers
>        Nick

Thanks very much!

- Guy


Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.69
diff -c -3 -p -w -r1.69 coffcode.h
*** coffcode.h           2002/02/06 16:29:28             1.69
--- coffcode.h           2002/03/14 10:38:54
*************** coff_slurp_symbol_table (abfd)
*** 4443,4458 ****
 
  #ifdef COFF_WITH_PE
                       if (src->u.syment.n_sclass == C_NT_WEAK)
!                                dst->symbol.flags = BSF_WEAK;
                       if (src->u.syment.n_sclass == C_SECTION
                                   && src->u.syment.n_scnum > 0)
-                                {
                                   dst->symbol.flags = BSF_LOCAL;
-                                }
  #endif
- 
                       if (src->u.syment.n_sclass == C_WEAKEXT)
!                                dst->symbol.flags = BSF_WEAK;
 
                       break;
 
--- 4443,4456 ----
 
  #ifdef COFF_WITH_PE
                       if (src->u.syment.n_sclass == C_NT_WEAK)
!                                dst->symbol.flags |= BSF_WEAK;
! 
                       if (src->u.syment.n_sclass == C_SECTION
                                   && src->u.syment.n_scnum > 0)
                                   dst->symbol.flags = BSF_LOCAL;
  #endif
                       if (src->u.syment.n_sclass == C_WEAKEXT)
!                                dst->symbol.flags |= BSF_WEAK;
 
                       break;
 





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