summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2015-03-18 10:57:24 +0800
committerAndrew Hsieh <andrewhsieh@google.com>2015-05-06 21:17:51 +0800
commitc39479f4ab4d372b518957871e1f205a03e7c3d6 (patch)
treec0c112647737e717933be5f838021dae71ca7b6b
parent97a8de179d86d83e05cab161566aad0e7a3281cc (diff)
downloadtoolchain_binutils-c39479f4ab4d372b518957871e1f205a03e7c3d6.tar.gz
toolchain_binutils-c39479f4ab4d372b518957871e1f205a03e7c3d6.tar.bz2
toolchain_binutils-c39479f4ab4d372b518957871e1f205a03e7c3d6.zip
Fix darwin build
1. In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4 doesn't support ended initializer list 2. wcsncasecmp doesn't exist in MacSDK10.6.x Change-Id: I69204a72f853f5263dffedc448379d75ed4eca2e
-rw-r--r--binutils-2.24/gold/gold-threads.cc15
-rw-r--r--binutils-2.25/bfd/peXXigen.c22
-rw-r--r--binutils-2.25/gold/gold-threads.cc15
3 files changed, 46 insertions, 6 deletions
diff --git a/binutils-2.24/gold/gold-threads.cc b/binutils-2.24/gold/gold-threads.cc
index 7f203a74..8334a87d 100644
--- a/binutils-2.24/gold/gold-threads.cc
+++ b/binutils-2.24/gold/gold-threads.cc
@@ -284,9 +284,18 @@ Condvar::~Condvar()
class Once_initialize
{
public:
- Once_initialize()
- : once_(PTHREAD_ONCE_INIT)
- { }
+ Once_initialize()
+#if defined(__clang__) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+ : 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*
diff --git a/binutils-2.25/bfd/peXXigen.c b/binutils-2.25/bfd/peXXigen.c
index 13e39e48..7a983066 100644
--- a/binutils-2.25/bfd/peXXigen.c
+++ b/binutils-2.25/bfd/peXXigen.c
@@ -3522,6 +3522,28 @@ u16_mbtouc (wchar_t * puc, const unsigned short * s, unsigned int n)
}
#endif /* HAVE_WCHAR_H and not Cygwin/Mingw */
+#ifdef __APPLE__
+/* 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 (bfd_boolean is_name, rsrc_entry * a, rsrc_entry * b)
diff --git a/binutils-2.25/gold/gold-threads.cc b/binutils-2.25/gold/gold-threads.cc
index ff5a8acc..45140e0b 100644
--- a/binutils-2.25/gold/gold-threads.cc
+++ b/binutils-2.25/gold/gold-threads.cc
@@ -284,9 +284,18 @@ Condvar::~Condvar()
class Once_initialize
{
public:
- Once_initialize()
- : once_(PTHREAD_ONCE_INIT)
- { }
+ Once_initialize()
+#if defined(__clang__) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+ : 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*