diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index c337fc5b282..5a0c4538481 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -3688,6 +3688,28 @@ u16_mbtouc (wint_t * puc, const unsigned short * s, unsigned int n) } #endif /* not Cygwin/Mingw */ +#if defined __APPLE__ && __DARWIN_C_LEVEL < 200809L +/* wcsncasecmp isn't always defined in Mac SDK */ +static int +wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n) +{ + wchar_t c1, c2; + + if (n == 0) + return (0); + for (; *s1; s1++, s2++) + { + c1 = towlower(*s1); + c2 = towlower(*s2); + if (c1 != c2) + return ((int)c1 - c2); + if (--n == 0) + return (0); + } + return (-*s2); +} +#endif + /* Perform a comparison of two entries. */ static signed int rsrc_cmp (bool is_name, rsrc_entry * a, rsrc_entry * b) diff --git a/gold/gold-threads.cc b/gold/gold-threads.cc index 9624ac60bc8..2e68a65c00e 100644 --- a/gold/gold-threads.cc +++ b/gold/gold-threads.cc @@ -284,9 +284,18 @@ Condvar::~Condvar() class Once_initialize { public: - Once_initialize() - : once_(PTHREAD_ONCE_INIT) - { } + Once_initialize() +#if !defined(__APPLE__) + : once_(PTHREAD_ONCE_INIT) + { } +#else +// In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4 doesn't support +// extended initializer list as above */ + { + pthread_once_t once_2 = PTHREAD_ONCE_INIT; + once_ = once_2; + } +#endif // Return a pointer to the pthread_once_t variable. pthread_once_t*