Hello, This patch adds support for ARM64EC builds on Windows by updating .def file generation logic for shared libraries and ensuring the correct machine flag is passed to lib.exe and dumpbin.exe.
In-Lined patch:
diff --git a/compat/windows/makedef b/compat/windows/makedef
index add8222d13..261e7d463f 100755
--- a/compat/windows/makedef
+++ b/compat/windows/makedef
@@ -48,7 +48,13 @@ trap 'rm -f -- $libname' EXIT
if [ -n "$AR" ]; then
$AR rcs ${libname} $@ >/dev/null
else
- lib.exe -out:${libname} $@ >/dev/null
+ machine_flag=""
+ case "$LDFLAGS" in
+ *"/machine:arm64ec"*)
+ machine_flag="-machine:arm64ec"
+ ;;
+ esac
+ lib.exe ${machine_flag} -out:${libname} $@ >/dev/null
fi
if [ $? != 0 ]; then
echo "Could not create temporary library." >&2
@@ -108,10 +114,19 @@ if [ -n "$NM" ]; then
cut -d' ' -f3 |
sed -e "s/^${prefix}//")
else
- dump=$(dumpbin.exe -linkermember:1 ${libname} |
- sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/
\{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
+ member=1
+ case "$LDFLAGS" in
+ *"/machine:arm64ec"*)
+ member=32
+ ;;
+ esac
+ dump=$(dumpbin.exe -linkermember:${member} ${libname} |
+ sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e
's/^[[:space:]]*[0-9A-Fa-f]* //' -e "s/^${prefix}//" -e 's/^#//' |
tail -n +2 |
- cut -d' ' -f3)
+ cut -d' ' -f3 |
+ grep -v '\$exit_thunk$' |
+ grep -v '\$entry_thunk' |
+ grep -v '\$exit_thunk')
fi
rm ${libname}
diff --git a/configure b/configure
index 7828381b5d..fbf5ab38a4 100755
--- a/configure
+++ b/configure
@@ -6040,7 +6040,7 @@ case $target_os in
SLIB_INSTALL_LINKS=
SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
- SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)"
NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver
$(OBJS) > $$(@:$(SLIBSUF)=.def)'
+ SLIB_CREATE_DEF_CMD='LDFLAGS="$(LDFLAGS)"
EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" NM="$(NM_CMD)"
$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) >
$$(@:$(SLIBSUF)=.def)'
SHFLAGS='-shared
-Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
-Wl,--disable-auto-image-base $$(@:$(SLIBSUF)=.def)'
enabled x86_64 && objformat="win64" || objformat="win32"
dlltool="${cross_prefix}dlltool"
@@ -6078,7 +6078,7 @@ case $target_os in
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
- SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)"
$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) >
$$(@:$(SLIBSUF)=.def)'
+ SLIB_CREATE_DEF_CMD='LDFLAGS="$(LDFLAGS)"
EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef
$(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_LINKS=
SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
--
2.50.1.windows.1
For reference, here is the configuration used to build FFmpeg with MSVC for
ARM64EC:
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}" \
--enable-shared
Thanks,
Harish Raja Selvan.
0001-PATCH-v2-Fix-.def-file-generation-for-ARM64EC-builds.patch
Description: 0001-PATCH-v2-Fix-.def-file-generation-for-ARM64EC-builds.patch
_______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
