* [Patch v2 01/11] BaseTools tools_def.template: Remove unnecessary $(DEST_DIR_DEBUG) path
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
@ 2019-10-15 0:26 ` Liming Gao
2019-10-16 8:59 ` [edk2-devel] " Bob Feng
2019-10-15 0:26 ` [Patch v2 02/11] BaseTools tools_def: Add CLANG9 tool chain to directly generate PE image Liming Gao
` (11 subsequent siblings)
12 siblings, 1 reply; 32+ messages in thread
From: Liming Gao @ 2019-10-15 0:26 UTC (permalink / raw)
To: devel
$(DEST_DIR_DEBUG) path is in Include directory.
It is not required to be specified again.
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
BaseTools/Conf/tools_def.template | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 88a6764f43..fd6fca542d 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -350,8 +350,8 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
# *_*_EBC_SLINK_PATH = C:\Program Files\Intel\EBC\Bin\link.exe
#
# *_*_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
-# *_*_EBC_PP_FLAGS = /nologo /E /TC /FI$(DEST_DIR_DEBUG)/AutoGen.h
-# *_*_EBC_CC_FLAGS = /nologo /FAcs /c /W3 /WX /FI$(DEST_DIR_DEBUG)/AutoGen.h
+# *_*_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+# *_*_EBC_CC_FLAGS = /nologo /FAcs /c /W3 /WX /FIAutoGen.h
# *_*_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /MACHINE:EBC /OPT:REF /NODEFAULTLIB /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
#
####################################################################################
@@ -1906,13 +1906,13 @@ DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _Ref
DEFINE GCC_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS)
DEFINE GCC_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS)
DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
-DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
-DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
-DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
+DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h
+DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h
+DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(MODULE_NAME)StrDefs.h
DEFINE GCC_ASLPP_FLAGS = -x c -E -include AutoGen.h
DEFINE GCC_ASLCC_FLAGS = -x c
DEFINE GCC_WINDRES_FLAGS = -J rc -O coff
-DEFINE GCC_DTCPP_FLAGS = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc -undef
+DEFINE GCC_DTCPP_FLAGS = -E -x assembler-with-cpp -imacros AutoGen.h -nostdinc -undef
DEFINE GCC_IA32_RC_FLAGS = -I binary -O elf32-i386 -B i386 --rename-section .data=.hii
DEFINE GCC_X64_RC_FLAGS = -I binary -O elf64-x86-64 -B i386 --rename-section .data=.hii
DEFINE GCC_ARM_RC_FLAGS = -I binary -O elf32-littlearm -B arm --rename-section .data=.hii
@@ -2772,8 +2772,8 @@ RELEASE_XCODE5_X64_DLINK_FLAGS = -arch x86_64 -u _$(IMAGE_ENTRY_POINT) -e _
NOOPT_XCODE5_X64_ASM_FLAGS = -arch x86_64 -g
RELEASE_XCODE5_X64_ASM_FLAGS = -arch x86_64
*_XCODE5_X64_NASM_FLAGS = -f macho64
-*_XCODE5_*_PP_FLAGS = -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
-*_XCODE5_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE -include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
+*_XCODE5_*_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h
+*_XCODE5_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE -include $(MODULE_NAME)StrDefs.h
DEBUG_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -gdwarf -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
NOOPT_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -gdwarf -O0 -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
@@ -2812,7 +2812,7 @@ RELEASE_RVCT_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS)
*_RVCT_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_ASM_FLAGS)
*_RVCT_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E --preinclude AutoGen.h
-*_RVCT_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
+*_RVCT_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(MODULE_NAME)StrDefs.h
*_RVCT_ARM_MAKE_PATH = nmake /NOLOGO
*_RVCT_ARM_SLINK_FLAGS = --partial -o
DEBUG_RVCT_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O1 -g
@@ -2853,7 +2853,7 @@ RELEASE_RVCTLINUX_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAG
*_RVCTLINUX_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_ASM_FLAGS)
*_RVCTLINUX_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E
-*_RVCTLINUX_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
+*_RVCTLINUX_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(MODULE_NAME)StrDefs.h
*_RVCTLINUX_ARM_SLINK_FLAGS = --partial -o
DEBUG_RVCTLINUX_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O1 -g
RELEASE_RVCTLINUX_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --diag_suppress=550 DEF(RVCT_ALL_CC_FLAGS) -O2
@@ -2900,7 +2900,7 @@ RELEASE_RVCTCYGWIN_ARM_DLINK_FLAGS = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS)
*_RVCTCYGWIN_ARM_ASM_FLAGS = "$(ASMPATH_FLAG)" $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_ASM_FLAGS)
*_RVCTCYGWIN_ARM_PP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E
-*_RVCTCYGWIN_ARM_VFRPP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude `cygpath -m $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h`
+*_RVCTCYGWIN_ARM_VFRPP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude `cygpath -m $(MODULE_NAME)StrDefs.h`
*_RVCTCYGWIN_ARM_MAKE_PATH = make
*_RVCTCYGWIN_ARM_SLINK_FLAGS = "$(SLINKPATH_FLAG)" --partial -o
DEBUG_RVCTCYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O1 -g
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Patch v2 02/11] BaseTools tools_def: Add CLANG9 tool chain to directly generate PE image
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
2019-10-15 0:26 ` [Patch v2 01/11] BaseTools tools_def.template: Remove unnecessary $(DEST_DIR_DEBUG) path Liming Gao
@ 2019-10-15 0:26 ` Liming Gao
2019-10-15 0:26 ` [Patch v2 03/11] BaseTools GenFw: Fix the issue to update the wrong size as SectionSize Liming Gao
` (10 subsequent siblings)
12 siblings, 0 replies; 32+ messages in thread
From: Liming Gao @ 2019-10-15 0:26 UTC (permalink / raw)
To: devel
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
BaseTools/Conf/build_rule.template | 26 ++++++----
BaseTools/Conf/tools_def.template | 102 +++++++++++++++++++++++++++++++++++++
2 files changed, 118 insertions(+), 10 deletions(-)
diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template
index db06d3a6b4..3a58ac8015 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -260,7 +260,7 @@
<OutputFile>
$(OUTPUT_DIR)(+)$(MODULE_NAME).lib
- <Command.MSFT, Command.INTEL>
+ <Command.MSFT, Command.INTEL, Command.CLANGPE>
"$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} @$(OBJECT_FILES_LIST)
<Command.GCC>
@@ -291,6 +291,9 @@
"$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK2_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
"$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
+ <Command.CLANGPE>
+ "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
+
<Command.GCC>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(CC_FLAGS) $(DLINK2_FLAGS)
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
@@ -331,7 +334,7 @@
<OutputFile>
$(DEBUG_DIR)(+)$(MODULE_NAME)
- <Command.MSFT, Command.INTEL>
+ <Command.MSFT, Command.INTEL, Command.CLANGPE>
"$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
<Command.GCC>
@@ -355,7 +358,7 @@
<OutputFile>
$(OUTPUT_DIR)(+)$(MODULE_NAME).efi
- <Command.MSFT, Command.INTEL, Command.RVCT>
+ <Command.MSFT, Command.INTEL, Command.RVCT, Command.CLANGPE>
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
$(CP) ${dst} $(DEBUG_DIR)
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
@@ -460,9 +463,14 @@
<Command.GCC>
"$(ASLCC)" -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
- "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+ "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS)
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
-
+
+ <Command.CLANGPE>
+ "$(ASLCC)" -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
+ "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+ "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
+
<Command.XCODE>
"$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) $(INC) ${src}
"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
@@ -622,21 +630,19 @@
<InputFile>
*.hpk
- <OutputFile.MSFT, OutputFile.INTEL, OutputFile.GCC>
+ <OutputFile.MSFT, OutputFile.INTEL, OutputFile.GCC, OutputFile.CLANGPE>
$(OUTPUT_DIR)(+)$(MODULE_NAME)hii.lib
<OutputFile.XCODE, OutputFile.RVCT>
$(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc
- <Command.MSFT, Command.INTEL>
+ <Command.MSFT, Command.INTEL, Command.CLANGPE>
"$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiipackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
"$(RC)" /Fo${dst} $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc
<Command.GCC>
"$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
"$(RC)" $(RC_FLAGS) $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc ${dst}
-
+
<Command.XCODE, Command.RVCT>
GenFw -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES)
-
-
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index fd6fca542d..e009f195b9 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -268,6 +268,15 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
# Required to build platforms or ACPI tables:
# Intel(r) ACPI Compiler from
# https://acpica.org/downloads
+# CLANG9 -Linux, Windows, Mac- Requires:
+# Clang 9 or above from http://releases.llvm.org/
+# Optional:
+# Required to compile nasm source:
+# nasm compiler from
+# NASM -- http://www.nasm.us/
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler from
+# https://acpica.org/downloads
# VS2008x86 -win64- Requires:
# Microsoft Visual Studio 2008 (x86)
# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
@@ -2698,6 +2707,99 @@ DEFINE CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH6
RELEASE_CLANG38_AARCH64_CC_FLAGS = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O3
RELEASE_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64
+####################################################################################
+#
+# CLANG9 - This configuration is used to compile under Windows/Linux/Mac to produce
+# PE/COFF binaries using LLVM/Clang/LLD with Link Time Optimization enabled
+#
+####################################################################################
+*_CLANG9_*_*_FAMILY = GCC
+*_CLANG9_*_*_BUILDRULEFAMILY = CLANGPE
+*_CLANG9_*_MAKE_PATH = ENV(CLANG_HOST_BIN)make
+*_CLANG9_*_*_DLL = ENV(CLANG9_DLL)
+*_CLANG9_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+*_CLANG9_*_APP_FLAGS =
+*_CLANG9_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_CLANG9_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_CLANG9_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+DEFINE CLANG9_IA32_PREFIX = ENV(CLANG9_BIN)
+DEFINE CLANG9_X64_PREFIX = ENV(CLANG9_BIN)
+
+DEFINE CLANG9_IA32_TARGET = -target i686-unknown-windows
+DEFINE CLANG9_X64_TARGET = -target x86_64-unknown-windows
+
+DEFINE CLANG9_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option -Wno-microsoft-enum-forward-reference
+DEFINE CLANG9_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANG9_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -fms-compatibility -mno-stack-arg-probe
+
+###########################
+# CLANG9 IA32 definitions
+###########################
+*_CLANG9_IA32_CC_PATH = DEF(CLANG9_IA32_PREFIX)clang
+*_CLANG9_IA32_SLINK_PATH = DEF(CLANG9_IA32_PREFIX)llvm-lib
+*_CLANG9_IA32_DLINK_PATH = DEF(CLANG9_IA32_PREFIX)lld-link
+*_CLANG9_IA32_ASLDLINK_PATH = DEF(CLANG9_IA32_PREFIX)lld-link
+*_CLANG9_IA32_ASM_PATH = DEF(CLANG9_IA32_PREFIX)clang
+*_CLANG9_IA32_PP_PATH = DEF(CLANG9_IA32_PREFIX)clang
+*_CLANG9_IA32_VFRPP_PATH = DEF(CLANG9_IA32_PREFIX)clang
+*_CLANG9_IA32_ASLCC_PATH = DEF(CLANG9_IA32_PREFIX)clang
+*_CLANG9_IA32_ASLPP_PATH = DEF(CLANG9_IA32_PREFIX)clang
+*_CLANG9_IA32_RC_PATH = DEF(CLANG9_IA32_PREFIX)llvm-rc
+
+*_CLANG9_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto DEF(CLANG9_IA32_TARGET)
+*_CLANG9_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG9_IA32_TARGET)
+*_CLANG9_IA32_OBJCOPY_FLAGS =
+*_CLANG9_IA32_NASM_FLAGS = -f win32
+*_CLANG9_IA32_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG9_IA32_TARGET)
+*_CLANG9_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG9_IA32_TARGET)
+*_CLANG9_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG9_IA32_TARGET)
+
+DEBUG_CLANG9_IA32_CC_FLAGS = DEF(CLANG9_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG9_IA32_TARGET) -gcodeview
+DEBUG_CLANG9_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap
+DEBUG_CLANG9_IA32_DLINK2_FLAGS =
+
+RELEASE_CLANG9_IA32_CC_FLAGS = DEF(CLANG9_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG9_IA32_TARGET)
+RELEASE_CLANG9_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /lldmap
+RELEASE_CLANG9_IA32_DLINK2_FLAGS =
+
+NOOPT_CLANG9_IA32_CC_FLAGS = DEF(CLANG9_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANG9_IA32_TARGET) -gcodeview
+NOOPT_CLANG9_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap
+NOOPT_CLANG9_IA32_DLINK2_FLAGS =
+
+##########################
+# CLANGWIN X64 definitions
+##########################
+*_CLANG9_X64_CC_PATH = DEF(CLANG9_X64_PREFIX)clang
+*_CLANG9_X64_SLINK_PATH = DEF(CLANG9_X64_PREFIX)llvm-lib
+*_CLANG9_X64_DLINK_PATH = DEF(CLANG9_X64_PREFIX)lld-link
+*_CLANG9_X64_ASLDLINK_PATH = DEF(CLANG9_X64_PREFIX)lld-link
+*_CLANG9_X64_ASM_PATH = DEF(CLANG9_X64_PREFIX)clang
+*_CLANG9_X64_PP_PATH = DEF(CLANG9_X64_PREFIX)clang
+*_CLANG9_X64_VFRPP_PATH = DEF(CLANG9_X64_PREFIX)clang
+*_CLANG9_X64_ASLCC_PATH = DEF(CLANG9_X64_PREFIX)clang
+*_CLANG9_X64_ASLPP_PATH = DEF(CLANG9_X64_PREFIX)clang
+*_CLANG9_X64_RC_PATH = DEF(CLANG9_IA32_PREFIX)llvm-rc
+
+*_CLANG9_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto DEF(CLANG9_X64_TARGET)
+*_CLANG9_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64 DEF(CLANG9_X64_TARGET)
+*_CLANG9_X64_OBJCOPY_FLAGS =
+*_CLANG9_X64_NASM_FLAGS = -f win64
+*_CLANG9_X64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG9_X64_TARGET)
+*_CLANG9_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG9_X64_TARGET)
+*_CLANG9_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG9_X64_TARGET)
+
+DEBUG_CLANG9_X64_CC_FLAGS = DEF(CLANG9_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -Oz -flto DEF(CLANG9_X64_TARGET) -gcodeview
+DEBUG_CLANG9_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap
+DEBUG_CLANG9_X64_DLINK2_FLAGS =
+
+RELEASE_CLANG9_X64_CC_FLAGS = DEF(CLANG9_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -Oz -flto DEF(CLANG9_X64_TARGET)
+RELEASE_CLANG9_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /lldmap
+RELEASE_CLANG9_X64_DLINK2_FLAGS =
+
+NOOPT_CLANG9_X64_CC_FLAGS = DEF(CLANG9_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -O0 DEF(CLANG9_X64_TARGET) -gcodeview
+NOOPT_CLANG9_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap
+NOOPT_CLANG9_X64_DLINK2_FLAGS =
#
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Patch v2 03/11] BaseTools GenFw: Fix the issue to update the wrong size as SectionSize
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
2019-10-15 0:26 ` [Patch v2 01/11] BaseTools tools_def.template: Remove unnecessary $(DEST_DIR_DEBUG) path Liming Gao
2019-10-15 0:26 ` [Patch v2 02/11] BaseTools tools_def: Add CLANG9 tool chain to directly generate PE image Liming Gao
@ 2019-10-15 0:26 ` Liming Gao
2019-10-15 9:21 ` [edk2-devel] " Philippe Mathieu-Daudé
2019-10-16 9:27 ` Bob Feng
2019-10-15 0:26 ` [Patch v2 04/11] MdePkg Base.h: Add definition for CLANG9 tool chain Liming Gao
` (9 subsequent siblings)
12 siblings, 2 replies; 32+ messages in thread
From: Liming Gao @ 2019-10-15 0:26 UTC (permalink / raw)
To: devel
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
BaseTools/Source/C/GenFw/GenFw.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c
index c99782b78e..d8d3360c24 100644
--- a/BaseTools/Source/C/GenFw/GenFw.c
+++ b/BaseTools/Source/C/GenFw/GenFw.c
@@ -653,7 +653,11 @@ PeCoffConvertImageToXip (
//
// Make the size of raw data in section header alignment.
//
- SectionHeader->SizeOfRawData = (SectionHeader->Misc.VirtualSize + PeHdr->Pe32.OptionalHeader.FileAlignment - 1) & (~(PeHdr->Pe32.OptionalHeader.FileAlignment - 1));
+ SectionSize = (SectionHeader->Misc.VirtualSize + PeHdr->Pe32.OptionalHeader.FileAlignment - 1) & (~(PeHdr->Pe32.OptionalHeader.FileAlignment - 1));
+ if (SectionSize < SectionHeader->SizeOfRawData) {
+ SectionHeader->SizeOfRawData = SectionSize;
+ }
+
SectionHeader->PointerToRawData = SectionHeader->VirtualAddress;
}
@@ -999,7 +1003,7 @@ Returns:
CopyMem (
FileBuffer + SectionHeader->PointerToRawData,
(VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
- SectionHeader->SizeOfRawData
+ SectionHeader->SizeOfRawData < SectionHeader->Misc.VirtualSize ? SectionHeader->SizeOfRawData : SectionHeader->Misc.VirtualSize
);
}
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 03/11] BaseTools GenFw: Fix the issue to update the wrong size as SectionSize
2019-10-15 0:26 ` [Patch v2 03/11] BaseTools GenFw: Fix the issue to update the wrong size as SectionSize Liming Gao
@ 2019-10-15 9:21 ` Philippe Mathieu-Daudé
2019-10-16 9:27 ` Bob Feng
1 sibling, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-15 9:21 UTC (permalink / raw)
To: devel, liming.gao
On 10/15/19 2:26 AM, Liming Gao wrote:
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> ---
> BaseTools/Source/C/GenFw/GenFw.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c
> index c99782b78e..d8d3360c24 100644
> --- a/BaseTools/Source/C/GenFw/GenFw.c
> +++ b/BaseTools/Source/C/GenFw/GenFw.c
> @@ -653,7 +653,11 @@ PeCoffConvertImageToXip (
> //
> // Make the size of raw data in section header alignment.
> //
> - SectionHeader->SizeOfRawData = (SectionHeader->Misc.VirtualSize + PeHdr->Pe32.OptionalHeader.FileAlignment - 1) & (~(PeHdr->Pe32.OptionalHeader.FileAlignment - 1));
> + SectionSize = (SectionHeader->Misc.VirtualSize + PeHdr->Pe32.OptionalHeader.FileAlignment - 1) & (~(PeHdr->Pe32.OptionalHeader.FileAlignment - 1));
> + if (SectionSize < SectionHeader->SizeOfRawData) {
> + SectionHeader->SizeOfRawData = SectionSize;
> + }
> +
> SectionHeader->PointerToRawData = SectionHeader->VirtualAddress;
> }
>
> @@ -999,7 +1003,7 @@ Returns:
> CopyMem (
> FileBuffer + SectionHeader->PointerToRawData,
> (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
> - SectionHeader->SizeOfRawData
> + SectionHeader->SizeOfRawData < SectionHeader->Misc.VirtualSize ? SectionHeader->SizeOfRawData : SectionHeader->Misc.VirtualSize
> );
> }
>
>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 03/11] BaseTools GenFw: Fix the issue to update the wrong size as SectionSize
2019-10-15 0:26 ` [Patch v2 03/11] BaseTools GenFw: Fix the issue to update the wrong size as SectionSize Liming Gao
2019-10-15 9:21 ` [edk2-devel] " Philippe Mathieu-Daudé
@ 2019-10-16 9:27 ` Bob Feng
2019-10-17 2:18 ` Liming Gao
1 sibling, 1 reply; 32+ messages in thread
From: Bob Feng @ 2019-10-16 9:27 UTC (permalink / raw)
To: devel@edk2.groups.io, Gao, Liming
Hi Liming,
Would you please add more description in commit message? This patch is in the patch set of CLANG9 enabling, but it's hard for me to see the direct relationship between CLANG9 and this fix and why the original code is wrong.
Thanks
Bob
-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Liming Gao
Sent: Tuesday, October 15, 2019 8:27 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] [Patch v2 03/11] BaseTools GenFw: Fix the issue to update the wrong size as SectionSize
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
BaseTools/Source/C/GenFw/GenFw.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c
index c99782b78e..d8d3360c24 100644
--- a/BaseTools/Source/C/GenFw/GenFw.c
+++ b/BaseTools/Source/C/GenFw/GenFw.c
@@ -653,7 +653,11 @@ PeCoffConvertImageToXip (
//
// Make the size of raw data in section header alignment.
//
- SectionHeader->SizeOfRawData = (SectionHeader->Misc.VirtualSize + PeHdr->Pe32.OptionalHeader.FileAlignment - 1) & (~(PeHdr->Pe32.OptionalHeader.FileAlignment - 1));
+ SectionSize = (SectionHeader->Misc.VirtualSize + PeHdr->Pe32.OptionalHeader.FileAlignment - 1) & (~(PeHdr->Pe32.OptionalHeader.FileAlignment - 1));
+ if (SectionSize < SectionHeader->SizeOfRawData) {
+ SectionHeader->SizeOfRawData = SectionSize;
+ }
+
SectionHeader->PointerToRawData = SectionHeader->VirtualAddress;
}
@@ -999,7 +1003,7 @@ Returns:
CopyMem (
FileBuffer + SectionHeader->PointerToRawData,
(VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
- SectionHeader->SizeOfRawData
+ SectionHeader->SizeOfRawData < SectionHeader->Misc.VirtualSize ? SectionHeader->SizeOfRawData : SectionHeader->Misc.VirtualSize
);
}
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 03/11] BaseTools GenFw: Fix the issue to update the wrong size as SectionSize
2019-10-16 9:27 ` Bob Feng
@ 2019-10-17 2:18 ` Liming Gao
0 siblings, 0 replies; 32+ messages in thread
From: Liming Gao @ 2019-10-17 2:18 UTC (permalink / raw)
To: Feng, Bob C, devel@edk2.groups.io
OK. I will update the commit message to describe this issue.
This change is to make sure section size is in section raw data scope.
>-----Original Message-----
>From: Feng, Bob C
>Sent: Wednesday, October 16, 2019 5:27 PM
>To: devel@edk2.groups.io; Gao, Liming <liming.gao@intel.com>
>Subject: RE: [edk2-devel] [Patch v2 03/11] BaseTools GenFw: Fix the issue to
>update the wrong size as SectionSize
>
>Hi Liming,
>
>Would you please add more description in commit message? This patch is in
>the patch set of CLANG9 enabling, but it's hard for me to see the direct
>relationship between CLANG9 and this fix and why the original code is wrong.
>
>Thanks
>Bob
>
>-----Original Message-----
>From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
>Liming Gao
>Sent: Tuesday, October 15, 2019 8:27 AM
>To: devel@edk2.groups.io
>Subject: [edk2-devel] [Patch v2 03/11] BaseTools GenFw: Fix the issue to
>update the wrong size as SectionSize
>
>Signed-off-by: Liming Gao <liming.gao@intel.com>
>---
> BaseTools/Source/C/GenFw/GenFw.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
>diff --git a/BaseTools/Source/C/GenFw/GenFw.c
>b/BaseTools/Source/C/GenFw/GenFw.c
>index c99782b78e..d8d3360c24 100644
>--- a/BaseTools/Source/C/GenFw/GenFw.c
>+++ b/BaseTools/Source/C/GenFw/GenFw.c
>@@ -653,7 +653,11 @@ PeCoffConvertImageToXip (
> //
> // Make the size of raw data in section header alignment.
> //
>- SectionHeader->SizeOfRawData = (SectionHeader->Misc.VirtualSize +
>PeHdr->Pe32.OptionalHeader.FileAlignment - 1) & (~(PeHdr-
>>Pe32.OptionalHeader.FileAlignment - 1));
>+ SectionSize = (SectionHeader->Misc.VirtualSize + PeHdr-
>>Pe32.OptionalHeader.FileAlignment - 1) & (~(PeHdr-
>>Pe32.OptionalHeader.FileAlignment - 1));
>+ if (SectionSize < SectionHeader->SizeOfRawData) {
>+ SectionHeader->SizeOfRawData = SectionSize;
>+ }
>+
> SectionHeader->PointerToRawData = SectionHeader->VirtualAddress;
> }
>
>@@ -999,7 +1003,7 @@ Returns:
> CopyMem (
> FileBuffer + SectionHeader->PointerToRawData,
> (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader-
>>VirtualAddress),
>- SectionHeader->SizeOfRawData
>+ SectionHeader->SizeOfRawData < SectionHeader->Misc.VirtualSize ?
>SectionHeader->SizeOfRawData : SectionHeader->Misc.VirtualSize
> );
> }
>
>--
>2.13.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Patch v2 04/11] MdePkg Base.h: Add definition for CLANG9 tool chain
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
` (2 preceding siblings ...)
2019-10-15 0:26 ` [Patch v2 03/11] BaseTools GenFw: Fix the issue to update the wrong size as SectionSize Liming Gao
@ 2019-10-15 0:26 ` Liming Gao
2019-10-15 9:32 ` [edk2-devel] " Philippe Mathieu-Daudé
2019-10-15 0:26 ` [Patch v2 05/11] MdePkg BaseIoLibIntrinsic: Remove __inline__ attribute for IO functions Liming Gao
` (8 subsequent siblings)
12 siblings, 1 reply; 32+ messages in thread
From: Liming Gao @ 2019-10-15 0:26 UTC (permalink / raw)
To: devel
CLANG9 tool chain defines __clang__ macro only,
doesn't define __GNUC__ macro. But, it uses some same definitions with GCC.
So, update base definition for CLANG9 tool chain.
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
MdePkg/Include/Base.h | 6 +++---
MdePkg/Include/Ia32/ProcessorBind.h | 4 ++--
MdePkg/Include/X64/ProcessorBind.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index d94b8a5f93..4680e64136 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -621,9 +621,9 @@ typedef char* VA_LIST;
#define VA_END(Marker) (Marker = (VA_LIST) 0)
#define VA_COPY(Dest, Start) ((void)((Dest) = (Start)))
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) || defined(__clang__)
-#if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS)
+#if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS) && !defined(__clang__)
//
// X64 only. Use MS ABI version of GCC built-in macros for variable argument lists.
//
@@ -1274,7 +1274,7 @@ typedef UINTN RETURN_STATUS;
**/
#define RETURN_ADDRESS(L) ((L == 0) ? _ReturnAddress() : (VOID *) 0)
-#elif defined(__GNUC__)
+#elif defined (__GNUC__) || defined (__clang__)
void * __builtin_return_address (unsigned int level);
/**
Get the return address of the calling function.
diff --git a/MdePkg/Include/Ia32/ProcessorBind.h b/MdePkg/Include/Ia32/ProcessorBind.h
index 497c58b33b..fa4b7e8e98 100644
--- a/MdePkg/Include/Ia32/ProcessorBind.h
+++ b/MdePkg/Include/Ia32/ProcessorBind.h
@@ -281,7 +281,7 @@ typedef INT32 INTN;
/// Microsoft* compiler specific method for EFIAPI calling convention.
///
#define EFIAPI __cdecl
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) || defined(__clang__)
///
/// GCC specific method for EFIAPI calling convention.
///
@@ -294,7 +294,7 @@ typedef INT32 INTN;
#define EFIAPI
#endif
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__clang__)
///
/// For GNU assembly code, .global or .globl can declare global symbols.
/// Define this macro to unify the usage.
diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h
index 6f65acd609..387e9c5c9c 100644
--- a/MdePkg/Include/X64/ProcessorBind.h
+++ b/MdePkg/Include/X64/ProcessorBind.h
@@ -313,7 +313,7 @@ typedef INT64 INTN;
#define EFIAPI
#endif
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__clang__)
///
/// For GNU assembly code, .global or .globl can declare global symbols.
/// Define this macro to unify the usage.
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 04/11] MdePkg Base.h: Add definition for CLANG9 tool chain
2019-10-15 0:26 ` [Patch v2 04/11] MdePkg Base.h: Add definition for CLANG9 tool chain Liming Gao
@ 2019-10-15 9:32 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-15 9:32 UTC (permalink / raw)
To: devel, liming.gao
On 10/15/19 2:26 AM, Liming Gao wrote:
> CLANG9 tool chain defines __clang__ macro only,
> doesn't define __GNUC__ macro. But, it uses some same definitions with GCC.
> So, update base definition for CLANG9 tool chain.
>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> ---
> MdePkg/Include/Base.h | 6 +++---
> MdePkg/Include/Ia32/ProcessorBind.h | 4 ++--
> MdePkg/Include/X64/ProcessorBind.h | 2 +-
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
> index d94b8a5f93..4680e64136 100644
> --- a/MdePkg/Include/Base.h
> +++ b/MdePkg/Include/Base.h
> @@ -621,9 +621,9 @@ typedef char* VA_LIST;
> #define VA_END(Marker) (Marker = (VA_LIST) 0)
> #define VA_COPY(Dest, Start) ((void)((Dest) = (Start)))
>
> -#elif defined(__GNUC__)
> +#elif defined(__GNUC__) || defined(__clang__)
>
> -#if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS)
> +#if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS) && !defined(__clang__)
> //
> // X64 only. Use MS ABI version of GCC built-in macros for variable argument lists.
> //
> @@ -1274,7 +1274,7 @@ typedef UINTN RETURN_STATUS;
>
> **/
> #define RETURN_ADDRESS(L) ((L == 0) ? _ReturnAddress() : (VOID *) 0)
> -#elif defined(__GNUC__)
> +#elif defined (__GNUC__) || defined (__clang__)
> void * __builtin_return_address (unsigned int level);
> /**
> Get the return address of the calling function.
> diff --git a/MdePkg/Include/Ia32/ProcessorBind.h b/MdePkg/Include/Ia32/ProcessorBind.h
> index 497c58b33b..fa4b7e8e98 100644
> --- a/MdePkg/Include/Ia32/ProcessorBind.h
> +++ b/MdePkg/Include/Ia32/ProcessorBind.h
> @@ -281,7 +281,7 @@ typedef INT32 INTN;
> /// Microsoft* compiler specific method for EFIAPI calling convention.
> ///
> #define EFIAPI __cdecl
> -#elif defined(__GNUC__)
> +#elif defined(__GNUC__) || defined(__clang__)
> ///
> /// GCC specific method for EFIAPI calling convention.
> ///
> @@ -294,7 +294,7 @@ typedef INT32 INTN;
> #define EFIAPI
> #endif
>
> -#if defined(__GNUC__)
> +#if defined(__GNUC__) || defined(__clang__)
> ///
> /// For GNU assembly code, .global or .globl can declare global symbols.
> /// Define this macro to unify the usage.
> diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h
> index 6f65acd609..387e9c5c9c 100644
> --- a/MdePkg/Include/X64/ProcessorBind.h
> +++ b/MdePkg/Include/X64/ProcessorBind.h
> @@ -313,7 +313,7 @@ typedef INT64 INTN;
> #define EFIAPI
> #endif
>
> -#if defined(__GNUC__)
> +#if defined(__GNUC__) || defined(__clang__)
> ///
> /// For GNU assembly code, .global or .globl can declare global symbols.
> /// Define this macro to unify the usage.
>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Patch v2 05/11] MdePkg BaseIoLibIntrinsic: Remove __inline__ attribute for IO functions
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
` (3 preceding siblings ...)
2019-10-15 0:26 ` [Patch v2 04/11] MdePkg Base.h: Add definition for CLANG9 tool chain Liming Gao
@ 2019-10-15 0:26 ` Liming Gao
2019-10-15 9:26 ` [edk2-devel] " Philippe Mathieu-Daudé
2019-10-22 1:42 ` Michael D Kinney
2019-10-15 0:26 ` [Patch v2 06/11] MdeModulePkg LzmaCustomDecompressLib: Update macro to be same in CLANG tool Liming Gao
` (7 subsequent siblings)
12 siblings, 2 replies; 32+ messages in thread
From: Liming Gao @ 2019-10-15 0:26 UTC (permalink / raw)
To: devel
__inline__ has no functional difference effect with the GCC48 / GCC49 / GCC5
toolchains, but it breaks the build with CLANG9. Remove __inline__.
Signed-off-by: Liming Gao <liming.gao@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
---
MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
index 055f0a947e..b3a1a20256 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
@@ -32,7 +32,6 @@
@return The value read.
**/
-__inline__
UINT8
EFIAPI
IoRead8 (
@@ -60,7 +59,6 @@ IoRead8 (
@return The value written the I/O port.
**/
-__inline__
UINT8
EFIAPI
IoWrite8 (
@@ -87,7 +85,6 @@ IoWrite8 (
@return The value read.
**/
-__inline__
UINT16
EFIAPI
IoRead16 (
@@ -117,7 +114,6 @@ IoRead16 (
@return The value written the I/O port.
**/
-__inline__
UINT16
EFIAPI
IoWrite16 (
@@ -145,7 +141,6 @@ IoWrite16 (
@return The value read.
**/
-__inline__
UINT32
EFIAPI
IoRead32 (
@@ -175,7 +170,6 @@ IoRead32 (
@return The value written the I/O port.
**/
-__inline__
UINT32
EFIAPI
IoWrite32 (
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 05/11] MdePkg BaseIoLibIntrinsic: Remove __inline__ attribute for IO functions
2019-10-15 0:26 ` [Patch v2 05/11] MdePkg BaseIoLibIntrinsic: Remove __inline__ attribute for IO functions Liming Gao
@ 2019-10-15 9:26 ` Philippe Mathieu-Daudé
2019-10-22 1:42 ` Michael D Kinney
1 sibling, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-15 9:26 UTC (permalink / raw)
To: devel, liming.gao
On 10/15/19 2:26 AM, Liming Gao wrote:
> __inline__ has no functional difference effect with the GCC48 / GCC49 / GCC5
> toolchains, but it breaks the build with CLANG9. Remove __inline__.
I never understod how the compiler can optimize inlining such functions,
and always considered this behavior buggy. Either declare a function as
inlined in the header exposing it and define it here, or do not declare
it as inlinable.
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> Acked-by: Laszlo Ersek <lersek@redhat.com>
> ---
> MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
> index 055f0a947e..b3a1a20256 100644
> --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
> +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
> @@ -32,7 +32,6 @@
> @return The value read.
>
> **/
> -__inline__
> UINT8
> EFIAPI
> IoRead8 (
> @@ -60,7 +59,6 @@ IoRead8 (
> @return The value written the I/O port.
>
> **/
> -__inline__
> UINT8
> EFIAPI
> IoWrite8 (
> @@ -87,7 +85,6 @@ IoWrite8 (
> @return The value read.
>
> **/
> -__inline__
> UINT16
> EFIAPI
> IoRead16 (
> @@ -117,7 +114,6 @@ IoRead16 (
> @return The value written the I/O port.
>
> **/
> -__inline__
> UINT16
> EFIAPI
> IoWrite16 (
> @@ -145,7 +141,6 @@ IoWrite16 (
> @return The value read.
>
> **/
> -__inline__
> UINT32
> EFIAPI
> IoRead32 (
> @@ -175,7 +170,6 @@ IoRead32 (
> @return The value written the I/O port.
>
> **/
> -__inline__
> UINT32
> EFIAPI
> IoWrite32 (
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 05/11] MdePkg BaseIoLibIntrinsic: Remove __inline__ attribute for IO functions
2019-10-15 0:26 ` [Patch v2 05/11] MdePkg BaseIoLibIntrinsic: Remove __inline__ attribute for IO functions Liming Gao
2019-10-15 9:26 ` [edk2-devel] " Philippe Mathieu-Daudé
@ 2019-10-22 1:42 ` Michael D Kinney
1 sibling, 0 replies; 32+ messages in thread
From: Michael D Kinney @ 2019-10-22 1:42 UTC (permalink / raw)
To: devel@edk2.groups.io, Gao, Liming, Kinney, Michael D
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On
> Behalf Of Liming Gao
> Sent: Monday, October 14, 2019 5:27 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [Patch v2 05/11] MdePkg
> BaseIoLibIntrinsic: Remove __inline__ attribute for IO
> functions
>
> __inline__ has no functional difference effect with the
> GCC48 / GCC49 / GCC5 toolchains, but it breaks the
> build with CLANG9. Remove __inline__.
>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> Acked-by: Laszlo Ersek <lersek@redhat.com>
> ---
> MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c | 6 -----
> -
> 1 file changed, 6 deletions(-)
>
> diff --git
> a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
> b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
> index 055f0a947e..b3a1a20256 100644
> --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
> +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
> @@ -32,7 +32,6 @@
> @return The value read.
>
> **/
> -__inline__
> UINT8
> EFIAPI
> IoRead8 (
> @@ -60,7 +59,6 @@ IoRead8 (
> @return The value written the I/O port.
>
> **/
> -__inline__
> UINT8
> EFIAPI
> IoWrite8 (
> @@ -87,7 +85,6 @@ IoWrite8 (
> @return The value read.
>
> **/
> -__inline__
> UINT16
> EFIAPI
> IoRead16 (
> @@ -117,7 +114,6 @@ IoRead16 (
> @return The value written the I/O port.
>
> **/
> -__inline__
> UINT16
> EFIAPI
> IoWrite16 (
> @@ -145,7 +141,6 @@ IoWrite16 (
> @return The value read.
>
> **/
> -__inline__
> UINT32
> EFIAPI
> IoRead32 (
> @@ -175,7 +170,6 @@ IoRead32 (
> @return The value written the I/O port.
>
> **/
> -__inline__
> UINT32
> EFIAPI
> IoWrite32 (
> --
> 2.13.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Patch v2 06/11] MdeModulePkg LzmaCustomDecompressLib: Update macro to be same in CLANG tool
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
` (4 preceding siblings ...)
2019-10-15 0:26 ` [Patch v2 05/11] MdePkg BaseIoLibIntrinsic: Remove __inline__ attribute for IO functions Liming Gao
@ 2019-10-15 0:26 ` Liming Gao
2019-10-16 2:05 ` [edk2-devel] " Wu, Hao A
2019-10-15 0:26 ` [Patch v2 07/11] MdeModulePkg RegularExpressionDxe: Disable warning for CLANG9 tool chain Liming Gao
` (6 subsequent siblings)
12 siblings, 1 reply; 32+ messages in thread
From: Liming Gao @ 2019-10-15 0:26 UTC (permalink / raw)
To: devel
Define the same macro in the different OS. It can make CLANG generate the same
image in the different host OS.
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
index ac06278002..c89b5c2433 100644
--- a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
+++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
@@ -118,7 +118,7 @@ typedef int Bool;
#define MY_STD_CALL
#endif
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && !defined(__clang__)
#if _MSC_VER >= 1300
#define MY_NO_INLINE __declspec(noinline)
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 06/11] MdeModulePkg LzmaCustomDecompressLib: Update macro to be same in CLANG tool
2019-10-15 0:26 ` [Patch v2 06/11] MdeModulePkg LzmaCustomDecompressLib: Update macro to be same in CLANG tool Liming Gao
@ 2019-10-16 2:05 ` Wu, Hao A
0 siblings, 0 replies; 32+ messages in thread
From: Wu, Hao A @ 2019-10-16 2:05 UTC (permalink / raw)
To: devel@edk2.groups.io, Gao, Liming
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Liming Gao
> Sent: Tuesday, October 15, 2019 8:27 AM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [Patch v2 06/11] MdeModulePkg
> LzmaCustomDecompressLib: Update macro to be same in CLANG tool
>
> Define the same macro in the different OS. It can make CLANG generate the
> same
> image in the different host OS.
>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> ---
> MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h | 2
> +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git
> a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
> b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
> index ac06278002..c89b5c2433 100644
> --- a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
> +++
> b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
> @@ -118,7 +118,7 @@ typedef int Bool;
> #define MY_STD_CALL
> #endif
>
> -#ifdef _MSC_VER
> +#if defined(_MSC_VER) && !defined(__clang__)
>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> #if _MSC_VER >= 1300
> #define MY_NO_INLINE __declspec(noinline)
> --
> 2.13.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Patch v2 07/11] MdeModulePkg RegularExpressionDxe: Disable warning for CLANG9 tool chain
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
` (5 preceding siblings ...)
2019-10-15 0:26 ` [Patch v2 06/11] MdeModulePkg LzmaCustomDecompressLib: Update macro to be same in CLANG tool Liming Gao
@ 2019-10-15 0:26 ` Liming Gao
2019-10-16 2:06 ` [edk2-devel] " Wu, Hao A
2019-10-15 0:26 ` [Patch v2 08/11] CryptoPkg: Append options to make CLANG9 tool chain pass build Liming Gao
` (5 subsequent siblings)
12 siblings, 1 reply; 32+ messages in thread
From: Liming Gao @ 2019-10-15 0:26 UTC (permalink / raw)
To: devel
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf | 3 +++
1 file changed, 3 insertions(+)
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf b/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
index 883d5f1127..e9c885465d 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
@@ -107,6 +107,9 @@
# Oniguruma: tag_end in parse_callout_of_name
GCC:*_*_*_CC_FLAGS = -Wno-error=maybe-uninitialized
+ # Oniguruma: implicit conversion from 'UINTN' (aka 'unsigned long long') to 'long'
+ GCC:*_CLANG9_*_CC_FLAGS = -Wno-error=constant-conversion
+
# Not add -Wno-error=maybe-uninitialized option for XCODE
# XCODE doesn't know this option
XCODE:*_*_*_CC_FLAGS =
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 07/11] MdeModulePkg RegularExpressionDxe: Disable warning for CLANG9 tool chain
2019-10-15 0:26 ` [Patch v2 07/11] MdeModulePkg RegularExpressionDxe: Disable warning for CLANG9 tool chain Liming Gao
@ 2019-10-16 2:06 ` Wu, Hao A
0 siblings, 0 replies; 32+ messages in thread
From: Wu, Hao A @ 2019-10-16 2:06 UTC (permalink / raw)
To: devel@edk2.groups.io, Gao, Liming
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Liming Gao
> Sent: Tuesday, October 15, 2019 8:27 AM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [Patch v2 07/11] MdeModulePkg
> RegularExpressionDxe: Disable warning for CLANG9 tool chain
>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> ---
>
> MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.in
> f | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git
> a/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.
> inf
> b/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.
> inf
> index 883d5f1127..e9c885465d 100644
> ---
> a/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.
> inf
> +++
> b/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.
> inf
> @@ -107,6 +107,9 @@
> # Oniguruma: tag_end in parse_callout_of_name
> GCC:*_*_*_CC_FLAGS = -Wno-error=maybe-uninitialized
>
> + # Oniguruma: implicit conversion from 'UINTN' (aka 'unsigned long long')
> to 'long'
> + GCC:*_CLANG9_*_CC_FLAGS = -Wno-error=constant-conversion
> +
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> # Not add -Wno-error=maybe-uninitialized option for XCODE
> # XCODE doesn't know this option
> XCODE:*_*_*_CC_FLAGS =
> --
> 2.13.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Patch v2 08/11] CryptoPkg: Append options to make CLANG9 tool chain pass build
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
` (6 preceding siblings ...)
2019-10-15 0:26 ` [Patch v2 07/11] MdeModulePkg RegularExpressionDxe: Disable warning for CLANG9 tool chain Liming Gao
@ 2019-10-15 0:26 ` Liming Gao
2019-10-15 9:29 ` [edk2-devel] " Philippe Mathieu-Daudé
2019-10-16 1:12 ` Wang, Jian J
2019-10-15 0:26 ` [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused always be used Liming Gao
` (4 subsequent siblings)
12 siblings, 2 replies; 32+ messages in thread
From: Liming Gao @ 2019-10-15 0:26 UTC (permalink / raw)
To: devel
Disable warning reported from CLANG9.
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf | 1 +
CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf | 1 +
CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf | 1 +
CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 1 +
CryptoPkg/Library/OpensslLib/OpensslLib.inf | 1 +
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 1 +
6 files changed, 6 insertions(+)
diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
index 8d4988e8c6..a98be2cd95 100644
--- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
@@ -101,5 +101,6 @@
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
+ GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
XCODE:*_*_*_CC_FLAGS = -std=c99
diff --git a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
index 3da8bd8480..7b07dd13d2 100644
--- a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
@@ -96,5 +96,6 @@
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
+ GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
XCODE:*_*_*_CC_FLAGS = -std=c99
diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
index 21a481eb77..d9e29ef660 100644
--- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
@@ -107,5 +107,6 @@
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
+ GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
XCODE:*_*_*_CC_FLAGS = -std=c99
diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
index 7c187e21b3..b4faaf3f80 100644
--- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
@@ -104,3 +104,4 @@
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
+ GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index 7432321fd4..b40d82783b 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -662,6 +662,7 @@
GCC:*_*_AARCH64_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-format -Wno-error=unused-but-set-variable
GCC:*_CLANG35_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
GCC:*_CLANG38_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
+ GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized -Wno-error=incompatible-pointer-types -Wno-error=pointer-sign -Wno-error=implicit-function-declaration -Wno-error=ignored-pragma-optimize
# suppress the following warnings in openssl so we don't break the build with warnings-as-errors:
# 1295: Deprecated declaration <entity> - give arg types
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index 8134b45eda..0a60196c8a 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -610,6 +610,7 @@
GCC:*_*_AARCH64_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-format -Wno-error=unused-but-set-variable
GCC:*_CLANG35_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
GCC:*_CLANG38_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
+ GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized -Wno-error=incompatible-pointer-types -Wno-error=pointer-sign -Wno-error=implicit-function-declaration -Wno-error=ignored-pragma-optimize
# suppress the following warnings in openssl so we don't break the build with warnings-as-errors:
# 1295: Deprecated declaration <entity> - give arg types
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 08/11] CryptoPkg: Append options to make CLANG9 tool chain pass build
2019-10-15 0:26 ` [Patch v2 08/11] CryptoPkg: Append options to make CLANG9 tool chain pass build Liming Gao
@ 2019-10-15 9:29 ` Philippe Mathieu-Daudé
2019-10-16 1:12 ` Wang, Jian J
1 sibling, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-15 9:29 UTC (permalink / raw)
To: devel, liming.gao
Hi Liming,
On 10/15/19 2:26 AM, Liming Gao wrote:
> Disable warning reported from CLANG9.
>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> ---
> CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf | 1 +
> CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf | 1 +
> CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf | 1 +
> CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 1 +
> CryptoPkg/Library/OpensslLib/OpensslLib.inf | 1 +
> CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 1 +
> 6 files changed, 6 insertions(+)
>
> diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> index 8d4988e8c6..a98be2cd95 100644
> --- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> @@ -101,5 +101,6 @@
>
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
>
> XCODE:*_*_*_CC_FLAGS = -std=c99
> diff --git a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> index 3da8bd8480..7b07dd13d2 100644
> --- a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> @@ -96,5 +96,6 @@
>
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
>
> XCODE:*_*_*_CC_FLAGS = -std=c99
> diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> index 21a481eb77..d9e29ef660 100644
> --- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> @@ -107,5 +107,6 @@
>
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
>
> XCODE:*_*_*_CC_FLAGS = -std=c99
> diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> index 7c187e21b3..b4faaf3f80 100644
> --- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> @@ -104,3 +104,4 @@
>
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
> diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> index 7432321fd4..b40d82783b 100644
> --- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> +++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> @@ -662,6 +662,7 @@
> GCC:*_*_AARCH64_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-format -Wno-error=unused-but-set-variable
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized -Wno-error=incompatible-pointer-types -Wno-error=pointer-sign -Wno-error=implicit-function-declaration -Wno-error=ignored-pragma-optimize
What pragma optimization errors are you having with Clang9?
> # suppress the following warnings in openssl so we don't break the build with warnings-as-errors:
> # 1295: Deprecated declaration <entity> - give arg types
> diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> index 8134b45eda..0a60196c8a 100644
> --- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> +++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> @@ -610,6 +610,7 @@
> GCC:*_*_AARCH64_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-format -Wno-error=unused-but-set-variable
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized -Wno-error=incompatible-pointer-types -Wno-error=pointer-sign -Wno-error=implicit-function-declaration -Wno-error=ignored-pragma-optimize
>
> # suppress the following warnings in openssl so we don't break the build with warnings-as-errors:
> # 1295: Deprecated declaration <entity> - give arg types
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 08/11] CryptoPkg: Append options to make CLANG9 tool chain pass build
2019-10-15 0:26 ` [Patch v2 08/11] CryptoPkg: Append options to make CLANG9 tool chain pass build Liming Gao
2019-10-15 9:29 ` [edk2-devel] " Philippe Mathieu-Daudé
@ 2019-10-16 1:12 ` Wang, Jian J
1 sibling, 0 replies; 32+ messages in thread
From: Wang, Jian J @ 2019-10-16 1:12 UTC (permalink / raw)
To: devel@edk2.groups.io, Gao, Liming
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Liming Gao
> Sent: Tuesday, October 15, 2019 8:27 AM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [Patch v2 08/11] CryptoPkg: Append options to make
> CLANG9 tool chain pass build
>
> Disable warning reported from CLANG9.
>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> ---
> CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf | 1 +
> CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf | 1 +
> CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf | 1 +
> CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 1 +
> CryptoPkg/Library/OpensslLib/OpensslLib.inf | 1 +
> CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 1 +
> 6 files changed, 6 insertions(+)
>
> diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> index 8d4988e8c6..a98be2cd95 100644
> --- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> @@ -101,5 +101,6 @@
>
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-
> types
>
> XCODE:*_*_*_CC_FLAGS = -std=c99
> diff --git a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> index 3da8bd8480..7b07dd13d2 100644
> --- a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> @@ -96,5 +96,6 @@
>
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-
> types
>
> XCODE:*_*_*_CC_FLAGS = -std=c99
> diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> index 21a481eb77..d9e29ef660 100644
> --- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> @@ -107,5 +107,6 @@
>
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-
> types
>
> XCODE:*_*_*_CC_FLAGS = -std=c99
> diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> index 7c187e21b3..b4faaf3f80 100644
> --- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> @@ -104,3 +104,4 @@
>
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-
> types
> diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> index 7432321fd4..b40d82783b 100644
> --- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> +++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> @@ -662,6 +662,7 @@
> GCC:*_*_AARCH64_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-
> uninitialized -Wno-format -Wno-error=unused-but-set-variable
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized -Wno-
> error=incompatible-pointer-types -Wno-error=pointer-sign -Wno-error=implicit-
> function-declaration -Wno-error=ignored-pragma-optimize
>
> # suppress the following warnings in openssl so we don't break the build with
> warnings-as-errors:
> # 1295: Deprecated declaration <entity> - give arg types
> diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> index 8134b45eda..0a60196c8a 100644
> --- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> +++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> @@ -610,6 +610,7 @@
> GCC:*_*_AARCH64_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-
> uninitialized -Wno-format -Wno-error=unused-but-set-variable
> GCC:*_CLANG35_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
> GCC:*_CLANG38_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
> + GCC:*_CLANG9_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized -Wno-
> error=incompatible-pointer-types -Wno-error=pointer-sign -Wno-error=implicit-
> function-declaration -Wno-error=ignored-pragma-optimize
>
> # suppress the following warnings in openssl so we don't break the build with
> warnings-as-errors:
> # 1295: Deprecated declaration <entity> - give arg types
> --
> 2.13.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused always be used
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
` (7 preceding siblings ...)
2019-10-15 0:26 ` [Patch v2 08/11] CryptoPkg: Append options to make CLANG9 tool chain pass build Liming Gao
@ 2019-10-15 0:26 ` Liming Gao
2019-10-15 9:30 ` [edk2-devel] " Philippe Mathieu-Daudé
2019-10-16 1:10 ` Wang, Jian J
2019-10-15 0:26 ` [Patch v2 10/11] EmulatorPkg: Enable CLANG9 tool chain Liming Gao
` (3 subsequent siblings)
12 siblings, 2 replies; 32+ messages in thread
From: Liming Gao @ 2019-10-15 0:26 UTC (permalink / raw)
To: devel
With this change, global variable _fltused will not be removed by LTO
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
index 6e4d4a68cc..94fe341bec 100644
--- a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
+++ b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
@@ -2,7 +2,7 @@
Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based
Cryptographic Library.
-Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -13,9 +13,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
typedef UINTN size_t;
+#if defined(__GNUC__) || defined(__clang__)
+ #define GLOBAL_USED __attribute__((used))
+#else
+ #define GLOBAL_USED
+#endif
+
/* OpenSSL will use floating point support, and C compiler produces the _fltused
symbol by default. Simply define this symbol here to satisfy the linker. */
-int _fltused = 1;
+int GLOBAL_USED _fltused = 1;
/* Sets buffers to a specified character */
void * memset (void *dest, int ch, size_t count)
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused always be used
2019-10-15 0:26 ` [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused always be used Liming Gao
@ 2019-10-15 9:30 ` Philippe Mathieu-Daudé
2019-10-16 1:10 ` Wang, Jian J
1 sibling, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-15 9:30 UTC (permalink / raw)
To: devel, liming.gao
On 10/15/19 2:26 AM, Liming Gao wrote:
> With this change, global variable _fltused will not be removed by LTO
>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> ---
> CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
> index 6e4d4a68cc..94fe341bec 100644
> --- a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
> +++ b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
> @@ -2,7 +2,7 @@
> Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based
> Cryptographic Library.
>
> -Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> **/
> @@ -13,9 +13,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>
> typedef UINTN size_t;
>
> +#if defined(__GNUC__) || defined(__clang__)
> + #define GLOBAL_USED __attribute__((used))
> +#else
> + #define GLOBAL_USED
> +#endif
> +
> /* OpenSSL will use floating point support, and C compiler produces the _fltused
> symbol by default. Simply define this symbol here to satisfy the linker. */
> -int _fltused = 1;
> +int GLOBAL_USED _fltused = 1;
>
> /* Sets buffers to a specified character */
> void * memset (void *dest, int ch, size_t count)
>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused always be used
2019-10-15 0:26 ` [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused always be used Liming Gao
2019-10-15 9:30 ` [edk2-devel] " Philippe Mathieu-Daudé
@ 2019-10-16 1:10 ` Wang, Jian J
1 sibling, 0 replies; 32+ messages in thread
From: Wang, Jian J @ 2019-10-16 1:10 UTC (permalink / raw)
To: devel@edk2.groups.io, Gao, Liming
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Liming Gao
> Sent: Tuesday, October 15, 2019 8:27 AM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused
> always be used
>
> With this change, global variable _fltused will not be removed by LTO
>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> ---
> CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
> b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
> index 6e4d4a68cc..94fe341bec 100644
> --- a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
> +++ b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
> @@ -2,7 +2,7 @@
> Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based
> Cryptographic Library.
>
> -Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> **/
> @@ -13,9 +13,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>
> typedef UINTN size_t;
>
> +#if defined(__GNUC__) || defined(__clang__)
> + #define GLOBAL_USED __attribute__((used))
> +#else
> + #define GLOBAL_USED
> +#endif
> +
> /* OpenSSL will use floating point support, and C compiler produces the _fltused
> symbol by default. Simply define this symbol here to satisfy the linker. */
> -int _fltused = 1;
> +int GLOBAL_USED _fltused = 1;
>
> /* Sets buffers to a specified character */
> void * memset (void *dest, int ch, size_t count)
> --
> 2.13.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Patch v2 10/11] EmulatorPkg: Enable CLANG9 tool chain
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
` (8 preceding siblings ...)
2019-10-15 0:26 ` [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused always be used Liming Gao
@ 2019-10-15 0:26 ` Liming Gao
2019-10-16 9:32 ` [edk2-devel] " Ni, Ray
2019-10-15 0:26 ` [Patch v2 11/11] OvmfPkg: " Liming Gao
` (2 subsequent siblings)
12 siblings, 1 reply; 32+ messages in thread
From: Liming Gao @ 2019-10-15 0:26 UTC (permalink / raw)
To: devel
1. Append CLANG CC and LINK flags to generate windows HOST.
2. Modify WinHost to move PCD getting in the late position
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
EmulatorPkg/Win/Host/WinHost.c | 11 +++++++----
EmulatorPkg/EmulatorPkg.dsc | 8 ++++++--
EmulatorPkg/EmulatorPkg.fdf | 2 +-
EmulatorPkg/Win/Host/WinHost.inf | 6 ++++++
4 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c
index 9aba3c8959..d51a96de7b 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
)
@@ -405,9 +405,6 @@ Returns:
AdjustTokenPrivileges(Token, FALSE, &TokenPrivileges, 0, (PTOKEN_PRIVILEGES) NULL, 0);
}
- MemorySizeStr = (CHAR16 *) PcdGetPtr (PcdEmuMemorySize);
- FirmwareVolumesStr = (CHAR16 *) PcdGetPtr (PcdEmuFirmwareVolume);
-
SecPrint ("\n\rEDK II WIN Host Emulation Environment from http://www.tianocore.org/edk2/\n\r");
//
@@ -423,6 +420,12 @@ Returns:
SetProcessAffinityMask (GetCurrentProcess (), (INTN)(BIT0 << LowBit));
}
}
+
+ //
+ // Move PCD getting late
+ //
+ MemorySizeStr = (CHAR16 *) PcdGetPtr (PcdEmuMemorySize);
+ FirmwareVolumesStr = (CHAR16 *) PcdGetPtr (PcdEmuFirmwareVolume);
//
// Make some Windows calls to Set the process to the highest priority in the
diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 20f1187713..21620d4e94 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -237,7 +237,7 @@
[Components]
!if "IA32" in $(ARCH) || "X64" in $(ARCH)
- !if "MSFT" in $(FAMILY)
+ !if "MSFT" in $(FAMILY) || "CLANG9" in $(TOOL_CHAIN_TAG)
##
# Emulator, OS WIN application
##
@@ -377,7 +377,7 @@
FatPkg/EnhancedFatDxe/Fat.inf
-!if "XCODE5" not in $(TOOL_CHAIN_TAG)
+!if "XCODE5" not in $(TOOL_CHAIN_TAG) and "CLANG9" not in $(TOOL_CHAIN_TAG)
ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
<PcdsFixedAtBuild>
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
@@ -419,7 +419,11 @@
MSFT:DEBUG_*_*_CC_FLAGS = /Od /Oy-
MSFT:NOOPT_*_*_CC_FLAGS = /Od /Oy-
+ GCC:DEBUG_CLANG9_*_CC_FLAGS =-O0 -D UNICODE -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/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
index 295f6f1db8..59d9927d29 100644
--- a/EmulatorPkg/EmulatorPkg.fdf
+++ b/EmulatorPkg/EmulatorPkg.fdf
@@ -196,7 +196,7 @@ INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
INF FatPkg/EnhancedFatDxe/Fat.inf
-!if "XCODE5" not in $(TOOL_CHAIN_TAG)
+!if "XCODE5" not in $(TOOL_CHAIN_TAG) and "CLANG9" not in $(TOOL_CHAIN_TAG)
INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
!endif
INF ShellPkg/Application/Shell/Shell.inf
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] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 10/11] EmulatorPkg: Enable CLANG9 tool chain
2019-10-15 0:26 ` [Patch v2 10/11] EmulatorPkg: Enable CLANG9 tool chain Liming Gao
@ 2019-10-16 9:32 ` Ni, Ray
2019-10-17 3:31 ` Liming Gao
0 siblings, 1 reply; 32+ messages in thread
From: Ni, Ray @ 2019-10-16 9:32 UTC (permalink / raw)
To: devel@edk2.groups.io, Gao, Liming; +Cc: 'Andrew Fish (afish@apple.com)'
Liming,
You missed the Cc tag so Andrew and I were not CCed.
3 comments in below.
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Liming
> Gao
> Sent: Tuesday, October 15, 2019 8:27 AM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [Patch v2 10/11] EmulatorPkg: Enable CLANG9 tool
> chain
>
> 1. Append CLANG CC and LINK flags to generate windows HOST.
> 2. Modify WinHost to move PCD getting in the late position
>
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> ---
> EmulatorPkg/Win/Host/WinHost.c | 11 +++++++----
> EmulatorPkg/EmulatorPkg.dsc | 8 ++++++--
> EmulatorPkg/EmulatorPkg.fdf | 2 +-
> EmulatorPkg/Win/Host/WinHost.inf | 6 ++++++
> 4 files changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/EmulatorPkg/Win/Host/WinHost.c
> b/EmulatorPkg/Win/Host/WinHost.c index 9aba3c8959..d51a96de7b 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
> )
> @@ -405,9 +405,6 @@ Returns:
> AdjustTokenPrivileges(Token, FALSE, &TokenPrivileges, 0,
> (PTOKEN_PRIVILEGES) NULL, 0);
> }
>
> - MemorySizeStr = (CHAR16 *) PcdGetPtr (PcdEmuMemorySize);
> - FirmwareVolumesStr = (CHAR16 *) PcdGetPtr (PcdEmuFirmwareVolume);
> -
> SecPrint ("\n\rEDK II WIN Host Emulation Environment from
> http://www.tianocore.org/edk2/\n\r");
>
> //
> @@ -423,6 +420,12 @@ Returns:
> SetProcessAffinityMask (GetCurrentProcess (), (INTN)(BIT0 << LowBit));
> }
> }
> +
> + //
> + // Move PCD getting late
> + //
> + MemorySizeStr = (CHAR16 *) PcdGetPtr (PcdEmuMemorySize);
> + FirmwareVolumesStr = (CHAR16 *) PcdGetPtr (PcdEmuFirmwareVolume);
1. Why move the assignment to a later place? Can you explain a bit more?
>
> //
> // Make some Windows calls to Set the process to the highest priority in the
> diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
> index 20f1187713..21620d4e94 100644
> --- a/EmulatorPkg/EmulatorPkg.dsc
> +++ b/EmulatorPkg/EmulatorPkg.dsc
> @@ -237,7 +237,7 @@
>
> [Components]
> !if "IA32" in $(ARCH) || "X64" in $(ARCH)
> - !if "MSFT" in $(FAMILY)
> + !if "MSFT" in $(FAMILY) || "CLANG9" in $(TOOL_CHAIN_TAG)
2. If CLANG9 is used in Linux, WinHost is still used. That seems not good.
> ##
> # Emulator, OS WIN application
> ##
> @@ -377,7 +377,7 @@
>
> FatPkg/EnhancedFatDxe/Fat.inf
>
> -!if "XCODE5" not in $(TOOL_CHAIN_TAG)
> +!if "XCODE5" not in $(TOOL_CHAIN_TAG) and "CLANG9" not in
> +$(TOOL_CHAIN_TAG)
3. Why TftpDynamicCommand cannot be built with CLANG9?
>
> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
> inf {
> <PcdsFixedAtBuild>
> gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
> @@ -419,7 +419,11 @@
>
> MSFT:DEBUG_*_*_CC_FLAGS = /Od /Oy-
> MSFT:NOOPT_*_*_CC_FLAGS = /Od /Oy-
> + GCC:DEBUG_CLANG9_*_CC_FLAGS =-O0 -D UNICODE
> + -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/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
> index 295f6f1db8..59d9927d29 100644
> --- a/EmulatorPkg/EmulatorPkg.fdf
> +++ b/EmulatorPkg/EmulatorPkg.fdf
> @@ -196,7 +196,7 @@ INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
>
> INF FatPkg/EnhancedFatDxe/Fat.inf
>
> -!if "XCODE5" not in $(TOOL_CHAIN_TAG)
> +!if "XCODE5" not in $(TOOL_CHAIN_TAG) and "CLANG9" not in
> +$(TOOL_CHAIN_TAG)
> INF
> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
> inf
> !endif
> INF ShellPkg/Application/Shell/Shell.inf
> 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] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 10/11] EmulatorPkg: Enable CLANG9 tool chain
2019-10-16 9:32 ` [edk2-devel] " Ni, Ray
@ 2019-10-17 3:31 ` Liming Gao
2019-10-17 5:21 ` Ni, Ray
0 siblings, 1 reply; 32+ messages in thread
From: Liming Gao @ 2019-10-17 3:31 UTC (permalink / raw)
To: Ni, Ray, devel@edk2.groups.io; +Cc: 'Andrew Fish (afish@apple.com)'
Ray:
>-----Original Message-----
>From: Ni, Ray
>Sent: Wednesday, October 16, 2019 5:32 PM
>To: devel@edk2.groups.io; Gao, Liming <liming.gao@intel.com>
>Cc: 'Andrew Fish (afish@apple.com)' <afish@apple.com>
>Subject: RE: [edk2-devel] [Patch v2 10/11] EmulatorPkg: Enable CLANG9 tool
>chain
>
>Liming,
>You missed the Cc tag so Andrew and I were not CCed.
I CC you in the cover letter, not single patch. I will add you in next version.
>
>3 comments in below.
>
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Liming
>> Gao
>> Sent: Tuesday, October 15, 2019 8:27 AM
>> To: devel@edk2.groups.io
>> Subject: [edk2-devel] [Patch v2 10/11] EmulatorPkg: Enable CLANG9 tool
>> chain
>>
>> 1. Append CLANG CC and LINK flags to generate windows HOST.
>> 2. Modify WinHost to move PCD getting in the late position
>>
>> Signed-off-by: Liming Gao <liming.gao@intel.com>
>> ---
>> EmulatorPkg/Win/Host/WinHost.c | 11 +++++++----
>> EmulatorPkg/EmulatorPkg.dsc | 8 ++++++--
>> EmulatorPkg/EmulatorPkg.fdf | 2 +-
>> EmulatorPkg/Win/Host/WinHost.inf | 6 ++++++
>> 4 files changed, 20 insertions(+), 7 deletions(-)
>>
>> diff --git a/EmulatorPkg/Win/Host/WinHost.c
>> b/EmulatorPkg/Win/Host/WinHost.c index 9aba3c8959..d51a96de7b 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
>> )
>> @@ -405,9 +405,6 @@ Returns:
>> AdjustTokenPrivileges(Token, FALSE, &TokenPrivileges, 0,
>> (PTOKEN_PRIVILEGES) NULL, 0);
>> }
>>
>> - MemorySizeStr = (CHAR16 *) PcdGetPtr (PcdEmuMemorySize);
>> - FirmwareVolumesStr = (CHAR16 *) PcdGetPtr (PcdEmuFirmwareVolume);
>> -
>> SecPrint ("\n\rEDK II WIN Host Emulation Environment from
>> http://www.tianocore.org/edk2/\n\r");
>>
>> //
>> @@ -423,6 +420,12 @@ Returns:
>> SetProcessAffinityMask (GetCurrentProcess (), (INTN)(BIT0 << LowBit));
>> }
>> }
>> +
>> + //
>> + // Move PCD getting late
>> + //
>> + MemorySizeStr = (CHAR16 *) PcdGetPtr (PcdEmuMemorySize);
>> + FirmwareVolumesStr = (CHAR16 *) PcdGetPtr (PcdEmuFirmwareVolume);
>
>1. Why move the assignment to a later place? Can you explain a bit more?
The hang issue here.
I investigate this issue more. The root cause is that GetProcessAffinityMask() API
requires the 64bit pointer as the input for 64bit ARCH. So, the correct fix should declare
ProcessAffinityMask and SystemAffinityMask as UINTN. I will update the patch.
(GetProcessAffinityMask (GetCurrentProcess (), &ProcessAffinityMask, &SystemAffinityMask))
>
>>
>> //
>> // Make some Windows calls to Set the process to the highest priority in
>the
>> diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
>> index 20f1187713..21620d4e94 100644
>> --- a/EmulatorPkg/EmulatorPkg.dsc
>> +++ b/EmulatorPkg/EmulatorPkg.dsc
>> @@ -237,7 +237,7 @@
>>
>> [Components]
>> !if "IA32" in $(ARCH) || "X64" in $(ARCH)
>> - !if "MSFT" in $(FAMILY)
>> + !if "MSFT" in $(FAMILY) || "CLANG9" in $(TOOL_CHAIN_TAG)
>
>2. If CLANG9 is used in Linux, WinHost is still used. That seems not good.
>
Now, CLANG9 is for Windows Emulator only. The key problem is that
there is no way to know which OS is used in DSC. So for now, I will add the
limitation here. For long term, we need to think the way to support Emulator usage.
>> ##
>> # Emulator, OS WIN application
>> ##
>> @@ -377,7 +377,7 @@
>>
>> FatPkg/EnhancedFatDxe/Fat.inf
>>
>> -!if "XCODE5" not in $(TOOL_CHAIN_TAG)
>> +!if "XCODE5" not in $(TOOL_CHAIN_TAG) and "CLANG9" not in
>> +$(TOOL_CHAIN_TAG)
>
>3. Why TftpDynamicCommand cannot be built with CLANG9?
>
CLANG9 supports RC section. I will update patch to remove this change.
Thanks
Liming
>>
>> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
>> inf {
>> <PcdsFixedAtBuild>
>> gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
>> @@ -419,7 +419,11 @@
>>
>> MSFT:DEBUG_*_*_CC_FLAGS = /Od /Oy-
>> MSFT:NOOPT_*_*_CC_FLAGS = /Od /Oy-
>> + GCC:DEBUG_CLANG9_*_CC_FLAGS =-O0 -D UNICODE
>> + -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/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
>> index 295f6f1db8..59d9927d29 100644
>> --- a/EmulatorPkg/EmulatorPkg.fdf
>> +++ b/EmulatorPkg/EmulatorPkg.fdf
>> @@ -196,7 +196,7 @@ INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
>>
>> INF FatPkg/EnhancedFatDxe/Fat.inf
>>
>> -!if "XCODE5" not in $(TOOL_CHAIN_TAG)
>> +!if "XCODE5" not in $(TOOL_CHAIN_TAG) and "CLANG9" not in
>> +$(TOOL_CHAIN_TAG)
>> INF
>> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
>> inf
>> !endif
>> INF ShellPkg/Application/Shell/Shell.inf
>> 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] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 10/11] EmulatorPkg: Enable CLANG9 tool chain
2019-10-17 3:31 ` Liming Gao
@ 2019-10-17 5:21 ` Ni, Ray
0 siblings, 0 replies; 32+ messages in thread
From: Ni, Ray @ 2019-10-17 5:21 UTC (permalink / raw)
To: Gao, Liming, devel@edk2.groups.io; +Cc: 'Andrew Fish (afish@apple.com)'
> >
> >1. Why move the assignment to a later place? Can you explain a bit more?
> The hang issue here.
>
> I investigate this issue more. The root cause is that GetProcessAffinityMask()
> API requires the 64bit pointer as the input for 64bit ARCH. So, the correct fix
> should declare ProcessAffinityMask and SystemAffinityMask as UINTN. I will
> update the patch.
>
> (GetProcessAffinityMask (GetCurrentProcess (), &ProcessAffinityMask,
> &SystemAffinityMask))
>
Thanks!
> >2. If CLANG9 is used in Linux, WinHost is still used. That seems not good.
> >
> Now, CLANG9 is for Windows Emulator only. The key problem is that there is
> no way to know which OS is used in DSC. So for now, I will add the limitation
> here. For long term, we need to think the way to support Emulator usage.
>
It's nice to build correct OS-host module depending on compiler tool chain.
But if CLANG9 is a cross-host compiler tool chain, I don't think such need should
be met.
So I would prefer the patch doesn't assume CLANG9 is a hint to build Win host.
Which means when using CLANG9, developer needs to use another macro to
tell build tool which host to build.
> >
> >3. Why TftpDynamicCommand cannot be built with CLANG9?
> >
> CLANG9 supports RC section. I will update patch to remove this change.
Thanks.
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Patch v2 11/11] OvmfPkg: Enable CLANG9 tool chain
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
` (9 preceding siblings ...)
2019-10-15 0:26 ` [Patch v2 10/11] EmulatorPkg: Enable CLANG9 tool chain Liming Gao
@ 2019-10-15 0:26 ` Liming Gao
2019-10-15 7:36 ` [edk2-devel] [Patch v2 00/11] New Cross OS tool chain CLANG9 Laszlo Ersek
2019-10-16 9:19 ` Bob Feng
12 siblings, 0 replies; 32+ messages in thread
From: Liming Gao @ 2019-10-15 0:26 UTC (permalink / raw)
To: devel
1. Apply CLANG9 Linker option.
2. Exclude -mno-mmx -mno-sse compiler option for CLANG9
These two options will cause CLANG Linker crush.
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
OvmfPkg/OvmfPkgIa32.dsc | 4 +++-
OvmfPkg/OvmfPkgIa32X64.dsc | 4 +++-
OvmfPkg/OvmfPkgX64.dsc | 4 +++-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 66e944436a..0fde8e6e84 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -66,7 +66,7 @@
GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
INTEL:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
MSFT:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
-!if $(TOOL_CHAIN_TAG) != "XCODE5"
+!if $(TOOL_CHAIN_TAG) != "XCODE5" && $(TOOL_CHAIN_TAG) != "CLANG9"
GCC:*_*_*_CC_FLAGS = -mno-mmx -mno-sse
!endif
@@ -80,12 +80,14 @@
[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
XCODE:*_*_*_DLINK_FLAGS =
+ CLANGPE: *_*_*_DLINK_FLAGS = /ALIGN:4096
# Force PE/COFF sections to be aligned at 4KB boundaries to support page level
# protection of DXE_SMM_DRIVER/SMM_CORE modules
[BuildOptions.common.EDKII.DXE_SMM_DRIVER, BuildOptions.common.EDKII.SMM_CORE]
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
XCODE:*_*_*_DLINK_FLAGS =
+ CLANGPE: *_*_*_DLINK_FLAGS = /ALIGN:4096
################################################################################
#
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 51c2bfb44f..c17329878e 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -66,7 +66,7 @@
GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
INTEL:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
MSFT:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
-!if $(TOOL_CHAIN_TAG) != "XCODE5"
+!if $(TOOL_CHAIN_TAG) != "XCODE5" && $(TOOL_CHAIN_TAG) != "CLANG9"
GCC:*_*_*_CC_FLAGS = -mno-mmx -mno-sse
!endif
!ifdef $(SOURCE_DEBUG_ENABLE)
@@ -85,12 +85,14 @@
[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
XCODE:*_*_*_DLINK_FLAGS =
+ CLANGPE: *_*_*_DLINK_FLAGS = /ALIGN:4096
# Force PE/COFF sections to be aligned at 4KB boundaries to support page level
# protection of DXE_SMM_DRIVER/SMM_CORE modules
[BuildOptions.common.EDKII.DXE_SMM_DRIVER, BuildOptions.common.EDKII.SMM_CORE]
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
XCODE:*_*_*_DLINK_FLAGS =
+ CLANGPE: *_*_*_DLINK_FLAGS = /ALIGN:4096
################################################################################
#
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index ba7a758844..af91265d05 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -66,7 +66,7 @@
GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
INTEL:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
MSFT:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
-!if $(TOOL_CHAIN_TAG) != "XCODE5"
+!if $(TOOL_CHAIN_TAG) != "XCODE5" && $(TOOL_CHAIN_TAG) != "CLANG9"
GCC:*_*_*_CC_FLAGS = -mno-mmx -mno-sse
!endif
!ifdef $(SOURCE_DEBUG_ENABLE)
@@ -85,12 +85,14 @@
[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
XCODE:*_*_*_DLINK_FLAGS =
+ CLANGPE: *_*_*_DLINK_FLAGS = /ALIGN:4096
# Force PE/COFF sections to be aligned at 4KB boundaries to support page level
# protection of DXE_SMM_DRIVER/SMM_CORE modules
[BuildOptions.common.EDKII.DXE_SMM_DRIVER, BuildOptions.common.EDKII.SMM_CORE]
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
XCODE:*_*_*_DLINK_FLAGS =
+ CLANGPE: *_*_*_DLINK_FLAGS = /ALIGN:4096
################################################################################
#
--
2.13.0.windows.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 00/11] New Cross OS tool chain CLANG9
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
` (10 preceding siblings ...)
2019-10-15 0:26 ` [Patch v2 11/11] OvmfPkg: " Liming Gao
@ 2019-10-15 7:36 ` Laszlo Ersek
2019-10-16 0:55 ` Liming Gao
2019-10-16 9:19 ` Bob Feng
12 siblings, 1 reply; 32+ messages in thread
From: Laszlo Ersek @ 2019-10-15 7:36 UTC (permalink / raw)
To: devel, liming.gao
Cc: Jiewen Yao, Steven Shi, Jordan Justen, Andrew Fish, Ray Ni,
Ard Biesheuvel, Jian J Wang, Hao A Wu, Bob Feng, Michael D Kinney
On 10/15/19 02:26, Liming Gao wrote:
> In v2, drop patch 12, and update commit message for 5 & 11.
Thank you, Liming.
In patch 11, there is a small typo in the commit message, "crush" vs.
"crash". If you get the chance, please correct that just before pushing.
Thanks!
Laszlo
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [Patch v2 00/11] New Cross OS tool chain CLANG9
2019-10-15 7:36 ` [edk2-devel] [Patch v2 00/11] New Cross OS tool chain CLANG9 Laszlo Ersek
@ 2019-10-16 0:55 ` Liming Gao
0 siblings, 0 replies; 32+ messages in thread
From: Liming Gao @ 2019-10-16 0:55 UTC (permalink / raw)
To: Laszlo Ersek, devel@edk2.groups.io
Cc: Yao, Jiewen, Shi, Steven, Justen, Jordan L, Andrew Fish, Ni, Ray,
Ard Biesheuvel, Wang, Jian J, Wu, Hao A, Feng, Bob C,
Kinney, Michael D
Good catch. I will correct it when I push this patch set.
>-----Original Message-----
>From: Laszlo Ersek [mailto:lersek@redhat.com]
>Sent: Tuesday, October 15, 2019 3:37 PM
>To: devel@edk2.groups.io; Gao, Liming <liming.gao@intel.com>
>Cc: Yao, Jiewen <jiewen.yao@intel.com>; Shi, Steven
><steven.shi@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>;
>Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>; Ard Biesheuvel
><ard.biesheuvel@linaro.org>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao
>A <hao.a.wu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Kinney,
>Michael D <michael.d.kinney@intel.com>
>Subject: Re: [edk2-devel] [Patch v2 00/11] New Cross OS tool chain CLANG9
>
>On 10/15/19 02:26, Liming Gao wrote:
>> In v2, drop patch 12, and update commit message for 5 & 11.
>
>Thank you, Liming.
>
>In patch 11, there is a small typo in the commit message, "crush" vs.
>"crash". If you get the chance, please correct that just before pushing.
>
>Thanks!
>Laszlo
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Patch v2 00/11] New Cross OS tool chain CLANG9
2019-10-15 0:26 [Patch v2 00/11] New Cross OS tool chain CLANG9 Liming Gao
` (11 preceding siblings ...)
2019-10-15 7:36 ` [edk2-devel] [Patch v2 00/11] New Cross OS tool chain CLANG9 Laszlo Ersek
@ 2019-10-16 9:19 ` Bob Feng
2019-10-17 2:15 ` Liming Gao
12 siblings, 1 reply; 32+ messages in thread
From: Bob Feng @ 2019-10-16 9:19 UTC (permalink / raw)
To: Gao, Liming, devel@edk2.groups.io
Cc: Yao, Jiewen, Shi, Steven, Justen, Jordan L, Laszlo Ersek,
Andrew Fish, Ni, Ray, Ard Biesheuvel, Wang, Jian J, Wu, Hao A,
Kinney, Michael D
Hi Liming,
Would you please add the BZ link to each of the patches? So that we can see it in git commit log.
Thanks,
Bob
-----Original Message-----
From: Gao, Liming
Sent: Tuesday, October 15, 2019 8:27 AM
To: devel@edk2.groups.io
Cc: Yao, Jiewen <jiewen.yao@intel.com>; Shi, Steven <steven.shi@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Laszlo Ersek <lersek@redhat.com>; Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [Patch v2 00/11] New Cross OS tool chain CLANG9
In v2, drop patch 12, and update commit message for 5 & 11.
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603
Code: https://github.com/lgao4/edk2/tree/CLANG9
Wiki: https://github.com/lgao4/edk2/wiki/CLANG9-Tools-Chain
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.
It must use LLVM 9 or above release. LLVM 9 is ready on http://releases.llvm.org/download.html#9.0.0.
CLANG9 is the cross OS tool chain. It can work on Windows/Linux/Mac host OS.
For the same source code, with the same version LLVM tool chain,
CLANG9 can generate the same binary image. So, the developer can choose the different development environment and work on the same code base. Besides, EDKII project build also requires third party
tools: nasm and iasl. They both keep the same version. If so, the same binary image can be generated on the different host OS.
LLVM tool chain provides the compiler and linker. To build EDK2 project, some other tools are still required. On Windows OS, nmake and Visual Studio are required to call Makefile and compile BaseTools C tools.
On Linux/Mac, binutils and gcc are required to make and compile BaseTools C tools. Because VS or GCC are mainly used to compile BaseTools and provide nmake/make tool, they can keep on the stable version without update.
To build source code, CLANG9 tool chain (-t CLANG9) can be specified on Windows OS, set CLANG_HOST_BIN=n, set CLANG9_BIN=LLVM installed directory CLANG_HOST_BIN is used CLANG_HOST_PREFIX. Prefix n is for nmake.
For example:
* set CLANG_HOST_BIN=n
* set CLANG9_BIN=C:\Program Files\LLVM\bin\
* set IASL_PREFIX=C:\Asl\
On Linux/Mac, export CLANG9_BIN=LLVM installed directory, CLANG_HOST_BIN is not required, because there is no prefix for make.
For example:
* export CLANG9_BIN=/home/clang9/bin/
Now, CLANG9 tool chain has been verified in Edk2 packages and Ovmf/Emulator with LLVM 9.0.0 on Windows and Linux OS.
OVMF IA32/X64/IA32X64 all boots to Shell on Windows and Linux OS.
Emulator can boot to Shell on Windows only with CLANG9.
OVMF Ia32X64 RELEASE build generates the same BIOS images on Windows and Linux OS.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Steven Shi <steven.shi@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Liming Gao (11):
BaseTools tools_def.template: Remove unnecessary $(DEST_DIR_DEBUG)
path
BaseTools tools_def: Add CLANG9 tool chain to directly generate PE
image
BaseTools GenFw: Fix the issue to update the wrong size as SectionSize
MdePkg Base.h: Add definition for CLANG9 tool chain
MdePkg BaseIoLibIntrinsic: Remove __inline__ attribute for IO
functions
MdeModulePkg LzmaCustomDecompressLib: Update macro to be same in CLANG
tool
MdeModulePkg RegularExpressionDxe: Disable warning for CLANG9 tool
chain
CryptoPkg: Append options to make CLANG9 tool chain pass build
CryptoPkg IntrinsicLib: Make _fltused always be used
EmulatorPkg: Enable CLANG9 tool chain
OvmfPkg: Enable CLANG9 tool chain
BaseTools/Source/C/GenFw/GenFw.c | 8 +-
CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c | 10 +-
EmulatorPkg/Win/Host/WinHost.c | 11 +-
MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c | 6 -
BaseTools/Conf/build_rule.template | 26 +++--
BaseTools/Conf/tools_def.template | 124 +++++++++++++++++++--
CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf | 1 +
CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf | 1 +
CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf | 1 +
CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 1 +
CryptoPkg/Library/OpensslLib/OpensslLib.inf | 1 +
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 1 +
EmulatorPkg/EmulatorPkg.dsc | 8 +-
EmulatorPkg/EmulatorPkg.fdf | 2 +-
EmulatorPkg/Win/Host/WinHost.inf | 6 +
.../LzmaCustomDecompressLib/Sdk/C/7zTypes.h | 2 +-
.../RegularExpressionDxe/RegularExpressionDxe.inf | 3 +
MdePkg/Include/Base.h | 6 +-
MdePkg/Include/Ia32/ProcessorBind.h | 4 +-
MdePkg/Include/X64/ProcessorBind.h | 2 +-
OvmfPkg/OvmfPkgIa32.dsc | 4 +-
OvmfPkg/OvmfPkgIa32X64.dsc | 4 +-
OvmfPkg/OvmfPkgX64.dsc | 4 +-
23 files changed, 188 insertions(+), 48 deletions(-)
--
2.13.0.windows.1
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Patch v2 00/11] New Cross OS tool chain CLANG9
2019-10-16 9:19 ` Bob Feng
@ 2019-10-17 2:15 ` Liming Gao
0 siblings, 0 replies; 32+ messages in thread
From: Liming Gao @ 2019-10-17 2:15 UTC (permalink / raw)
To: Feng, Bob C, devel@edk2.groups.io
Cc: Yao, Jiewen, Shi, Steven, Justen, Jordan L, Laszlo Ersek,
Andrew Fish, Ni, Ray, Ard Biesheuvel, Wang, Jian J, Wu, Hao A,
Kinney, Michael D
Yes. I will add it on next version patch.
Thanks
Liming
>-----Original Message-----
>From: Feng, Bob C
>Sent: Wednesday, October 16, 2019 5:19 PM
>To: Gao, Liming <liming.gao@intel.com>; devel@edk2.groups.io
>Cc: Yao, Jiewen <jiewen.yao@intel.com>; Shi, Steven
><steven.shi@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Laszlo
>Ersek <lersek@redhat.com>; Andrew Fish <afish@apple.com>; Ni, Ray
><ray.ni@intel.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Wang, Jian
>J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Kinney,
>Michael D <michael.d.kinney@intel.com>
>Subject: RE: [Patch v2 00/11] New Cross OS tool chain CLANG9
>
>Hi Liming,
>
>Would you please add the BZ link to each of the patches? So that we can see it
>in git commit log.
>
>Thanks,
>Bob
>
>-----Original Message-----
>From: Gao, Liming
>Sent: Tuesday, October 15, 2019 8:27 AM
>To: devel@edk2.groups.io
>Cc: Yao, Jiewen <jiewen.yao@intel.com>; Shi, Steven
><steven.shi@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Laszlo
>Ersek <lersek@redhat.com>; Andrew Fish <afish@apple.com>; Ni, Ray
><ray.ni@intel.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Wang, Jian
>J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Feng, Bob C
><bob.c.feng@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
>Subject: [Patch v2 00/11] New Cross OS tool chain CLANG9
>
>In v2, drop patch 12, and update commit message for 5 & 11.
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603
>Code: https://github.com/lgao4/edk2/tree/CLANG9
>Wiki: https://github.com/lgao4/edk2/wiki/CLANG9-Tools-Chain
>
>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.
>It must use LLVM 9 or above release. LLVM 9 is ready on
>http://releases.llvm.org/download.html#9.0.0.
>
>CLANG9 is the cross OS tool chain. It can work on Windows/Linux/Mac host OS.
>For the same source code, with the same version LLVM tool chain,
>CLANG9 can generate the same binary image. So, the developer can choose
>the different development environment and work on the same code base.
>Besides, EDKII project build also requires third party
>tools: nasm and iasl. They both keep the same version. If so, the same binary
>image can be generated on the different host OS.
>
>LLVM tool chain provides the compiler and linker. To build EDK2 project, some
>other tools are still required. On Windows OS, nmake and Visual Studio are
>required to call Makefile and compile BaseTools C tools.
>On Linux/Mac, binutils and gcc are required to make and compile BaseTools C
>tools. Because VS or GCC are mainly used to compile BaseTools and provide
>nmake/make tool, they can keep on the stable version without update.
>
>To build source code, CLANG9 tool chain (-t CLANG9) can be specified on
>Windows OS, set CLANG_HOST_BIN=n, set CLANG9_BIN=LLVM installed
>directory CLANG_HOST_BIN is used CLANG_HOST_PREFIX. Prefix n is for
>nmake.
>For example:
>* set CLANG_HOST_BIN=n
>* set CLANG9_BIN=C:\Program Files\LLVM\bin\
>* set IASL_PREFIX=C:\Asl\
>
>On Linux/Mac, export CLANG9_BIN=LLVM installed directory,
>CLANG_HOST_BIN is not required, because there is no prefix for make.
>For example:
>* export CLANG9_BIN=/home/clang9/bin/
>
>Now, CLANG9 tool chain has been verified in Edk2 packages and
>Ovmf/Emulator with LLVM 9.0.0 on Windows and Linux OS.
>OVMF IA32/X64/IA32X64 all boots to Shell on Windows and Linux OS.
>Emulator can boot to Shell on Windows only with CLANG9.
>OVMF Ia32X64 RELEASE build generates the same BIOS images on Windows
>and Linux OS.
>
>Cc: Jiewen Yao <jiewen.yao@intel.com>
>Cc: Steven Shi <steven.shi@intel.com>
>Cc: Jordan Justen <jordan.l.justen@intel.com>
>Cc: Laszlo Ersek <lersek@redhat.com>
>Cc: Andrew Fish <afish@apple.com>
>Cc: Ray Ni <ray.ni@intel.com>
>Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>Cc: Jian J Wang <jian.j.wang@intel.com>
>Cc: Hao A Wu <hao.a.wu@intel.com>
>Cc: Bob Feng <bob.c.feng@intel.com>
>Cc: Michael D Kinney <michael.d.kinney@intel.com>
>
>Liming Gao (11):
> BaseTools tools_def.template: Remove unnecessary $(DEST_DIR_DEBUG)
> path
> BaseTools tools_def: Add CLANG9 tool chain to directly generate PE
> image
> BaseTools GenFw: Fix the issue to update the wrong size as SectionSize
> MdePkg Base.h: Add definition for CLANG9 tool chain
> MdePkg BaseIoLibIntrinsic: Remove __inline__ attribute for IO
> functions
> MdeModulePkg LzmaCustomDecompressLib: Update macro to be same in
>CLANG
> tool
> MdeModulePkg RegularExpressionDxe: Disable warning for CLANG9 tool
> chain
> CryptoPkg: Append options to make CLANG9 tool chain pass build
> CryptoPkg IntrinsicLib: Make _fltused always be used
> EmulatorPkg: Enable CLANG9 tool chain
> OvmfPkg: Enable CLANG9 tool chain
>
> BaseTools/Source/C/GenFw/GenFw.c | 8 +-
> CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c | 10 +-
> EmulatorPkg/Win/Host/WinHost.c | 11 +-
> MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c | 6 -
> BaseTools/Conf/build_rule.template | 26 +++--
> BaseTools/Conf/tools_def.template | 124 +++++++++++++++++++--
> CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf | 1 +
> CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf | 1 +
> CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf | 1 +
> CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 1 +
> CryptoPkg/Library/OpensslLib/OpensslLib.inf | 1 +
> CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 1 +
> EmulatorPkg/EmulatorPkg.dsc | 8 +-
> EmulatorPkg/EmulatorPkg.fdf | 2 +-
> EmulatorPkg/Win/Host/WinHost.inf | 6 +
> .../LzmaCustomDecompressLib/Sdk/C/7zTypes.h | 2 +-
> .../RegularExpressionDxe/RegularExpressionDxe.inf | 3 +
> MdePkg/Include/Base.h | 6 +-
> MdePkg/Include/Ia32/ProcessorBind.h | 4 +-
> MdePkg/Include/X64/ProcessorBind.h | 2 +-
> OvmfPkg/OvmfPkgIa32.dsc | 4 +-
> OvmfPkg/OvmfPkgIa32X64.dsc | 4 +-
> OvmfPkg/OvmfPkgX64.dsc | 4 +-
> 23 files changed, 188 insertions(+), 48 deletions(-)
>
>--
>2.13.0.windows.1
^ permalink raw reply [flat|nested] 32+ messages in thread