From f8c51389c6dbc8e99715489f70fb4ad47d49be1f Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Thu, 4 Aug 2016 16:37:13 +0200 Subject: [PATCH] ArmPkg/CompilerIntrinsicsLib: make the default memset() weak The ARM compiler intrinsics library defines __aeabi_memset() and memset() in the same object, which means that both will be pulled in if either is referenced. The IntrinsicLib in CryptoPkg defines its own, preferred memset(), which may clash with our memset(). So make our version weak. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S index bb75d7a70b..65f6289b41 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S @@ -40,6 +40,14 @@ ASM_PFX(__aeabi_memset): # IN UINT32 Character, # IN UINT32 Size # ); + // + // This object may be pulled in to satisfy an undefined reference to + // __aeabi_memset above, but in some cases, memset() is already provided + // by another library (i.e., CryptoPkg/IntrinsicLib), in which case we + // prefer the other version. So allow this one to be overridden by + // giving it weak linkage. + // + .weak memset ASM_PFX(memset): subs ip, r2, #0 bxeq lr