[Mesa-dev] [PATCH 3/5] meson: Override C++ standard to gnu++11 when building with altivec on ppc64le

Dylan Baker dylan at pnwbakers.com
Tue Dec 4 21:52:19 UTC 2018


Otherwise there will be symbol collisions for the vector name.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108943
Fixes: 34bbb24ce7702658cdc4e9d34a650e169716c39e
       ("meson: Add support for ppc assembly/optimizations")
---
 meson.build                                   | 12 ++++++++++++
 src/gallium/state_trackers/clover/meson.build |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/meson.build b/meson.build
index 3d07c88364a..0785609c4b0 100644
--- a/meson.build
+++ b/meson.build
@@ -624,6 +624,7 @@ if with_gallium_st_nine
   endif
 endif
 
+clover_cpp_std = []
 if get_option('power8') != 'false'
   # on old versions of meson the cpu family would return as ppc64le on little
   # endian power8, this was changed in 0.48 such that the family would always
@@ -631,6 +632,7 @@ if get_option('power8') != 'false'
   # should be checked. Since we support versions < 0.48 we need to use
   # startswith.
   if host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
+    _test_args = []
     if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.8')
       error('Altivec is not supported with gcc version < 4.8.')
     endif
@@ -645,9 +647,19 @@ if get_option('power8') != 'false'
         args : '-mpower8-vector',
         name : 'POWER8 intrinsics')
       pre_args += ['-D_ARCH_PWR8', '-mpower8-vector']
+      _test_args += ['-D_ARCH_PWR8', '-mpower8-vector']
     elif get_option('power8') == 'true'
       error('POWER8 intrinsic support required but not found.')
     endif
+
+    if cpp.compiles('''
+        #if !defined(__VEC__) || !defined(__ALTIVEC__)
+        #error "AltiVec not enabled"
+        #endif''',
+        args : _test_args,
+        name : 'Altivec')
+      clover_cpp_std += ['cpp_std=gnu++11']
+    endif
   endif
 endif
 
diff --git a/src/gallium/state_trackers/clover/meson.build b/src/gallium/state_trackers/clover/meson.build
index 1a09d8f2ca9..a6729af2fb8 100644
--- a/src/gallium/state_trackers/clover/meson.build
+++ b/src/gallium/state_trackers/clover/meson.build
@@ -30,6 +30,7 @@ libcltgsi = static_library(
   files('tgsi/compiler.cpp', 'tgsi/invocation.hpp'),
   include_directories : clover_incs,
   cpp_args : [cpp_vis_args],
+  override_options : clover_cpp_std,
 )
 
 libclllvm = static_library(
@@ -56,6 +57,7 @@ libclllvm = static_library(
     )),
   ],
   dependencies : [dep_llvm, dep_elf],
+  override_options : clover_cpp_std,
 )
 
 clover_files = files(
@@ -119,4 +121,5 @@ libclover = static_library(
   include_directories : clover_incs,
   cpp_args : [clover_cpp_args, cpp_vis_args],
   link_with : [libcltgsi, libclllvm],
+  override_options : clover_cpp_std,
 )
-- 
2.19.2



More information about the mesa-dev mailing list