[edk2-devel] [Patch] IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build error.

Michael D Kinney michael.d.kinney at intel.com
Thu Feb 27 06:03:41 UTC 2020


Liming,

This does not make sense.  Those compilers
should support C99 flexible array members.

Structured PCDs also require use of flexible
array members.

We need to make sure the compiler flags for
those tool chain are correct to support flexible
array members.

Mike

> -----Original Message-----
> From: Gao, Liming <liming.gao at intel.com>
> Sent: Wednesday, February 26, 2020 9:58 PM
> To: devel at edk2.groups.io; Kinney, Michael D
> <michael.d.kinney at intel.com>; Fu, Siyuan
> <siyuan.fu at intel.com>
> Cc: Ni, Ray <ray.ni at intel.com>; Chaganty, Rangasai V
> <rangasai.v.chaganty at intel.com>
> Subject: RE: [edk2-devel] [Patch]
> IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build
> error.
> 
> Mike:
>   I find this issue on GCC5 tool chain tag with GCC 5.5
> and CLANGPDB tool chain tag with CLANG 9.0.0
> 
> Thanks
> Liming
> > -----Original Message-----
> > From: devel at edk2.groups.io <devel at edk2.groups.io> On
> Behalf Of Michael D Kinney
> > Sent: Thursday, February 27, 2020 1:54 PM
> > To: Gao, Liming <liming.gao at intel.com>;
> devel at edk2.groups.io; Fu, Siyuan <siyuan.fu at intel.com>;
> Kinney, Michael D
> > <michael.d.kinney at intel.com>
> > Cc: Ni, Ray <ray.ni at intel.com>; Chaganty, Rangasai V
> <rangasai.v.chaganty at intel.com>
> > Subject: Re: [edk2-devel] [Patch]
> IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build
> error.
> >
> > Which GCC and CLANG tool chain tags?
> >
> > Flexible array member is a standard C feature
> > documented in C99.
> >
> > Mike
> >
> > > -----Original Message-----
> > > From: Gao, Liming <liming.gao at intel.com>
> > > Sent: Wednesday, February 26, 2020 9:38 PM
> > > To: Kinney, Michael D <michael.d.kinney at intel.com>;
> > > devel at edk2.groups.io; Fu, Siyuan
> <siyuan.fu at intel.com>
> > > Cc: Ni, Ray <ray.ni at intel.com>; Chaganty, Rangasai
> V
> > > <rangasai.v.chaganty at intel.com>
> > > Subject: RE: [edk2-devel] [Patch]
> > > IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build
> > > error.
> > >
> > > Mike:
> > >   I find GCC and CLANG will report the error for
> the
> > > empty struct.
> > >
> > > d:\allpkg\edk2-
> > >
> platforms\Silicon\Intel\IntelSiliconPkg\Include\Guid/Mi
> > > crocodeShadowInfoHob.h:61:11: error: flexible array
> > > member 'MicrocodeAddressInFlash' not allowed in
> > > otherwise empty struct
> > >   UINT64  MicrocodeAddressInFlash[];
> > >           ^
> > > 1 error generated.
> > >
> > > Thanks
> > > Liming
> > > > -----Original Message-----
> > > > From: Kinney, Michael D
> <michael.d.kinney at intel.com>
> > > > Sent: Thursday, February 27, 2020 1:25 PM
> > > > To: devel at edk2.groups.io; Fu, Siyuan
> > > <siyuan.fu at intel.com>; Kinney, Michael D
> > > <michael.d.kinney at intel.com>
> > > > Cc: Ni, Ray <ray.ni at intel.com>; Chaganty,
> Rangasai V
> > > <rangasai.v.chaganty at intel.com>; Gao, Liming
> > > <liming.gao at intel.com>
> > > > Subject: RE: [edk2-devel] [Patch]
> > > IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build
> > > error.
> > > >
> > > > What compiler does not like the flexible array
> > > > member syntax [].
> > > >
> > > > Mike
> > > >
> > > > > -----Original Message-----
> > > > > From: devel at edk2.groups.io
> <devel at edk2.groups.io>
> > > On
> > > > > Behalf Of Siyuan, Fu
> > > > > Sent: Wednesday, February 26, 2020 5:58 PM
> > > > > To: devel at edk2.groups.io
> > > > > Cc: Ni, Ray <ray.ni at intel.com>; Chaganty,
> Rangasai
> > > V
> > > > > <rangasai.v.chaganty at intel.com>; Gao, Liming
> > > > > <liming.gao at intel.com>
> > > > > Subject: [edk2-devel] [Patch]
> > > > > IntelSiliconPkg/ShadowMicrocodePei: Fix GCC
> build
> > > > > error.
> > > > >
> > > > > This patch fixes compiler error introduced by
> > > commit
> > > > > b0099a39bd.
> > > > >
> > > > > BZ:
> > > > >
> > >
> https://tianocore.acgmultimedia.com/show_bug.cgi?id=244
> > > > > 9
> > > > > Cc: Ray Ni <ray.ni at intel.com>
> > > > > Cc: Rangasai V Chaganty
> > > <rangasai.v.chaganty at intel.com>
> > > > > Cc: Liming Gao <liming.gao at intel.com>
> > > > > Signed-off-by: Siyuan Fu <siyuan.fu at intel.com>
> > > > > ---
> > > > >
> .../Feature/ShadowMicrocode/ShadowMicrocodePei.c
> > > > > | 2 +-
> > > > >
> > > > >
> > >
> .../Intel/IntelSiliconPkg/Include/Guid/MicrocodeShadowI
> > > > > nfoHob.h | 2 +-
> > > > >  2 files changed, 2 insertions(+), 2
> deletions(-)
> > > > >
> > > > > diff --git
> > > > >
> > >
> a/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode
> > > > > /ShadowMicrocodePei.c
> > > > >
> > >
> b/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode
> > > > > /ShadowMicrocodePei.c
> > > > > index 7e4084247e..8d6574f667 100644
> > > > > ---
> > > > >
> > >
> a/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode
> > > > > /ShadowMicrocodePei.c
> > > > > +++
> > > > >
> > >
> b/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode
> > > > > /ShadowMicrocodePei.c
> > > > > @@ -247,7 +247,7 @@ ShadowMicrocodePatchWorker
> (
> > > > >        (VOID *) Patches[Index].Address,
> > > > >        Patches[Index].Size
> > > > >        );
> > > > > -    MicrocodeAddressInMemory[Index] = (UINT64)
> > > Walker;
> > > > > +    MicrocodeAddressInMemory[Index] = (UINT64)
> > > (UINTN)
> > > > > Walker;
> > > > >      Flashcontext-
> >MicrocodeAddressInFlash[Index]
> > > =
> > > > > (UINT64) Patches[Index].Address;
> > > > >      Walker += Patches[Index].Size;
> > > > >    }
> > > > > diff --git
> > > > >
> > >
> a/Silicon/Intel/IntelSiliconPkg/Include/Guid/MicrocodeS
> > > > > hadowInfoHob.h
> > > > >
> > >
> b/Silicon/Intel/IntelSiliconPkg/Include/Guid/MicrocodeS
> > > > > hadowInfoHob.h
> > > > > index d887b39123..1daae1234a 100644
> > > > > ---
> > > > >
> > >
> a/Silicon/Intel/IntelSiliconPkg/Include/Guid/MicrocodeS
> > > > > hadowInfoHob.h
> > > > > +++
> > > > >
> > >
> b/Silicon/Intel/IntelSiliconPkg/Include/Guid/MicrocodeS
> > > > > hadowInfoHob.h
> > > > > @@ -58,7 +58,7 @@ typedef struct {
> > > > >    // microcode patch address on flash. The
> address
> > > is
> > > > > placed in same
> > > > >    // order as the microcode patches in
> > > > > MicrocodeAddrInMemory.
> > > > >    //
> > > > > -  UINT64  MicrocodeAddressInFlash[];
> > > > > +  UINT64  MicrocodeAddressInFlash[0];
> > > > >  } EFI_MICROCODE_STORAGE_TYPE_FLASH_CONTEXT;
> > > > >
> > > > >  #endif
> > > > > --
> > > > > 2.19.1.windows.1
> > > > >
> > > > >
> > > > >
> >
> >
> > 


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

View/Reply Online (#54979): https://edk2.groups.io/g/devel/message/54979
Mute This Topic: https://groups.io/mt/71579115/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list