[Bug lto/52634] multiple definition error when using alias

2012-10-14 Thread tianbin at cernet dot edu.cn


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52634



--- Comment #10 from Bin Tian  2012-10-14 
09:14:13 UTC ---

please backport to gcc-4_7-branch, thanks.


[Bug lto/52401] New: lto can't handle ld script

2012-02-27 Thread tianbin at cernet dot edu.cn
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52401

 Bug #: 52401
   Summary: lto can't handle ld script
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: tian...@cernet.edu.cn


If an object file compiled with -flto is loaded by using ld script, the final
ld procedure will report multiple definition error.

$ cat a.c
int main (){return 0;}
$ cat a.ld
INPUT(a.o)
$ gcc -flto -c a.c
$ gcc -flto a.ld
/tmp/ccPbuiPm.ltrans0.ltrans.o: In function `main':
ccPbuiPm.ltrans0.o:(.text+0x0): multiple definition of `main'
a.o:a.c:(.text+0x0): first defined here
a.o: In function `main':
a.c:(.text+0x0): multiple definition of `main'
a.o:a.c:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status

So far as I know, qt is using ld script for windows target if there are too
many object files to link.


[Bug lto/52401] lto can't handle ld script

2012-02-27 Thread tianbin at cernet dot edu.cn
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52401

--- Comment #3 from Bin Tian  2012-02-28 02:59:03 
UTC ---
(In reply to comment #1)
> Confirmed.  There are other cases with linker-scripts / linker options that
> are not handled well.
> 
> This one is more a linker bug though.  The input a.o should be translated
> to the new replacement input that went though LTO processing, instead it
> seems to be appended.
> 
> Please file a binutils bug.

http://sourceware.org/bugzilla/show_bug.cgi?id=13779


[Bug lto/52634] New: multiple definition error when using alias

2012-03-20 Thread tianbin at cernet dot edu.cn
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: unassig...@gcc.gnu.org
ReportedBy: tian...@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
.setcfliteArrayCallBacks.4936,cfliteKeyCallBacks

in xxx.ltrans15.s, I found

.hidden cfliteKeyCallBacks
.globl  cfliteKeyCallBacks
.bss
.align 32
.type   cfliteKeyCallBacks, @object
.size   cfliteKeyCallBacks, 48
cfliteKeyCallBacks:
.zero   48
.setcfliteValueCallBacks.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.


[Bug lto/52634] multiple definition error when using alias

2012-03-20 Thread tianbin at cernet dot edu.cn
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52634

--- Comment #2 from Bin Tian  2012-03-20 14:16:02 
UTC ---
Created attachment 26931
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26931
patch for make-3.82


[Bug lto/52634] multiple definition error when using alias

2012-03-20 Thread tianbin at cernet dot edu.cn
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52634

--- Comment #3 from Bin Tian  2012-03-20 14:16:49 
UTC ---
The bug is reproducable with -r -flto-partition=1to1, and not with -r
-flto-partition=none.

My project is hard to reduce because of complex dependencies. It seems that if
the call graph is too simple, the bug never shows up.

Finally, I make a testcase based on make-3.82
(http://ftp.gnu.org/gnu/make/make-3.82.tar.gz).

Please apply the attached patch on make-3.82, and compile it with the following
instructions:

$ autoreconf -vif
$ ./configure CFLAGS='-g -O2 -flto' CC=gcc-4.7
$ make

The patch is produced with git format-patch.