From: Sunil Dora <[email protected]>

The memcpy alias in CryptoPkg's IntrinsicLib declares its size
parameter as unsigned int while the aliasee uses size_t. clang 23
diagnoses that through the new -Wattribute-alias, which the CLANGDWARF
build's -Werror turns into

  CopyMem.c:29:17: error: alias and aliasee have different types
  'void *(void *, const void *, unsigned int)' and
  'void *(void *, const void *, size_t)' [-Werror,-Wattribute-alias]

Declare the alias with size_t to match.

Signed-off-by: Sunil Dora <[email protected]>
---
 ...sicLib-fix-memcpy-alias-prototype-fo.patch | 35 +++++++++++++++++++
 meta/recipes-core/ovmf/ovmf_git.bb            |  1 +
 2 files changed, 36 insertions(+)
 create mode 100644 
meta/recipes-core/ovmf/ovmf/0005-CryptoPkg-IntrinsicLib-fix-memcpy-alias-prototype-fo.patch

diff --git 
a/meta/recipes-core/ovmf/ovmf/0005-CryptoPkg-IntrinsicLib-fix-memcpy-alias-prototype-fo.patch
 
b/meta/recipes-core/ovmf/ovmf/0005-CryptoPkg-IntrinsicLib-fix-memcpy-alias-prototype-fo.patch
new file mode 100644
index 0000000000..0921f21347
--- /dev/null
+++ 
b/meta/recipes-core/ovmf/ovmf/0005-CryptoPkg-IntrinsicLib-fix-memcpy-alias-prototype-fo.patch
@@ -0,0 +1,35 @@
+From: Sunil Dora <[email protected]>
+Date: Wed, 20 Aug 2026 10:45:00 +0530
+Subject: [PATCH] CryptoPkg/IntrinsicLib: fix memcpy alias prototype for clang
+
+The clang-only memcpy alias declares its size parameter as unsigned int
+while the __memcpy aliasee uses size_t (UINTN, unsigned long long on
+X64). clang 23 diagnoses mismatched alias/aliasee types via the new
+-Wattribute-alias warning, which the CLANGDWARF build's -Werror turns
+into a hard error:
+
+  CopyMem.c:29:17: error: alias and aliasee have different types
+  'void *(void *, const void *, unsigned int)' and
+  'void *(void *, const void *, size_t)' [-Werror,-Wattribute-alias]
+
+Declare the alias with size_t, matching the aliasee on every
+architecture (UINTN is unsigned int on IA32, unsigned long long on X64).
+
+Upstream-Status: Submitted [https://github.com/tianocore/edk2/pull/13038]
+Signed-off-by: Sunil Dora <[email protected]>
+---
+--- a/CryptoPkg/Library/IntrinsicLib/CopyMem.c
++++ b/CryptoPkg/Library/IntrinsicLib/CopyMem.c
+@@ -29,9 +29,9 @@
+ __attribute__ ((__alias__ ("__memcpy")))
+ void *
+ memcpy (
+-  void          *dest,
+-  const void    *src,
+-  unsigned int  count
++  void        *dest,
++  const void  *src,
++  size_t      count
+   );
+ 
+ #else
diff --git a/meta/recipes-core/ovmf/ovmf_git.bb 
b/meta/recipes-core/ovmf/ovmf_git.bb
index 660aefcf46..bf69108f0a 100644
--- a/meta/recipes-core/ovmf/ovmf_git.bb
+++ b/meta/recipes-core/ovmf/ovmf_git.bb
@@ -19,6 +19,7 @@ SRC_URI = 
"gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https;ta
            
file://0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch \
            file://0003-debug-prefix-map.patch \
            file://0004-reproducible.patch \
+           
file://0005-CryptoPkg-IntrinsicLib-fix-memcpy-alias-prototype-fo.patch \
            "
 
 PV = "edk2-stable202605"
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#244650): 
https://lists.openembedded.org/g/openembedded-core/message/244650
Mute This Topic: https://lists.openembedded.org/mt/120998130/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to