[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patches] Re: eglibc-2.8 fails to link with OPTION_EGLIBC_LOCAL_CODE=n
- To: patches@xxxxxxxxxx
- Subject: [patches] Re: eglibc-2.8 fails to link with OPTION_EGLIBC_LOCAL_CODE=n
- From: Josh Boyer <jwboyer@xxxxxxxxx>
- Date: Wed, 15 Oct 2008 14:48:27 -0400
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.
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
# endif
__libc_rwlock_unlock (_nl_state_lock);
return retval;
@@ -565,7 +569,9 @@
/* We cannot get the current working directory. Don't signal an
error but simply return the default string. */
FREE_BLOCKS (block_list);
+#if __OPTION_EGLIBC_LOCALE_CODE
__libc_rwlock_unlock (__libc_setlocale_lock);
+#endif
__libc_rwlock_unlock (_nl_state_lock);
__set_errno (saved_errno);
return (plural == 0
@@ -632,7 +638,9 @@
{
no_translation:
FREE_BLOCKS (block_list);
+#if __OPTION_EGLIBC_LOCALE_CODE
__libc_rwlock_unlock (__libc_setlocale_lock);
+#endif
__libc_rwlock_unlock (_nl_state_lock);
__set_errno (saved_errno);
return (plural == 0
@@ -746,7 +754,9 @@
if (plural)
retval = plural_lookup (domain, n, retval, retlen);
+#if __OPTION_EGLIBC_LOCALE_CODE
__libc_rwlock_unlock (__libc_setlocale_lock);
+#endif
__libc_rwlock_unlock (_nl_state_lock);
return retval;
}