[edk2-devel] [Patch v3 04/11] MdePkg Base.h: Add definition for CLANG9 tool chain

Liming Gao posted 11 patches 6 years, 3 months ago
[edk2-devel] [Patch v3 04/11] MdePkg Base.h: Add definition for CLANG9 tool chain
Posted by Liming Gao 6 years, 3 months ago
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603
CLANG9 tool chain defines __clang__ macro only,
doesn't define __GNUC__ macro. But, it uses some same definitions with GCC.
So, update base definition for CLANG9 tool chain.

Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
 MdePkg/Include/Base.h               | 6 +++---
 MdePkg/Include/Ia32/ProcessorBind.h | 4 ++--
 MdePkg/Include/X64/ProcessorBind.h  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index d94b8a5f93..4680e64136 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -621,9 +621,9 @@ typedef char* VA_LIST;
 #define VA_END(Marker)                  (Marker = (VA_LIST) 0)
 #define VA_COPY(Dest, Start)            ((void)((Dest) = (Start)))
 
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) || defined(__clang__)
 
-#if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS)
+#if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS) && !defined(__clang__)
 //
 // X64 only. Use MS ABI version of GCC built-in macros for variable argument lists.
 //
@@ -1274,7 +1274,7 @@ typedef UINTN RETURN_STATUS;
 
   **/
   #define RETURN_ADDRESS(L)     ((L == 0) ? _ReturnAddress() : (VOID *) 0)
-#elif defined(__GNUC__)
+#elif defined (__GNUC__) || defined (__clang__)
   void * __builtin_return_address (unsigned int level);
   /**
     Get the return address of the calling function.
diff --git a/MdePkg/Include/Ia32/ProcessorBind.h b/MdePkg/Include/Ia32/ProcessorBind.h
index 497c58b33b..fa4b7e8e98 100644
--- a/MdePkg/Include/Ia32/ProcessorBind.h
+++ b/MdePkg/Include/Ia32/ProcessorBind.h
@@ -281,7 +281,7 @@ typedef INT32   INTN;
   /// Microsoft* compiler specific method for EFIAPI calling convention.
   ///
   #define EFIAPI __cdecl
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) || defined(__clang__)
   ///
   /// GCC specific method for EFIAPI calling convention.
   ///
@@ -294,7 +294,7 @@ typedef INT32   INTN;
   #define EFIAPI
 #endif
 
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__clang__)
   ///
   /// For GNU assembly code, .global or .globl can declare global symbols.
   /// Define this macro to unify the usage.
diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h
index 6f65acd609..387e9c5c9c 100644
--- a/MdePkg/Include/X64/ProcessorBind.h
+++ b/MdePkg/Include/X64/ProcessorBind.h
@@ -313,7 +313,7 @@ typedef INT64   INTN;
   #define EFIAPI
 #endif
 
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__clang__)
   ///
   /// For GNU assembly code, .global or .globl can declare global symbols.
   /// Define this macro to unify the usage.
-- 
2.13.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49161): https://edk2.groups.io/g/devel/message/49161
Mute This Topic: https://groups.io/mt/34694443/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [Patch v3 04/11] MdePkg Base.h: Add definition for CLANG9 tool chain
Posted by Michael D Kinney 6 years, 3 months ago
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On
> Behalf Of Liming Gao
> Sent: Wednesday, October 16, 2019 11:56 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>
> Subject: [edk2-devel] [Patch v3 04/11] MdePkg Base.h:
> Add definition for CLANG9 tool chain
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603
> CLANG9 tool chain defines __clang__ macro only, doesn't
> define __GNUC__ macro. But, it uses some same
> definitions with GCC.
> So, update base definition for CLANG9 tool chain.
> 
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> Cc: Michael Kinney <michael.d.kinney@intel.com>
> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
> ---
>  MdePkg/Include/Base.h               | 6 +++---
>  MdePkg/Include/Ia32/ProcessorBind.h | 4 ++--
> MdePkg/Include/X64/ProcessorBind.h  | 2 +-
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/MdePkg/Include/Base.h
> b/MdePkg/Include/Base.h index d94b8a5f93..4680e64136
> 100644
> --- a/MdePkg/Include/Base.h
> +++ b/MdePkg/Include/Base.h
> @@ -621,9 +621,9 @@ typedef char* VA_LIST;
>  #define VA_END(Marker)                  (Marker =
> (VA_LIST) 0)
>  #define VA_COPY(Dest, Start)            ((void)((Dest)
> = (Start)))
> 
> -#elif defined(__GNUC__)
> +#elif defined(__GNUC__) || defined(__clang__)
> 
> -#if defined(MDE_CPU_X64) &&
> !defined(NO_MSABI_VA_FUNCS)
> +#if defined(MDE_CPU_X64) &&
> !defined(NO_MSABI_VA_FUNCS) &&
> +!defined(__clang__)
>  //
>  // X64 only. Use MS ABI version of GCC built-in macros
> for variable argument lists.
>  //
> @@ -1274,7 +1274,7 @@ typedef UINTN RETURN_STATUS;
> 
>    **/
>    #define RETURN_ADDRESS(L)     ((L == 0) ?
> _ReturnAddress() : (VOID *) 0)
> -#elif defined(__GNUC__)
> +#elif defined (__GNUC__) || defined (__clang__)
>    void * __builtin_return_address (unsigned int
> level);
>    /**
>      Get the return address of the calling function.
> diff --git a/MdePkg/Include/Ia32/ProcessorBind.h
> b/MdePkg/Include/Ia32/ProcessorBind.h
> index 497c58b33b..fa4b7e8e98 100644
> --- a/MdePkg/Include/Ia32/ProcessorBind.h
> +++ b/MdePkg/Include/Ia32/ProcessorBind.h
> @@ -281,7 +281,7 @@ typedef INT32   INTN;
>    /// Microsoft* compiler specific method for EFIAPI
> calling convention.
>    ///
>    #define EFIAPI __cdecl
> -#elif defined(__GNUC__)
> +#elif defined(__GNUC__) || defined(__clang__)
>    ///
>    /// GCC specific method for EFIAPI calling
> convention.
>    ///
> @@ -294,7 +294,7 @@ typedef INT32   INTN;
>    #define EFIAPI
>  #endif
> 
> -#if defined(__GNUC__)
> +#if defined(__GNUC__) || defined(__clang__)
>    ///
>    /// For GNU assembly code, .global or .globl can
> declare global symbols.
>    /// Define this macro to unify the usage.
> diff --git a/MdePkg/Include/X64/ProcessorBind.h
> b/MdePkg/Include/X64/ProcessorBind.h
> index 6f65acd609..387e9c5c9c 100644
> --- a/MdePkg/Include/X64/ProcessorBind.h
> +++ b/MdePkg/Include/X64/ProcessorBind.h
> @@ -313,7 +313,7 @@ typedef INT64   INTN;
>    #define EFIAPI
>  #endif
> 
> -#if defined(__GNUC__)
> +#if defined(__GNUC__) || defined(__clang__)
>    ///
>    /// For GNU assembly code, .global or .globl can
> declare global symbols.
>    /// Define this macro to unify the usage.
> --
> 2.13.0.windows.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49322): https://edk2.groups.io/g/devel/message/49322
Mute This Topic: https://groups.io/mt/34694443/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-