Bugzilla – Bug 120331
X.Org compile failures related to gcc 4.1.0 (gcc bug?)
Last modified: 2005-10-25 15:16:17 UTC
X.Org compilation no longer works with gcc 4.1.0 . :-( # xc/lib/ICE$ make rm -f transport.o unshared/transport.o gcc -m32 -c -ansi -pedantic -Wall -Wpointer-arith -Wundef -I../.. +-I../../exports/include -I../../../include -I../../../glide3 -Dlinux -D__i386__ +-D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE +-D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE +-D_GNU_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -O2 -march=i586 +-mtune=i686 -fmessage-length=0 -Wall -fno-strict-aliasing -I../../lib/xtrans +-DUNIXCONN -DTCPCONN -DHAS_STICKY_DIR_BIT -DHAS_FCHOWN -DIPv6 -DICE_t -DTRANS_CLIENT +-DTRANS_SERVER -DFAIL_HARD transport.c -o unshared/transport.o /tmp/cckqbWcr.s: Assembler messages: /tmp/cckqbWcr.s:6371: Error: Local symbol `in6addr_any' can't be equated to undefined +symbol `local_in6addr_any' /tmp/cckqbWcr.s:6371: Error: Local symbol `in6addr_any' can't be equated to undefined +symbol `local_in6addr_any' /tmp/cckqbWcr.s:6371: Error: Local symbol `in6addr_any' can't be equated to undefined +symbol `local_in6addr_any' /tmp/cckqbWcr.s:6371: Error: Local symbol `in6addr_any' can't be equated to undefined +symbol `local_in6addr_any' make: *** [transport.o] Error 1 xc/lib/ICE/transport.c: [...] #if defined(TCPCONN) || defined(UNIXCONN) #include "Xtranssock.c" #endif [...] xc/lib/xtrans/Xtranssock.c: [...] #if defined(IPv6) && defined(AF_INET6) static const struct in6_addr local_in6addr_any = IN6ADDR_ANY_INIT; #pragma weak in6addr_any = local_in6addr_any [...]
Hmpf. Es ist so, dass weak Symbole defined sein muessen (man kann also nicht in einem anderen File einen Alias fuer ein Symbol einfuehren. Das ist zumindest in deinem kleinen Ausschnitt der Fall. Der Compiler scheint allerdings diese lokale Variable wegzuoptimieren was dann zu der Fehlermeldung fuehrt. :-( Ein Compilerbug wuerde ich sagen. Ciao, Micha.
Dieses Problem ist bereits einmal aufgetaucht und in Ticket #64364 disukutiert worden. Dort gibt es auch einen pointer auf ein gcc Ticket, wo das Problem schlussendlich gefixed wurde. Gruss, Egbert.
For me bug 64364 looks completely different to me. This time the code doesn't even compile. It might be the same construction that leads to compilation failure, but it's not the same bug.
Matthias, it's really the same, only this time the assembler already complains. If it wouldn't, then there would be a link error afterwards. It's a compiler bug, somehow in cgraph code, hence assigning to Honza. Honza: this bug already happened with gcc 4.0 but was fixed there, but seems to have resurfaced.
This can be worked around by sticking __attribute__((used)) to the otherwise unused static local like static const struct in6_addr local_in6addr_any __attribute__((used)) = IN6ADDR_ANY_INIT; I filed gcc PR24295 for the bug.
From the bugzilla I suspect that with static const struct in6_addr local_in6addr_any = IN6ADDR_ANY_INIT; #pragma weak in6addr_any = local_in6addr_any the only use of local_in6addr_any is in the weak definition? If so, try static const struct in6_addr local_in6addr_any __attribute__((used)) = IN6ADDR_ANY_INIT; #pragma weak in6addr_any = local_in6addr_any Btw, from a C pov this isn't a gcc bug. Richard.
We may have to put the __attribute__((used)) into a macro which only expands for gcc.
The proposal by Richard works, but I let this bugreport open until it is investigated upstream. Assigning to Richard, since he made the upstream bugreport.
The bug is fixed upstream, I'll get a fixed compiler into beta asap.
Thanks for keeping us up-to-date. Please let us know, when the new compiler is in BETA/STABLE, so I can remove the workaround of comment #6 again.
The compiler hit BETA, can you remove the workaround and close the bug if it is really fixed? Thanks, Richard.
Thanks. I'll give it a try.
Sorry ...
Works fine now without the workaround. Thanks. I disabled this patch in xorg-x11 build now completely.