Hello,

[this is my first contribution here, I apologize if I'm not doing this right]


When building without ENABLE_ASSEMBLY, the cpu_xgetbv function is noped in 
primitives.cpp with a different signature than its declaration in cpu.cpp.

The signature was changed in cpu.cpp by commit 
3a20c6d31fd3e1b959cdf7904118958f2ee20d8e but not in primitives.cpp.

I came across this while building with emscripten giving warnings such as:

wasm-ld: warning: function signature mismatch: x265_10bit_cpu_xgetbv
>>> defined as (i32) -> i64 in libx265.a(cpu.cpp.o)
>>> defined as (i32, i32, i32) -> void in libx265.a(primitives.cpp.o)


Here's the patch:


From fa86cc5d43a301792562d358797ed051f2da2368 Mon Sep 17 00:00:00 2001
From: Aurelien David <[email protected]>
Date: Wed, 5 Jul 2023 18:18:10 +0200
Subject: [PATCH] fix cpu_xgetbv signature mismatch when ENABLE_ASSEMBLY is off

---
 source/common/primitives.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source/common/primitives.cpp b/source/common/primitives.cpp
index 10e41888..cd39ca95 100644
--- a/source/common/primitives.cpp
+++ b/source/common/primitives.cpp
@@ -293,7 +293,7 @@ extern "C" {
 int PFX(cpu_cpuid_test)(void) { return 0; }
 void PFX(cpu_emms)(void) {}
 void PFX(cpu_cpuid)(uint32_t, uint32_t *eax, uint32_t *, uint32_t *, uint32_t 
*) { *eax = 0; }
-void PFX(cpu_xgetbv)(uint32_t, uint32_t *, uint32_t *) {}
+uint64_t PFX(cpu_xgetbv)(int) { return 0; }
 
 #if X265_ARCH_ARM == 0
 void PFX(cpu_neon_test)(void) {}
-- 
2.34.1



Have a nice day,

-- 
Aurélien David
_______________________________________________
x265-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/x265-devel

Reply via email to