* [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain
@ 2019-10-23 8:46 Liming Gao
2019-10-23 8:47 ` [edk2-devel] " Ni, Ray
2019-10-24 17:09 ` Andrew Fish
0 siblings, 2 replies; 4+ messages in thread
From: Liming Gao @ 2019-10-23 8:46 UTC (permalink / raw)
To: devel; +Cc: Jordan Justen, Andrew Fish, Ray Ni
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603
1. Add WIN_HOST_BUILD macro check for CLANG9 tool chain
build -p EmulatorPkg\EmulatorPkg.dsc -a IA32 -DWIN_HOST_BUILD=TRUE -t CLANG9
build -p EmulatorPkg\EmulatorPkg.dsc -a X64 -DWIN_HOST_BUILD=TRUE -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.
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
---
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/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;
//
@@ -414,7 +414,7 @@ Returns:
// Determine the first thread available to this process.
//
if (GetProcessAffinityMask (GetCurrentProcess (), &ProcessAffinityMask, &SystemAffinityMask)) {
- LowBit = (INT32)LowBitSet32 (ProcessAffinityMask);
+ LowBit = (INT32)LowBitSet32 ((UINT32)ProcessAffinityMask);
if (LowBit != -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 @@
[Components]
!if "IA32" in $(ARCH) || "X64" in $(ARCH)
- !if "MSFT" in $(FAMILY)
+ !if "MSFT" in $(FAMILY) || $(WIN_HOST_BUILD) == 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 @@
MSFT:DEBUG_*_*_CC_FLAGS = /Od /Oy-
MSFT:NOOPT_*_*_CC_FLAGS = /Od /Oy-
+ GCC:DEBUG_CLANG9_*_CC_FLAGS =-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
MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
MSFT:DEBUG_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
MSFT:NOOPT_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
+
+!if $(WIN_HOST_BUILD) == TRUE
+ #
+ # CLANG9 tool chain depends on WIN_HOST_BUILD flag to generate the windows application.
+ #
+ GCC:*_CLANG9_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
+ GCC:DEBUG_CLANG9_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
+ GCC:NOOPT_CLANG9_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(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 = /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 == /nologo /W3 /WX /c /Cx /Zd /W0 /Zi
MSFT:*_*_X64_ASMLINK_FLAGS == /link /nologo
+
+ GCC:*_CLANG9_X64_DLINK_FLAGS == /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=_ModuleEntryPoint
+ GCC:*_CLANG9_X64_CC_FLAGS == -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 == /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=_ModuleEntryPoint
+ GCC:*_CLANG9_IA32_CC_FLAGS == -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
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain
2019-10-23 8:46 [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain Liming Gao
@ 2019-10-23 8:47 ` Ni, Ray
2019-10-24 17:09 ` Andrew Fish
1 sibling, 0 replies; 4+ messages in thread
From: Ni, Ray @ 2019-10-23 8:47 UTC (permalink / raw)
To: devel@edk2.groups.io, Gao, Liming; +Cc: Justen, Jordan L, Andrew Fish
Liming,
The patch is good. You've already got the Reviewed-by.
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Liming Gao
> Sent: Wednesday, October 23, 2019 4:46 PM
> To: devel@edk2.groups.io
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>
> Subject: [edk2-devel] [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603
> 1. Add WIN_HOST_BUILD macro check for CLANG9 tool chain
> build -p EmulatorPkg\EmulatorPkg.dsc -a IA32 -DWIN_HOST_BUILD=TRUE -t CLANG9
> build -p EmulatorPkg\EmulatorPkg.dsc -a X64 -DWIN_HOST_BUILD=TRUE -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.
>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> Reviewed-by: Ray Ni <ray.ni@intel.com>
> ---
> 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/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;
>
> //
> @@ -414,7 +414,7 @@ Returns:
> // Determine the first thread available to this process.
> //
> if (GetProcessAffinityMask (GetCurrentProcess (), &ProcessAffinityMask, &SystemAffinityMask)) {
> - LowBit = (INT32)LowBitSet32 (ProcessAffinityMask);
> + LowBit = (INT32)LowBitSet32 ((UINT32)ProcessAffinityMask);
> if (LowBit != -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 @@
>
> [Components]
> !if "IA32" in $(ARCH) || "X64" in $(ARCH)
> - !if "MSFT" in $(FAMILY)
> + !if "MSFT" in $(FAMILY) || $(WIN_HOST_BUILD) == 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 @@
>
> MSFT:DEBUG_*_*_CC_FLAGS = /Od /Oy-
> MSFT:NOOPT_*_*_CC_FLAGS = /Od /Oy-
> + GCC:DEBUG_CLANG9_*_CC_FLAGS =-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
>
> MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
> MSFT:DEBUG_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
> MSFT:NOOPT_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
> +
> +!if $(WIN_HOST_BUILD) == TRUE
> + #
> + # CLANG9 tool chain depends on WIN_HOST_BUILD flag to generate the windows application.
> + #
> + GCC:*_CLANG9_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
> + GCC:DEBUG_CLANG9_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
> + GCC:NOOPT_CLANG9_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(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 = /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 == /nologo /W3 /WX /c /Cx /Zd /W0 /Zi
> MSFT:*_*_X64_ASMLINK_FLAGS == /link /nologo
> +
> + GCC:*_CLANG9_X64_DLINK_FLAGS == /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=_ModuleEntryPoint
> + GCC:*_CLANG9_X64_CC_FLAGS == -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 == /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=_ModuleEntryPoint
> + GCC:*_CLANG9_IA32_CC_FLAGS == -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
> --
> 2.13.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain
2019-10-23 8:46 [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain Liming Gao
2019-10-23 8:47 ` [edk2-devel] " Ni, Ray
@ 2019-10-24 17:09 ` Andrew Fish
2019-10-25 1:38 ` [edk2-devel] " Liming Gao
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Fish @ 2019-10-24 17:09 UTC (permalink / raw)
To: Liming Gao; +Cc: devel, Jordan Justen, Ray Ni
How do you use PDB debug formats on Linux and macOS? Should the /pdb flags also be under WIN_HOST_BUILD?
Thanks,
Andrew Fish
> On Oct 23, 2019, at 1:46 AM, Liming Gao <liming.gao@intel.com> wrote:
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603
> 1. Add WIN_HOST_BUILD macro check for CLANG9 tool chain
> build -p EmulatorPkg\EmulatorPkg.dsc -a IA32 -DWIN_HOST_BUILD=TRUE -t CLANG9
> build -p EmulatorPkg\EmulatorPkg.dsc -a X64 -DWIN_HOST_BUILD=TRUE -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.
>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> Reviewed-by: Ray Ni <ray.ni@intel.com>
> ---
> 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/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;
>
> //
> @@ -414,7 +414,7 @@ Returns:
> // Determine the first thread available to this process.
> //
> if (GetProcessAffinityMask (GetCurrentProcess (), &ProcessAffinityMask, &SystemAffinityMask)) {
> - LowBit = (INT32)LowBitSet32 (ProcessAffinityMask);
> + LowBit = (INT32)LowBitSet32 ((UINT32)ProcessAffinityMask);
> if (LowBit != -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 @@
>
> [Components]
> !if "IA32" in $(ARCH) || "X64" in $(ARCH)
> - !if "MSFT" in $(FAMILY)
> + !if "MSFT" in $(FAMILY) || $(WIN_HOST_BUILD) == 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 @@
>
> MSFT:DEBUG_*_*_CC_FLAGS = /Od /Oy-
> MSFT:NOOPT_*_*_CC_FLAGS = /Od /Oy-
> + GCC:DEBUG_CLANG9_*_CC_FLAGS =-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
>
> MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
> MSFT:DEBUG_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
> MSFT:NOOPT_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
> +
> +!if $(WIN_HOST_BUILD) == TRUE
> + #
> + # CLANG9 tool chain depends on WIN_HOST_BUILD flag to generate the windows application.
> + #
> + GCC:*_CLANG9_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
> + GCC:DEBUG_CLANG9_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
> + GCC:NOOPT_CLANG9_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(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 = /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 == /nologo /W3 /WX /c /Cx /Zd /W0 /Zi
> MSFT:*_*_X64_ASMLINK_FLAGS == /link /nologo
> +
> + GCC:*_CLANG9_X64_DLINK_FLAGS == /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=_ModuleEntryPoint
> + GCC:*_CLANG9_X64_CC_FLAGS == -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 == /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=_ModuleEntryPoint
> + GCC:*_CLANG9_IA32_CC_FLAGS == -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
> --
> 2.13.0.windows.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain
2019-10-24 17:09 ` Andrew Fish
@ 2019-10-25 1:38 ` Liming Gao
0 siblings, 0 replies; 4+ messages in thread
From: Liming Gao @ 2019-10-25 1:38 UTC (permalink / raw)
To: devel@edk2.groups.io, afish@apple.com
Andrew:
EmulatorPkg/Win/Host/WinHost.inf is for Windows OS only. Linux/Mac uses Unix Host.
Thanks
Liming
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Andrew Fish via Groups.Io
> Sent: Friday, October 25, 2019 1:09 AM
> To: Gao, Liming <liming.gao@intel.com>
> Cc: devel@edk2.groups.io; Justen, Jordan L <jordan.l.justen@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: Re: [edk2-devel] [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain
>
> How do you use PDB debug formats on Linux and macOS? Should the /pdb flags also be under WIN_HOST_BUILD?
>
> Thanks,
>
> Andrew Fish
>
> > On Oct 23, 2019, at 1:46 AM, Liming Gao <liming.gao@intel.com> wrote:
> >
> > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603
> > 1. Add WIN_HOST_BUILD macro check for CLANG9 tool chain
> > build -p EmulatorPkg\EmulatorPkg.dsc -a IA32 -DWIN_HOST_BUILD=TRUE -t CLANG9
> > build -p EmulatorPkg\EmulatorPkg.dsc -a X64 -DWIN_HOST_BUILD=TRUE -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.
> >
> > Cc: Jordan Justen <jordan.l.justen@intel.com>
> > Cc: Andrew Fish <afish@apple.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Signed-off-by: Liming Gao <liming.gao@intel.com>
> > Reviewed-by: Ray Ni <ray.ni@intel.com>
> > ---
> > 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/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;
> >
> > //
> > @@ -414,7 +414,7 @@ Returns:
> > // Determine the first thread available to this process.
> > //
> > if (GetProcessAffinityMask (GetCurrentProcess (), &ProcessAffinityMask, &SystemAffinityMask)) {
> > - LowBit = (INT32)LowBitSet32 (ProcessAffinityMask);
> > + LowBit = (INT32)LowBitSet32 ((UINT32)ProcessAffinityMask);
> > if (LowBit != -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 @@
> >
> > [Components]
> > !if "IA32" in $(ARCH) || "X64" in $(ARCH)
> > - !if "MSFT" in $(FAMILY)
> > + !if "MSFT" in $(FAMILY) || $(WIN_HOST_BUILD) == 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 @@
> >
> > MSFT:DEBUG_*_*_CC_FLAGS = /Od /Oy-
> > MSFT:NOOPT_*_*_CC_FLAGS = /Od /Oy-
> > + GCC:DEBUG_CLANG9_*_CC_FLAGS =-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
> >
> > MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
> > MSFT:DEBUG_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
> > MSFT:NOOPT_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
> > +
> > +!if $(WIN_HOST_BUILD) == TRUE
> > + #
> > + # CLANG9 tool chain depends on WIN_HOST_BUILD flag to generate the windows application.
> > + #
> > + GCC:*_CLANG9_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
> > + GCC:DEBUG_CLANG9_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
> > + GCC:NOOPT_CLANG9_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(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 = /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 == /nologo /W3 /WX /c /Cx /Zd /W0 /Zi
> > MSFT:*_*_X64_ASMLINK_FLAGS == /link /nologo
> > +
> > + GCC:*_CLANG9_X64_DLINK_FLAGS == /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=_ModuleEntryPoint
> > + GCC:*_CLANG9_X64_CC_FLAGS == -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 == /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=_ModuleEntryPoint
> > + GCC:*_CLANG9_IA32_CC_FLAGS == -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
> > --
> > 2.13.0.windows.1
> >
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-25 1:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-23 8:46 [Patch v5 10/11] EmulatorPkg: Enable CLANG9 tool chain Liming Gao
2019-10-23 8:47 ` [edk2-devel] " Ni, Ray
2019-10-24 17:09 ` Andrew Fish
2019-10-25 1:38 ` [edk2-devel] " Liming Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox