From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web09.1500.1571967508336697863 for ; Thu, 24 Oct 2019 18:38:28 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2019 18:38:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,226,1569308400"; d="scan'208";a="202474339" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga006.jf.intel.com with ESMTP; 24 Oct 2019 18:38:26 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 24 Oct 2019 18:38:25 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 24 Oct 2019 18:38:25 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 24 Oct 2019 18:38:25 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.166]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.96]) with mapi id 14.03.0439.000; Fri, 25 Oct 2019 09:38:23 +0800 From: "Liming Gao" To: "devel@edk2.groups.io" , "afish@apple.com" Subject: Re: [edk2-devel] [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain Thread-Topic: [edk2-devel] [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain Thread-Index: AQHVio3H0YWnIk/OhU2jA69/SAxvyadqlFjg Date: Fri, 25 Oct 2019 01:38:23 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E521F2D@SHSMSX104.ccr.corp.intel.com> References: <1571820364-21836-1-git-send-email-liming.gao@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmM4MjQ3NmYtOGMzZi00ZDgwLWI4MzctNDI0OTc1ZTE5YTI4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiS3U0SFc0cWdmdFwvVEsxWmxYdzJkNkErXC9oQ3NFQVJIdGZ2NmREc0l5VXFrSFhaU3Z6UU4zMmQyNGFCblBrdit1In0= dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Andrew: EmulatorPkg/Win/Host/WinHost.inf is for Windows OS only. Linux/Mac uses = Unix Host.=20 Thanks Liming > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Andrew Fi= sh via Groups.Io > Sent: Friday, October 25, 2019 1:09 AM > To: Gao, Liming > Cc: devel@edk2.groups.io; Justen, Jordan L ; = Ni, Ray > Subject: Re: [edk2-devel] [Patch v5 10/11] EmulatorPkg: Enable CLANG9 to= ol chain >=20 > How do you use PDB debug formats on Linux and macOS? Should the /pdb fla= gs also be under WIN_HOST_BUILD? >=20 > Thanks, >=20 > Andrew Fish >=20 > > On Oct 23, 2019, at 1:46 AM, Liming Gao wrote: > > > > 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 pointe= r. > > > > 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. > > > > EmulatorPkg/Win/Host/WinHost.c | 8 ++++---- > > EmulatorPkg/EmulatorPkg.dsc | 14 +++++++++++++- > > EmulatorPkg/Win/Host/WinHost.inf | 6 ++++++ > > 3 files changed, 23 insertions(+), 5 deletions(-) > > > > diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/Win= Host.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; > > > > // > > @@ -414,7 +414,7 @@ Returns: > > // Determine the first thread available to this process. > > // > > if (GetProcessAffinityMask (GetCurrentProcess (), &ProcessAffinityMa= sk, &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 wo= rk > > 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 @@ > > > > [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 fl= ag > > + # to build WinHost application. > > ## > > EmulatorPkg/Win/Host/WinHost.inf > > !else > > @@ -419,7 +421,17 @@ > > > > 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-argumen= t -Wno-incompatible-pointer-types > -Wno-enum-conversion -Wno-incompatible-pointer-types -Wno-sometimes-unin= itialized -Wno-constant-conversion > -Wno-main-return-type > > > > MSFT:*_*_*_DLINK_FLAGS =3D /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTE= M:CONSOLE > > MSFT:DEBUG_*_*_DLINK_FLAGS =3D /EXPORT:InitializeDriver=3D$(IMAGE_EN= TRY_POINT) /BASE:0x10000 > > MSFT:NOOPT_*_*_DLINK_FLAGS =3D /EXPORT:InitializeDriver=3D$(IMAGE_EN= TRY_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 /SUB= SYSTEM:CONSOLE > > + GCC:DEBUG_CLANG9_*_DLINK_FLAGS =3D /EXPORT:InitializeDriver=3D$(IMA= GE_ENTRY_POINT) /BASE:0x10000 > > + GCC:NOOPT_CLANG9_*_DLINK_FLAGS =3D /EXPORT:InitializeDriver=3D$(IMA= GE_ENTRY_POINT) /BASE:0x10000 > > +!endif > > diff --git a/EmulatorPkg/Win/Host/WinHost.inf b/EmulatorPkg/Win/Host/W= inHost.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:"%Win= dowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" > /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEB= UG /MACHINE:AMD64 /LTCG Kernel32.lib > MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Adva= pi32.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).e= xe" /base:0x10000000 > /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"%UniversalCRTSdkDir%lib\%U= CRTVersion%\ucrt\x64" > /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /LIBPATH:"%V= CToolsInstallDir%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 /ll= dmap /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_S= ECURE_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\%UC= RTVersion%\ucrt\x86" > /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /LIBPATH:"%V= CToolsInstallDir%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:I= nitializeDriver=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_S= ECURE_NO_DEPRECATE > > -- > > 2.13.0.windows.1 > > >=20 >=20 >=20