[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patches] Re: eglibc-2.8 fails to link with OPTION_EGLIBC_LOCAL_CODE=n



Josh Boyer wrote:
On Wed, Oct 15, 2008 at 12:47:20PM -0400, Josh Boyer wrote:
Hi All,

While building eglibc for powerpc, I encountered linking error
when using the following option-groups.config:

OPTION_EGLIBC_BSD = n
OPTION_EGLIBC_CXX_TESTS = n
OPTION_EGLIBC_CATGETS = n
OPTION_EGLIBC_LOCALES = n
OPTION_EGLIBC_LOCALE_CODE = n
OPTION_EGLIBC_STREAMS = n

The error is:

/home/jwboyer/src/eglibc-build/libc_pic.os: In function `__dcigettext':
/home/jwboyer/src/eglibc-2.8/libc/intl/dcigettext.c:749: undefined reference to `__libc_setlocale_lock'
/home/jwboyer/src/eglibc-2.8/libc/intl/dcigettext.c:459: undefined reference to `__libc_setlocale_lock'
/home/jwboyer/src/eglibc-2.8/libc/intl/dcigettext.c:635: undefined reference to `__libc_setlocale_lock'
/usr/bin/ld: /home/jwboyer/src/eglibc-build/libc.so: hidden symbol `__libc_setlocale_lock' isn't defined
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[1]: *** [/home/jwboyer/src/eglibc-build/libc.so] Error 1
make[1]: Leaving directory `/home/jwboyer/src/eglibc-2.8/libc'
make: *** [all] Error 2

If I simply set OPTION_EGLIBC_LOCALES_CODE=y, then it appears to
build and link just fine.  I haven't debugged it further yet, but
it would seem the __libc_setlocale_lock code should probably be
protected by an ifdef of some kind.

The following patch allowed the build to complete.  I haven't tested this
beyond building, and I'm not entirely sure this is the proper fix.

Comments welcome.

Sorry for the delay,

The patch seems fine, modulo missing changelog entry and formatting (see below). I've tested the patch on powerpc-linux-gnu with no unexpected failures. There are two iconvdata tests (iconvdata/bug-iconv6.out and iconvdata/tst-iconv7.out) that use UTF-8 locale, and, hence, need conditioning on OPTION_EGLIBC_LOCALES_CODE; I'll post a separate patch to fix those.

Joseph, can you review/approve this patch?


--
MaximK
CodeSourcery


josh


Index: intl/dcigettext.c
===================================================================
--- intl/dcigettext.c	(revision 7147)
+++ intl/dcigettext.c	(working copy)
@@ -455,9 +455,11 @@
 #endif
#ifdef _LIBC
+#if __OPTION_EGLIBC_LOCALE_CODE
   __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
   __libc_rwlock_rdlock (__libc_setlocale_lock);
 #endif
+#endif
__libc_rwlock_rdlock (_nl_state_lock); @@ -504,7 +506,9 @@
 	retval = (char *) (*foundp)->translation;
# ifdef _LIBC
+#if __OPTION_EGLIBC_LOCALE_CODE
       __libc_rwlock_unlock (__libc_setlocale_lock);
+#endif

It is better to use
#  if
 ^^
#  endif
 ^^ <- nesting level