global vars and symbol visibility for mips32/elf
Ian Lance Taylor
ian@cygnus.com
Fri Aug 9 09:01:00 GMT 1996
Date: Fri, 9 Aug 1996 05:24:28 -0700
From: "David S. Miller" <dm@neteng.engr.sgi.com>
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
More information about the Gas2
mailing list