Bug 1085607 - libvpx doesn't build on OS X with Apple clang from OS X 10.7 command line tools. r=giles
authorSteven Michaud <smichaud@pobox.com>
Mon, 20 Oct 2014 19:35:39 -0500
changeset 211295 5515fa5ba20d8efc8231f2bc96036415f30d644e
parent 211294 3fefbf7f0b78bbde23b306d46ff405f8efec88f3
child 211296 b08a0ab5efdf8c7b9e3681448d33e35ba496d004
push id50684
push usersmichaud@pobox.com
push dateTue, 21 Oct 2014 00:36:01 +0000
treeherdermozilla-inbound@5515fa5ba20d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgiles
bugs1085607
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1085607 - libvpx doesn't build on OS X with Apple clang from OS X 10.7 command line tools. r=giles
media/libvpx/apple-clang.patch
media/libvpx/update.py
media/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c
new file mode 100644
--- /dev/null
+++ b/media/libvpx/apple-clang.patch
@@ -0,0 +1,29 @@
+diff --git a/media/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c b/media/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c
+--- a/media/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c
++++ b/media/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c
+@@ -27,21 +27,24 @@ DECLARE_ALIGNED(32, static const uint8_t
+   4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12
+ };
+ 
+ DECLARE_ALIGNED(32, static const uint8_t, filt4_global_avx2[32]) = {
+   6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14,
+   6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14
+ };
+ 
+ #if defined(__clang__)
+ # if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ <= 3) || \
+-      (defined(__APPLE__) && __clang_major__ == 5 && __clang_minor__ == 0)
++      (defined(__APPLE__) && \
++          (__clang_major__ == 4 && __clang_minor__ >= 0 && \
++              __clang_minor__ <= 2) || \
++          (__clang_major__ == 5 && __clang_minor__ == 0))
+ #  define MM256_BROADCASTSI128_SI256(x) \
+        _mm_broadcastsi128_si256((__m128i const *)&(x))
+ # else  // clang > 3.3, and not 5.0 on macosx.
+ #  define MM256_BROADCASTSI128_SI256(x) _mm256_broadcastsi128_si256(x)
+ # endif  // clang <= 3.3
+ #elif defined(__GNUC__)
+ # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 6)
+ #  define MM256_BROADCASTSI128_SI256(x) \
+        _mm_broadcastsi128_si256((__m128i const *)&(x))
+ # elif __GNUC__ == 4 && __GNUC_MINOR__ == 7
--- a/media/libvpx/update.py
+++ b/media/libvpx/update.py
@@ -525,16 +525,18 @@ def update_and_remove_files(prefix, libv
         print "Remove files:"
         for f in removed_files:
             os.unlink(f)
             print '    ', f
 
 def apply_patches():
     # Patch to permit vpx users to specify their own <stdint.h> types.
     os.system("patch -p0 < stdint.patch")
+    # Patch to allow older versions of Apple's clang to build libvpx.
+    os.system("patch -p3 < apple-clang.patch")
 
 def update_readme(commit):
     with open('README_MOZILLA') as f:
         readme = f.read()
 
     if 'The git commit ID used was' in readme:
         new_readme = re.sub('The git commit ID used was [a-f0-9]+',
             'The git commit ID used was %s' % commit, readme)
--- a/media/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c
+++ b/media/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c
@@ -29,17 +29,20 @@ DECLARE_ALIGNED(32, static const uint8_t
 
 DECLARE_ALIGNED(32, static const uint8_t, filt4_global_avx2[32]) = {
   6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14,
   6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14
 };
 
 #if defined(__clang__)
 # if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ <= 3) || \
-      (defined(__APPLE__) && __clang_major__ == 5 && __clang_minor__ == 0)
+      (defined(__APPLE__) && \
+          (__clang_major__ == 4 && __clang_minor__ >= 0 && \
+              __clang_minor__ <= 2) || \
+          (__clang_major__ == 5 && __clang_minor__ == 0))
 #  define MM256_BROADCASTSI128_SI256(x) \
        _mm_broadcastsi128_si256((__m128i const *)&(x))
 # else  // clang > 3.3, and not 5.0 on macosx.
 #  define MM256_BROADCASTSI128_SI256(x) _mm256_broadcastsi128_si256(x)
 # endif  // clang <= 3.3
 #elif defined(__GNUC__)
 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 6)
 #  define MM256_BROADCASTSI128_SI256(x) \