public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ArmPkg/CompilerIntrinsicsLib ARM: make memset() weak again
@ 2016-09-05 12:37 Ard Biesheuvel
  2016-09-05 14:37 ` Leif Lindholm
  0 siblings, 1 reply; 2+ messages in thread
From: Ard Biesheuvel @ 2016-09-05 12:37 UTC (permalink / raw)
  To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel

After the recent update of CompilerIntrinsicsLib, our memset() is no
longer emitted as a weak symbol. On ARM, this may cause problems when
combining this library with another library that supplies memset() [e.g.,
CryptoPkg/IntrinsicLib], due to the fact that the object also supplies
the __aeabi_memXXX entry points, which can only be satisfied by this
object. So make our memset() weak again, to let the other implementation
take precedence.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---

This makes ArmVirtQemu build again for ARM with SECURE_BOOT_ENABLE=TRUE

 ArmPkg/Library/CompilerIntrinsicsLib/memset.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c b/ArmPkg/Library/CompilerIntrinsicsLib/memset.c
index 3d417d797242..0d837fcecf09 100644
--- a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c
+++ b/ArmPkg/Library/CompilerIntrinsicsLib/memset.c
@@ -31,6 +31,15 @@ void *memset(void *dest, int c, size_t n);
 
 #ifdef __arm__
 
+//
+// Other modules (such as CryptoPkg/IntrinsicLib) may provide another
+// implementation of memset(), which may conflict with this one if this
+// object was pulled into the link due to the definitions below. So make
+// our memset() 'weak' to let the other implementation take precedence.
+//
+__attribute__((__weak__))
+void *memset(void *dest, int c, size_t n);
+
 void __aeabi_memset(void *dest, size_t n, int c)
 {
   __memset(dest, c, n);
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ArmPkg/CompilerIntrinsicsLib ARM: make memset() weak again
  2016-09-05 12:37 [PATCH] ArmPkg/CompilerIntrinsicsLib ARM: make memset() weak again Ard Biesheuvel
@ 2016-09-05 14:37 ` Leif Lindholm
  0 siblings, 0 replies; 2+ messages in thread
From: Leif Lindholm @ 2016-09-05 14:37 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: edk2-devel

On Mon, Sep 05, 2016 at 01:37:46PM +0100, Ard Biesheuvel wrote:
> After the recent update of CompilerIntrinsicsLib, our memset() is no
> longer emitted as a weak symbol. On ARM, this may cause problems when
> combining this library with another library that supplies memset() [e.g.,
> CryptoPkg/IntrinsicLib], due to the fact that the object also supplies
> the __aeabi_memXXX entry points, which can only be satisfied by this
> object. So make our memset() weak again, to let the other implementation
> take precedence.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
> 
> This makes ArmVirtQemu build again for ARM with SECURE_BOOT_ENABLE=TRUE
> 
>  ArmPkg/Library/CompilerIntrinsicsLib/memset.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c b/ArmPkg/Library/CompilerIntrinsicsLib/memset.c
> index 3d417d797242..0d837fcecf09 100644
> --- a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c
> +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memset.c
> @@ -31,6 +31,15 @@ void *memset(void *dest, int c, size_t n);
>  
>  #ifdef __arm__
>  
> +//
> +// Other modules (such as CryptoPkg/IntrinsicLib) may provide another
> +// implementation of memset(), which may conflict with this one if this
> +// object was pulled into the link due to the definitions below. So make
> +// our memset() 'weak' to let the other implementation take precedence.
> +//
> +__attribute__((__weak__))
> +void *memset(void *dest, int c, size_t n);
> +
>  void __aeabi_memset(void *dest, size_t n, int c)
>  {
>    __memset(dest, c, n);
> -- 
> 2.7.4
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-05 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-05 12:37 [PATCH] ArmPkg/CompilerIntrinsicsLib ARM: make memset() weak again Ard Biesheuvel
2016-09-05 14:37 ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox