public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* patch for cofflink.c
@ 2000-07-02 17:13 Mark E.
  0 siblings, 0 replies; 2+ messages in thread
From: Mark E. @ 2000-07-02 17:13 UTC (permalink / raw)
  To: binutils

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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: patch for cofflink.c
@ 2000-07-02 20:43 Mark E.
  0 siblings, 0 replies; 2+ messages in thread
From: Mark E. @ 2000-07-02 20:43 UTC (permalink / raw)
  To: binutils

Also, one question: If this patch has the right idea, should it only do this for a static link (to an .exe in DJGPP) or is this ok for a shared link (to a .dll in Win32)?


> +   if (isym.n_sclass == C_WEAKEXT
> +       || (obj_pe (abfd) && sym.n_sclass == C_NT_WEAK))
> +     isym.n_sclass = C_EXT;
> + 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-07-02 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-02 17:13 patch for cofflink.c Mark E.
2000-07-02 20:43 Mark E.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).