[SCM] x265/master: Disable yasm on i386 until the build produces PIC code

sramacher at users.alioth.debian.org sramacher at users.alioth.debian.org
Fri Dec 5 20:30:58 UTC 2014


The following commit has been merged in the master branch:
commit 89c995dc43395dc5ab19a57f435e2861c8236dd5
Author: Sebastian Ramacher <sramacher at debian.org>
Date:   Fri Dec 5 20:40:56 2014 +0100

    Disable yasm on i386 until the build produces PIC code

diff --git a/debian/control b/debian/control
index 2fa709d..791d133 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,7 @@ Uploaders: Sebastian Ramacher <sramacher at debian.org>
 Build-Depends:
  debhelper (>= 9),
  cmake,
- yasm (>= 1.2) [any-amd64 any-i386]
+ yasm (>= 1.2) [any-amd64]
 Build-Depends-Indep:
  python-sphinx
 Standards-Version: 3.9.6
diff --git a/debian/patches/series b/debian/patches/series
index 00941dc..d926bbf 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 compile-flags.patch
 atomic.patch
+workaround-partial-SIMD-support.patch
diff --git a/debian/patches/workaround-partial-SIMD-support.patch b/debian/patches/workaround-partial-SIMD-support.patch
new file mode 100644
index 0000000..de3ccbb
--- /dev/null
+++ b/debian/patches/workaround-partial-SIMD-support.patch
@@ -0,0 +1,204 @@
+Description: remove buggy workarounds for partial SIMD support
+ In the past, there were a number of primitives written in SIMD intrinsics that
+ could work without compiling with YASM. Most of those are now gone, and we
+ generally require YASM for SIMD support. This commit remoes support for using
+ the few remaining SIMD intrinsics without having YASM to provide
+ implementations of x265_emms(), x265_cpu_cpuid(), etc. Fixing a bug in the
+ process.
+Origin: upstream,
+ https://bitbucket.org/multicoreware/x265/commits/d7b5e73fc91ab20f86c36d5c1924632c1bcf3e68
+Bug: https://bitbucket.org/multicoreware/x265/issue/92/fails-to-build-on-x86-32-without-yasm
+Last-Update: 2014-12-05
+
+--- a/source/common/CMakeLists.txt
++++ b/source/common/CMakeLists.txt
+@@ -1,44 +1,46 @@
+ # vim: syntax=cmake
+-set(SSE3  vec/dct-sse3.cpp)
+-set(SSSE3 vec/dct-ssse3.cpp)
+-set(SSE41 vec/dct-sse41.cpp)
+ 
+-if(MSVC AND X86)
+-    set(PRIMITIVES ${SSE3} ${SSSE3} ${SSE41})
+-    set(WARNDISABLE "/wd4100") # unreferenced formal parameter
+-    if(INTEL_CXX)
+-        add_definitions(/Qwd111) # statement is unreachable
+-        add_definitions(/Qwd128) # loop is unreachable
+-        add_definitions(/Qwd177) # declared function is unused
+-        add_definitions(/Qwd185) # dynamic initialization in unreachable code
+-        add_definitions(/Qwd280) # conditional expression is constant
+-    endif()
+-    if(X64)
+-        set_source_files_properties(${SSE3} ${SSSE3} ${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE}")
+-    else()
+-        # x64 implies SSE4, so only add /arch:SSE2 if building for Win32
+-        set_source_files_properties(${SSE3} ${SSSE3} ${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} /arch:SSE2")
+-    endif()
+-endif()
+-if(GCC AND X86)
+-    if(CLANG)
+-        # llvm intrinsic headers cause shadow warnings
+-        set(WARNDISABLE "-Wno-shadow -Wno-unused-parameter")
+-    else()
+-        set(WARNDISABLE "-Wno-unused-parameter")
+-    endif()
+-    if(INTEL_CXX OR CLANG OR (NOT CC_VERSION VERSION_LESS 4.3))
++if(ENABLE_ASSEMBLY)
++    set_source_files_properties(primitives.cpp PROPERTIES COMPILE_FLAGS -DENABLE_ASSEMBLY=1)
++
++    set(SSE3  vec/dct-sse3.cpp)
++    set(SSSE3 vec/dct-ssse3.cpp)
++    set(SSE41 vec/dct-sse41.cpp)
++
++    if(MSVC AND X86)
+         set(PRIMITIVES ${SSE3} ${SSSE3} ${SSE41})
+-        set_source_files_properties(${SSE3}  PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -msse3")
+-        set_source_files_properties(${SSSE3} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -mssse3")
+-        set_source_files_properties(${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -msse4.1")
++        set(WARNDISABLE "/wd4100") # unreferenced formal parameter
++        if(INTEL_CXX)
++            add_definitions(/Qwd111) # statement is unreachable
++            add_definitions(/Qwd128) # loop is unreachable
++            add_definitions(/Qwd177) # declared function is unused
++            add_definitions(/Qwd185) # dynamic initialization in unreachable code
++            add_definitions(/Qwd280) # conditional expression is constant
++        endif()
++        if(X64)
++            set_source_files_properties(${SSE3} ${SSSE3} ${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE}")
++        else()
++            # x64 implies SSE4, so only add /arch:SSE2 if building for Win32
++            set_source_files_properties(${SSE3} ${SSSE3} ${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} /arch:SSE2")
++        endif()
++    endif()
++    if(GCC AND X86)
++        if(CLANG)
++            # llvm intrinsic headers cause shadow warnings
++            set(WARNDISABLE "-Wno-shadow -Wno-unused-parameter")
++        else()
++            set(WARNDISABLE "-Wno-unused-parameter")
++        endif()
++        if(INTEL_CXX OR CLANG OR (NOT CC_VERSION VERSION_LESS 4.3))
++            set(PRIMITIVES ${SSE3} ${SSSE3} ${SSE41})
++            set_source_files_properties(${SSE3}  PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -msse3")
++            set_source_files_properties(${SSSE3} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -mssse3")
++            set_source_files_properties(${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -msse4.1")
++        endif()
+     endif()
+-endif()
+-set(VEC_PRIMITIVES vec/vec-primitives.cpp ${PRIMITIVES})
+-source_group(Intrinsics FILES ${VEC_PRIMITIVES})
++    set(VEC_PRIMITIVES vec/vec-primitives.cpp ${PRIMITIVES})
++    source_group(Intrinsics FILES ${VEC_PRIMITIVES})
+ 
+-if(ENABLE_ASSEMBLY)
+-    set_source_files_properties(primitives.cpp PROPERTIES COMPILE_FLAGS -DENABLE_ASSEMBLY=1)
+     set(C_SRCS asm-primitives.cpp pixel.h mc.h ipfilter8.h blockcopy8.h dct8.h loopfilter.h)
+     set(A_SRCS pixel-a.asm const-a.asm cpu-a.asm ssd-a.asm mc-a.asm
+                mc-a2.asm pixel-util8.asm blockcopy8.asm
+--- a/source/common/primitives.cpp
++++ b/source/common/primitives.cpp
+@@ -123,9 +123,9 @@
+     if (!primitives.sad[0])
+     {
+         Setup_C_Primitives(primitives);
+-        Setup_Instrinsic_Primitives(primitives, cpuid);
+ 
+ #if ENABLE_ASSEMBLY
++        Setup_Instrinsic_Primitives(primitives, cpuid);
+         Setup_Assembly_Primitives(primitives, cpuid);
+ #else
+         x265_log(param, X265_LOG_WARNING, "Assembly not supported in this binary\n");
+@@ -169,74 +169,14 @@
+     }
+ }
+ 
+-#if !defined(ENABLE_ASSEMBLY)
+-#if defined(_MSC_VER)
+-#include <intrin.h>
+-#endif
+-
++#if ENABLE_ASSEMBLY
++/* these functions are implemented in assembly. When assembly is not being
++ * compiled, they are unnecessary and can be NOPs */
++#else
+ extern "C" {
+-// the intrinsic primitives will not use MMX instructions, so if assembly
+-// is disabled there should be no reason to use EMMS.
++int x265_cpu_cpuid_test(void) { return 0; }
+ void x265_cpu_emms(void) {}
+-
+-#if defined(X265_ARCH_X86)
+-
+-#if defined(_MSC_VER)
+-# pragma warning(disable: 4100)
+-#elif defined(__GNUC__) || defined(__clang__)    // use inline assembly, Gnu/AT&T syntax
+-# define __cpuidex(regsArray, level, index) \
+-    __asm__ __volatile__ ("cpuid" \
+-                          : "=a" ((regsArray)[0]), "=b" ((regsArray)[1]), "=c" ((regsArray)[2]), "=d" ((regsArray)[3]) \
+-                          : "0" (level), "2" (index));
+-#else
+-# error "compiler not supported"
+-#endif
+-
+-int x265_cpu_cpuid_test(void)
+-{
+-    return 0;
++void x265_cpu_cpuid(uint32_t, uint32_t *, uint32_t *, uint32_t *, uint32_t *) {}
++void x265_cpu_xgetbv(uint32_t, uint32_t *, uint32_t *) {}
+ }
+-
+-void x265_cpu_cpuid(uint32_t op, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
+-{
+-    int output[4];
+-
+-    __cpuidex(output, op, 0);
+-    *eax = output[0];
+-    *ebx = output[1];
+-    *ecx = output[2];
+-    *edx = output[3];
+-}
+-
+-void x265_cpu_xgetbv(uint32_t op, uint32_t *eax, uint32_t *edx)
+-{
+-    uint64_t out = 0;
+-
+-#if X265_ARCH_X86
+-
+-#if (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040000) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1200)
+-
+-    // MSVC 2010 SP1 or later, or similar Intel release
+-    out = _xgetbv(op);
+-
+-#elif defined(__GNUC__) || defined(__clang__)    // use inline assembly, Gnu/AT&T syntax
+-
+-    uint32_t a, d;
+-    __asm("xgetbv" : "=a" (a), "=d" (d) : "c" (op) :);
+-    *eax = a;
+-    *edx = d;
+-    return;
+-
+-#elif defined(_WIN64)      // On x64 with older compilers, this is impossible
+-
+-#endif // if (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040000) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1200)
+-
+-#endif // if x86
+-
+-    *eax = (uint32_t)out;
+-    *edx = (uint32_t)(out >> 32);
+-}
+-
+-#endif // X265_ARCH_X86
+-}
+-#endif // if !ENABLE_ASSEMBLY
++#endif
+--- a/source/common/common.h
++++ b/source/common/common.h
+@@ -49,7 +49,7 @@
+ #define ALIGN_VAR_16(T, var) T var __attribute__((aligned(16)))
+ #define ALIGN_VAR_32(T, var) T var __attribute__((aligned(32)))
+ 
+-#if X265_ARCH_X86 && !defined(X86_64)
++#if ENABLE_ASSEMBLY && X265_ARCH_X86 && !defined(X86_64)
+ extern "C" intptr_t x265_stack_align(void (*func)(), ...);
+ #define x265_stack_align(func, ...) x265_stack_align((void (*)())func, __VA_ARGS__)
+ #else

-- 
x265 packaging



More information about the pkg-multimedia-commits mailing list