From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Mark E." To: binutils@sourceware.cygnus.com Subject: patch for cofflink.c Date: Sun, 02 Jul 2000 17:13:00 -0000 Message-id: <395FA274.29278.293B59@localhost> X-SW-Source: 2000-07/msg00013.html 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 * 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);