From 24c8e11c85da12211d530b8721dbfd2606352ac7 Mon Sep 17 00:00:00 2001
From: Harishmcw <harish.rajaselvan@multicorewareinc.com>
Date: Tue, 23 Sep 2025 16:44:34 +0530
Subject: [PATCH] ffmpeg/gas-preprocessor: enable ARM64EC compilation

Updated gas-preprocessor.pl to correctly handle -arm64EC flags during
preprocessing and compilation command filtering. Previously, all -m*
flags were removed, which broke ARM64EC builds. This change ensures
assembly files preprocess correctly and allows FFmpeg to build on
Windows for ARM64EC targets.

Signed-off-by: Harishmcw <harish.rajaselvan@multicorewareinc.com>
---
 gas-preprocessor.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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

