#include "lmonetary.h"
#include "lnumeric.h"
#include "timelocal.h"
+#include <TargetConditionals.h>
#undef MB_CUR_MAX
#define MB_CUR_MAX (__current_locale()->__lc_ctype->__mb_cur_max)
#define XL_RETAIN(x) if ((x) && (x)->__free_extra != XPERMANENT) { OSAtomicIncrement32Barrier(&(x)->__refcount); }
#define XL_UNLOCK(x) UNLOCK((x)->__lock);
-__private_extern__ struct __xlocale_st_runelocale _DefaultRuneXLocale;
-__private_extern__ struct _xlocale __global_locale;
-__private_extern__ pthread_key_t __locale_key;
+__attribute__((visibility("hidden")))
+extern struct __xlocale_st_runelocale _DefaultRuneXLocale;
+
+__attribute__((visibility("hidden")))
+extern struct _xlocale __global_locale;
+
+__attribute__((visibility("hidden")))
+extern pthread_key_t __locale_key;
__BEGIN_DECLS
static inline __attribute__((always_inline)) locale_t
__current_locale(void)
{
+#if TARGET_IPHONE_SIMULATOR
+ /* <rdar://problem/14136256> Crash in _objc_inform for duplicate class name during simulator launch
+ * TODO: Remove after the simulator's libSystem is initialized properly.
+ */
+ if (__locale_key == (pthread_key_t)-1) {
+ return &__global_locale;
+ }
+#endif
+
locale_t __locale = (locale_t)pthread_getspecific(__locale_key);
return (__locale ? __locale : &__global_locale);
}