Patch from Brad Smith to fix build of vvenc on

powerpc, powerpc64, and mips64.
This commit is contained in:
kmos
2026-03-30 22:13:49 +00:00
parent a2f7297769
commit 6da9e16f45
2 changed files with 38 additions and 16 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ COMMENT= Versatile Video Coding (VVC) encoder
GH_ACCOUNT= fraunhoferhhi GH_ACCOUNT= fraunhoferhhi
GH_PROJECT= vvenc GH_PROJECT= vvenc
GH_TAGNAME= v1.14.0 GH_TAGNAME= v1.14.0
REVISION= 0 REVISION= 1
CATEGORIES= multimedia CATEGORIES= multimedia
SHARED_LIBS= vvenc 0.0 SHARED_LIBS= vvenc 0.0
@@ -1,42 +1,64 @@
math: guard __builtin_roundeven against non-glibc platforms - math: guard __builtin_roundeven against non-glibc platforms
6b772fe4e9a0b647f5413a2b56489c776406eaa9
- math: extend non-glibc guard to Clang and add exp10 guard
e6f82439d5088c57344f0bc1113ecf8c4cc0a42a
Index: thirdparty/simde/simde-math.h Index: thirdparty/simde/simde-math.h
--- thirdparty/simde/simde-math.h.orig --- thirdparty/simde/simde-math.h.orig
+++ thirdparty/simde/simde-math.h +++ thirdparty/simde/simde-math.h
@@ -1265,9 +1265,17 @@ simde_math_fpclass(double v, const int imm8) { @@ -972,13 +972,18 @@ simde_math_fpclass(double v, const int imm8) {
#endif
#endif
-#if HEDLEY_HAS_BUILTIN(__builtin_exp10) || HEDLEY_GCC_VERSION_CHECK(3,4,0)
+/* __builtin_exp10 lowers to exp10() which is a GNU extension available
+ * only in glibc. Other libcs (musl, OpenBSD, FreeBSD, MinGW, etc.)
+ * lack the symbol and produce a link error. Fall back to pow(10, v). */
+#if (HEDLEY_HAS_BUILTIN(__builtin_exp10) || HEDLEY_GCC_VERSION_CHECK(3,4,0)) && \
+ defined(__GLIBC__)
# define simde_math_exp10(v) __builtin_exp10(v)
#else
# define simde_math_exp10(v) simde_math_pow(10.0, (v))
#endif
-#if HEDLEY_HAS_BUILTIN(__builtin_exp10f) || HEDLEY_GCC_VERSION_CHECK(3,4,0)
+#if (HEDLEY_HAS_BUILTIN(__builtin_exp10f) || HEDLEY_GCC_VERSION_CHECK(3,4,0)) && \
+ defined(__GLIBC__)
# define simde_math_exp10f(v) __builtin_exp10f(v)
#else
# define simde_math_exp10f(v) simde_math_powf(10.0f, (v))
@@ -1265,9 +1270,16 @@ simde_math_fpclass(double v, const int imm8) {
#endif #endif
#if !defined(simde_math_roundeven) #if !defined(simde_math_roundeven)
+ /* GCC 10+ lowers __builtin_roundeven to a libm roundeven() call when + /* __builtin_roundeven lowers to a roundeven() libm call on targets
+ * the target has no native instruction. roundeven() is C23 and only + * without a native rounding instruction (x86 without SSE4.1,
+ * available in glibc >= 2.25; other platforms (musl, OpenBSD, MinGW, + * powerpc, sparc, i386, etc.). roundeven() is C23 and only
+ * etc.) lack the symbol and produce a link error. Clang lowers the + * available in glibc >= 2.25; other libcs (musl, OpenBSD, FreeBSD,
+ * builtin to an llvm.roundeven.* intrinsic which is always emitted + * MinGW, etc.) lack the symbol and produce a link error. Guard for
+ * inline (no libm dependency), so the GCC guard is not needed there. */ + * all compilers: non-glibc platforms use the inline fallback below. */
#if \ #if \
- ((!defined(HEDLEY_EMSCRIPTEN_VERSION) || HEDLEY_EMSCRIPTEN_VERSION_CHECK(3, 1, 43)) && HEDLEY_HAS_BUILTIN(__builtin_roundeven)) || \ - ((!defined(HEDLEY_EMSCRIPTEN_VERSION) || HEDLEY_EMSCRIPTEN_VERSION_CHECK(3, 1, 43)) && HEDLEY_HAS_BUILTIN(__builtin_roundeven)) || \
- HEDLEY_GCC_VERSION_CHECK(10,0,0) - HEDLEY_GCC_VERSION_CHECK(10,0,0)
+ ((!defined(HEDLEY_EMSCRIPTEN_VERSION) || HEDLEY_EMSCRIPTEN_VERSION_CHECK(3, 1, 43)) && \ + ((!defined(HEDLEY_EMSCRIPTEN_VERSION) || HEDLEY_EMSCRIPTEN_VERSION_CHECK(3, 1, 43)) && \
+ HEDLEY_HAS_BUILTIN(__builtin_roundeven) && \ + HEDLEY_HAS_BUILTIN(__builtin_roundeven) && \
+ (!HEDLEY_GCC_VERSION_CHECK(10,0,0) || \ + (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25))))
+ (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25)))))
#define simde_math_roundeven(v) __builtin_roundeven(v) #define simde_math_roundeven(v) __builtin_roundeven(v)
#elif defined(simde_math_round) && defined(simde_math_fabs) #elif defined(simde_math_round) && defined(simde_math_fabs)
static HEDLEY_INLINE static HEDLEY_INLINE
@@ -1285,9 +1293,14 @@ simde_math_fpclass(double v, const int imm8) { @@ -1285,9 +1297,13 @@ simde_math_fpclass(double v, const int imm8) {
#endif #endif
#if !defined(simde_math_roundevenf) #if !defined(simde_math_roundevenf)
+ /* Same rationale as simde_math_roundeven above; applies to the float + /* Same rationale as simde_math_roundeven above; applies to the float
+ * variant. GCC 10+ requires glibc >= 2.25 for roundevenf(); Clang + * variant. Both GCC and Clang emit a roundevenf() libm call on
+ * is always safe via llvm.roundeven.f32 inline expansion. */ + * targets without a native instruction. */
#if \ #if \
- ((!defined(HEDLEY_EMSCRIPTEN_VERSION) || HEDLEY_EMSCRIPTEN_VERSION_CHECK(3, 1, 43)) && HEDLEY_HAS_BUILTIN(__builtin_roundevenf)) || \ - ((!defined(HEDLEY_EMSCRIPTEN_VERSION) || HEDLEY_EMSCRIPTEN_VERSION_CHECK(3, 1, 43)) && HEDLEY_HAS_BUILTIN(__builtin_roundevenf)) || \
- HEDLEY_GCC_VERSION_CHECK(10,0,0) - HEDLEY_GCC_VERSION_CHECK(10,0,0)
+ ((!defined(HEDLEY_EMSCRIPTEN_VERSION) || HEDLEY_EMSCRIPTEN_VERSION_CHECK(3, 1, 43)) && \ + ((!defined(HEDLEY_EMSCRIPTEN_VERSION) || HEDLEY_EMSCRIPTEN_VERSION_CHECK(3, 1, 43)) && \
+ HEDLEY_HAS_BUILTIN(__builtin_roundevenf) && \ + HEDLEY_HAS_BUILTIN(__builtin_roundevenf) && \
+ (!HEDLEY_GCC_VERSION_CHECK(10,0,0) || \ + (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25))))
+ (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25)))))
#define simde_math_roundevenf(v) __builtin_roundevenf(v) #define simde_math_roundevenf(v) __builtin_roundevenf(v)
#elif defined(simde_math_roundf) && defined(simde_math_fabsf) #elif defined(simde_math_roundf) && defined(simde_math_fabsf)
static HEDLEY_INLINE static HEDLEY_INLINE