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

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-14 
11:22:45 UTC ---
(In reply to comment #7)
> When there are many files to link, gnatlink passes a file containing the file
> names, instead of the file names directly, on the GCC link line.  There is a
> bad interaction with LTO:
> 
> eric@atlantis:~/build/gcc-4_7-branch/native32> cat t.c
> int main (void) { return 0; }
> eric@atlantis:~/build/gcc-4_7-branch/native32> gcc/xgcc -Bgcc -c t.c -flto
> eric@atlantis:~/build/gcc-4_7-branch/native32> cat FILE
> INPUT (./t.o)
> eric@atlantis:~/build/gcc-4_7-branch/native32> gcc/xgcc -Bgcc -o t FILE
> eric@atlantis:~/build/gcc-4_7-branch/native32> ./t
> eric@atlantis:~/build/gcc-4_7-branch/native32> gcc/xgcc -Bgcc -o t FILE -flto
> /tmp/ccTBohVP.ltrans0.ltrans.o: In function `main':
> ccTBohVP.ltrans0.o:(.text+0x0): multiple definition of `main'
> ./t.o:t.c:(.text+0x0): first defined here
> ./t.o: In function `main':
> t.c:(.text+0x0): multiple definition of `main'
> ./t.o:t.c:(.text+0x0): first defined here
> collect2: error: ld returned 1 exit status
> 
> We should probably use a regular response file instead:
> eric@atlantis:~/build/gcc-4_7-branch/native32> cat FILE2
> ./t.o
> eric@atlantis:~/build/gcc-4_7-branch/native32> gcc/xgcc -Bgcc -o t -Wl,@FILE2
> -flto
> eric@atlantis:~/build/gcc-4_7-branch/native32> ./t

Yes, we don't "understand" linker scripts.  The linker plugin would need to
handle feeding additional inputs towards the link stage - and we'd need to
drop the original FILE input from the final link (which is where the multiple
references come from).

Reply via email to