From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from nwk-aaemail-lapp01.apple.com (nwk-aaemail-lapp01.apple.com [17.151.62.66]) by mx.groups.io with SMTP id smtpd.web10.2258.1571936972445822558 for ; Thu, 24 Oct 2019 10:09:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@apple.com header.s=20180706 header.b=H9sb4rp/; spf=pass (domain: apple.com, ip: 17.151.62.66, mailfrom: afish@apple.com) Received: from pps.filterd (nwk-aaemail-lapp01.apple.com [127.0.0.1]) by nwk-aaemail-lapp01.apple.com (8.16.0.27/8.16.0.27) with SMTP id x9OH2mEp008178; Thu, 24 Oct 2019 10:09:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=sender : content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=20180706; bh=9Sqdt1Q7PTvXyEou68QX+DRvcoo24VuLBXtQwhvIWiQ=; b=H9sb4rp/Hx1P5snNwinatp8EOdDJutM/wKcT2tkqM4fDuDIMOB5pPEQX1p54ZDYmu9Y0 nD4oMgtWR7+lMcNrDnpTb5z72fWuJLEH2R3YipyKFfXpLt0i5E+dapvR03YF3j6JTsLm ZdoJ2Vsxiai6RK67kZ2l690I8w+cxOOKN+NBLoOojy6P9GEcKYV7Tv7XTDJybEC1/4Y4 dQrAQzHoEy8wmbiVbe/oCEDhrRApQ4nAvfY7es/rqu87sIhfxyPcl3QsexKHJNi9MQbQ LKQVU8Q4E8nKJQZPw0kRQMMuMPXdcs5MUlLi3L6WCFpHIA1dgzRA89Vn3S4q9QkprERg PA== Received: from ma1-mtap-s03.corp.apple.com (ma1-mtap-s03.corp.apple.com [17.40.76.7]) by nwk-aaemail-lapp01.apple.com with ESMTP id 2vr1e1umkj-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 24 Oct 2019 10:09:30 -0700 Received: from nwk-mmpp-sz11.apple.com (nwk-mmpp-sz11.apple.com [17.128.115.155]) by ma1-mtap-s03.corp.apple.com (Oracle Communications Messaging Server 8.0.2.4.20190507 64bit (built May 7 2019)) with ESMTPS id <0PZW00KFH2BQIU10@ma1-mtap-s03.corp.apple.com>; Thu, 24 Oct 2019 10:09:27 -0700 (PDT) Received: from process_milters-daemon.nwk-mmpp-sz11.apple.com by nwk-mmpp-sz11.apple.com (Oracle Communications Messaging Server 8.0.2.4.20190507 64bit (built May 7 2019)) id <0PZW00200296DW00@nwk-mmpp-sz11.apple.com>; Thu, 24 Oct 2019 10:09:26 -0700 (PDT) X-Va-A: X-Va-T-CD: 281f8fa03638b888ab0035439e9fe9bb X-Va-E-CD: c0638a3ae50db80a18db89d6fe24c0ff X-Va-R-CD: 93982b383d307d3e290a6f7aa91f074d X-Va-CD: 0 X-Va-ID: cb5c9065-d10e-473e-910e-9d64cbb10760 X-V-A: X-V-T-CD: 281f8fa03638b888ab0035439e9fe9bb X-V-E-CD: c0638a3ae50db80a18db89d6fe24c0ff X-V-R-CD: 93982b383d307d3e290a6f7aa91f074d X-V-CD: 0 X-V-ID: 688e3f12-f1db-4172-9f47-65afc5afdbd5 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-24_10:,, signatures=0 Received: from da0602a-dhcp213.apple.com (da0602a-dhcp213.apple.com [17.226.23.213]) by nwk-mmpp-sz11.apple.com (Oracle Communications Messaging Server 8.0.2.4.20190507 64bit (built May 7 2019)) with ESMTPSA id <0PZW00M262BNDU80@nwk-mmpp-sz11.apple.com>; Thu, 24 Oct 2019 10:09:24 -0700 (PDT) Sender: afish@apple.com MIME-version: 1.0 (Mac OS X Mail 13.0 \(3594.4.17\)) Subject: Re: [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain From: "Andrew Fish" In-reply-to: <1571820364-21836-1-git-send-email-liming.gao@intel.com> Date: Thu, 24 Oct 2019 10:09:22 -0700 Cc: devel@edk2.groups.io, Jordan Justen , Ray Ni Message-id: References: <1571820364-21836-1-git-send-email-liming.gao@intel.com> To: Liming Gao X-Mailer: Apple Mail (2.3594.4.17) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-24_10:,, signatures=0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: quoted-printable How do you use PDB debug formats on Linux and macOS? Should the /pdb = flags also be under WIN_HOST_BUILD?=20 Thanks, Andrew Fish > On Oct 23, 2019, at 1:46 AM, Liming Gao wrote: >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1603 > 1. Add WIN_HOST_BUILD macro check for CLANG9 tool chain > build -p EmulatorPkg\EmulatorPkg.dsc -a IA32 -DWIN_HOST_BUILD=3DTRUE = -t CLANG9 > build -p EmulatorPkg\EmulatorPkg.dsc -a X64 -DWIN_HOST_BUILD=3DTRUE -t = CLANG9 > 2. Append CLANG CC and LINK flags to generate windows HOST. > 3. Fix WinHost issue to call GetProcessAffinityMask() API. > The input parameter should be UINTN pointer instead of UINT32 = pointer. >=20 > Cc: Jordan Justen > Cc: Andrew Fish > Cc: Ray Ni > Signed-off-by: Liming Gao > Reviewed-by: Ray Ni > --- > In v5, update commit message and fix VS2015 X64 build failure. >=20 > EmulatorPkg/Win/Host/WinHost.c | 8 ++++---- > EmulatorPkg/EmulatorPkg.dsc | 14 +++++++++++++- > EmulatorPkg/Win/Host/WinHost.inf | 6 ++++++ > 3 files changed, 23 insertions(+), 5 deletions(-) >=20 > diff --git a/EmulatorPkg/Win/Host/WinHost.c = b/EmulatorPkg/Win/Host/WinHost.c > index 9aba3c8959..62a89f7617 100644 > --- a/EmulatorPkg/Win/Host/WinHost.c > +++ b/EmulatorPkg/Win/Host/WinHost.c > @@ -356,7 +356,7 @@ Returns: > INTN > EFIAPI > main ( > - IN INTN Argc, > + IN INT Argc, > IN CHAR8 **Argv, > IN CHAR8 **Envp > ) > @@ -391,8 +391,8 @@ Returns: > VOID *SecFile; > CHAR16 *MemorySizeStr; > CHAR16 *FirmwareVolumesStr; > - UINT32 ProcessAffinityMask; > - UINT32 SystemAffinityMask; > + UINTN ProcessAffinityMask; > + UINTN SystemAffinityMask; > INT32 LowBit; >=20 > // > @@ -414,7 +414,7 @@ Returns: > // Determine the first thread available to this process. > // > if (GetProcessAffinityMask (GetCurrentProcess (), = &ProcessAffinityMask, &SystemAffinityMask)) { > - LowBit =3D (INT32)LowBitSet32 (ProcessAffinityMask); > + LowBit =3D (INT32)LowBitSet32 ((UINT32)ProcessAffinityMask); > if (LowBit !=3D -1) { > // > // Force the system to bind the process to a single thread to = work > diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc > index 20f1187713..109685b062 100644 > --- a/EmulatorPkg/EmulatorPkg.dsc > +++ b/EmulatorPkg/EmulatorPkg.dsc > @@ -237,9 +237,11 @@ >=20 > [Components] > !if "IA32" in $(ARCH) || "X64" in $(ARCH) > - !if "MSFT" in $(FAMILY) > + !if "MSFT" in $(FAMILY) || $(WIN_HOST_BUILD) =3D=3D TRUE > ## > # Emulator, OS WIN application > + # CLANG9 is cross OS tool chain. It depends on WIN_HOST_BUILD = flag > + # to build WinHost application. > ## > EmulatorPkg/Win/Host/WinHost.inf > !else > @@ -419,7 +421,17 @@ >=20 > MSFT:DEBUG_*_*_CC_FLAGS =3D /Od /Oy- > MSFT:NOOPT_*_*_CC_FLAGS =3D /Od /Oy- > + GCC:DEBUG_CLANG9_*_CC_FLAGS =3D-O0 = -Wno-unused-command-line-argument -Wno-incompatible-pointer-types = -Wno-enum-conversion -Wno-incompatible-pointer-types = -Wno-sometimes-uninitialized -Wno-constant-conversion = -Wno-main-return-type >=20 > MSFT:*_*_*_DLINK_FLAGS =3D /ALIGN:4096 /FILEALIGN:4096 = /SUBSYSTEM:CONSOLE > MSFT:DEBUG_*_*_DLINK_FLAGS =3D = /EXPORT:InitializeDriver=3D$(IMAGE_ENTRY_POINT) /BASE:0x10000 > MSFT:NOOPT_*_*_DLINK_FLAGS =3D = /EXPORT:InitializeDriver=3D$(IMAGE_ENTRY_POINT) /BASE:0x10000 > + > +!if $(WIN_HOST_BUILD) =3D=3D TRUE > + # > + # CLANG9 tool chain depends on WIN_HOST_BUILD flag to generate the = windows application. > + # > + GCC:*_CLANG9_*_DLINK_FLAGS =3D /ALIGN:4096 /FILEALIGN:4096 = /SUBSYSTEM:CONSOLE > + GCC:DEBUG_CLANG9_*_DLINK_FLAGS =3D = /EXPORT:InitializeDriver=3D$(IMAGE_ENTRY_POINT) /BASE:0x10000 > + GCC:NOOPT_CLANG9_*_DLINK_FLAGS =3D = /EXPORT:InitializeDriver=3D$(IMAGE_ENTRY_POINT) /BASE:0x10000 > +!endif > diff --git a/EmulatorPkg/Win/Host/WinHost.inf = b/EmulatorPkg/Win/Host/WinHost.inf > index 631d5a6470..1adca10d79 100644 > --- a/EmulatorPkg/Win/Host/WinHost.inf > +++ b/EmulatorPkg/Win/Host/WinHost.inf > @@ -95,3 +95,9 @@ > MSFT:*_VS2017_X64_DLINK_FLAGS =3D = /LIBPATH:"%VCToolsInstallDir%lib\x64" = /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" = /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO = /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG = /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib = Gdi32.lib User32.lib Winmm.lib Advapi32.lib > MSFT:*_*_X64_ASM_FLAGS =3D=3D /nologo /W3 /WX /c /Cx /Zd = /W0 /Zi > MSFT:*_*_X64_ASMLINK_FLAGS =3D=3D /link /nologo > + > + GCC:*_CLANG9_X64_DLINK_FLAGS =3D=3D = /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 = /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" = /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" = /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" = /LIBPATH:"%VCToolsInstallDir%lib\x64" /NOLOGO /SUBSYSTEM:CONSOLE = /NODEFAULTLIB /IGNORE:4086 /OPT:REF /DEBUG /MACHINE:AMD64 Kernel32.lib = MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib = Advapi32.lib /lldmap /EXPORT:InitializeDriver=3D_ModuleEntryPoint > + GCC:*_CLANG9_X64_CC_FLAGS =3D=3D -m64 -g -fshort-wchar = -fno-strict-aliasing -Wall -c -include AutoGen.h -D = _CRT_SECURE_NO_WARNINGS -Wnonportable-include-path -D UNICODE -D = _CRT_SECURE_NO_DEPRECATE > + > + GCC:*_CLANG9_IA32_DLINK_FLAGS =3D=3D = /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 = /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" = /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" = /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" = /LIBPATH:"%VCToolsInstallDir%ib\x86" /NOLOGO /SUBSYSTEM:CONSOLE = /NODEFAULTLIB /IGNORE:4086 /OPT:REF /DEBUG /MACHINE:I386 Kernel32.lib = MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib = Advapi32.lib /lldmap /EXPORT:InitializeDriver=3D_ModuleEntryPoint > + GCC:*_CLANG9_IA32_CC_FLAGS =3D=3D -m32 -g -fshort-wchar = -fno-strict-aliasing -Wall -c -include AutoGen.h -D = _CRT_SECURE_NO_WARNINGS -Wnonportable-include-path -D UNICODE -D = _CRT_SECURE_NO_DEPRECATE > --=20 > 2.13.0.windows.1 >=20