diff mbox

[edk2] ArmPkg/CompilerIntrinsicsLib: use Clang-compatible 'weak' attribute

Message ID 1473172051-25022-1-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit ec68dc28557925e0708d5676288ad140651a3851
Headers show

Commit Message

Ard Biesheuvel Sept. 6, 2016, 2:27 p.m. UTC
Clang does not like separate definitions for the __alias__ and the
__weak__ attributes, so merge the definitions into one.

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

---

Note that the CI job is currently broken due to this clang issue.

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

-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Leif Lindholm Sept. 6, 2016, 2:38 p.m. UTC | #1
On Tue, Sep 06, 2016 at 03:27:31PM +0100, Ard Biesheuvel wrote:
> Clang does not like separate definitions for the __alias__ and the

> __weak__ attributes, so merge the definitions into one.

> 

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


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


> ---

> 

> Note that the CI job is currently broken due to this clang issue.

> 

>  ArmPkg/Library/CompilerIntrinsicsLib/memset.c | 9 +++------

>  1 file changed, 3 insertions(+), 6 deletions(-)

> 

> diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c b/ArmPkg/Library/CompilerIntrinsicsLib/memset.c

> index 0d837fcecf09..7271b4be6f96 100644

> --- a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c

> +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memset.c

> @@ -26,20 +26,17 @@ void *__memset(void *s, int c, size_t n)

>    return s;

>  }

>  

> -__attribute__((__alias__("__memset")))

> -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__))

> +__attribute__((__weak__, __alias__("__memset")))

>  void *memset(void *dest, int c, size_t n);

>  

> +#ifdef __arm__

> +

>  void __aeabi_memset(void *dest, size_t n, int c)

>  {

>    __memset(dest, c, n);

> -- 

> 2.7.4

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c b/ArmPkg/Library/CompilerIntrinsicsLib/memset.c
index 0d837fcecf09..7271b4be6f96 100644
--- a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c
+++ b/ArmPkg/Library/CompilerIntrinsicsLib/memset.c
@@ -26,20 +26,17 @@  void *__memset(void *s, int c, size_t n)
   return s;
 }
 
-__attribute__((__alias__("__memset")))
-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__))
+__attribute__((__weak__, __alias__("__memset")))
 void *memset(void *dest, int c, size_t n);
 
+#ifdef __arm__
+
 void __aeabi_memset(void *dest, size_t n, int c)
 {
   __memset(dest, c, n);