Bug 3651

Summary: Link error with local_in6addr_any
Product: xorg Reporter: Falk Hueffner <falk>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED WORKSFORME QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: high CC: ajax
Version: git   
Hardware: Alpha   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Falk Hueffner 2005-06-28 12:14:14 UTC
With gcc 4.1 on Alpha Linux, I get:

gcc -o Xorg [...]
os/libos.a(transport.o)(.text+0x3c3c): In function
`_XSERVTransSocketINETCreateListener':
: undefined reference to `local_in6addr_any'
../../lib/font/libXfont.a(transport.o)(.text+0x634c): In function
`_FontTransSocketINETCreateListener':
: undefined reference to `local_in6addr_any'
collect2: ld returned 1 exit status
make[3]: *** [Xorg] Error 1

Apparently, gcc thinks it can optimize out the "unused" static variable.

This patch fixes it. Most likely it is not the real solution, I don't
fully understand this symbol trickery.

--- lib/xtrans/Xtranssock.c~    2005-06-28 15:28:26.000000000 +0200
+++ lib/xtrans/Xtranssock.c     2005-06-28 20:59:33.000000000 +0200
@@ -282,7 +282,7 @@
  * that don't have IPv6 support.
  */
 #if defined(IPv6) && defined(AF_INET6)
-static const struct in6_addr local_in6addr_any = IN6ADDR_ANY_INIT;
+static const struct in6_addr local_in6addr_any __attribute__((used)) =
IN6ADDR_ANY_INIT;
 #pragma weak in6addr_any = local_in6addr_any
 #ifndef __USLC__
 #pragma weak getaddrinfo
Comment 1 Adam Jackson 2005-06-29 11:34:00 UTC
except __attribute__ isn't a valid token for non-gcc.  probably need to add that
to Xfuncproto.h.
Comment 2 Daniel Stone 2007-02-27 01:27:11 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 3 Matt Turner 2008-12-10 15:20:49 UTC
Closing. Unable to reproduce. Last touched more than 3 years ago.

Reopen if still a bug.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.