From: "Liming Gao" <liming.gao@intel.com>
To: "afish@apple.com" <afish@apple.com>, "Ni, Ray" <ray.ni@intel.com>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Justen, Jordan L" <jordan.l.justen@intel.com>
Subject: Re: [Patch v3 10/11] EmulatorPkg: Enable CLANG9 tool chain
Date: Fri, 18 Oct 2019 14:27:44 +0000 [thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E51EC84@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <34BE6669-004C-48AD-A09D-FE1A8475ABE0@apple.com>
[-- Attachment #1: Type: text/plain, Size: 8752 bytes --]
Andrew:
Here is the cover letter on CLANG9 introduction. https://edk2.groups.io/g/devel/message/49157
1) Yes. CLANG9 tool chain is added to directly generate PE/COFF image (EFI image).
This tool chain uses LLVM clang C compiler and lld linker, generates PE/COFF
image and PDB compatible debug symbol format. Now, it supports IA32/X64 Archs.
LLVM clang C compiler and lld linker are the standalone tool set. They don't depend other lib to generate PE/COFF image.
2) Yes. CLANG9 is the cross OS tool chain. It can work on Windows/Linux/Mac host OS.
LLVM LLD linker uses Windows style arguments. I verify CLANG9 for Ovmf3264 in Windows/Linux host OS.
3) This patch enables WinHost in Windows. It doesn't enable UnixHost. Now, EmulatorPkg with CLANG9 only works on Windows Host.
This patch can make other modules pass build in Windows/Linux/Mac only if LLVM9 tool set is installed.
But, the generated image may not work on Linux/Mac. I agree below linker flags are specific to windows host.
So, I suggest to add the conditional statement of $(WIN_HOST_BUILD) == TRUE for them.
!if $(WIN_HOST_BUILD) == TRUE
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
Thanks
Liming
From: afish@apple.com <afish@apple.com>
Sent: Friday, October 18, 2019 1:15 AM
To: Ni, Ray <ray.ni@intel.com>
Cc: Gao, Liming <liming.gao@intel.com>; devel@edk2.groups.io; Justen, Jordan L <jordan.l.justen@intel.com>
Subject: Re: [Patch v3 10/11] EmulatorPkg: Enable CLANG9 tool chain
Ray,
Sorry I'm coming a little late to this and I'm confused. I have some questions?
1) Does CLANG9 imply CLANGPE?
2) Does CLANGPE work on Linux and macOS? Can you pass the Windows style arguments to CLANGPE linker on Linux and macOS?
3) For the EmulatorPkg don't you have the extra requirement that compiler needs a standard C lib (or platform specific libs) to function?
a) GCC:*_CLANG9_*_DLINK_FLAGS in EmulatorPkg.dsc seems to imply the Linux and macOS systems will have a Windows SKD dir and a lot of Windows DLLs? Does all that come when you install CLANG9 when you install it on Linux or macOS?
So I guess I'm asking is the linker really the same for CLANG9 on all systems? I guess the answer could be yes, but it seems the C lib for the Host App is still an App for that OS and is OS dependent?
Sorry if I'm missing something fundamental and this is a dumb question.
Thanks,
Andrew Fish
On Oct 17, 2019, at 12:27 AM, Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>> wrote:
Liming,
Emulator is using a generic SEC module. The host specific module is called "Host".
So I prefer to change the macro to "WIN_HOST_BUILD", with this change, Reviewed-by: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>>
-----Original Message-----
From: Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>
Sent: Thursday, October 17, 2019 2:56 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Justen, Jordan L <jordan.l.justen@intel.com<mailto:jordan.l.justen@intel.com>>; Andrew Fish
<afish@apple.com<mailto:afish@apple.com>>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Subject: [Patch v3 10/11] EmulatorPkg: Enable CLANG9 tool chain
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603
1. Add WIN_SEC_BUILD macro check for CLANG9 tool chain build -p
EmulatorPkg\EmulatorPkg.dsc -a IA32 -DWIN_SEC_BUILD=TRUE -t CLANG9
build -p EmulatorPkg\EmulatorPkg.dsc -a X64 -DWIN_SEC_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<mailto:jordan.l.justen@intel.com>>
Cc: Andrew Fish <afish@apple.com<mailto:afish@apple.com>>
Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Signed-off-by: Liming Gao <liming.gao@intel.com<mailto:liming.gao@intel.com>>
---
EmulatorPkg/Win/Host/WinHost.c | 6 +++---
EmulatorPkg/EmulatorPkg.dsc | 7 ++++++-
EmulatorPkg/Win/Host/WinHost.inf | 6 ++++++
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/EmulatorPkg/Win/Host/WinHost.c
b/EmulatorPkg/Win/Host/WinHost.c index 9aba3c8959..e40ce32548 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;
//
diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 20f1187713..72532f5daf 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -237,9 +237,10 @@
[Components]
!if "IA32" in $(ARCH) || "X64" in $(ARCH)
- !if "MSFT" in $(FAMILY)
+ !if "MSFT" in $(FAMILY) || $(WIN_SEC_BUILD) == TRUE
##
# Emulator, OS WIN application
+ # CLANG9 is cross OS tool chain. It depends on WIN_SEC_BUILD macro.
##
EmulatorPkg/Win/Host/WinHost.inf
!else
@@ -419,7 +420,11 @@
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
+ 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
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
[-- Attachment #2: Type: text/html, Size: 21375 bytes --]
next prev parent reply other threads:[~2019-10-18 14:27 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-17 6:55 [Patch v3 00/11] New Cross OS tool chain CLANG9 Liming Gao
2019-10-17 6:55 ` [Patch v3 01/11] BaseTools tools_def.template: Remove unnecessary $(DEST_DIR_DEBUG) path Liming Gao
2019-10-17 6:55 ` [Patch v3 02/11] BaseTools tools_def: Add CLANG9 tool chain to directly generate PE image Liming Gao
2019-10-17 8:18 ` Bob Feng
2019-10-17 6:55 ` [Patch v3 03/11] BaseTools GenFw: Fix the issue to update the wrong size as SectionSize Liming Gao
2019-10-17 8:17 ` Bob Feng
2019-10-17 6:55 ` [Patch v3 04/11] MdePkg Base.h: Add definition for CLANG9 tool chain Liming Gao
2019-10-22 1:44 ` [edk2-devel] " Michael D Kinney
2019-10-17 6:55 ` [Patch v3 05/11] MdePkg BaseIoLibIntrinsic: Remove __inline__ attribute for IO functions Liming Gao
2019-10-17 6:55 ` [Patch v3 06/11] MdeModulePkg LzmaCustomDecompressLib: Update macro to be same in CLANG tool Liming Gao
2019-10-17 6:55 ` [Patch v3 07/11] MdeModulePkg RegularExpressionDxe: Disable warning for CLANG9 tool chain Liming Gao
2019-10-17 6:55 ` [Patch v3 08/11] CryptoPkg: Append options to make CLANG9 tool chain pass build Liming Gao
2019-10-17 6:55 ` [Patch v3 09/11] CryptoPkg IntrinsicLib: Make _fltused always be used Liming Gao
2019-10-17 6:55 ` [Patch v3 10/11] EmulatorPkg: Enable CLANG9 tool chain Liming Gao
2019-10-17 7:27 ` Ni, Ray
2019-10-17 17:15 ` Andrew Fish
2019-10-18 14:27 ` Liming Gao [this message]
2019-10-25 18:45 ` [edk2-devel] " Andrew Fish
2019-10-30 15:43 ` Liming Gao
2019-11-07 17:19 ` Leif Lindholm
2019-11-07 17:54 ` Andrew Fish
2019-11-07 18:37 ` Leif Lindholm
2019-11-08 0:44 ` Andrew Fish
2019-11-08 1:49 ` Liming Gao
2019-11-08 3:34 ` Ni, Ray
2019-11-11 16:39 ` Leif Lindholm
2019-11-11 16:51 ` Andrew Fish
2019-11-11 16:51 ` Andrew Fish
2019-11-12 0:40 ` Liming Gao
2019-11-12 1:46 ` Ni, Ray
[not found] ` <15D646FBD4763D55.27853@groups.io>
2019-11-12 3:10 ` Ni, Ray
[not found] ` <15D64B9456F8C33A.2582@groups.io>
2019-11-12 3:22 ` Ni, Ray
2019-11-12 3:48 ` Michael D Kinney
2019-11-12 6:48 ` Ni, Ray
2019-11-12 15:26 ` Liming Gao
2019-11-11 16:36 ` Leif Lindholm
2019-11-07 17:06 ` Leif Lindholm
2019-10-17 6:55 ` [Patch v3 11/11] OvmfPkg: " Liming Gao
2019-10-17 16:30 ` [edk2-devel] [Patch v3 00/11] New Cross OS tool chain CLANG9 Leif Lindholm
2019-10-18 13:21 ` Liming Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14E51EC84@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox