Hello, Following up on the discussion above on ARM64EC support, I’ve prepared a patch to update gas-preprocessor.pl that enables FFmpeg to be compiled for ARM64EC target on Windows. This change ensures that -m flags are not eliminated for ARM64EC target, allowing assembly files to preprocess as expected. This avoids build failures. The patch has been tested locally & allows FFmpeg to build successfully for ARM64EC target. Attaching the patch file and in-lined here for your reference. Thanks, Harish Raja Selvan. In-Lined patch: diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl index 62c1a04..b2e38c0 100755 --- a/gas-preprocessor.pl +++ b/gas-preprocessor.pl @@ -166,6 +166,7 @@ if ($as_type ne "armasm") { @gcc_cmd = grep ! /^-D/, @gcc_cmd; } else { @preprocess_c_cmd = grep ! /^-m/, @preprocess_c_cmd; + @preprocess_c_cmd = grep ! /^ARM64EC/, @preprocess_c_cmd; @preprocess_c_cmd = grep ! /^-G/, @preprocess_c_cmd; @preprocess_c_cmd = grep ! /^-W/, @preprocess_c_cmd; @@ -195,7 +196,8 @@ if ($as_type ne "armasm") { # which doesn't support any of the common compiler/preprocessor options. @gcc_cmd = grep ! /^-D/, @gcc_cmd; @gcc_cmd = grep ! /^-U/, @gcc_cmd; - @gcc_cmd = grep ! /^-m/, @gcc_cmd; + @gcc_cmd = grep !/^-m/, @gcc_cmd if !grep /-arm64EC/, @gcc_cmd; + @gcc_cmd = grep ! /^-arm64EC/, @gcc_cmd; @gcc_cmd = grep ! /^-M/, @gcc_cmd; @gcc_cmd = grep ! /^-c$/, @gcc_cmd; @gcc_cmd = grep ! /^-I/, @gcc_cmd; -- 2.50.1.windows.1 ________________________________ From: Martin Storsjö Sent: 22 September 2025 17:18 To: harish.rajaselvan--- via ffmpeg-devel Cc: Harish Raja Selvan Subject: Re: [FFmpeg-devel] [DISCUSSION] Adding ARM64EC support to FFmpeg On Mon, 22 Sep 2025, harish.rajaselvan--- via ffmpeg-devel wrote: > I have been working on enabling ARM64EC compilation and have > successfully built FFmpeg binaries for this target. To achieve this it > required modifications to the build configuration files and to the > gas-preprocessor.pl script (maintained in > https://github.com/FFmpeg/gas-preprocessor). Should changes to > gas-preprocessor.pl be submitted as a pull request to its repository, or > also sent to this mailing list for review? I'm not sure if we have a policy for this; reviewing it on the mailing list probably gives it more visibility than as a PR in a repo that very few follows. > I would like to submit these patches upstream for review and feedback > from the community in the near future in this thread. Please let us know > if we can proceed with submitting them, or if there are any challenges > we should anticipate for enabling for this target. Feel free to send patches for review - although I cannot guarantee that we are willing to integrate the changes. As far as I can see, for building for ARM64EC with MSVC, the changes required mainly are for passing "-machine:arm64ec" to lib.exe, and for filtering out the -arm64EC option from the compiler command in gas-preprocessor.pl. Such changes probably are straightforward and probably can be accepted. If building with https://github.com/mstorsjo/llvm-mingw/releases (with the latest 2 releases), no such changes are needed, and it's possible to configure a build with just "--cross-prefix=arm64ec-w64-mingw32- --target-os=mingw32 --arch=aarch64". The other, much more major issue, is that all aarch64 assembly may need to be tweaked to work in ARM64EC mode. This may need rewrites (or ugly conditionals) to avoid using registers that are forbidden in ARM64EC mode. (Building with Clang makes this aspect much more straightforward, as Clang gives warnings about the use of forbidden registers, like "warning: register Q25 is disallowed on ARM64EC.".) We would have to see the proposed patches to see if these changes are palatable or if they are too outrageous for us to want to take them upstream. > Additionally, I would like to know the point of contact for hosting > ARM64EC binaries (for example, via btbn or gyan.dev), so that people > targeting this platform can have access to FFmpeg builds for this > target. Upstream ffmpeg can't make any promises about this; you'd have to convince the developers providing those builds to do it. Personally, I'm unconvinced. For users of the plain ffmpeg.exe binaries, I don't see any reason why anyone would want to run an ARM64EC version rather than a plain regular ARM64 build. (The main theoretical reason is if intending to load a binary x86_64 plugin, but I don't know what plugins that would be?) The main reason for wanting an ARM64EC build of ffmpeg is for integrating into an app that still runs in emulated x86_64 mode - then you'd want linking against the libraries and not just using the commandline executable. I'm not familiar with those binary distributions, whether they include such libraries as well, or only the end executables. If they do provide libraries as well, I could see some value in it, but it's of course totally up to them whether they feel it's worth the effort (I doubt it). // Martin