This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: possible bug in coffcode.h
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- To: Guy dot McCarthy at microchip dot com
- Cc: binutils at sources dot redhat dot com
- Date: 14 Mar 2002 10:42:30 +0000
- Subject: Re: possible bug in coffcode.h
- References: <OF498BC90A.A81881E4-ON07256B7B.00795B35@microchip.com>
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).
> 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.
Cheers
Nick
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;