1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avutil: Fix linking x86 asm constants with Clang in MSVC mode

This fixes building with Clang in MSVC mode, for x86, which was
broken in 6e49b86996 (in Nov 2024);
previously it failed with undefined symbols for the constants
defined with DECLARE_ASM_CONST, accessed via inline assembly.

Before 57861911a3, there was an
    #elif defined(__GNUC__) || defined(__clang__)
case before the
    #elif defined(_MSC_VER)
case for defining DECLARE_ASM_CONST, which included av_used.
(This case included the explicit "defined(__clang__)" since
f637046d3134a331e4b5a7243ac3dfb92735b8a5.)

After 57861911a3, it used the
generic definition of DECLARE_ASM_CONST that also included
av_used - which also worked for Clang in MSVC mode. But after
6e49b86996, Clang in MSVC mode
ended up using the MSVC specific variant which lacked the
av_used declaration, causing linker errors due to undefined
symbols.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö
2025-06-12 12:06:15 +03:00
parent 58f3d8a461
commit fb65ecbc9b

View File

@ -82,8 +82,8 @@
#define DECLARE_ASM_CONST(n,t,v) alignas(FFMIN(n, 16)) static const t av_used v #define DECLARE_ASM_CONST(n,t,v) alignas(FFMIN(n, 16)) static const t av_used v
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#define DECLARE_ALIGNED_T(n,t,v) __declspec(align(n)) t v #define DECLARE_ALIGNED_T(n,t,v) __declspec(align(n)) t v
#define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t av_used v
#define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t av_used v
#else #else
#define DECLARE_ALIGNED_T(n,t,v) alignas(n) t v #define DECLARE_ALIGNED_T(n,t,v) alignas(n) t v
#define DECLARE_ASM_ALIGNED(n,t,v) alignas(n) t av_used v #define DECLARE_ASM_ALIGNED(n,t,v) alignas(n) t av_used v