public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tianbin at cernet dot edu.cn" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/52634] New: multiple definition error when using alias
Date: Tue, 20 Mar 2012 12:32:00 -0000	[thread overview]
Message-ID: <bug-52634-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2012-03-20 12:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-20 12:32 tianbin at cernet dot edu.cn [this message]
2012-03-20 13:16 ` [Bug lto/52634] " rguenth at gcc dot gnu.org
2012-03-20 14:17 ` tianbin at cernet dot edu.cn
2012-03-20 14:31 ` tianbin at cernet dot edu.cn
2012-03-20 14:56 ` rguenth at gcc dot gnu.org
2012-03-20 15:05 ` rguenth at gcc dot gnu.org
2012-03-20 17:22 ` hubicka at gcc dot gnu.org
2012-03-25 10:24 ` hubicka at gcc dot gnu.org
2012-04-09 23:39 ` hubicka at gcc dot gnu.org
2012-04-10 15:10 ` hubicka at gcc dot gnu.org
2012-10-14  9:14 ` tianbin at cernet dot edu.cn
2021-12-24  8:59 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-52634-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).