Control: reassign -1 src:rocksdb
Control: retitle -1 rocksdb wrongly optimized for P9 causes SIGILL in binaries 
using it

Here is a debdiff introducing a quilt patch and explaining what the
issue is.
I'm not sure if should be forwarded/fixed upstream... it depends what
they want to achieve. It was originally a commit called "Add ppc64le
builds to Travis" : 
https://github.com/facebook/rocksdb/pull/6144/files#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20a
I guess for Debian/Ubuntu, the default gcc profile (P8 compatible on
Debian/P9 compatible on Ubuntu since 22.04), should be used and CPU
related features not forced.

F.
diff -Nru 
rocksdb-7.2.2/debian/patches/rely-on-default-for-optimization-on-Power.patch 
rocksdb-7.2.2/debian/patches/rely-on-default-for-optimization-on-Power.patch
--- 
rocksdb-7.2.2/debian/patches/rely-on-default-for-optimization-on-Power.patch    
    1970-01-01 01:00:00.000000000 +0100
+++ 
rocksdb-7.2.2/debian/patches/rely-on-default-for-optimization-on-Power.patch    
    2022-06-06 20:22:35.000000000 +0200
@@ -0,0 +1,46 @@
+Description: Don't optimize without knowing the target system on Power
+ Upstream's CMake configuration assumes having gcc P9 optimizations flags means
+ we are compiling for P9.
+ On ppc64*, gcc can produce binaries optimized for P8, P9 or P10 atm.
+ But on Debian we want to be compatible with all and default to P8.
+ ---
+ $ gcc -Q --help=target|grep -i power
+  -mpower10                            [disabled]
+  -mpower10-fusion                     [disabled]
+  -mpower8-fusion                      [enabled]
+  -mpower8-fusion-sign                 [disabled]
+  -mpower8-vector                      [enabled]
+  -mpower9-minmax                      [disabled]
+  -mpower9-misc                        [disabled]
+  -mpower9-vector                      [disabled]
+  -mpowerpc                            [ignored]
+  -mpowerpc-gfxopt                     [enabled]
+  -mpowerpc-gpopt                      [enabled]
+  -mpowerpc64                          [enabled]
+  ---
+ Altivec is a different story, as it is enabled by default on ppc64el but not
+ on ppc64. So leaving it for now.
+Author: Frédéric Bonnard <fre...@debian.org>
+Forwarded: no
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -203,17 +203,6 @@
+ 
+ include(CheckCCompilerFlag)
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
+-  CHECK_C_COMPILER_FLAG("-mcpu=power9" HAS_POWER9)
+-  if(HAS_POWER9)
+-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=power9 -mtune=power9")
+-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=power9 -mtune=power9")
+-  else()
+-    CHECK_C_COMPILER_FLAG("-mcpu=power8" HAS_POWER8)
+-    if(HAS_POWER8)
+-      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=power8 -mtune=power8")
+-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=power8 -mtune=power8")
+-    endif(HAS_POWER8)
+-  endif(HAS_POWER9)
+   CHECK_C_COMPILER_FLAG("-maltivec" HAS_ALTIVEC)
+   if(HAS_ALTIVEC)
+     message(STATUS " HAS_ALTIVEC yes")
diff -Nru rocksdb-7.2.2/debian/patches/series 
rocksdb-7.2.2/debian/patches/series
--- rocksdb-7.2.2/debian/patches/series 2022-05-21 19:47:37.000000000 +0200
+++ rocksdb-7.2.2/debian/patches/series 2022-06-06 20:22:35.000000000 +0200
@@ -8,3 +8,4 @@
 arm.patch
 armv7_support.patch
 0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch
+rely-on-default-for-optimization-on-Power.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to