This is the mail archive of the mailing list for the gas2 project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: global vars and symbol visibility for mips32/elf

   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