This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/37121] g++ create global symbol for inline function, which make link failed with multiple defination
- From: "dannysmith at users dot sourceforge dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Mar 2009 07:46:03 -0000
- Subject: [Bug target/37121] g++ create global symbol for inline function, which make link failed with multiple defination
- References: <bug-37121-15104@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #13 from dannysmith at users dot sourceforge dot net 2009-03-09 07:46 -------
(In reply to comment #12)
> Was this broken in 4.3 compilers? Is it a 4.4 regression?
>
This is not a new bug in the compiler (the same multiple definition will occur
with 3.4.5) , but an old 'feature' of the the PE-COFF linker
_InterlockedIncrement is defined as an ordinary C library function in
lib64_libmingwex_a-wininterlocked.o
In thread.cpp, it is defined and emitted using linkonce semantics (it is put
into its own .text$_InterlockedIncrement link_once sections, which is how
PE-COFF implements vague linkage.
The linker grabs the one and only .text$_InterlockedIncrement section in
thread.o and then while resolving another symbol it needs from
lib64_libmingwex_a-wininterlocked.o finds an ordinary (not .linkonce)
definition InterlockedIncrement
Hence the multiple definition.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37121