[edk2-devel] [PATCH v6 edk2-platforms 1/1] Silicon/Synopsys/Designware/Driver: DwEmacSnpDxe: Add DesignWare EMAC driver

Ooi, Tzy Way tzy.way.ooi at intel.com
Wed Jul 17 09:25:49 UTC 2019


Hi Leif,

Ya. I am on Linux. I managed to replicated the warning that you have provided in the previous email thread by using the gcc 8.3.

Currently,  I'm looking at the compiler warning/error. While I am fixing the issue when compiling the source code, I encountered another issue where the compiler complain "undefined reference to __stack_chk_fail". I check from google and it can be solved by setting -fnostack-protector. Hence, I would like to ask if is it ok to set this to the CFLAGs for the compiler?

Thank you

Best regards,
Tzy Way

-----Original Message-----
From: Leif Lindholm <leif.lindholm at linaro.org> 
Sent: Wednesday, July 17, 2019 1:22 AM
To: Ooi, Tzy Way <tzy.way.ooi at intel.com>
Cc: devel at edk2.groups.io; Ard BieSheuvel <ard.biesheuvel at linaro.org>; Kinney, Michael D <michael.d.kinney at intel.com>; Loh, Tien Hock <tien.hock.loh at intel.com>
Subject: Re: [edk2-devel] [PATCH v6 edk2-platforms 1/1] Silicon/Synopsys/Designware/Driver: DwEmacSnpDxe: Add DesignWare EMAC driver

Hi Tzy Way,

On Tue, Jul 16, 2019 at 09:37:38AM +0000, Ooi, Tzy Way wrote:
> I am new to the compilation tools. May I know if you can share to me 
> how to run the compilation with Debian's gcc 8.3 so that I can see the 
> same warning described below? Currently, I am using linaro toolchain 
> 7.2.1 and follow the guide in the link below to compile the source 
> code.
>
> https://github.com/tianocore/edk2-platforms
> 
> I am not able to see any warning in the compilation messages. Wonder 
> if I need to enable something, for example some CFLAGS during 
> compilation?

Yeah, the tools are getting stricter all the time - but we don't want to merge code we can't build with the toolchains included in current long-term supported Linux distributions.

What does your setup look like today - are you on Windows or Linux?
If Linux, can you use WSL?

Cross compilation tools for both ARM and AARCH64 (and the very latest ones Ia32/X64) are available in several current Linux distributions (and hence in WSL).

Best Regards,

Leif

> 
> Thank you in advance.
> 
> Best regards,
> Tzy Way
> 
> -----Original Message-----
> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Leif 
> Lindholm
> Sent: Friday, July 12, 2019 12:43 AM
> To: Ooi, Tzy Way <tzy.way.ooi at intel.com>
> Cc: devel at edk2.groups.io; Ard BieSheuvel <ard.biesheuvel at linaro.org>; 
> Kinney, Michael D <michael.d.kinney at intel.com>; Loh, Tien Hock 
> <tien.hock.loh at intel.com>
> Subject: Re: [edk2-devel] [PATCH v6 edk2-platforms 1/1] 
> Silicon/Synopsys/Designware/Driver: DwEmacSnpDxe: Add DesignWare EMAC 
> driver
> 
> Hi Tzy Way,
> 
> Nearly there, but please make sure BaseTools/Scripts/PatchCheck.py runs without warnings or errors (there are quite a few still in this version).
> 
> Building the .dsc using current edk2 fails with 'MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf is not found in packages path'
> The path needs to be updated to NetworkPkg/Library/DxeNetLib/DxeNetLib.inf.
> 
> Secondly, could you add NOOPT as a BUILD_TARGET, in addition to DEBUG and RELEASE?
> 
> Also, Debian's gcc 8.3 throws a set of compilation errors (both DEBUG and RELEASE) when building for AARCH64:
> 
> /work/git/edk2-platforms/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c: In function <E2><80><98>EmacSetupTxdesc<E2><80><99>:
> /work/git/edk2-platforms/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c:236:81: error: iteration 9 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
>      TxDescriptor->AddrNext = (UINT32)(UINTN)EmacDriver->TxdescRingMap[Index + 1].AddrMap;
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
> /work/git/edk2-platforms/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c:233:3: note: within this loop
>    for (Index = 0; Index < CONFIG_TX_DESCR_NUM; Index++) {
>    ^~~
> /work/git/edk2-platforms/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c: In function <E2><80><98>EmacSetupRxdesc<E2><80><99>:
> /work/git/edk2-platforms/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c:270:81: error: iteration 9 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
>      RxDescriptor->AddrNext = (UINT32)(UINTN)EmacDriver->RxdescRingMap[Index + 1].AddrMap;
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
> /work/git/edk2-platforms/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c:267:3: note: within this loop
>    for (Index = 0; Index < CONFIG_RX_DESCR_NUM; Index++) {
>    ^~~
> cc1: all warnings being treated as errors
> 
> 
> It also throws the following errors when building for ARM:
> /work/git/edk2-platforms/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c: In function <E2><80><98>SnpTransmit<E2><80><99>:
> /work/git/edk2-platforms/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c:962:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>    TxDescriptorMap = (VOID *)Snp->MacDriver.TxdescRingMap[DescNum].AddrMap;
>                      ^
> /work/git/edk2-platforms/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c:1026:51: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>      Snp->RecycledTxBuf[Snp->RecycledTxBufCount] = (UINT64) Data;
>                                                    ^
> /work/git/edk2-platforms/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c: In function <E2><80><98>SnpReceive<E2><80><99>:
> /work/git/edk2-platforms/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c:1143:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>    RxDescriptorMap = (VOID *)Snp->MacDriver.RxdescRingMap[DescNum].AddrMap;
>                      ^
> cc1: all warnings being treated as errors
> 
> 
> Could you please look into and address these issues for the next version?
> 
> Best Regards,
> 
> Leif
> 
> On Mon, Jul 08, 2019 at 03:05:07PM +0800, tzy.way.ooi at intel.com wrote:
> > From: Ooi Tzy Way <tzy.way.ooi at intel.com>
> > 
> > Add driver support for the Ethernet MAC based on Synopsys DesignWare
> > 3504-0 Universal 10/100/1000 Ethernet MAC and KSZ9031 PHY
> > 
> > Cc: Ard BieSheuvel <ard.biesheuvel at linaro.org>
> > Cc: Leif Lindholm <leif.lindholm at linaro.org>
> > Cc: Michael D Kinney <michael.d.kinney at intel.com>
> > Cc: Loh Tien Hock <tien.hock.loh at intel.com>
> > 
> > Contributed-under: Tianocore Contribution Agreement 1.1
> > Signed-off-by: Ooi Tzy Way <tzy.way.ooi at intel.com>
> > 
> > ---
> > v6:
> > - Update to recent version for EDK2 specific file formats
> > - Update the directory layout to Silicon/Synopsys/DesignWare
> > - Add a DesignWare.dsc for building this driver
> > - Update the license
> > - Update the .c file to declare its own include file
> > - Remove __ in defining the header file
> > - Fix indentation
> > - Delete commented-out code
> 
> 
> 

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

View/Reply Online (#43861): https://edk2.groups.io/g/devel/message/43861
Mute This Topic: https://groups.io/mt/32389522/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