[edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix GCC build error

Nickle Wang via groups.io posted 1 patch 1 year, 4 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
.../Universal/RegularExpressionDxe/OnigurumaUefiPort.h       | 5 +++++
1 file changed, 5 insertions(+)
[edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix GCC build error
Posted by Nickle Wang via groups.io 1 year, 4 months ago
Fix GCC build error on AARCH64 system.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Nick Ramirez <nramirez@nvidia.com>
---
 .../Universal/RegularExpressionDxe/OnigurumaUefiPort.h       | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
index 3dc207da3e..e9dfd6de06 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
@@ -4,6 +4,7 @@
 
   (C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP<BR>
   Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
@@ -44,6 +45,10 @@ typedef INTN    intptr_t;
 #define SIZEOF_VOIDP  8
 #endif
 
+#ifdef MDE_CPU_AARCH64
+#define SIZEOF_VOIDP  8
+#endif
+
 #define calloc(n, s)                    AllocateZeroPool((n)*(s))
 #define xmemmove(Dest, Src, Length)     CopyMem(Dest,Src,Length)
 #define xmemcpy(Dest, Src, Length)      CopyMem(Dest,Src,Length)
-- 
2.38.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96738): https://edk2.groups.io/g/devel/message/96738
Mute This Topic: https://groups.io/mt/95360067/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix GCC build error
Posted by Michael D Kinney 1 year, 4 months ago
Hi,

I see the following pattern in the RedfishPkg to cover all CPUs 

    #if defined (MDE_CPU_X64) || defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64)
    //
    // With GCC we would normally use SIXTY_FOUR_BIT_LONG, but MSVC needs
    // SIXTY_FOUR_BIT, because 'long' is 32-bit and only 'long long' is
    // 64-bit. Since using 'long long' works fine on GCC too, just do that.
    //
    #define SIXTY_FOUR_BIT
    #elif defined (MDE_CPU_IA32) || defined (MDE_CPU_ARM) || defined (MDE_CPU_EBC)
    #define THIRTY_TWO_BIT
    #endif

Can we apply the same pattern to OnigurumaUefiPort.h to define SIZEOF_VOIDP and add LOONGARCH64?

#if defined (MDE_CPU_X64) || defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64) || defined (MDE_CPU_LOONGARCH64)
#define SIZEOF_VOIDP  8
#elif defined (MDE_CPU_IA32) || defined (MDE_CPU_ARM) || defined (MDE_CPU_EBC)
#define SIZEOF_VOIDP  4
#endif

Or it may be simpler to only check for 32-bit archs and assume all others are 64-bit.

#if defined (MDE_CPU_IA32) || defined (MDE_CPU_ARM) || defined (MDE_CPU_EBC)
#define SIZEOF_VOIDP  4
#else
#define SIZEOF_VOIDP  8
#endif


Thanks,

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Nickle Wang via groups.io
> Sent: Wednesday, November 30, 2022 7:28 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Nick Ramirez <nramirez@nvidia.com>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix GCC build error
> 
> Fix GCC build error on AARCH64 system.
> 
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
>  .../Universal/RegularExpressionDxe/OnigurumaUefiPort.h       | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
> b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
> index 3dc207da3e..e9dfd6de06 100644
> --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
> +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
> @@ -4,6 +4,7 @@
> 
>    (C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP<BR>
>    Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> 
>    SPDX-License-Identifier: BSD-2-Clause-Patent
>  **/
> @@ -44,6 +45,10 @@ typedef INTN    intptr_t;
>  #define SIZEOF_VOIDP  8
>  #endif
> 
> +#ifdef MDE_CPU_AARCH64
> +#define SIZEOF_VOIDP  8
> +#endif
> +
>  #define calloc(n, s)                    AllocateZeroPool((n)*(s))
>  #define xmemmove(Dest, Src, Length)     CopyMem(Dest,Src,Length)
>  #define xmemcpy(Dest, Src, Length)      CopyMem(Dest,Src,Length)
> --
> 2.38.1.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96740): https://edk2.groups.io/g/devel/message/96740
Mute This Topic: https://groups.io/mt/95360067/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix GCC build error
Posted by Nickle Wang via groups.io 1 year, 4 months ago
Hi Mike,

Thanks for your review.

> Or it may be simpler to only check for 32-bit archs and assume all others are 64-bit.

I like this one. I will provide version 2 patch later.

Regards,
Nickle

-----Original Message-----
From: Kinney, Michael D <michael.d.kinney@intel.com> 
Sent: Thursday, December 1, 2022 12:28 AM
To: devel@edk2.groups.io; Nickle Wang <nicklew@nvidia.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Cc: Wang, Jian J <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Nick Ramirez <nramirez@nvidia.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix GCC build error

External email: Use caution opening links or attachments


Hi,

I see the following pattern in the RedfishPkg to cover all CPUs

    #if defined (MDE_CPU_X64) || defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64)
    //
    // With GCC we would normally use SIXTY_FOUR_BIT_LONG, but MSVC needs
    // SIXTY_FOUR_BIT, because 'long' is 32-bit and only 'long long' is
    // 64-bit. Since using 'long long' works fine on GCC too, just do that.
    //
    #define SIXTY_FOUR_BIT
    #elif defined (MDE_CPU_IA32) || defined (MDE_CPU_ARM) || defined (MDE_CPU_EBC)
    #define THIRTY_TWO_BIT
    #endif

Can we apply the same pattern to OnigurumaUefiPort.h to define SIZEOF_VOIDP and add LOONGARCH64?

#if defined (MDE_CPU_X64) || defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64) || defined (MDE_CPU_LOONGARCH64) #define SIZEOF_VOIDP  8 #elif defined (MDE_CPU_IA32) || defined (MDE_CPU_ARM) || defined (MDE_CPU_EBC) #define SIZEOF_VOIDP  4 #endif

Or it may be simpler to only check for 32-bit archs and assume all others are 64-bit.

#if defined (MDE_CPU_IA32) || defined (MDE_CPU_ARM) || defined (MDE_CPU_EBC) #define SIZEOF_VOIDP  4 #else #define SIZEOF_VOIDP  8 #endif


Thanks,

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Nickle 
> Wang via groups.io
> Sent: Wednesday, November 30, 2022 7:28 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>; Nick Ramirez <nramirez@nvidia.com>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix 
> GCC build error
>
> Fix GCC build error on AARCH64 system.
>
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
>  .../Universal/RegularExpressionDxe/OnigurumaUefiPort.h       | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git 
> a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
> b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
> index 3dc207da3e..e9dfd6de06 100644
> --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
> +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
> @@ -4,6 +4,7 @@
>
>    (C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP<BR>
>    Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
>
>    SPDX-License-Identifier: BSD-2-Clause-Patent  **/
> @@ -44,6 +45,10 @@ typedef INTN    intptr_t;
>  #define SIZEOF_VOIDP  8
>  #endif
>
> +#ifdef MDE_CPU_AARCH64
> +#define SIZEOF_VOIDP  8
> +#endif
> +
>  #define calloc(n, s)                    AllocateZeroPool((n)*(s))
>  #define xmemmove(Dest, Src, Length)     CopyMem(Dest,Src,Length)
>  #define xmemcpy(Dest, Src, Length)      CopyMem(Dest,Src,Length)
> --
> 2.38.1.windows.1
>
>
>
> 
>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96806): https://edk2.groups.io/g/devel/message/96806
Mute This Topic: https://groups.io/mt/95360067/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-