patch for cofflink.c
Mark E.
snowball3@bigfoot.com
Sun Jul 2 17:13:00 GMT 2000
Hi guys, I believe I found a bug. In this example:
int func_weak() __attribute__((weak));
int func_weak()
{
return 0;
}
"func_weak" is listed as weak in the final executable. Shouldn't it be turned into a
strong definition for output? It will also make it unneccessary to change GBD to treat
C_WEAKEXT symbols like C_EXT.
00001570 W _func_weak
2000-07-02 Mark Elbrecht <snowball3@bigfoot.com>
* cofflink.c (_bfd_coff_write_global_sym): Turn a weak symbol into
a strong one for the final output.
Index: src/bfd/cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.17
diff -c -p -r1.17 cofflink.c
*** cofflink.c 2000/06/19 01:22:37 1.17
--- cofflink.c 2000/07/02 23:54:04
*************** _bfd_coff_write_global_sym (h, data)
*** 2560,2565 ****
--- 2560,2571 ----
isym.n_sclass = C_STAT;
}
+ /* When a weak symbol is not overriden by a strong one,
+ turn it into an external symbol for the final output. */
+ if (isym.n_sclass == C_WEAKEXT
+ || (obj_pe (abfd) && sym.n_sclass == C_NT_WEAK))
+ isym.n_sclass = C_EXT;
+
isym.n_numaux = h->numaux;
bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) finfo->outsyms);
More information about the Binutils
mailing list