From: "Martin Storsjö" <martin@martin.st>
To: ffmpeg-devel@ffmpeg.org
Cc: Zhao Zhili <quinkblack@foxmail.com>
Subject: Re: [FFmpeg-devel] [PATCH] avutil: Fix linking x86 asm constants with Clang in MSVC mode
Date: Fri, 13 Jun 2025 11:34:12 +0300 (EEST)
Message-ID: <bc88e190-dacd-beb3-64e7-59d5ab6106c@martin.st> (raw)
In-Reply-To: <20250612093933.395475-1-martin@martin.st>
On Thu, 12 Jun 2025, Martin Storsjö wrote:
> This fixes building with Clang in MSVC mode, for x86, which was
> broken in 6e49b8699657b808b7dc80033f2c3f2d0e029fa3 (in Nov 2024);
> previously it failed with undefined symbols for the constants
> defined with DECLARE_ASM_CONST, accessed via inline assembly.
>
> Before 57861911a34e1c33796be97f2b2f44e05fffd647, 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 57861911a34e1c33796be97f2b2f44e05fffd647, it used the
> generic definition of DECLARE_ASM_CONST that also included
> av_used - which also worked for Clang in MSVC mode. But after
> 6e49b8699657b808b7dc80033f2c3f2d0e029fa3, Clang in MSVC mode
> ended up using the MSVC specific variant which lacked the
> av_used declaration, causing linker errors due to undefined
> symbols.
> ---
> libavutil/mem_internal.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavutil/mem_internal.h b/libavutil/mem_internal.h
> index d58881d09c..78adc4f407 100644
> --- a/libavutil/mem_internal.h
> +++ b/libavutil/mem_internal.h
> @@ -82,8 +82,8 @@
> #define DECLARE_ASM_CONST(n,t,v) alignas(FFMIN(n, 16)) static const t av_used v
> #elif defined(_MSC_VER)
> #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_CONST(n,t,v) __declspec(align(n)) static const 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 av_used v
> #else
> #define DECLARE_ALIGNED_T(n,t,v) alignas(n) t v
> #define DECLARE_ASM_ALIGNED(n,t,v) alignas(n) t av_used v
> --
> 2.43.0
OK'd by Hendrik on irc, as I've tested it with both clang and actual MSVC
- will push.
// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2025-06-13 8:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 9:39 Martin Storsjö
2025-06-13 8:34 ` Martin Storsjö [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bc88e190-dacd-beb3-64e7-59d5ab6106c@martin.st \
--to=martin@martin.st \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=quinkblack@foxmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git