Bug 10861 - gold fails to link fuse user space library (multiple definitions in same object)
Summary: gold fails to link fuse user space library (multiple definitions in same object)
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.20
: P2 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-28 14:56 UTC by Priit Laes
Modified: 2009-12-30 22:43 UTC (History)
1 user (show)

See Also:
Host: x86_64-pc-linux-gnu
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Priit Laes 2009-10-28 14:56:25 UTC
fuse - http://fuse.sourceforge.net/

[snip]
libtool: link: x86_64-pc-linux-gnu-gcc -shared  .libs/fuse.o
.libs/fuse_kern_chan.o .libs/fuse_loop.o .libs/fuse_loop_mt.o
.libs/fuse_lowlevel.o .libs/fuse_mt.o .libs/fuse_opt.o .libs/fuse_session.o
.libs/fuse_signals.o .libs/helper.o .libs/subdir.o .libs/iconv.o .libs/mount.o
.libs/mount_util.o   -lrt -ldl  -march=nocona -Wl,-O1 -Wl,--as-needed -pthread
-Wl,--version-script -Wl,./fuse_versionscript -Wl,-soname -Wl,libfuse.so.2 -o
.libs/libfuse.so.2.7.4
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/../../../../x86_64-pc-linux-gnu/bin/ld:
error: .libs/fuse_session.o: multiple definition of fuse_chan_new
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/../../../../x86_64-pc-linux-gnu/bin/ld:
error: .libs/fuse_session.o: previous definition here
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/../../../../x86_64-pc-linux-gnu/bin/ld:
error: symbol __fuse_set_getcontext_func has undefined version 
collect2: ld returned 1 exit status
[/snip]
Comment 1 Sourceware Commits 2009-12-30 22:36:19 UTC
Subject: Bug 10861

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2009-12-30 22:35:49

Modified files:
	gold           : ChangeLog options.cc options.h script.cc 
	                 script.h 
	gold/testsuite : Makefile.am Makefile.in ver_test_4.script 
	                 version_script.map 

Log message:
	PR 10861
	* script.h (class Version_script_info): Define Language enum.
	Update declarations.  Define Glob, Exact, and Lookup types.  Add
	new fields globals_, locals_, and is_finalized_.
	* script.cc: Various formatting fixes.
	(class Parser_closure): Change language_stack_ from a vector of
	std::string to one of Version_script_info::Language.  Adjust all
	uses accordingly.
	(class Lazy_demangler): Remove.
	(struct Version_expression): Change language from std::string to
	Version_script_info::Language.
	(Version_script_info::Version_script_info): New function.
	(Version_script_info::~Version_script_info): Don't call clear.
	(Version_script_info::finalize): New function.
	(Version_script_info::build_lookup_tables): New function.
	(Version_script_info::build_expression_list_lookup): New
	function.
	(Version_script_info::get_symbol_version_helper): Rewrite to use
	lookup tables.
	(Version_script_info::print_expression_list): Adjust to use
	Version_script_info::Language.
	(script_push_lex_into_version_mode): Check that the version script
	has not been finalized.
	(version_script_push_lang): Change language string to
	Version_script_info::Language.
	* options.cc (Command_line::version_script): New function.
	* options.h (class General_options): Add finalize_dynamic_list
	function.  Change version_script from declaration to definition.
	* testsuite/ver_test_4.script: Remove duplicate def of t2_2.
	* testsuite/version_script.map: Remove duplicate def of foo.
	* testsuite/Makefile.am (ver_matching_def.so): Depend upon
	version_script.map.
	* testsuite/Makefile.in: Rebuild.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.411&r2=1.412
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.cc.diff?cvsroot=src&r1=1.96&r2=1.97
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&r1=1.122&r2=1.123
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/script.cc.diff?cvsroot=src&r1=1.62&r2=1.63
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/script.h.diff?cvsroot=src&r1=1.29&r2=1.30
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/testsuite/Makefile.am.diff?cvsroot=src&r1=1.113&r2=1.114
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/testsuite/Makefile.in.diff?cvsroot=src&r1=1.119&r2=1.120
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/testsuite/ver_test_4.script.diff?cvsroot=src&r1=1.4&r2=1.5
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/testsuite/version_script.map.diff?cvsroot=src&r1=1.4&r2=1.5

Comment 2 Ian Lance Taylor 2009-12-30 22:43:08 UTC
Thanks for the bug report.  The root problem here is that fuse_chan_new appears 
twice in the version script.  I can't think of any reasonable meaning for that, 
so I changed it to be an error.  gold now gives this when linking fuse 2.7.4:

/home/iant/binutils/gold-dir/ld: error: 'fuse_chan_new' appears in version 
script with both versions 'FUSE_2.4' and 'FUSE_2.6'
/home/iant/binutils/gold-dir/ld: error: .libs/fuse_session.o: multiple 
definition of 'fuse_chan_new'
/home/iant/binutils/gold-dir/ld: .libs/fuse_session.o: previous definition here
/home/iant/binutils/gold-dir/ld: error: symbol __fuse_exited has undefined 
version 

The last error is because of this line in lib/fuse.c:

FUSE_SYMVER(".symver fuse_exited,__fuse_exited@");

which appears to be missing a version string.

So think gold is now OK, and the remaining fixes should be done in fuse.  Those 
fixes will be appropriate for the GNU linker as well.