This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/52634] New: multiple definition error when using alias
- From: "tianbin at cernet dot edu.cn" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 20 Mar 2012 12:09:23 +0000
- Subject: [Bug lto/52634] New: multiple definition error when using alias
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52634
Bug #: 52634
Summary: multiple definition error when using alias
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: tianbin@cernet.edu.cn
When compiling a project which have 11 cpp files with -flto, g++-4.7 reports
the following error
------
xxx.ltrans25.ltrans.o:(.bss+0x0): multiple definition of `cfliteKeyCallBacks'
xxx.ltrans15.ltrans.o:(.bss+0x0): first defined here
xxx.ltrans29.ltrans.o:(.data+0xc80): multiple definition of
`cfliteKeyCallBacks'
xxx.ltrans15.ltrans.o:(.bss+0x0): first defined here
in xxx.ltrans25.s, I found
----
.hidden cfliteKeyCallBacks
.globl cfliteKeyCallBacks
.bss
.align 32
.type cfliteKeyCallBacks, @object
.size cfliteKeyCallBacks, 48
cfliteKeyCallBacks:
.zero 48
.set cfliteArrayCallBacks.4936,cfliteKeyCallBacks
in xxx.ltrans15.s, I found
----
.hidden cfliteKeyCallBacks
.globl cfliteKeyCallBacks
.bss
.align 32
.type cfliteKeyCallBacks, @object
.size cfliteKeyCallBacks, 48
cfliteKeyCallBacks:
.zero 48
.set cfliteValueCallBacks.3513,cfliteKeyCallBacks
in xxx.ltrans29.s, I found
----
.hidden cfliteKeyCallBacks
.globl cfliteKeyCallBacks
.data
.align 32
.type cfliteKeyCallBacks, @object
.size cfliteKeyCallBacks, 48
cfliteKeyCallBacks:
.quad 0
.quad _ZL17cflite_key_retainPK13__CFAllocatorPKv.19440
.quad _ZL18cflite_key_releasePK13__CFAllocatorPKv.19434
.quad _ZL21cflite_key_copy_descrPKv.19447
.quad _ZL16cflite_key_equalPKvS0_.19429
.quad _ZL15cflite_key_hashPKv.19425
And in cflite.cpp, the corespond source is
---------------
...
CFDictionaryKeyCallBacks cfliteKeyCallBacks = {
0,
cflite_key_retain,
cflite_key_release,
cflite_key_copy_descr,
cflite_key_equal,
cflite_key_hash,
};
extern CFDictionaryValueCallBacks cfliteValueCallBacks
__attribute__((alias("cfliteKeyCallBacks")));
extern CFArrayCallBacks cfliteArrayCallBacks
__attribute__((alias("cfliteKeyCallBacks")));
The project compiles ok without -flto.