From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Lance Taylor To: dm@sgi.com Cc: dm@sgi.com, gcc2@cygnus.com, gas2@cygnus.com Subject: Re: global vars and symbol visibility for mips32/elf Date: Fri, 09 Aug 1996 09:01:00 -0000 Message-id: <199608091535.LAA05132@sanguine.cygnus.com> References: <199608091224.FAA07966@neteng.engr.sgi.com> X-SW-Source: 1996/msg00077.html Date: Fri, 9 Aug 1996 05:24:28 -0700 From: "David S. Miller" Addendum, after further reasearch, the following patch to bfd/elflink.h "fixes" my problem. I say "fixes" because I am doubtful that my fix is correct. Would someone who is more knowledgable please comment on my change? --- elflink.h.~1~ Fri Aug 9 05:19:07 1996 +++ elflink.h Fri Aug 9 05:20:37 1996 @@ -685,7 +685,7 @@ if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak || (h->root.type == bfd_link_hash_common - && bind == STB_WEAK)) + && (bind == STB_WEAK || bind == STB_GLOBAL))) { sec = bfd_und_section_ptr; definition = false; This patch is not correct. I have not tested this, but I believe that it will break a program that looks like this: int sys_nerr; foo () { printf ("%d\n", sys_nerr); } Your patch will cause the program to use the uninitialized common variable sys_nerr. However, what is desired here is that sys_nerr become a reference to the global variable sys_nerr in the shared library. Ian