A patch for common symbol with default version.
H . J . Lu
hjl@valinux.com
Wed Nov 8 14:22:00 GMT 2000
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: com.tar.gz
Type: application/x-gzip
Size: 419 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20001108/0864cf31/attachment.bin>
More information about the Binutils
mailing list