This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

A patch for common symbol with default version.


If there is a common symbol with default version, it will cause a
problem:

gcc  -O   -c -o test.o test.c
gcc  -O   -c -o foo.o foo.c
gcc  -o test test.o foo.o
test.o: In function `main':
test.o(.text+0x4): undefined reference to `bar'
test.o(.text+0xa): undefined reference to `foo@GLIBC_2.0'
collect2: ld returned 1 exit status

I am enclosing a patch and a testcase here.


-- 
H.J. Lu (hjl@gnu.org)
---
2000-11-08  H.J. Lu  <hjl@gnu.org>

	* elflink.h (elf_link_add_object_symbols): Also add indirect
	symbols for common symbols with the default version.

Index: elflink.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elflink.h,v
retrieving revision 1.45
diff -u -p -r1.45 elflink.h
--- elflink.h	2000/10/15 01:08:18	1.45
+++ elflink.h	2000/11/08 22:08:25
@@ -1715,7 +1727,7 @@ elf_link_add_object_symbols (abfd, info)
              name to the fully decorated name.  This will cause
              external references which do not specify a version to be
              bound to this version of the symbol.  */
-	  if (definition)
+	  if (definition || h->root.type == bfd_link_hash_common)
 	    {
 	      char *p;
 

com.tar.gz


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