Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Martin Storsjö via ffmpeg-devel" <ffmpeg-devel@ffmpeg.org>
To: Harish Raja Selvan <harish.rajaselvan@multicorewareinc.com>
Cc: "harish.rajaselvan--- via ffmpeg-devel" <ffmpeg-devel@ffmpeg.org>,
	"Martin Storsjö" <martin@martin.st>
Subject: [FFmpeg-devel] Re: [DISCUSSION] Adding ARM64EC support to FFmpeg
Date: Fri, 3 Oct 2025 15:27:27 +0300 (EEST)
Message-ID: <2af51c6e-4a3d-a6fe-e78-95de4fd8b4b6@martin.st> (raw)
In-Reply-To: <MA5P287MB46250801E615EFD59F4ACEF69E1EA@MA5P287MB4625.INDP287.PROD.OUTLOOK.COM>

On Tue, 30 Sep 2025, Harish Raja Selvan wrote:

> Thank you for your feedback and questions about the ARM64EC patch.
> I’m sharing the build system patch for enabling ARM64EC support in FFmpeg.
> This patch addresses .def file generation for ARM64EC builds on Windows.
> 
> In-Lined patch:
> 
> diff --git a/compat/windows/makedef b/compat/windows/makedef
> index add8222d13..59e300ab61 100755
> --- a/compat/windows/makedef
> +++ b/compat/windows/makedef
> @@ -108,7 +108,12 @@ if [ -n "$NM" ]; then
>                cut -d' ' -f3 |
>                sed -e "s/^${prefix}//")
>  else
> -    dump=$(dumpbin.exe -linkermember:1 ${libname} |
> +    member=1
> +    arch=$VSCMD_ARG_TGT_ARCH
> +    if [ "${arch^^}" = "ARM64EC" ]; then
> +        member=32
> +    fi

We shouldn't inspect any VSCMD_* env variables here in order to deduce the 
target architecture. (Also, how do you initialize the environment in order 
to get such a variable set? If you just open a regular arm64 VS command 
prompt, which AFAIK is the default environment for arm64ec compilation, I 
wouldn't expect such a variable to be set?)

Instead we need to deduce the architecture from something else here - 
potentially by passing some parameter from configure.

> +        dump=$(dumpbin.exe -linkermember:${member} ${libname} |
>                sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e
> "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
>                tail -n +2 |
>                cut -d' ' -f3)
> @@ -121,7 +126,7 @@ list=""
>  for exp in ${regex}; do
>      list="${list}"'
>  '$(echo "${dump}" |
> -          grep "^${exp}" |
> +          grep "^${exp}" | awk '!/\$exit_thunk/{print}' |

I presume the added awk expression here is just to filter out any line 
that doesn't match '$exit_thunk'? Why not just a "grep -v '$exit_thunk'"? 
And that can be in the dump expression as well, in order not to need to do 
that filtering for each expression. (If we add it to the dump expression, 
we do need to include it in both variants of the dump expression though; 
it's possible to build arm64ec with mingw style tools as well.)

For me, this doesn't really end up matching any symbols - I only get the 
data symbols. What does EXTERN_PREFIX end up being set to in your 
configurations; for me it's an empty string. Does it get set to "#" in 
your case?


> For reference, here is the configuration used to build FFmpeg with MSVC for
> ARM64EC:
> I've also attached the same configuration in ffmpeg-arm64ec-msvc.config for
> convenience.
> 
> # find_ar_lib resolves to /usr/share/automake-1.16/ar-lib
> AR_LIB="$(find_ar_lib)"
> AR_CMD="${AR_LIB} lib.exe -machine:arm64ec"

Why do you need any extra ar-lib here? This works fine for me with just 
AR_CMD="lib.exe -machine:arm64ec".

> ARCH="arm64"
> 
> "${SRC_DIR}/configure" \
>     --toolchain=msvc \
>     --target-os=win64 \
>     --cc=cl.exe \
>     --cxx=cl.exe \
>     --extra-cxxflags="-arm64EC" \
>     --extra-cflags="-arm64EC" \
>     --extra-ldflags="/machine:arm64ec" \
>     --as="armasm64.exe -machine ARM64EC" \
>     --ld=link.exe \
>     --ar="${AR_CMD}" \
>     --arch="${ARCH}"
> 
> In my setup, this configuration requires the gas-preprocessor.pl patch, as
> the build otherwise ends with a “GNU assembler not found” error.

Thanks - with this context, it's easier to review your gas-preprocessor 
patch.

As far as I can see, this builds fine without any extra modifications of 
ffmpeg, as long as gas-preprocessor is patched. Building with 
--enable-shared would require the suggested changes to makedef, but those 
changes aren't entirely right in order to work for me in my tests.

I have an alternative suggestion on how to do the gas-preprocessor patch - 
I'll send those patches and CC you on them.

Another alternative for gas-preprocessor would be to just look for the 
-arm64EC option, and inject the "-machine arm64ec" options implicitly in 
that case (it turns out I actually had such a patch lying around since 
experiments in 2021), but it's perhaps more transparent to force the 
caller of gas-preprocessor to provide the option.

// Martin
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

  reply	other threads:[~2025-10-03 12:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22 10:04 [FFmpeg-devel] " harish.rajaselvan--- via ffmpeg-devel
2025-09-22 11:48 ` [FFmpeg-devel] " Martin Storsjö via ffmpeg-devel
2025-09-23 13:03   ` Harish Raja Selvan via ffmpeg-devel
2025-09-24 12:15     ` Martin Storsjö via ffmpeg-devel
2025-09-30  4:58       ` Harish Raja Selvan via ffmpeg-devel
2025-10-03 12:27         ` Martin Storsjö via ffmpeg-devel [this message]
2025-09-27  9:00 ` Rémi Denis-Courmont via ffmpeg-devel
2025-10-03 12:44   ` Martin Storsjö via ffmpeg-devel
2025-10-03 14:32     ` Rémi Denis-Courmont via ffmpeg-devel
2025-10-03 15:11       ` Martin Storsjö via ffmpeg-devel
2025-10-03 16:39         ` Rémi Denis-Courmont via ffmpeg-devel
2025-10-03 20:49           ` Stephen Hutchinson via ffmpeg-devel
2025-10-04  8:43             ` Rémi Denis-Courmont via ffmpeg-devel

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=2af51c6e-4a3d-a6fe-e78-95de4fd8b4b6@martin.st \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=harish.rajaselvan@multicorewareinc.com \
    --cc=martin@martin.st \
    /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 http://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/ http://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