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

--- Comment #78 from Mike Hommey <mh+gcc at glandium dot org> 2011-04-08 
15:57:14 UTC ---
(In reply to comment #75)
> (In reply to comment #74)
> > Interesting. -O3 makes no difference for me.  I will look into your dumps 
> > if I
> > can spot something useful.
> > ...
> > If GCC fail to link even such a simple program as elfhack is, something 
> > pretty
> > fundamental must go wrong.  Perhaps it is linker bug. I had problems with 
> > older
> > versions of gold.
> 
> The failure only happens with -flto.
> And the reason is that:
> 
> c++ -o host_elf.o -c -fno-rtti -Wall -Wpointer-arith -Woverloaded-virtual
> -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align
> -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -Wno-long-long
> -march=native -fpermissive -flto=4 -fuse-linker-plugin -fno-strict-aliasing
> -fshort-wchar -pthread -pipe -fexceptions -DNDEBUG -DTRIMMED -Os
> -I/var/tmp/mozilla-central/build/unix/elfhack -I. -I../../../dist/include
> -I../../../dist/include/nsprpub -I/usr/include/nspr -I/usr/include/nss
> -I/usr/include/nspr /var/tmp/mozilla-central/build/unix/elfhack/elf.cpp
> 
> apparently only compiles correctly in the -Os case. All other optimization
> switches (-O(0..3) or without -O) lead to the eventual link failure above.
> And it happens with both gnu-ld and gold (2.21.51.20110402).

What matters is what is used to build/link test.so, not elfhack itself, and
from the look at the command line in comment 70, you're building test.so with
unexpected things. It is not meant to be optimized. So, some more variables
tweaking would apparently be required in build/unix/elfhack/Makefile.in.

Reply via email to