A ELF_LINK_NON_GOT_REF patch

Ian Lance Taylor ian@zembu.com
Thu Sep 9 19:28:00 GMT 1999


   Date: Thu, 9 Sep 1999 15:51:45 -0700 (PDT)
   From: hjl@varesearch.com (H.J. Lu)

   I need this patch. Otherwise, I get

   # cat main.c
   extern   char *sys_errlist[] ;

   main ()
   {
     return sys_errlist[0]== 0;
   }
   # gcc main.c
   /usr/i386-redhat-linux/bin/ld: /tmp/ccZizvat.o: warning: unresolvable
   relocation against symbol `sys_errlist@@GLIBC_2.1' from .text section

   on Linux/glibc 2.1.

I don't have glibc 2.1.  Can you give me a standalone test case?

Your patch isn't correct.  You don't consider the various error and
multiple definition cases.

I also don't see why it is needed.  The code which does consider the
other cases already copies the flag.  Do you have Andreas's patch in
your sources?

1999-09-06  Andreas Schwab  <schwab@suse.de>

	* elflink.h (elf_link_add_object_symbols): Copy NON_GOT_REF flag
	to version symbols.

The weakdef flag is copied down in elf_adjust_dynamic_symbol.

I'll note that comments like ``very tricky'' are fine when you explain
the trickiness.  When you don't, they are a poster child for
unmaintainable code.

Ian


More information about the Binutils mailing list