Re: [edk2] [patch] SecurityPkg: Fixed build error due to FixedAtBuild PcdTcg2HashAlgorithmBitmap

2015-08-14 Thread Yao, Jiewen
Sounds good to me.

Thank you
Yao Jiewen

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
El-Haj-Mahmoud, Samer
Sent: Saturday, August 15, 2015 8:55 AM
To: edk2-devel@lists.01.org
Cc: El-Haj-Mahmoud, Samer; Zhang, Chao B
Subject: [edk2] [patch] SecurityPkg: Fixed build error due to FixedAtBuild 
PcdTcg2HashAlgorithmBitmap

PcdTcg2HashAlgorithmBitmap is declared in a section that allows it to be Fixed 
or PatchableAtBuild, but there is code that sets it. This breaks the build on 
some platforms. Changed it to be PcdsDynamic and PcdsDynamicEx only.

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Samer El-Haj-Mahmoud 





Samer El-Haj-Mahmoud
System Firmware Architect
HP Servers 

el...@hp.com 
T +1.281.514.5973
C +1.512.659.1523
Hewlett-Packard Company
hp.com/go/proliant/uefi



___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [patch] SecurityPkg: Fixed build error due to FixedAtBuild PcdTcg2HashAlgorithmBitmap

2015-08-14 Thread El-Haj-Mahmoud, Samer
PcdTcg2HashAlgorithmBitmap is declared in a section that allows it to be Fixed 
or PatchableAtBuild, but there is code that sets it. This breaks the build on 
some platforms. Changed it to be PcdsDynamic and PcdsDynamicEx only.

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Samer El-Haj-Mahmoud 





Samer El-Haj-Mahmoud
System Firmware Architect
HP Servers 

el...@hp.com 
T +1.281.514.5973
C +1.512.659.1523
Hewlett-Packard Company
hp.com/go/proliant/uefi



___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] Help debugging PEIM on Minnowboard Max

2015-08-14 Thread Eric Wittmayer
I'm writing a PEIM for a USB3 device but having trouble even getting the
UsbBusPie and XhciPei modules to load during boot.

I thought getting the existing Usb Peims to load would be a good first step.
I looked at the DEPEX for both of the above modules and tried removing
"gEfiPeiBootInRecoveryModePpiGuid" but I didn't see them load.  If I set
both of their DEPEX == TRUE then I see some print statements that show they
are at least trying to load but then I have a chicken and egg problem in
that UsbBusPie needs either gPeiUsbHostControllerPpiGuid or
gPeiUsb2HostControllerPpiGuid which come from XhciPei.  However, XhciPei
needs gPeiUsbControllerPpiGuid which comes from UsbBusPei before  it will
install the gPeiUsb2HostControllerPpiGuid.  The same cross dependency is
shown in the DEPEX for these two modules.

I feel like I'm missing something simple and fundamental and I'm hoping
someone will point me in the right direction.

Thanks,
Eric W

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [patch] Fix typo in BaseCrypto2HashInit() which causes sanity check incorrect.

2015-08-14 Thread jiewen yao
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" 
Cc: "Zhang, Chao B" 
---
 SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c 
b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
index 6a7ecf2..dab0299 100644
--- a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
+++ b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
@@ -454,7 +454,7 @@ BaseCrypto2HashInit (
   // Consistency Check
   //
   Instance = HASH2_INSTANCE_DATA_FROM_THIS(This);
-  if ((Instance->HashContext != NULL) || (Instance->HashInfoContext != 
HashInfo)) {
+  if ((Instance->HashContext != NULL) || (Instance->HashInfoContext != NULL)) {
 return EFI_ALREADY_STARTED;
   }
 
-- 
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] OVMF: iasl "Control Method should be made Serialized"

2015-08-14 Thread Bruce Cran
With iasl version 20150410-64 building OvmfX64 (using OvmfPkg/build.sh 
-a X64 -t GCC49 -b RELEASE) results in a couple of warnings about 
methods that should be serialized:


"iasl" 
-p/home/bcran/workspace/edk2/Build/OvmfX64/RELEASE_GCC49/X64/OvmfPkg/AcpiTables/AcpiTables/OUTPUT/./Dsdt.aml 
/home/bcran/workspace/edk2/Build/OvmfX64/RELEASE_GCC49/X64/OvmfPkg/AcpiTables/AcpiTables/OUTPUT/./Dsdt.
/home/bcran/workspace/edk2/Build/OvmfX64/RELEASE_GCC49/X64/OvmfPkg/AcpiTables/AcpiTables/OUTPUT/./Dsdt. 
95:   Method (_CRS, 0) {
Remark   2120 - Control Method should be made Serialized ^  (due to 
creation of named objects within)


/home/bcran/workspace/edk2/Build/OvmfX64/RELEASE_GCC49/X64/OvmfPkg/AcpiTables/AcpiTables/OUTPUT/./Dsdt. 
235: Method (PCRS, 1, NotSerialized) {
Remark   2120 - Control Method should be made Serialized ^  (due to 
creation of named objects within)



--
Bruce
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 13/15] BaseTools: unify ASM flags for all GCC versions

2015-08-14 Thread Ard Biesheuvel
Use the same GCC options for assembling regardless of the exact
GCC version.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 67 
 1 file changed, 27 insertions(+), 40 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index fdabd6e716c9..38f7996d57d7 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3845,7 +3845,13 @@ DEFINE GCC_AARCH64_DLINK2_FLAGS= 
--defsym=PECOFF_HEADER_SIZE=0x228 DEF(GCC_A
 
 DEFINE GCC_IPF_OBJCOPY_FLAGS   = -I elf64-ia64-little -O efi-bsdrv-ia64
 DEFINE GCC_IPF_SYMRENAME_FLAGS = --redefine-sym memcpy=CopyMem
+
 DEFINE GCC_ASM_FLAGS   = -c -x assembler -imacros 
$(DEST_DIR_DEBUG)/AutoGen.h
+DEFINE GCC_IA32_ASM_FLAGS  = DEF(GCC_ASM_FLAGS) -m32 -Wa,--32 
-march=i386
+DEFINE GCC_X64_ASM_FLAGS   = DEF(GCC_ASM_FLAGS) -m64 -Wa,--64
+DEFINE GCC_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
+DEFINE GCC_AARCH64_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
+
 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_ASLPP_FLAGS = -x c -E -P
@@ -3856,25 +3862,6 @@ DEFINE GCC_IPF_RC_FLAGS= -I binary -O 
elf64-ia64-little   -B ia64
 DEFINE GCC_ARM_RC_FLAGS= -I binary -O elf32-littlearm -B arm   
  --rename-section .data=.hii
 DEFINE GCC_AARCH64_RC_FLAGS= -I binary -O elf64-littleaarch64 -B 
aarch64 --rename-section .data=.hii
 
-DEFINE GCC44_ASM_FLAGS   = DEF(GCC_ASM_FLAGS)
-
-DEFINE GCC45_ASM_FLAGS   = DEF(GCC44_ASM_FLAGS)
-
-DEFINE GCC46_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
-DEFINE GCC46_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
-
-DEFINE GCC47_ASM_FLAGS   = DEF(GCC46_ASM_FLAGS)
-DEFINE GCC47_ARM_ASM_FLAGS   = DEF(GCC46_ARM_ASM_FLAGS)
-DEFINE GCC47_AARCH64_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
-
-DEFINE GCC48_ASM_FLAGS   = DEF(GCC47_ASM_FLAGS)
-DEFINE GCC48_ARM_ASM_FLAGS   = DEF(GCC47_ARM_ASM_FLAGS)
-DEFINE GCC48_AARCH64_ASM_FLAGS   = DEF(GCC47_AARCH64_ASM_FLAGS)
-
-DEFINE GCC49_ASM_FLAGS   = DEF(GCC48_ASM_FLAGS)
-DEFINE GCC49_ARM_ASM_FLAGS   = DEF(GCC48_ARM_ASM_FLAGS)
-DEFINE GCC49_AARCH64_ASM_FLAGS   = DEF(GCC48_AARCH64_ASM_FLAGS)
-
 

 #
 # Unix GCC And Intel Linux ACPI Compiler
@@ -4000,7 +3987,7 @@ DEFINE GCC49_AARCH64_ASM_FLAGS   = 
DEF(GCC48_AARCH64_ASM_FLAGS)
 
 *_GCC44_IA32_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m32
 *_GCC44_IA32_ASLDLINK_FLAGS   = DEF(GCC_IA32_ASLDLINK_ELF_FLAGS)
-*_GCC44_IA32_ASM_FLAGS= DEF(GCC44_ASM_FLAGS) -m32 --32 -march=i386
+*_GCC44_IA32_ASM_FLAGS= DEF(GCC_IA32_ASM_FLAGS)
 *_GCC44_IA32_CC_FLAGS = DEF(GCC_IA32_CC_ELF_FLAGS) -Os
 *_GCC44_IA32_DLINK_FLAGS  = DEF(GCC_IA32_DLINK_ELF_FLAGS)
 *_GCC44_IA32_DLINK2_FLAGS = DEF(GCC_IA32_DLINK2_FLAGS)
@@ -4025,7 +4012,7 @@ DEFINE GCC49_AARCH64_ASM_FLAGS   = 
DEF(GCC48_AARCH64_ASM_FLAGS)
 
 *_GCC44_X64_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m64
 *_GCC44_X64_ASLDLINK_FLAGS   = DEF(GCC_X64_ASLDLINK_ELF_FLAGS)
-*_GCC44_X64_ASM_FLAGS= DEF(GCC44_ASM_FLAGS) -m64 --64 -melf_x86_64
+*_GCC44_X64_ASM_FLAGS= DEF(GCC_X64_ASM_FLAGS) -melf_x86_64
 *_GCC44_X64_CC_FLAGS = DEF(GCC_X64_CC_ELF_FLAGS)
 *_GCC44_X64_DLINK_FLAGS  = DEF(GCC_X64_DLINK_ELF_FLAGS)
 *_GCC44_X64_DLINK2_FLAGS = DEF(GCC_X64_DLINK2_FLAGS)
@@ -4070,7 +4057,7 @@ DEFINE GCC49_AARCH64_ASM_FLAGS   = 
DEF(GCC48_AARCH64_ASM_FLAGS)
 
 *_GCC45_IA32_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m32
 *_GCC45_IA32_ASLDLINK_FLAGS   = DEF(GCC_IA32_ASLDLINK_ELF_FLAGS)
-*_GCC45_IA32_ASM_FLAGS= DEF(GCC45_ASM_FLAGS) -m32 --32 -march=i386
+*_GCC45_IA32_ASM_FLAGS= DEF(GCC_IA32_ASM_FLAGS)
 *_GCC45_IA32_CC_FLAGS = DEF(GCC_IA32_CC_ELF_FLAGS) -Os
 *_GCC45_IA32_DLINK_FLAGS  = DEF(GCC_IA32_DLINK_ELF_FLAGS)
 *_GCC45_IA32_DLINK2_FLAGS = DEF(GCC_IA32_DLINK2_FLAGS)
@@ -4095,7 +4082,7 @@ DEFINE GCC49_AARCH64_ASM_FLAGS   = 
DEF(GCC48_AARCH64_ASM_FLAGS)
 
 *_GCC45_X64_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m64
 *_GCC45_X64_ASLDLINK_FLAGS   = DEF(GCC_X64_ASLDLINK_ELF_FLAGS)
-*_GCC45_X64_ASM_FLAGS= DEF(GCC45_ASM_FLAGS) -m64 --64 -melf_x86_64
+*_GCC45_X64_ASM_FLAGS= DEF(GCC_X64_ASM_FLAGS) -melf_x86_64
 *_GCC45_X64_CC_FLAGS = DEF(GCC_X64_CC_ELF_FLAGS)
 *_GC

[edk2] [PATCH 14/15] BaseTools: align ELFGCC with GCC4x toolchains

2015-08-14 Thread Ard Biesheuvel
This aligns the remaining configuration options for ELFGCC with
the other ELF based toolchains.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 38f7996d57d7..fabfe7436167 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4873,8 +4873,8 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = 
DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
 *_ELFGCC_IA32_DLINK2_FLAGS  = DEF(GCC_IA32_DLINK2_FLAGS)
 *_ELFGCC_IA32_ASLDLINK_FLAGS= DEF(GCC_IA32_ASLDLINK_ELF_FLAGS)
 *_ELFGCC_IA32_ASM_FLAGS = DEF(GCC_IA32_ASM_FLAGS)
-*_ELFGCC_IA32_PP_FLAGS  = -m32 -E -x assembler-with-cpp -include 
$(DEST_DIR_DEBUG)/AutoGen.h
-*_ELFGCC_IA32_VFRPP_FLAGS   = -x c -E -P -DVFRCOMPILE --include 
$(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
+*_ELFGCC_IA32_PP_FLAGS  = DEF(GCC_PP_FLAGS)
+*_ELFGCC_IA32_VFRPP_FLAGS   = DEF(GCC_VFRPP_FLAGS)
 *_ELFGCC_IA32_RC_FLAGS  = DEF(GCC_IA32_RC_FLAGS)
 *_ELFGCC_IA32_OBJCOPY_FLAGS =
 *_ELFGCC_IA32_NASM_FLAGS= -f elf32
@@ -4899,8 +4899,8 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = 
DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
 *_ELFGCC_X64_DLINK2_FLAGS  = DEF(GCC_X64_DLINK2_FLAGS)
 *_ELFGCC_X64_ASLDLINK_FLAGS= DEF(GCC_X64_ASLDLINK_ELF_FLAGS)
 *_ELFGCC_X64_ASM_FLAGS = DEF(GCC_X64_ASM_FLAGS)
-*_ELFGCC_X64_PP_FLAGS  = -E -x assembler-with-cpp -include 
$(DEST_DIR_DEBUG)/AutoGen.h
-*_ELFGCC_X64_VFRPP_FLAGS   = -x c -E -P -DVFRCOMPILE --include 
$(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
+*_ELFGCC_X64_PP_FLAGS  = DEF(GCC_PP_FLAGS)
+*_ELFGCC_X64_VFRPP_FLAGS   = DEF(GCC_VFRPP_FLAGS)
 *_ELFGCC_X64_RC_FLAGS  = DEF(GCC_X64_RC_FLAGS)
 *_ELFGCC_X64_NASM_FLAGS= -f elf64
 
@@ -4918,12 +4918,12 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = 
DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
 *_ELFGCC_IPF_VFRPP_PATH   = DEF(ELFGCC_BIN)/gcc
 *_ELFGCC_IPF_RC_PATH  = DEF(ELFGCC_BIN)/objcopy
 
-*_ELFGCC_IPF_CC_FLAGS = -Os -fshort-wchar -Wall -Werror -c 
-include AutoGen.h -D_EFI_P64
-*_ELFGCC_IPF_DLINK_FLAGS  = -nostdlib --shared --entry 
$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+*_ELFGCC_IPF_CC_FLAGS = DEF(GCC_IPF_CC_FLAGS)
 *_ELFGCC_IPF_SLINK_FLAGS  =
-*_ELFGCC_IPF_ASM_FLAGS= -c -x assembler -imacros 
$(DEST_DIR_DEBUG)/AutoGen.h
-*_ELFGCC_IPF_PP_FLAGS = -E -x assembler-with-cpp -include 
$(DEST_DIR_DEBUG)/AutoGen.h
-*_ELFGCC_IPF_VFRPP_FLAGS  = -x c -E -P -DVFRCOMPILE --include 
$(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
+*_ELFGCC_IPF_DLINK_FLAGS  = DEF(GCC_IPF_DLINK_FLAGS)
+*_ELFGCC_IPF_ASM_FLAGS= DEF(GCC_ASM_FLAGS)
+*_ELFGCC_IPF_PP_FLAGS = DEF(GCC_PP_FLAGS)
+*_ELFGCC_IPF_VFRPP_FLAGS  = DEF(GCC_VFRPP_FLAGS)
 *_ELFGCC_IPF_RC_FLAGS = DEF(GCC_IPF_RC_FLAGS)
 
 

-- 
1.9.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 15/15] OvmfPkg/X64: enable 4 KB alignment for DXE_RUNTIME modules

2015-08-14 Thread Ard Biesheuvel
This enables 4 KB section alignment for DXE_RUNTIME modules, for
ELF based toolchains and for the UNIXGCC PE/COFF toolchain.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 OvmfPkg/OvmfPkgX64.dsc | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index b72eaa92f82e..817c381f4913 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -48,6 +48,13 @@ [BuildOptions]
   INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable
 !endif
 
+[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
+!if $(TOOLCHAIN) == UNIXGCC
+  GCC:*_*_X64_DLINK_FLAGS = --section-alignment 0x1000 --file-alignment 0x1000
+!else
+  GCC:*_*_X64_DLINK_FLAGS = -z common-page-size=0x1000
+!endif
+
 

 #
 # SKU Identification section - list of all SKU IDs supported by this Platform.
-- 
1.9.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 12/15] BaseTools: unify ARM and AARCH64 DLINK flags for all GCC versions

2015-08-14 Thread Ard Biesheuvel
Use the same GCC options for linking regardless of the exact
GCC version.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 63 +++-
 1 file changed, 23 insertions(+), 40 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 8aaa9d62625b..fdabd6e716c9 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3818,7 +3818,6 @@ DEFINE GCC_IPF_CC_FLAGS= 
DEF(GCC_ALL_ELF_CC_FLAGS) -Os -minline-int-
 DEFINE GCC_ARM_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ALL_ELF_CC_FLAGS) -Os -mword-relocations -mlittle-endian -mabi=aapcs 
-mapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections 
-fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft 
-fstack-protector -mno-unaligned-access
 DEFINE GCC_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ALL_ELF_CC_FLAGS) -Os -mcmodel=large -mlittle-endian -fno-short-enums 
-save-temps -fverbose-asm -fsigned-char  -ffunction-sections -fdata-sections 
-fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables
 
-DEFINE GCC_DLINK2_FLAGS_COMMON = 
--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
 DEFINE GCC_ALL_DLINK_FLAGS = -nostdlib
 DEFINE GCC_ALL_DLINK_PE_FLAGS  = DEF(GCC_ALL_DLINK_FLAGS) --pie
 DEFINE GCC_ALL_DLINK_ELF_FLAGS = DEF(GCC_ALL_DLINK_FLAGS) -n -q 
--gc-sections -z common-page-size=0x20
@@ -3828,20 +3827,21 @@ DEFINE GCC_IA32_DLINK_PE_FLAGS = 
DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry _$
 DEFINE GCC_IA32_DLINK_ELF_FLAGS= DEF(GCC_IA32_X64_DLINK_ELF_FLAGS) -m 
elf_i386 --oformat=elf32-i386
 DEFINE GCC_X64_DLINK_PE_FLAGS  = DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry 
$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 DEFINE GCC_X64_DLINK_ELF_FLAGS = DEF(GCC_IA32_X64_DLINK_ELF_FLAGS) 
-melf_x86_64 --oformat=elf64-x86-64
-DEFINE GCC_ARM_AARCH64_DLINK_COMMON= --emit-relocs -nostdlib --gc-sections -u 
$(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
-DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) 
-Ttext=0x0
-DEFINE GCC_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z 
common-page-size=0x20
+DEFINE GCC_ARM_AARCH64_DLINK_FLAGS = --emit-relocs -nostdlib --gc-sections -u 
$(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_FLAGS) 
-Ttext=0x0 --oformat=elf32-littlearm
+DEFINE GCC_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_FLAGS) -z 
common-page-size=0x20
 DEFINE GCC_IA32_ASLDLINK_PE_FLAGS  = DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry 
_ReferenceAcpiTable -u _$(IMAGE_ENTRY_POINT)
 DEFINE GCC_X64_ASLDLINK_PE_FLAGS   = DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
 DEFINE GCC_IA32_ASLDLINK_ELF_FLAGS = DEF(GCC_ALL_DLINK_ELF_FLAGS) --entry 
ReferenceAcpiTable -u ReferenceAcpiTable -melf_i386
 DEFINE GCC_X64_ASLDLINK_ELF_FLAGS  = DEF(GCC_ALL_DLINK_ELF_FLAGS) --entry 
ReferenceAcpiTable -u ReferenceAcpiTable -melf_x86_64
-DEFINE GCC_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_DLINK_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
+DEFINE GCC_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_DLINK_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) --oformat=elf32-littlearm
 DEFINE GCC_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_AARCH64_DLINK_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
 DEFINE GCC_IPF_DLINK_FLAGS = -nostdlib -O2 --gc-sections --dll -static 
--entry $(IMAGE_ENTRY_POINT) --undefined $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 
 DEFINE GCC_ALL_DLINK2_FLAGS= 
--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
 DEFINE GCC_IA32_DLINK2_FLAGS   = --defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_ALL_DLINK2_FLAGS)
 DEFINE GCC_X64_DLINK2_FLAGS= --defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_ALL_DLINK2_FLAGS)
+DEFINE GCC_AARCH64_DLINK2_FLAGS= --defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_ALL_DLINK2_FLAGS)
 
 DEFINE GCC_IPF_OBJCOPY_FLAGS   = -I elf64-ia64-little -O efi-bsdrv-ia64
 DEFINE GCC_IPF_SYMRENAME_FLAGS = --redefine-sym memcpy=CopyMem
@@ -3862,35 +3862,18 @@ DEFINE GCC45_ASM_FLAGS   = 
DEF(GCC44_ASM_FLAGS)
 
 DEFINE GCC46_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
 DEFINE GCC46_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
-DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) 
--oformat=elf32-littlearm
-DEFINE GCC46_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_ASLDLINK_FLAGS) 
--oformat=elf32-littlearm
 
 DEFINE GCC47_ASM_FLAGS   = DEF(GCC46_ASM_FLAGS)
 DEFINE GCC47_ARM_ASM_FLAGS   = DEF(GCC46_ARM_ASM_FLAGS)
 DEFINE GCC47_AARCH64_ASM_FLAGS   = $(ARCHASM_

[edk2] [PATCH 07/15] BaseTools: use leading underscore for symbol names where appropriate

2015-08-14 Thread Ard Biesheuvel
The MS ABI uses leading underscores to decorate symbol names when
generating 32-bit code only. Due to a bug in GCC prior to version 4.3,
it used the same decoration for 64-bit code but this has been fixed
since. So uses the leading underscore for IA32 only, and remove it
for X64.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 22 +++-
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 28b1b49fd020..ebd6d0448586 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3824,10 +3824,12 @@ DEFINE GCC_IA32_X64_DLINK_COMMON   = 
DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
 DEFINE GCC_ARM_AARCH64_DLINK_COMMON= --emit-relocs -nostdlib --gc-sections -u 
$(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) 
-Ttext=0x0
 DEFINE GCC_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z 
common-page-size=0x20
-DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry 
_ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
+DEFINE GCC_IA32_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry 
_ReferenceAcpiTable -u _$(IMAGE_ENTRY_POINT)
+DEFINE GCC_X64_ASLDLINK_FLAGS  = DEF(GCC_IA32_X64_DLINK_COMMON) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
 DEFINE GCC_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_DLINK_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
 DEFINE GCC_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_AARCH64_DLINK_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
-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_IA32_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_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_IPF_DLINK_FLAGS = -nostdlib -O2 --gc-sections --dll -static 
--entry $(IMAGE_ENTRY_POINT) --undefined $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 DEFINE GCC_IPF_OBJCOPY_FLAGS   = -I elf64-ia64-little -O efi-bsdrv-ia64
 DEFINE GCC_IPF_SYMRENAME_FLAGS = --redefine-sym memcpy=CopyMem
@@ -3933,10 +3935,10 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS  = 
DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
 *_UNIXGCC_*_MAKE_PATH= make
 *_UNIXGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN)
 
-*_UNIXGCC_IA32_DLINK_FLAGS   = DEF(GCC_IA32_X64_DLINK_FLAGS) 
--image-base=0
-*_UNIXGCC_X64_DLINK_FLAGS= DEF(GCC_IA32_X64_DLINK_FLAGS) 
--image-base=0
-*_UNIXGCC_IA32_ASLDLINK_FLAGS= DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
-*_UNIXGCC_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
+*_UNIXGCC_IA32_DLINK_FLAGS   = DEF(GCC_IA32_DLINK_FLAGS) 
--image-base=0
+*_UNIXGCC_X64_DLINK_FLAGS= DEF(GCC_X64_DLINK_FLAGS) 
--image-base=0
+*_UNIXGCC_IA32_ASLDLINK_FLAGS= DEF(GCC_IA32_ASLDLINK_FLAGS)
+*_UNIXGCC_X64_ASLDLINK_FLAGS = DEF(GCC_X64_ASLDLINK_FLAGS)
 *_UNIXGCC_*_ASM_FLAGS= DEF(GCC_ASM_FLAGS)
 *_UNIXGCC_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
 *_UNIXGCC_*_ASLPP_FLAGS  = DEF(GCC_ASLPP_FLAGS)
@@ -4692,10 +4694,10 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = 
DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
 *_CYGGCC_*_MAKE_PATH = DEF(MS_VS_BIN)\nmake.exe
 *_CYGGCC_*_ASL_PATH  = DEF(DEFAULT_WIN_ASL_BIN)
 
-*_CYGGCC_IA32_DLINK_FLAGS   = DEF(GCC_IA32_X64_DLINK_FLAGS) 
--image-base=0
-*_CYGGCC_X64_DLINK_FLAGS= DEF(GCC_IA32_X64_DLINK_FLAGS) 
--image-base=0
-*_CYGGCC_IA32_ASLDLINK_FLAGS= DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
-*_CYGGCC_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
+*_CYGGCC_IA32_DLINK_FLAGS   = DEF(GCC_IA32_DLINK_FLAGS) 
--image-base=0
+*_CYGGCC_X64_DLINK_FLAGS= DEF(GCC_X64_DLINK_FLAGS) 
--image-base=0
+*_CYGGCC_IA32_ASLDLINK_FLAGS= DEF(GCC_IA32_ASLDLINK_FLAGS)
+*_CYGGCC_X64_ASLDLINK_FLAGS = DEF(GCC_X64_ASLDLINK_FLAGS)
 *_CYGGCC_*_MAKE_FLAGS   = /nologo
 *_CYGGCC_*_ASM_FLAGS= DEF(GCC_ASM_FLAGS)
 *_CYGGCC_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
-- 
1.9.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 05/15] BaseTools GCC: refactor tools_def internal GCC defines for CC flags

2015-08-14 Thread Ard Biesheuvel
As a first step towards disentangling the arguments passed to the
various flavors of GCC we support, refactor the CC flags so that
we distinguish more clearly between toolchains that generate PE/COFF
directly (for IA32 and X86 only) and toolchains that generate ELF
only.

Note that this does not modify the options passed that are ultimately
passed to GCC, although it does deduplicate ARM and AARCH64 since those
toolchains were passing both GCC_ALL_CC_FLAGS and GCC44_ALL_CC_FLAGS,
which overlap to a great extent.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 35 ++--
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 5aa703996554..78c2d0a64599 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3807,12 +3807,14 @@ NOOPT_DDK3790xASL_IPF_DLINK_FLAGS= /NOLOGO 
/NODEFAULTLIB /LTCG /DLL /OPT:REF
 DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG = 
--add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug
 RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG   =
 
-DEFINE GCC_ALL_CC_FLAGS= -g -Os -fshort-wchar -fno-strict-aliasing 
-Wall -Werror -Wno-array-bounds -c -include AutoGen.h
-DEFINE GCC_IA32_CC_FLAGS   = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double 
-freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
-DEFINE GCC_X64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mno-red-zone 
-Wno-address -mno-stack-arg-probe
-DEFINE GCC_IPF_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) 
-minline-int-divide-min-latency
-DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mword-relocations 
-mlittle-endian -mabi=aapcs -mapcs -fno-short-enums -save-temps -fsigned-char 
-ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb 
-mfloat-abi=soft
-DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mcmodel=large 
-mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char  
-ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin 
-Wno-address -fno-asynchronous-unwind-tables
+DEFINE GCC_ALL_CC_FLAGS= -g -fshort-wchar -fno-strict-aliasing 
-Wall -Werror -Wno-array-bounds -Wno-address -Wno-unused-but-set-variable -c 
-include AutoGen.h
+DEFINE GCC_ALL_PE_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS)
+DEFINE GCC_ALL_ELF_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -ffunction-sections 
-fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
+DEFINE GCC_IA32_CC_PE_FLAGS= DEF(GCC_ALL_PE_CC_FLAGS) -m32 
-malign-double -freorder-blocks -freorder-blocks-and-partition -O2 
-mno-stack-arg-probe
+DEFINE GCC_X64_CC_PE_FLAGS = DEF(GCC_ALL_PE_CC_FLAGS) -Os 
-mno-red-zone -mno-stack-arg-probe
+DEFINE GCC_IPF_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -Os 
-minline-int-divide-min-latency
+DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -Os 
-mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums 
-save-temps -fsigned-char -ffunction-sections -fdata-sections 
-fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
+DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -Os 
-mcmodel=large -mlittle-endian -fno-short-enums -save-temps -fverbose-asm 
-fsigned-char  -ffunction-sections -fdata-sections -fomit-frame-pointer 
-fno-builtin -Wno-address -fno-asynchronous-unwind-tables
 DEFINE GCC_DLINK_FLAGS_COMMON  = -nostdlib --pie
 DEFINE GCC_DLINK2_FLAGS_COMMON = 
--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
 DEFINE GCC_IA32_X64_DLINK_COMMON   = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
@@ -3837,9 +3839,8 @@ DEFINE GCC_IPF_RC_FLAGS= -I binary -O 
elf64-ia64-little   -B ia64
 DEFINE GCC_ARM_RC_FLAGS= -I binary -O elf32-littlearm -B arm   
  --rename-section .data=.hii
 DEFINE GCC_AARCH64_RC_FLAGS= -I binary -O elf64-littleaarch64 -B 
aarch64 --rename-section .data=.hii
 
-DEFINE GCC44_ALL_CC_FLAGS= -g -fshort-wchar -fno-strict-aliasing 
-Wall -Werror -Wno-array-bounds -Wno-address -Wno-unused-but-set-variable 
-ffunction-sections -fdata-sections -c -include AutoGen.h 
-DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
-DEFINE GCC44_IA32_CC_FLAGS   = DEF(GCC44_ALL_CC_FLAGS) -m32 
-malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables
-DEFINE GCC44_X64_CC_FLAGS= DEF(GCC44_ALL_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS 
-mno-red-zone -Wno-address -mcmodel=large -fno-asynchronous-unwind-tables
+DEFINE GCC44_IA32_CC_FLAGS   = DEF(GCC_ALL_ELF_CC_FLAGS) -m32 
-malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables
+DEFINE GCC44_X64_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS 
-mno-red-zone -Wno-address -mcmodel=large -fno-asynchronous-unwind-tables
 DEFINE

[edk2] [PATCH 04/15] BaseTools: merge warning flags for all GCC versions

2015-08-14 Thread Ard Biesheuvel
The warning flags -Wno-address -Wno-unused-but-set-variable are added
for version 4.6 and up, but since they are happily accepted by version
4.4 and 4.5 as well, add them there as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
Reviewed-by: Liming Gao 
---
 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 028cc2531e95..5aa703996554 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3837,7 +3837,7 @@ DEFINE GCC_IPF_RC_FLAGS= -I binary -O 
elf64-ia64-little   -B ia64
 DEFINE GCC_ARM_RC_FLAGS= -I binary -O elf32-littlearm -B arm   
  --rename-section .data=.hii
 DEFINE GCC_AARCH64_RC_FLAGS= -I binary -O elf64-littleaarch64 -B 
aarch64 --rename-section .data=.hii
 
-DEFINE GCC44_ALL_CC_FLAGS= -g -fshort-wchar -fno-strict-aliasing 
-Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -c -include 
AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
+DEFINE GCC44_ALL_CC_FLAGS= -g -fshort-wchar -fno-strict-aliasing 
-Wall -Werror -Wno-array-bounds -Wno-address -Wno-unused-but-set-variable 
-ffunction-sections -fdata-sections -c -include AutoGen.h 
-DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
 DEFINE GCC44_IA32_CC_FLAGS   = DEF(GCC44_ALL_CC_FLAGS) -m32 
-malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables
 DEFINE GCC44_X64_CC_FLAGS= DEF(GCC44_ALL_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS 
-mno-red-zone -Wno-address -mcmodel=large -fno-asynchronous-unwind-tables
 DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -n -q --gc-sections -z 
common-page-size=0x20
@@ -3858,8 +3858,8 @@ DEFINE GCC45_X64_DLINK_FLAGS = 
DEF(GCC44_X64_DLINK_FLAGS)
 DEFINE GCC45_X64_DLINK2_FLAGS= DEF(GCC44_X64_DLINK2_FLAGS)
 DEFINE GCC45_ASM_FLAGS   = DEF(GCC44_ASM_FLAGS)
 
-DEFINE GCC46_IA32_CC_FLAGS   = DEF(GCC45_IA32_CC_FLAGS) -Wno-address 
-Wno-unused-but-set-variable
-DEFINE GCC46_X64_CC_FLAGS= DEF(GCC45_X64_CC_FLAGS) -Wno-address 
-Wno-unused-but-set-variable
+DEFINE GCC46_IA32_CC_FLAGS   = DEF(GCC45_IA32_CC_FLAGS)
+DEFINE GCC46_X64_CC_FLAGS= DEF(GCC45_X64_CC_FLAGS)
 DEFINE GCC46_IA32_X64_DLINK_COMMON   = DEF(GCC45_IA32_X64_DLINK_COMMON)
 DEFINE GCC46_IA32_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS)
 DEFINE GCC46_IA32_X64_DLINK_FLAGS= DEF(GCC45_IA32_X64_DLINK_FLAGS)
@@ -4255,7 +4255,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS  = 
DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
 *_GCC46_ARM_VFRPP_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_VFRPP_FLAGS)
 
   DEBUG_GCC46_ARM_CC_FLAGS   = DEF(GCC46_ARM_CC_FLAGS) -O0
-RELEASE_GCC46_ARM_CC_FLAGS   = DEF(GCC46_ARM_CC_FLAGS) 
-Wno-unused-but-set-variable
+RELEASE_GCC46_ARM_CC_FLAGS   = DEF(GCC46_ARM_CC_FLAGS)
 
 

 #
@@ -4354,7 +4354,7 @@ RELEASE_GCC46_ARM_CC_FLAGS   = 
DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-v
 *_GCC47_ARM_VFRPP_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_VFRPP_FLAGS)
 
   DEBUG_GCC47_ARM_CC_FLAGS   = DEF(GCC47_ARM_CC_FLAGS) -O0
-RELEASE_GCC47_ARM_CC_FLAGS   = DEF(GCC47_ARM_CC_FLAGS) 
-Wno-unused-but-set-variable
+RELEASE_GCC47_ARM_CC_FLAGS   = DEF(GCC47_ARM_CC_FLAGS)
 
 ##
 # GCC47 AARCH64 definitions
@@ -4381,7 +4381,7 @@ RELEASE_GCC47_ARM_CC_FLAGS   = 
DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-v
 *_GCC47_AARCH64_VFRPP_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_VFRPP_FLAGS)
 
   DEBUG_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS) -O0
-RELEASE_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS) 
-Wno-unused-but-set-variable
+RELEASE_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS)
 
 

 #
@@ -4480,7 +4480,7 @@ RELEASE_GCC47_AARCH64_CC_FLAGS   = 
DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s
 *_GCC48_ARM_VFRPP_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_VFRPP_FLAGS)
 
   DEBUG_GCC48_ARM_CC_FLAGS   = DEF(GCC48_ARM_CC_FLAGS) -O0
-RELEASE_GCC48_ARM_CC_FLAGS   = DEF(GCC48_ARM_CC_FLAGS) 
-Wno-unused-but-set-variable
+RELEASE_GCC48_ARM_CC_FLAGS   = DEF(GCC48_ARM_CC_FLAGS)
 
 ##
 # GCC48 AARCH64 definitions
@@ -4507,7 +4507,7 @@ RELEASE_GCC48_ARM_CC_FLAGS   = 
DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-v
 *_GCC48_AARCH64_VFRPP_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_VFRPP_FLAGS)
 
   DEBUG_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -O0
-RELEASE_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) 
-Wno-unused-but-set-variable
+RELEASE_GCC48_AARCH64_CC_FLAGS   = DEF(GCC

[edk2] [PATCH 03/15] BaseTools: remove unused definition of GCC_WINDRES_FLAGS

2015-08-14 Thread Ard Biesheuvel
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 1 -
 1 file changed, 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 7209cb7cf282..028cc2531e95 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3831,7 +3831,6 @@ DEFINE GCC_PP_FLAGS= -E -x 
assembler-with-cpp -include $(DEST_DI
 DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include 
$(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
 DEFINE GCC_ASLPP_FLAGS = -x c -E -P
 DEFINE GCC_ASLCC_FLAGS = -x c
-DEFINE GCC_WINDRES_FLAGS   = -J rc -O coff
 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_IPF_RC_FLAGS= -I binary -O elf64-ia64-little   -B ia64  
  --rename-section .data=.hii
-- 
1.9.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 00/15] unify GCC command line options

2015-08-14 Thread Ard Biesheuvel
This got a bit out of hand after I noticed the ELFGCC and UNIXGCC
toolchains that needed some tlc as well.

Anyway, this series aims to refactor the toolchains definitions for
UNIXGCC, GCC44, GCC45, GCC46, GCC47, GCC48, GCC49, CLANG35, ELFGCC,
CYGGCC and CYGGCCxASL so that they share as much of the settings as
possible. Currently, there is very little coordination between these,
which means for instance that the 4 KB alignment feature is only supported
on GCC4x at the moment.

The primary difference between these toolchains is that GCC4x and ELFGCC
are entirely ELF based, whereas the other are PE/COFF based (but only when
building for IA32 or X64)

Note that this series does not remove any toolchains, nor should it result
in major changes in the command lines that are passed to the various tools.
However, things may be reordered, and (in case of ELFGCC), missing functionality
such as increased section alignment has been added so there are some changes
there.

Patch #2 fixes a problem in the GenFv tool where it may access unallocated
memory while rebasing the FFS when using large section and file alignment.

Patch #3 removes an unused DEFINE from tools_def

Patch #4 moved some warning flags that were applied to GCC4x 4.6 and up to
all GCC versions.

Patch #5 is the first big refactor patch that introduces PE and ELF variants
for some CC flags.

Patch #6 unifies the IA32 and X64 CC flags for all toolchains listed above.

Patch #7 fixes the issue mentioned by Bill where the underscore decoration
is erroneously applied on X64 as well.

Patch #8 is the second refactor the introduces PE and ELF variants for the
various DLINK flags.

Patch #9 removes the explicit 64 byte alignment applied to GCC 4.9. The latest
GenFw and linker script propagate the alignment automatically, i.e., if objects
with such alignment requirement are present, GCC will set the ELF header
accordingly, and this value will be used for the PE/COFF section alignment
as well.

Patch #10 unifies the IA32 and X64 linker flags for all toolchains listed above.

Patch #11 unifies the ARM and AARCH64 CC flags, i.e., it removes all the
redundant definitions.

Patch #12 and #10 but for the linker.

Patch #13 unifies the ASM flags for all archs.

Patch #14 brings the remaining configuration options of ELFGCC in line with
the GCC4x series.

Patch #15 is a PoC that allows Ovmf/X64 to be built with 4 KB section alignment
for DXE_RUNTIME modules using UNIXGCC and ELFGCC, as is required to support
the properties table memprotection feature.

Branch can be found here
https://git.linaro.org/people/ard.biesheuvel/uefi-next.git/shortlog/refs/heads/unify-gcc


Ard Biesheuvel (14):
  BaseTools/GenFv: use PE/COFF virtual section size if raw size is
larger
  BaseTools: remove unused definition of GCC_WINDRES_FLAGS
  BaseTools: merge warning flags for all GCC versions
  BaseTools GCC: refactor tools_def internal GCC defines for CC flags
  BaseTools: unify all IA32 and X64 CC flags for ELF based GCC
  BaseTools: use leading underscore for symbol names where appropriate
  BaseTools GCC: refactor tools_def internal GCC defines for [AS]DLINK
  BaseTools: remove GCC 4.9 specific linker alignment override
  BaseTools: unify all IA32 and X64 [AS]DLINK[2] flags for ELF based GCC
  BaseTools: unify ARM and AARCH64 GCC compiler flags
  BaseTools: unify ARM and AARCH64 DLINK flags for all GCC versions
  BaseTools: unify ASM flags for all GCC versions
  BaseTools: align ELFGCC with GCC4x toolchains
  OvmfPkg/X64: enable 4 KB alignment for DXE_RUNTIME modules

Scott Duplichan (1):
  BaseTools: Fix GCC49 build failure

 BaseTools/Conf/tools_def.template   | 412 
 BaseTools/Source/C/GenFv/GenFvInternalLib.c |   2 +-
 OvmfPkg/OvmfPkgX64.dsc  |   7 +
 3 files changed, 181 insertions(+), 240 deletions(-)

-- 
1.9.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 10/15] BaseTools: unify all IA32 and X64 [AS]DLINK[2] flags for ELF based GCC

2015-08-14 Thread Ard Biesheuvel
GCC4x and ELFGCC are both ELF based GCC toolchains, so there is no
justification for allowing the command line options to deviate.
So align them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 128 
 1 file changed, 52 insertions(+), 76 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 574dc360fcf9..6990f4303c65 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3821,18 +3821,28 @@ DEFINE GCC_AARCH64_CC_FLAGS= 
DEF(GCC_ALL_ELF_CC_FLAGS) -Os -mcmodel=larg
 DEFINE GCC_DLINK2_FLAGS_COMMON = 
--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
 DEFINE GCC_ALL_DLINK_FLAGS = -nostdlib
 DEFINE GCC_ALL_DLINK_PE_FLAGS  = DEF(GCC_ALL_DLINK_FLAGS) --pie
+DEFINE GCC_ALL_DLINK_ELF_FLAGS = DEF(GCC_ALL_DLINK_FLAGS) -n -q 
--gc-sections -z common-page-size=0x20
 DEFINE GCC_IA32_X64_DLINK_PE_FLAGS = DEF(GCC_ALL_DLINK_PE_FLAGS) --gc-sections
+DEFINE GCC_IA32_X64_DLINK_ELF_FLAGS= DEF(GCC_ALL_DLINK_ELF_FLAGS) --entry 
$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 DEFINE GCC_IA32_DLINK_PE_FLAGS = DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry 
_$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC_IA32_DLINK_ELF_FLAGS= DEF(GCC_IA32_X64_DLINK_ELF_FLAGS) -m 
elf_i386 --oformat=elf32-i386
 DEFINE GCC_X64_DLINK_PE_FLAGS  = DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry 
$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC_X64_DLINK_ELF_FLAGS = DEF(GCC_IA32_X64_DLINK_ELF_FLAGS) 
-melf_x86_64 --oformat=elf64-x86-64
 DEFINE GCC_ARM_AARCH64_DLINK_COMMON= --emit-relocs -nostdlib --gc-sections -u 
$(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) 
-Ttext=0x0
 DEFINE GCC_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z 
common-page-size=0x20
 DEFINE GCC_IA32_ASLDLINK_PE_FLAGS  = DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry 
_ReferenceAcpiTable -u _$(IMAGE_ENTRY_POINT)
 DEFINE GCC_X64_ASLDLINK_PE_FLAGS   = DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
+DEFINE GCC_IA32_ASLDLINK_ELF_FLAGS = DEF(GCC_ALL_DLINK_ELF_FLAGS) --entry 
ReferenceAcpiTable -u ReferenceAcpiTable -melf_i386
+DEFINE GCC_X64_ASLDLINK_ELF_FLAGS  = DEF(GCC_ALL_DLINK_ELF_FLAGS) --entry 
ReferenceAcpiTable -u ReferenceAcpiTable -melf_x86_64
 DEFINE GCC_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_DLINK_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
 DEFINE GCC_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_AARCH64_DLINK_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
 DEFINE GCC_IPF_DLINK_FLAGS = -nostdlib -O2 --gc-sections --dll -static 
--entry $(IMAGE_ENTRY_POINT) --undefined $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 
+DEFINE GCC_ALL_DLINK2_FLAGS= 
--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
+DEFINE GCC_IA32_DLINK2_FLAGS   = --defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_ALL_DLINK2_FLAGS)
+DEFINE GCC_X64_DLINK2_FLAGS= --defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_ALL_DLINK2_FLAGS)
+
 DEFINE GCC_IPF_OBJCOPY_FLAGS   = -I elf64-ia64-little -O efi-bsdrv-ia64
 DEFINE GCC_IPF_SYMRENAME_FLAGS = --redefine-sym memcpy=CopyMem
 DEFINE GCC_ASM_FLAGS   = -c -x assembler -imacros 
$(DEST_DIR_DEBUG)/AutoGen.h
@@ -3846,40 +3856,16 @@ DEFINE GCC_IPF_RC_FLAGS= -I binary -O 
elf64-ia64-little   -B ia64
 DEFINE GCC_ARM_RC_FLAGS= -I binary -O elf32-littlearm -B arm   
  --rename-section .data=.hii
 DEFINE GCC_AARCH64_RC_FLAGS= -I binary -O elf64-littleaarch64 -B 
aarch64 --rename-section .data=.hii
 
-DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -n -q --gc-sections -z 
common-page-size=0x20
-DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) 
--entry ReferenceAcpiTable -u ReferenceAcpiTable
-DEFINE GCC44_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_COMMON) 
--entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
-DEFINE GCC44_IA32_DLINK2_FLAGS   = --defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_DLINK2_FLAGS_COMMON)
-DEFINE GCC44_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS)  
-melf_x86_64 --oformat=elf64-x86-64
-DEFINE GCC44_X64_DLINK2_FLAGS= --defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_DLINK2_FLAGS_COMMON)
 DEFINE GCC44_ASM_FLAGS   = DEF(GCC_ASM_FLAGS)
 
-DEFINE GCC45_IA32_X64_DLINK_COMMON   = DEF(GCC44_IA32_X64_DLINK_COMMON)
-DEFINE GCC45_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS)
-DEFINE GCC45_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_FLAGS)
-DEFINE GCC45_IA32_DLINK2_FLAGS   = DEF(GCC44_IA32_DLINK2_FLAGS)
-DEFINE GC

[edk2] [PATCH 11/15] BaseTools: unify ARM and AARCH64 GCC compiler flags

2015-08-14 Thread Ard Biesheuvel
Use the same GCC options for compiling regardless of the exact
GCC version.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 39 
 1 file changed, 16 insertions(+), 23 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 6990f4303c65..8aaa9d62625b 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3815,8 +3815,8 @@ DEFINE GCC_IA32_CC_ELF_FLAGS   = 
DEF(GCC_ALL_ELF_CC_FLAGS) -m32 -malign-doub
 DEFINE GCC_X64_CC_PE_FLAGS = DEF(GCC_ALL_PE_CC_FLAGS) -Os 
-mno-red-zone -mno-stack-arg-probe
 DEFINE GCC_X64_CC_ELF_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS 
-mno-red-zone -mcmodel=large -fno-asynchronous-unwind-tables
 DEFINE GCC_IPF_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -Os 
-minline-int-divide-min-latency
-DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -Os 
-mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums 
-save-temps -fsigned-char -ffunction-sections -fdata-sections 
-fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
-DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -Os 
-mcmodel=large -mlittle-endian -fno-short-enums -save-temps -fverbose-asm 
-fsigned-char  -ffunction-sections -fdata-sections -fomit-frame-pointer 
-fno-builtin -Wno-address -fno-asynchronous-unwind-tables
+DEFINE GCC_ARM_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ALL_ELF_CC_FLAGS) -Os -mword-relocations -mlittle-endian -mabi=aapcs 
-mapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections 
-fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft 
-fstack-protector -mno-unaligned-access
+DEFINE GCC_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ALL_ELF_CC_FLAGS) -Os -mcmodel=large -mlittle-endian -fno-short-enums 
-save-temps -fverbose-asm -fsigned-char  -ffunction-sections -fdata-sections 
-fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables
 
 DEFINE GCC_DLINK2_FLAGS_COMMON = 
--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
 DEFINE GCC_ALL_DLINK_FLAGS = -nostdlib
@@ -3862,15 +3862,12 @@ DEFINE GCC45_ASM_FLAGS   = 
DEF(GCC44_ASM_FLAGS)
 
 DEFINE GCC46_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
 DEFINE GCC46_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
-DEFINE GCC46_ARM_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ARM_CC_FLAGS) -fstack-protector
 DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) 
--oformat=elf32-littlearm
 DEFINE GCC46_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_ASLDLINK_FLAGS) 
--oformat=elf32-littlearm
 
 DEFINE GCC47_ASM_FLAGS   = DEF(GCC46_ASM_FLAGS)
 DEFINE GCC47_ARM_ASM_FLAGS   = DEF(GCC46_ARM_ASM_FLAGS)
 DEFINE GCC47_AARCH64_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
-DEFINE GCC47_ARM_CC_FLAGS= DEF(GCC46_ARM_CC_FLAGS) 
-mno-unaligned-access
-DEFINE GCC47_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_AARCH64_CC_FLAGS)
 DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
 DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS)
 DEFINE GCC47_AARCH64_DLINK2_FLAGS= --defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_DLINK2_FLAGS_COMMON)
@@ -3880,8 +3877,6 @@ DEFINE GCC47_AARCH64_ASLDLINK_FLAGS  = 
DEF(GCC_AARCH64_ASLDLINK_FLAGS)
 DEFINE GCC48_ASM_FLAGS   = DEF(GCC47_ASM_FLAGS)
 DEFINE GCC48_ARM_ASM_FLAGS   = DEF(GCC47_ARM_ASM_FLAGS)
 DEFINE GCC48_AARCH64_ASM_FLAGS   = DEF(GCC47_AARCH64_ASM_FLAGS)
-DEFINE GCC48_ARM_CC_FLAGS= DEF(GCC47_ARM_CC_FLAGS)
-DEFINE GCC48_AARCH64_CC_FLAGS= DEF(GCC47_AARCH64_CC_FLAGS)
 DEFINE GCC48_ARM_DLINK_FLAGS = DEF(GCC47_ARM_DLINK_FLAGS)
 DEFINE GCC48_AARCH64_DLINK_FLAGS = DEF(GCC47_AARCH64_DLINK_FLAGS)
 DEFINE GCC48_AARCH64_DLINK2_FLAGS= DEF(GCC47_AARCH64_DLINK2_FLAGS)
@@ -3891,8 +3886,6 @@ DEFINE GCC48_AARCH64_ASLDLINK_FLAGS  = 
DEF(GCC47_AARCH64_ASLDLINK_FLAGS)
 DEFINE GCC49_ASM_FLAGS   = DEF(GCC48_ASM_FLAGS)
 DEFINE GCC49_ARM_ASM_FLAGS   = DEF(GCC48_ARM_ASM_FLAGS)
 DEFINE GCC49_AARCH64_ASM_FLAGS   = DEF(GCC48_AARCH64_ASM_FLAGS)
-DEFINE GCC49_ARM_CC_FLAGS= DEF(GCC48_ARM_CC_FLAGS)
-DEFINE GCC49_AARCH64_CC_FLAGS= DEF(GCC48_AARCH64_CC_FLAGS)
 DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
 DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS)
 DEFINE GCC49_AARCH64_DLINK2_FLAGS= DEF(GCC48_AARCH64_DLINK2_FLAGS)
@@ -4224,8 +4217,8 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS  = 
DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
 *_GCC46_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
 *_GCC46_ARM_VFRPP_FLAGS 

[edk2] [PATCH 01/15] BaseTools: Fix GCC49 build failure

2015-08-14 Thread Ard Biesheuvel
From: Scott Duplichan 

Some gnu linkers used with GCC44, such as GNU ld 2.19.1, require a
--defsym= command line option to precede the --script= option in
order for the definition to be available for use by the script.
Move the --defsym= command line option to satisfy this requirement
and avoid a GCC44 build failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan 

Additional change by Ard Biesheuvel:
move the --defsym= command line option also for AARCH64.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 859fbe14ad59..7209cb7cf282 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3844,9 +3844,9 @@ DEFINE GCC44_X64_CC_FLAGS= 
DEF(GCC44_ALL_CC_FLAGS) -m64 -fno-stack-p
 DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -n -q --gc-sections -z 
common-page-size=0x20
 DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) 
--entry ReferenceAcpiTable -u ReferenceAcpiTable
 DEFINE GCC44_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_COMMON) 
--entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
-DEFINE GCC44_IA32_DLINK2_FLAGS   = DEF(GCC_DLINK2_FLAGS_COMMON) 
--defsym=PECOFF_HEADER_SIZE=0x220
+DEFINE GCC44_IA32_DLINK2_FLAGS   = --defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_DLINK2_FLAGS_COMMON)
 DEFINE GCC44_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS)  
-melf_x86_64 --oformat=elf64-x86-64
-DEFINE GCC44_X64_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
--defsym=PECOFF_HEADER_SIZE=0x228
+DEFINE GCC44_X64_DLINK2_FLAGS= --defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_DLINK2_FLAGS_COMMON)
 DEFINE GCC44_ASM_FLAGS   = DEF(GCC_ASM_FLAGS)
 
 DEFINE GCC45_IA32_CC_FLAGS   = DEF(GCC44_IA32_CC_FLAGS)
@@ -3888,7 +3888,7 @@ DEFINE GCC47_ARM_CC_FLAGS= 
DEF(GCC46_ARM_CC_FLAGS) -mno-unaligned-ac
 DEFINE GCC47_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS)
 DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
 DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS)
-DEFINE GCC47_AARCH64_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
--defsym=PECOFF_HEADER_SIZE=0x228
+DEFINE GCC47_AARCH64_DLINK2_FLAGS= --defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_DLINK2_FLAGS_COMMON)
 DEFINE GCC47_ARM_ASLDLINK_FLAGS  = DEF(GCC46_ARM_ASLDLINK_FLAGS)
 DEFINE GCC47_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_AARCH64_ASLDLINK_FLAGS)
 
-- 
1.9.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 06/15] BaseTools: unify all IA32 and X64 CC flags for ELF based GCC

2015-08-14 Thread Ard Biesheuvel
GCC4x and ELFGCC are both ELF based GCC toolchains, so there is no
justification for allowing the command line option to deviate.
So align them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 43 
 1 file changed, 17 insertions(+), 26 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 78c2d0a64599..28b1b49fd020 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3811,10 +3811,13 @@ DEFINE GCC_ALL_CC_FLAGS= -g -fshort-wchar 
-fno-strict-aliasing -Wall
 DEFINE GCC_ALL_PE_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS)
 DEFINE GCC_ALL_ELF_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -ffunction-sections 
-fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
 DEFINE GCC_IA32_CC_PE_FLAGS= DEF(GCC_ALL_PE_CC_FLAGS) -m32 
-malign-double -freorder-blocks -freorder-blocks-and-partition -O2 
-mno-stack-arg-probe
+DEFINE GCC_IA32_CC_ELF_FLAGS   = DEF(GCC_ALL_ELF_CC_FLAGS) -m32 
-malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables
 DEFINE GCC_X64_CC_PE_FLAGS = DEF(GCC_ALL_PE_CC_FLAGS) -Os 
-mno-red-zone -mno-stack-arg-probe
+DEFINE GCC_X64_CC_ELF_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS 
-mno-red-zone -mcmodel=large -fno-asynchronous-unwind-tables
 DEFINE GCC_IPF_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -Os 
-minline-int-divide-min-latency
 DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -Os 
-mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums 
-save-temps -fsigned-char -ffunction-sections -fdata-sections 
-fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
 DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -Os 
-mcmodel=large -mlittle-endian -fno-short-enums -save-temps -fverbose-asm 
-fsigned-char  -ffunction-sections -fdata-sections -fomit-frame-pointer 
-fno-builtin -Wno-address -fno-asynchronous-unwind-tables
+
 DEFINE GCC_DLINK_FLAGS_COMMON  = -nostdlib --pie
 DEFINE GCC_DLINK2_FLAGS_COMMON = 
--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
 DEFINE GCC_IA32_X64_DLINK_COMMON   = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
@@ -3839,8 +3842,6 @@ DEFINE GCC_IPF_RC_FLAGS= -I binary -O 
elf64-ia64-little   -B ia64
 DEFINE GCC_ARM_RC_FLAGS= -I binary -O elf32-littlearm -B arm   
  --rename-section .data=.hii
 DEFINE GCC_AARCH64_RC_FLAGS= -I binary -O elf64-littleaarch64 -B 
aarch64 --rename-section .data=.hii
 
-DEFINE GCC44_IA32_CC_FLAGS   = DEF(GCC_ALL_ELF_CC_FLAGS) -m32 
-malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables
-DEFINE GCC44_X64_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS 
-mno-red-zone -Wno-address -mcmodel=large -fno-asynchronous-unwind-tables
 DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -n -q --gc-sections -z 
common-page-size=0x20
 DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) 
--entry ReferenceAcpiTable -u ReferenceAcpiTable
 DEFINE GCC44_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_COMMON) 
--entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
@@ -3849,8 +3850,6 @@ DEFINE GCC44_X64_DLINK_FLAGS = 
DEF(GCC44_IA32_X64_DLINK_FLAGS)  -melf_x8
 DEFINE GCC44_X64_DLINK2_FLAGS= --defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_DLINK2_FLAGS_COMMON)
 DEFINE GCC44_ASM_FLAGS   = DEF(GCC_ASM_FLAGS)
 
-DEFINE GCC45_IA32_CC_FLAGS   = DEF(GCC44_IA32_CC_FLAGS)
-DEFINE GCC45_X64_CC_FLAGS= DEF(GCC44_X64_CC_FLAGS)
 DEFINE GCC45_IA32_X64_DLINK_COMMON   = DEF(GCC44_IA32_X64_DLINK_COMMON)
 DEFINE GCC45_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS)
 DEFINE GCC45_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_FLAGS)
@@ -3859,8 +3858,6 @@ DEFINE GCC45_X64_DLINK_FLAGS = 
DEF(GCC44_X64_DLINK_FLAGS)
 DEFINE GCC45_X64_DLINK2_FLAGS= DEF(GCC44_X64_DLINK2_FLAGS)
 DEFINE GCC45_ASM_FLAGS   = DEF(GCC44_ASM_FLAGS)
 
-DEFINE GCC46_IA32_CC_FLAGS   = DEF(GCC45_IA32_CC_FLAGS)
-DEFINE GCC46_X64_CC_FLAGS= DEF(GCC45_X64_CC_FLAGS)
 DEFINE GCC46_IA32_X64_DLINK_COMMON   = DEF(GCC45_IA32_X64_DLINK_COMMON)
 DEFINE GCC46_IA32_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS)
 DEFINE GCC46_IA32_X64_DLINK_FLAGS= DEF(GCC45_IA32_X64_DLINK_FLAGS)
@@ -3873,8 +3870,6 @@ DEFINE GCC46_ARM_CC_FLAGS= $(ARCHCC_FLAGS) 
$(PLATFORM_FLAGS) DEF(GCC
 DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) 
--oformat=elf32-littlearm
 DEFINE GCC46_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_ASLDLINK_FLAGS) 
--oformat=elf32-littlearm
 
-DEFINE GCC47_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS)
-DEFINE GCC47_X64_CC_FLAGS  

[edk2] [PATCH 08/15] BaseTools GCC: refactor tools_def internal GCC defines for [AS]DLINK

2015-08-14 Thread Ard Biesheuvel
As a first step towards disentangling the arguments passed to the
various flavors of GCC we support, refactor the CC flags so that
we distinguish more clearly between toolchains that generate PE/COFF
directly (for IA32 and X86 only) and toolchains that generate ELF
only.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 30 +++-
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index ebd6d0448586..26e17fef6b2e 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3818,19 +3818,21 @@ DEFINE GCC_IPF_CC_FLAGS= 
DEF(GCC_ALL_ELF_CC_FLAGS) -Os -minline-int-
 DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -Os 
-mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums 
-save-temps -fsigned-char -ffunction-sections -fdata-sections 
-fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
 DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_ELF_CC_FLAGS) -Os 
-mcmodel=large -mlittle-endian -fno-short-enums -save-temps -fverbose-asm 
-fsigned-char  -ffunction-sections -fdata-sections -fomit-frame-pointer 
-fno-builtin -Wno-address -fno-asynchronous-unwind-tables
 
-DEFINE GCC_DLINK_FLAGS_COMMON  = -nostdlib --pie
 DEFINE GCC_DLINK2_FLAGS_COMMON = 
--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
-DEFINE GCC_IA32_X64_DLINK_COMMON   = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
+DEFINE GCC_ALL_DLINK_FLAGS = -nostdlib
+DEFINE GCC_ALL_DLINK_PE_FLAGS  = DEF(GCC_ALL_DLINK_FLAGS) --pie
+DEFINE GCC_IA32_X64_DLINK_PE_FLAGS = DEF(GCC_ALL_DLINK_PE_FLAGS) --gc-sections
+DEFINE GCC_IA32_DLINK_PE_FLAGS = DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry 
_$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC_X64_DLINK_PE_FLAGS  = DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry 
$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 DEFINE GCC_ARM_AARCH64_DLINK_COMMON= --emit-relocs -nostdlib --gc-sections -u 
$(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) 
-Ttext=0x0
 DEFINE GCC_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z 
common-page-size=0x20
-DEFINE GCC_IA32_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry 
_ReferenceAcpiTable -u _$(IMAGE_ENTRY_POINT)
-DEFINE GCC_X64_ASLDLINK_FLAGS  = DEF(GCC_IA32_X64_DLINK_COMMON) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
+DEFINE GCC_IA32_ASLDLINK_PE_FLAGS  = DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry 
_ReferenceAcpiTable -u _$(IMAGE_ENTRY_POINT)
+DEFINE GCC_X64_ASLDLINK_PE_FLAGS   = DEF(GCC_IA32_X64_DLINK_PE_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
 DEFINE GCC_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_DLINK_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
 DEFINE GCC_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_AARCH64_DLINK_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
-DEFINE GCC_IA32_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_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_IPF_DLINK_FLAGS = -nostdlib -O2 --gc-sections --dll -static 
--entry $(IMAGE_ENTRY_POINT) --undefined $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+
 DEFINE GCC_IPF_OBJCOPY_FLAGS   = -I elf64-ia64-little -O efi-bsdrv-ia64
 DEFINE GCC_IPF_SYMRENAME_FLAGS = --redefine-sym memcpy=CopyMem
 DEFINE GCC_ASM_FLAGS   = -c -x assembler -imacros 
$(DEST_DIR_DEBUG)/AutoGen.h
@@ -3935,10 +3937,10 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS  = 
DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
 *_UNIXGCC_*_MAKE_PATH= make
 *_UNIXGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN)
 
-*_UNIXGCC_IA32_DLINK_FLAGS   = DEF(GCC_IA32_DLINK_FLAGS) 
--image-base=0
-*_UNIXGCC_X64_DLINK_FLAGS= DEF(GCC_X64_DLINK_FLAGS) 
--image-base=0
-*_UNIXGCC_IA32_ASLDLINK_FLAGS= DEF(GCC_IA32_ASLDLINK_FLAGS)
-*_UNIXGCC_X64_ASLDLINK_FLAGS = DEF(GCC_X64_ASLDLINK_FLAGS)
+*_UNIXGCC_IA32_DLINK_FLAGS   = DEF(GCC_IA32_DLINK_PE_FLAGS) 
--image-base=0
+*_UNIXGCC_X64_DLINK_FLAGS= DEF(GCC_X64_DLINK_PE_FLAGS) 
--image-base=0
+*_UNIXGCC_IA32_ASLDLINK_FLAGS= DEF(GCC_IA32_ASLDLINK_PE_FLAGS)
+*_UNIXGCC_X64_ASLDLINK_FLAGS = DEF(GCC_X64_ASLDLINK_PE_FLAGS)
 *_UNIXGCC_*_ASM_FLAGS= DEF(GCC_ASM_FLAGS)
 *_UNIXGCC_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
 *_UNIXGCC_*_ASLPP_FLAG

[edk2] [PATCH 09/15] BaseTools: remove GCC 4.9 specific linker alignment override

2015-08-14 Thread Ard Biesheuvel
If any version of GCC emits any object whose actual alignment
requirement exceeds 32 bytes, this actual alignment value will
automatically become the PE/COFF section alignment value after
PE/COFF conversion now that GenFw propagates the alignment of
the ELF input sections. So there is no longer a need for special
treatment of GCC 4.9, and the linker command line override can
be removed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 26e17fef6b2e..574dc360fcf9 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3908,11 +3908,11 @@ DEFINE GCC48_AARCH64_DLINK2_FLAGS= 
DEF(GCC47_AARCH64_DLINK2_FLAGS)
 DEFINE GCC48_ARM_ASLDLINK_FLAGS  = DEF(GCC47_ARM_ASLDLINK_FLAGS)
 DEFINE GCC48_AARCH64_ASLDLINK_FLAGS  = DEF(GCC47_AARCH64_ASLDLINK_FLAGS)
 
-DEFINE GCC49_IA32_X64_DLINK_COMMON   = -nostdlib -n -q --gc-sections -z 
common-page-size=0x40
-DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) 
--entry ReferenceAcpiTable -u ReferenceAcpiTable
-DEFINE GCC49_IA32_X64_DLINK_FLAGS= DEF(GCC49_IA32_X64_DLINK_COMMON) 
--entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC49_IA32_X64_DLINK_COMMON   = DEF(GCC48_IA32_X64_DLINK_COMMON)
+DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS)
+DEFINE GCC49_IA32_X64_DLINK_FLAGS= DEF(GCC48_IA32_X64_DLINK_FLAGS)
 DEFINE GCC49_IA32_DLINK2_FLAGS   = DEF(GCC48_IA32_DLINK2_FLAGS)
-DEFINE GCC49_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS)  
-melf_x86_64 --oformat=elf64-x86-64
+DEFINE GCC49_X64_DLINK_FLAGS = DEF(GCC48_X64_DLINK_FLAGS)
 DEFINE GCC49_X64_DLINK2_FLAGS= DEF(GCC48_X64_DLINK2_FLAGS)
 DEFINE GCC49_ASM_FLAGS   = DEF(GCC48_ASM_FLAGS)
 DEFINE GCC49_ARM_ASM_FLAGS   = DEF(GCC48_ARM_ASM_FLAGS)
-- 
1.9.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 02/15] BaseTools/GenFv: use PE/COFF virtual section size if raw size is larger

2015-08-14 Thread Ard Biesheuvel
When copying the relocted sections into the FFS file, we need to
take care that we don't overrun the end of the file. Since, unlike
the virtual size, the PE/COFF raw section size must be a multiple of
file alignment, which means its size may exceed the virtual size.
So use the minimum of the two.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Source/C/GenFv/GenFvInternalLib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c 
b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
index 6d2d5d1f8c67..b0135bf0155a 100644
--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
@@ -3329,7 +3329,7 @@ Returns:
   CopyMem (
 (UINT8 *) CurrentPe32Section.Pe32Section + CurSecHdrSize + 
SectionHeader->PointerToRawData, 
 (VOID*) (UINTN) (ImageContext.ImageAddress + 
SectionHeader->VirtualAddress), 
-SectionHeader->SizeOfRawData
+MIN(SectionHeader->SizeOfRawData, SectionHeader->Misc.VirtualSize)
 );
 }
 
-- 
1.9.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Shell 2.0 and 2.1

2015-08-14 Thread Daniel Samuelraj
*From:* Daniel Samuelraj [mailto:daniel.samuel...@avagotech.com]
*Sent:* Friday, August 14, 2015 12:40 PM
*To:* 'uswg'; edk2-de...@lists.sourceforge.net
*Subject:* Shell 2.0 and 2.1



Hi,

I assume that Shell 2.0 apps are expected to run fine in Shell 2.1. Can you
please confirm?



Should shell 2.1 app be using new toolkit (e.g., UDK2014 or newer?) when
app want to make use of the content added in Shell 2.1?



Will there be any backward or forward compatibility issue? That is end user
running Shell 2.0 app in shell 2.1; similarly running Shell 2.1 app in
Shell 2.0?



Appreciate the response!



Thanks,

Daniel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [RFC PATCH 0/4] unify GCC command line options

2015-08-14 Thread Bill Paul
Of all the gin joints in all the towns in all the world, Ard Biesheuvel had to 
walk into mine at 00:55:26 on Friday 14 August 2015 and say:

> On 13 August 2015 at 21:57, Bill Paul  wrote:
> > Of all the gin joints in all the towns in all the world, Ard Biesheuvel
> > had to
> > 
> > walk into mine at 12:25:31 on Thursday 13 August 2015 and say:
> >> On 13 August 2015 at 21:14, David Woodhouse  wrote:
> >> > On Thu, 2015-08-13 at 13:25 -0500, Scott Duplichan wrote:
> >> >> A while back I experimented with mingw as a Windows hosted gcc tool
> >> >> chain for EDK2. It is usable, but has limitations. From a 2014 email
> >> >> to this list:
> >> >> 
> >> >> 1) Image is big due to dead library code in final image.
> >> >> 2) Default calling convention is different. This makes MINGW code
> >> >> 
> >> >>generation differ from gcc-linux code generation.
> >> >> 
> >> >> 3) MINGW sizeof long differs from gnu-linux size of long, resulting
> >> >> 
> >> >>in more code generation differences.
> >> > 
> >> > These aren't new issues, surely? The GCC builds are still larger than
> >> > the MSVC builds, largely due to CFLAGS as recently discussed but also
> >> > because we don't yet have LTO for GCC, do we? And we don't use
> >> > -ffunction-sections --gc-sections and other tricks so we can only drop
> >> > unused things out at the C file granularity.
> >> 
> >> Another reason to unify the GCC compiler and linker flags: we do use
> >> -ffunction-sections -fdata-sections and --gc-sections, but only for
> >> GCC44 - GCC49, and these flags are not inherited by UNIXGCC et al
> >> 
> >> So I suppose the linker output is a PE/COFF application when using
> >> MinGW, and the BaseTools/ just skip the ELF conversion in this case? I
> >> wonder whether --gc-sections works well here, but I can have a look.
> > 
> > For the record, I tend to use the UNIXGCC cross-build toolchain on my
> > FreeBSD/amd64 9.1-RELEASE machine at work. The system compiler is gcc
> > 4.2.1, and it and the system linker aren't quite sexy enough to build
> > EDK2/OVMF on their own. (Newer releases might be better, but I'm not in
> > a position to upgrade my work system right now.) Instead I've been using
> > the mingw-gcc- build.py script to bootstrap a GCC MinGW-targeted
> > toolchain, and it's worked fine for me so far.
> 
> OK, good to know.
> 
> > Yes, the MinGW toolchain does generate PE/COFF objects directly so you
> > can skip the objcopy conversion step from ELF. You need a set of
> > binutils to handle this off course, but the mingw-gcc-build.py
> > bootstraps those for you too.
> 
> I am currently testing with my distro supplied MinGW, which is based on
> 4.8.3

That should be ok. I tried a couple different cases including 4.6.x, 4.8.x and 
4.9.x which worked ok. I was able to bootstrap a GCC 5 compiler but it crashed 
with an internal compiler error somewhere during the OVMF build.
 
> > I recently experimented with updating the mingw-gcc-build.py script to
> > use a newer version of GCC, in this case 4.9.3 and binutils 2.25. I had
> > to update tools_def.template a little to get it to work. I was planning
> > to submit this as a patch but was waiting for the dust around GCC rule
> > tweaking to settle. So far it hasn't settled yet. :)
> 
> Well, MinGW is a really good data point, so if I end up proposing
> another round of patches that unifies GCC support, I will take this
> into account.

Okay.
 
> > The only real gotcha I ran into is the "underscore" convention. With
> > MinGW, the rule seems to be that for IA32, all symbols get a leading
> > underscore, but on X64 they do not. This is something that seems to have
> > changed between GCC 4.3.0 and 4.9.3. For example, currently (well,
> > unless someone changed them recently), the following generic GCC rules
> > exist:
> > 
> > DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON)
> > --entry _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
> > 
> > DEFINE GCC_IA32_X64_DLINK_FLAGS= DEF(GCC_IA32_X64_DLINK_COMMON)
> > --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment
> > 0x20 -Map $(D EST_DIR_DEBUG)/$(BASE_NAME).map
> > 
> > The IA32_X64 in the names assumes that these rules apply for both
> > targets, and you can see that they apply leading underscores to symbol
> > names
> > (_ReferenceAcpiTable, _$(IMAGE_ENTRY_POINT)). This worked for GCC 4.3.0,
> > but GCC 4.9.3 only automatically applies the leading underscore for
> > IA32, not for X64. So this rule can't be applied to both anymore.
> > 
> > I'm not sure of the reason for the difference, but I tried several
> > different GCC releases newer than 4.3.0 and they all had the same
> > behavior. I suspect the newer behavior (X64 doesn't use leading
> > underscores) is correct and the earlier behavior was buggy. Maybe
> > someone who knows more about the MS toolchain can clear this up.
> 
> As far as I could dig up, the leading underscore convention used by
> Microsoft is 32-bit only. I guess that means ED

Re: [edk2] [PATCH 0/2] Add HttpBoot support to OvmfPkg

2015-08-14 Thread Blibbet

On 08/14/2015 02:03 AM, Gary Ching-Pang Lin wrote:
> Although the current HttpBoot implementation is incomplete, it would be
> easier to develop and test the software stack with a virtual machine.

THANKS for adding to OVMF!

Besides "1219 UEFI.Next Feature - UEFI TLS API", what else is missing?

Thanks.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] GetFirstGuidHob availability across phases

2015-08-14 Thread Andrew Fish

> On Aug 14, 2015, at 3:57 AM, Michael Zimmermann  
> wrote:
> 
> 
> I registered a data Hob from the ARM PrePI(2ndstage) phase like this:
> BuildGuidDataHob (&gLKApiAddrGuid, &mLKApiAddress, sizeof mLKApiAddress);
> 
> Unfortunately this hob is not available in later phase anymore(DXE+). When
> I use 'GetFirstGuidHob (&gLKApiAddrGuid);' it just returns NULL.
> 
> Is there a way to make this Hob persistent across all phases?

What Phase are you talking about? Most of EFI goes away when the OS calls 
gBS->ExitBootServices().

Thanks,

Andrew Fish

> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 2/2] OvmfPkg: Add HttpBoot support

2015-08-14 Thread Laszlo Ersek
Hi Gary,

On 08/14/15 11:03, Gary Ching-Pang Lin wrote:
> This commit introdues a new build option to OvmfPkg: HTTP_BOOT_ENABLE.
> When HttpBoot is enabled, a new Network boot option will show in the
> boot manager menu with the device path like this:
> 
> PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv4(0.0.0.0)/Uri()
> 
> It works like the PXE one but fetches the NBP from the given http
> url instead of the tftp service.
> 
> A simple testing environment can be set up with the QEMU tap network
> and dnsmasq + lighttpd.
> 
> Here is the example of the dnsmasq config:
> 
>   interface=
>   dhcp-range=192.168.111.100,192.168.111.120,12h
>   dhcp-option=60,"HTTPClient"
>   dhcp-boot="http:///"
> 
> It's similar to the PXE server settings except the tftp function is
> disabled, the option 60 must be "HTTPClient", and the boot uri is a
> http url.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Gary Ching-Pang Lin 
> ---
>  OvmfPkg/OvmfPkgIa32.dsc| 10 ++
>  OvmfPkg/OvmfPkgIa32.fdf|  5 +
>  OvmfPkg/OvmfPkgIa32X64.dsc | 10 ++
>  OvmfPkg/OvmfPkgIa32X64.fdf |  5 +
>  OvmfPkg/OvmfPkgX64.dsc | 10 ++
>  OvmfPkg/OvmfPkgX64.fdf |  5 +
>  6 files changed, 45 insertions(+)

Please configure your git so that git-format-patch includes the section
names in the diff hunk headers, in the dsc / fdf / inf / dec files:

http://thread.gmane.org/gmane.comp.bios.tianocore.devel/15486

Can you please repost the patch like that? I'll try to look at it
sometime later then.

Thanks
Laszlo

> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index 4ab618d..9a6de15 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -35,6 +35,7 @@
>#
>DEFINE SECURE_BOOT_ENABLE  = FALSE
>DEFINE NETWORK_IP6_ENABLE  = FALSE
> +  DEFINE HTTP_BOOT_ENABLE= FALSE
>  
>  [BuildOptions]
>GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
> @@ -129,6 +130,10 @@
>
> AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
>  !endif
>  
> +!if $(HTTP_BOOT_ENABLE) == TRUE
> +  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> +!endif
> +
>
> S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
>SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
>
> OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
> @@ -551,6 +556,11 @@
>MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
>MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
>  !endif
> +!if $(HTTP_BOOT_ENABLE) == TRUE
> +  NetworkPkg/DnsDxe/DnsDxe.inf
> +  NetworkPkg/HttpDxe/HttpDxe.inf
> +  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> +!endif
>OvmfPkg/VirtioNetDxe/VirtioNet.inf
>  
>#
> diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
> index 16675f8..0e4ee49 100644
> --- a/OvmfPkg/OvmfPkgIa32.fdf
> +++ b/OvmfPkg/OvmfPkgIa32.fdf
> @@ -324,6 +324,11 @@ FILE FREEFORM = 
> PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
>INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
>INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
>  !endif
> +!if $(HTTP_BOOT_ENABLE) == TRUE
> +  INF  NetworkPkg/DnsDxe/DnsDxe.inf
> +  INF  NetworkPkg/HttpDxe/HttpDxe.inf
> +  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> +!endif
>INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
>  
>  #
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 90ca42a..2f8006d 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -35,6 +35,7 @@
>#
>DEFINE SECURE_BOOT_ENABLE  = FALSE
>DEFINE NETWORK_IP6_ENABLE  = FALSE
> +  DEFINE HTTP_BOOT_ENABLE= FALSE
>  
>  [BuildOptions]
>GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
> @@ -134,6 +135,10 @@
>
> AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
>  !endif
>  
> +!if $(HTTP_BOOT_ENABLE) == TRUE
> +  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> +!endif
> +
>
> S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
>SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
>
> OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
> @@ -558,6 +563,11 @@
>MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
>MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
>  !endif
> +!if $(HTTP_BOOT_ENABLE) == TRUE
> +  NetworkPkg/DnsDxe/DnsDxe.inf
> +  NetworkPkg/HttpDxe/HttpDxe.inf
> +  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> +!endif
>OvmfPkg/VirtioNetDxe/VirtioNet.inf
>  
>#
> diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
> index e6c525a..74412d4 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.fdf
> +++ b/OvmfPkg/OvmfPkgIa32X64.fdf
> @@ -324,6 +324,11 @@ FILE FREEFORM = 
> P

Re: [edk2] [Patch 2/3] OvmfPkg: use new BDS and UiApp in MdeModulePkg

2015-08-14 Thread Laszlo Ersek
On 08/14/15 10:28, Ni, Ruiyu wrote:
> Laszlo,
> Where can I read your first 17 remarks? I didn't find it in my mail folder.

Strange; your email address  was the only one in the
To: field. (The list and Jordan were Cc'd.)

In any case, here's the link into the archive:

http://thread.gmane.org/gmane.comp.bios.edk2.devel/759/focus=1153

Thanks!
Laszlo


> 
> Thanks,
> Ray
> 
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com] 
> Sent: Wednesday, August 12, 2015 10:59 PM
> To: Ni, Ruiyu 
> Cc: Justen, Jordan L ; edk2-de...@ml01.01.org
> Subject: Re: [edk2] [Patch 2/3] OvmfPkg: use new BDS and UiApp in MdeModulePkg
> 
> Continuing:
> 
> On 08/12/15 00:53, Laszlo Ersek wrote:
>> On 08/03/15 07:41, Ruiyu Ni wrote:
>>> Compare to the old BDS, the new BDS separates the UI part to a standalone
>>> application UiApp.
>>> QemuBootOrderLib was changed to depend on the UefiBootManagerLib.
> 
>> I've covered the following files thus far:
>>>  OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
>>>   | 347 +++
>>>  OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf  
>>>   |   4 +-
>>>  OvmfPkg/OvmfPkg.dec
>>>   |   5 +-
>>>  OvmfPkg/OvmfPkgIa32.dsc
>>>   |  28 +-
>>>  OvmfPkg/OvmfPkgIa32.fdf
>>>   |   3 +-
>>>  OvmfPkg/OvmfPkgIa32X64.dsc 
>>>   |  30 +-
>>>  OvmfPkg/OvmfPkgIa32X64.fdf 
>>>   |   3 +-
>>>  OvmfPkg/OvmfPkgX64.dsc 
>>>   |  28 +-
>>>  OvmfPkg/OvmfPkgX64.fdf 
>>>   |   3 +-
>>
>> and made 17 remarks that should be addressed in v2.
>>
>> I will continue the review later; the rest of the patch is preserved in
>> the trailing context, so I will follow up on that. The remaining
>> diffstat is, with rename & copy detection enabled:
>>
> 
> (sorting the below)
> 
>>>  EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.c => 
>>> OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c | 559 +-
>>>  OvmfPkg/Library/PlatformBootManagerLib/Strings.uni 
>>>   | Bin 0 -> 3658 bytes
>>>  OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/BdsPlatform.c   
>>>   | 611 
>>>  OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/BdsPlatform.h   
>>>   | 132 ++---
>>>  OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/PlatformData.c  
>>>   |  18 +-
>>>  OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/QemuKernel.c
>>>   |   0
>>>  OvmfPkg/Library/{PlatformBdsLib/PlatformBdsLib.inf => 
>>> PlatformBootManagerLib/PlatformBootManagerLib.inf} |  20 +-
>>>  {IntelFrameworkModulePkg/Universal/BdsDxe => 
>>> OvmfPkg/Library/PlatformBootManagerLib}/MemoryTest.c
>>> | 227 
> 
> Let's see "MemoryTest.c" and "Strings.uni" first.
> 
>>> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/MemoryTest.c 
>>> b/OvmfPkg/Library/PlatformBootManagerLib/MemoryTest.c
>>> new file mode 100644
>>> index 000..c9a7ecb
>>> --- /dev/null
>>> +++ b/OvmfPkg/Library/PlatformBootManagerLib/MemoryTest.c
> 
> [contents snipped]
> 
>>> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/Strings.uni 
>>> b/OvmfPkg/Library/PlatformBootManagerLib/Strings.uni
>>> new file mode 100644
>>> index 
>>> ..7300975620fef86ea31c556a6fa66c098e8a0538
>>> GIT binary patch
>>> literal 3658
> 
> [contents snipped]
> 
> These two files do the following:
> 
> - "MemoryTest.c" is a slightly customized copy of
>   "IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c". The
>   customization comprises:
> 
>   - hard-coding PcdBootlogoOnlyEnable as FALSE
>   - removing DEBUG messages
>   - open coding some HII string lookup helper functions
> 
> - "Strings.uni" provides English and French text for the following
>   string tokens:
> 
>   - STR_PERFORM_MEM_TEST,
>   - STR_MEMORY_TEST_PERCENT,
>   - STR_ESC_TO_SKIP_MEM_TEST,
>   - STR_MEM_TEST_COMPLETED,
>   - STR_NO_EXT_MEM_FOUND,
>   - STR_SYSTEM_MEM_ERROR
> 
>   All of these tokens are needed for mes

[edk2] GetFirstGuidHob availability across phases

2015-08-14 Thread Michael Zimmermann
I registered a data Hob from the ARM PrePI(2ndstage) phase like this:
BuildGuidDataHob (&gLKApiAddrGuid, &mLKApiAddress, sizeof mLKApiAddress);

Unfortunately this hob is not available in later phase anymore(DXE+). When
I use 'GetFirstGuidHob (&gLKApiAddrGuid);' it just returns NULL.

Is there a way to make this Hob persistent across all phases?
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 0/2] Add HttpBoot support to OvmfPkg

2015-08-14 Thread Gary Ching-Pang Lin
On Fri, Aug 14, 2015 at 10:27:31AM +0100, David Woodhouse wrote:
> On Fri, 2015-08-14 at 17:03 +0800, Gary Ching-Pang Lin wrote:
> > I've tested the HttpBoot implementation with a simple test 
> > environment:
> 
> Is this tested with IPv6?
No, IPv6 is not implemented in HttpBootDxe, so I only tested IPv4.

Gary Lin
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 0/2] Add HttpBoot support to OvmfPkg

2015-08-14 Thread David Woodhouse
On Fri, 2015-08-14 at 17:03 +0800, Gary Ching-Pang Lin wrote:
> I've tested the HttpBoot implementation with a simple test 
> environment:

Is this tested with IPv6?

-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation


smime.p7s
Description: S/MIME cryptographic signature
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 0/2] Add HttpBoot support to OvmfPkg

2015-08-14 Thread Gary Ching-Pang Lin
I've tested the HttpBoot implementation with a simple test environment:

[QEMU] <---(tap0)---> [HOST]
 Ovmf   DHCP server
HTTP server

With a proper config for the dhcp and http server in the host, the firmware
successfully fetched the remote EFI file and executed it. However, the EFI
file couldn't get the correct device path so it's still not good enough for
the bootloader development.

Although the current HttpBoot implementation is incomplete, it would be
easier to develop and test the software stack with a virtual machine.

Gary Ching-Pang Lin (2):
  NetworkPkg: Remove the hostname for the http request url
  OvmfPkg: Add HttpBoot support

 NetworkPkg/HttpDxe/HttpImpl.c | 14 +-
 OvmfPkg/OvmfPkgIa32.dsc   | 10 ++
 OvmfPkg/OvmfPkgIa32.fdf   |  5 +
 OvmfPkg/OvmfPkgIa32X64.dsc| 10 ++
 OvmfPkg/OvmfPkgIa32X64.fdf|  5 +
 OvmfPkg/OvmfPkgX64.dsc| 10 ++
 OvmfPkg/OvmfPkgX64.fdf|  5 +
 7 files changed, 58 insertions(+), 1 deletion(-)

-- 
2.1.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel



[edk2] [PATCH 1/2] NetworkPkg: Remove the hostname for the http request url

2015-08-14 Thread Gary Ching-Pang Lin
The hostname is already set in the header of the http request.
The url shouldn't contain the hostname since the hostname will
be prepended to the url when the server interprets the request.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 545fe42..030dcfe 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -227,6 +227,7 @@ EfiHttpRequest (
   CHAR16*HostNameStr;
   HTTP_TOKEN_WRAP   *Wrap;
   HTTP_TCP_TOKEN_WRAP   *TcpWrap;
+  CHAR8 *FileUrl;
 
   if ((This == NULL) || (Token == NULL)) {
 return EFI_INVALID_PARAMETER;
@@ -450,7 +451,18 @@ EfiHttpRequest (
   //
   // Create request message.
   //
-  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, Url);
+  FileUrl = Url;
+  while (*FileUrl != ':')
+FileUrl++;
+  if ((*(FileUrl+1) == '/') && (*(FileUrl+2) == '/')) {
+FileUrl += 3;
+while (*FileUrl != '/')
+  FileUrl++;
+  } else {
+Status = EFI_INVALID_PARAMETER;
+goto Error3;
+  }
+  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, FileUrl);
   if (RequestStr == NULL) {
 Status = EFI_OUT_OF_RESOURCES;
 goto Error3;
-- 
2.1.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 2/2] OvmfPkg: Add HttpBoot support

2015-08-14 Thread Gary Ching-Pang Lin
This commit introdues a new build option to OvmfPkg: HTTP_BOOT_ENABLE.
When HttpBoot is enabled, a new Network boot option will show in the
boot manager menu with the device path like this:

PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv4(0.0.0.0)/Uri()

It works like the PXE one but fetches the NBP from the given http
url instead of the tftp service.

A simple testing environment can be set up with the QEMU tap network
and dnsmasq + lighttpd.

Here is the example of the dnsmasq config:

  interface=
  dhcp-range=192.168.111.100,192.168.111.120,12h
  dhcp-option=60,"HTTPClient"
  dhcp-boot="http:///"

It's similar to the PXE server settings except the tftp function is
disabled, the option 60 must be "HTTPClient", and the boot uri is a
http url.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin 
---
 OvmfPkg/OvmfPkgIa32.dsc| 10 ++
 OvmfPkg/OvmfPkgIa32.fdf|  5 +
 OvmfPkg/OvmfPkgIa32X64.dsc | 10 ++
 OvmfPkg/OvmfPkgIa32X64.fdf |  5 +
 OvmfPkg/OvmfPkgX64.dsc | 10 ++
 OvmfPkg/OvmfPkgX64.fdf |  5 +
 6 files changed, 45 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 4ab618d..9a6de15 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -35,6 +35,7 @@
   #
   DEFINE SECURE_BOOT_ENABLE  = FALSE
   DEFINE NETWORK_IP6_ENABLE  = FALSE
+  DEFINE HTTP_BOOT_ENABLE= FALSE
 
 [BuildOptions]
   GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
@@ -129,6 +130,10 @@
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
 
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
+!endif
+
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -551,6 +556,11 @@
   MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  NetworkPkg/DnsDxe/DnsDxe.inf
+  NetworkPkg/HttpDxe/HttpDxe.inf
+  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 16675f8..0e4ee49 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -324,6 +324,11 @@ FILE FREEFORM = 
PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
   INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  INF  NetworkPkg/DnsDxe/DnsDxe.inf
+  INF  NetworkPkg/HttpDxe/HttpDxe.inf
+  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
 #
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 90ca42a..2f8006d 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -35,6 +35,7 @@
   #
   DEFINE SECURE_BOOT_ENABLE  = FALSE
   DEFINE NETWORK_IP6_ENABLE  = FALSE
+  DEFINE HTTP_BOOT_ENABLE= FALSE
 
 [BuildOptions]
   GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
@@ -134,6 +135,10 @@
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
 
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
+!endif
+
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -558,6 +563,11 @@
   MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  NetworkPkg/DnsDxe/DnsDxe.inf
+  NetworkPkg/HttpDxe/HttpDxe.inf
+  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index e6c525a..74412d4 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -324,6 +324,11 @@ FILE FREEFORM = 
PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
   INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  INF  NetworkPkg/DnsDxe/DnsDxe.inf
+  INF  NetworkPkg/HttpDxe/HttpDxe.inf
+  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
 #
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index b72eaa9..5407d9d 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -35,6 +35,7 @@
   #
   DEFINE SECURE_BOOT_ENABLE  = FALSE
   

Re: [edk2] [RFC PATCH 0/4] unify GCC command line options

2015-08-14 Thread David Woodhouse
On Thu, 2015-08-13 at 23:54 -0500, Scott Duplichan wrote:
> David Woodhouse [mailto:dw...@infradead.org] wrote:
> ]On Thu, 2015-08-13 at 13:25 -0500, Scott Duplichan wrote:
> ]> A while back I experimented with mingw as a Windows hosted gcc tool
> ]> chain for EDK2. It is usable, but has limitations. From a 2014 email
> ]> to this list:
> ]
> ]> 1) Image is big due to dead library code in final image.
> ]> 2) Default calling convention is different. This makes MINGW code
> ]>generation differ from gcc-linux code generation.
> ]> 3) MINGW sizeof long differs from gnu-linux size of long, resulting
> ]>in more code generation differences.
> ]
> ]These aren't new issues, surely? The GCC builds are still larger than
> ]the MSVC builds, largely due to CFLAGS as recently discussed but also
> ]because we don't yet have LTO for GCC, do we? And we don't use 
> ]-ffunction-sections --gc-sections and other tricks so we can only drop
> ]unused things out at the C file granularity.
> 
> Issue 1) is something separate from missing GCC LTO, and affects only
> mingw: https://sourceware.org/bugzilla/show_bug.cgi?id=11539.

I note Nick is waiting for test results in that bug. Is anyone trying
the patch he just committed?

>  As for
> GCC LTO, the 07/14/2015 patch didn't get enough reviews for approval. 

Pet peeve: There aren't 14 months in 2015. Use ISO standard dates (2015
-07-14) unless you *know* you're only talking to Americans, please.

Or http://permalink.gmane.org/gmane.comp.bios.tianocore.devel/17382 wou
ld be even better :)

> With equal settings, GCC is competitive with Microsoft on code size now.

Nice.

> ](I wonder if we could get the MSVC build running under wine... now
> ]*that* would be useful)
> 
> Brian Johnson says this works (using the DDK3790 tool chain). The
> newer DDK7600 most likely works too. See the 05/27/2015 email:
> "Re: [edk2] CorebootModulePkg: gcc reports conflicting types for
> 'CbParseAcpiTable'"

Hm, I don't seem to have that one. Found it at
https://sourceforge.net/p/edk2/mailman/message/34151871/ though.

Brian said it took 'a lot of one-time setup' to get the DDK compilers
running under wine, but that's precisely the kind of thing that could
be scripted, surely?

-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation


smime.p7s
Description: S/MIME cryptographic signature
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] NetworkPkg: Stop and release DHCP4 child after boot info is ready

2015-08-14 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: Wu, Jiaxin 
Sent: Monday, August 10, 2015 8:30 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting; Zhang, Lubo
Subject: [Patch] NetworkPkg: Stop and release DHCP4 child after boot info is 
ready

HttpBootDxe need to stop and release the DHCP4 child when it's
not used so the NBP could create new DHCP4 child and use it.

Cc: Ye Ting 
Cc: Zhang Lubo 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 NetworkPkg/HttpBootDxe/HttpBootImpl.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c 
b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index 711cc3c..920761e 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -242,10 +242,16 @@ HttpBootStop (
   Private->BootFileSize = 0;
   Private->SelectIndex = 0;
   Private->SelectProxyType = HttpOfferTypeMax;
 
   if (!Private->UsingIpv6) {
+//
+// Stop and release the DHCP4 child.
+//
+Private->Dhcp4->Stop (Private->Dhcp4);
+Private->Dhcp4->Configure (Private->Dhcp4, NULL);
+
 for (Index = 0; Index < HTTP_BOOT_OFFER_MAX_NUM; Index++) {
   if (Private->OfferBuffer[Index].Dhcp4.UriParser) {
 HttpUrlFreeParser (Private->OfferBuffer[Index].Dhcp4.UriParser);
   }
 }
@@ -336,10 +342,16 @@ HttpBootDxeLoadFile (
 Status = HttpBootLoadFile (Private, BufferSize, Buffer);
   }
 
   if (Status != EFI_SUCCESS && Status != EFI_BUFFER_TOO_SMALL) {
 HttpBootStop (Private);
+  } else {
+//
+// Stop and release the DHCP4 child.
+//
+Private->Dhcp4->Stop (Private->Dhcp4);
+Private->Dhcp4->Configure (Private->Dhcp4, NULL);
   }
 
   return Status;
 }
 
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch 2/3] OvmfPkg: use new BDS and UiApp in MdeModulePkg

2015-08-14 Thread Ni, Ruiyu
Laszlo,
Where can I read your first 17 remarks? I didn't find it in my mail folder.

Thanks,
Ray

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Wednesday, August 12, 2015 10:59 PM
To: Ni, Ruiyu 
Cc: Justen, Jordan L ; edk2-de...@ml01.01.org
Subject: Re: [edk2] [Patch 2/3] OvmfPkg: use new BDS and UiApp in MdeModulePkg

Continuing:

On 08/12/15 00:53, Laszlo Ersek wrote:
> On 08/03/15 07:41, Ruiyu Ni wrote:
>> Compare to the old BDS, the new BDS separates the UI part to a standalone
>> application UiApp.
>> QemuBootOrderLib was changed to depend on the UefiBootManagerLib.

> I've covered the following files thus far:
>>  OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c 
>>  | 347 +++
>>  OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf   
>>  |   4 +-
>>  OvmfPkg/OvmfPkg.dec 
>>  |   5 +-
>>  OvmfPkg/OvmfPkgIa32.dsc 
>>  |  28 +-
>>  OvmfPkg/OvmfPkgIa32.fdf 
>>  |   3 +-
>>  OvmfPkg/OvmfPkgIa32X64.dsc  
>>  |  30 +-
>>  OvmfPkg/OvmfPkgIa32X64.fdf  
>>  |   3 +-
>>  OvmfPkg/OvmfPkgX64.dsc  
>>  |  28 +-
>>  OvmfPkg/OvmfPkgX64.fdf  
>>  |   3 +-
>
> and made 17 remarks that should be addressed in v2.
>
> I will continue the review later; the rest of the patch is preserved in
> the trailing context, so I will follow up on that. The remaining
> diffstat is, with rename & copy detection enabled:
>

(sorting the below)

>>  EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.c => 
>> OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c | 559 +-
>>  OvmfPkg/Library/PlatformBootManagerLib/Strings.uni  
>>  | Bin 0 -> 3658 bytes
>>  OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/BdsPlatform.c
>>  | 611 
>>  OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/BdsPlatform.h
>>  | 132 ++---
>>  OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/PlatformData.c   
>>  |  18 +-
>>  OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/QemuKernel.c 
>>  |   0
>>  OvmfPkg/Library/{PlatformBdsLib/PlatformBdsLib.inf => 
>> PlatformBootManagerLib/PlatformBootManagerLib.inf} |  20 +-
>>  {IntelFrameworkModulePkg/Universal/BdsDxe => 
>> OvmfPkg/Library/PlatformBootManagerLib}/MemoryTest.c
>> | 227 

Let's see "MemoryTest.c" and "Strings.uni" first.

>> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/MemoryTest.c 
>> b/OvmfPkg/Library/PlatformBootManagerLib/MemoryTest.c
>> new file mode 100644
>> index 000..c9a7ecb
>> --- /dev/null
>> +++ b/OvmfPkg/Library/PlatformBootManagerLib/MemoryTest.c

[contents snipped]

>> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/Strings.uni 
>> b/OvmfPkg/Library/PlatformBootManagerLib/Strings.uni
>> new file mode 100644
>> index 
>> ..7300975620fef86ea31c556a6fa66c098e8a0538
>> GIT binary patch
>> literal 3658

[contents snipped]

These two files do the following:

- "MemoryTest.c" is a slightly customized copy of
  "IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c". The
  customization comprises:

  - hard-coding PcdBootlogoOnlyEnable as FALSE
  - removing DEBUG messages
  - open coding some HII string lookup helper functions

- "Strings.uni" provides English and French text for the following
  string tokens:

  - STR_PERFORM_MEM_TEST,
  - STR_MEMORY_TEST_PERCENT,
  - STR_ESC_TO_SKIP_MEM_TEST,
  - STR_MEM_TEST_COMPLETED,
  - STR_NO_EXT_MEM_FOUND,
  - STR_SYSTEM_MEM_ERROR

  All of these tokens are needed for messages printed by "MemoryTest.c".

(18) Now that I understand what these files do: please drop them both.
There's no need for them, for the following reasons:

- They complicate OvmfPkg for no benefit.

- The memory test for a virtual machine is a joke. We don't do it in
  ArmVirtPkg, for example.

- Dropping these files -- and therefore the BdsMemoryTest() function --
  only causes a *minimal* visual change on the splash sc

Re: [edk2] [PATCH] MdePkg: Fix the duplicated protocol GUID.

2015-08-14 Thread Yao, Jiewen
Hey
We should use same GUID for Tcg2Protocol and TrEEProtocol. Both of them are 
well defined in industry standard, and with different protocol version.



-Original Message-
From: Qiu, Shumin 
Sent: Friday, August 14, 2015 4:07 PM
To: edk2-devel@lists.01.org
Cc: Qiu, Shumin; Yao, Jiewen
Subject: [PATCH] MdePkg: Fix the duplicated protocol GUID.

Tcg2Protocl and TrEEProtocol use the same GUID value.

Cc: Yao Jiewen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin 
---
 MdePkg/Include/Protocol/Tcg2Protocol.h | 2 +-
 MdePkg/MdePkg.dec  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Include/Protocol/Tcg2Protocol.h 
b/MdePkg/Include/Protocol/Tcg2Protocol.h
index 0bda105..69221a2 100644
--- a/MdePkg/Include/Protocol/Tcg2Protocol.h
+++ b/MdePkg/Include/Protocol/Tcg2Protocol.h
@@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 
 #define EFI_TCG2_PROTOCOL_GUID \
-  {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 
0x0f }}
+  {0x35509ddb, 0x7523, 0x407e, { 0x9e, 0x23, 0xef, 0xd4, 0xc4, 0x45, 
+ 0x57, 0xea }}
 
 typedef struct tdEFI_TCG2_PROTOCOL EFI_TCG2_PROTOCOL;
 
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 64dc5f9..c91ccb4 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1363,7 +1363,8 @@
   gEfiTrEEProtocolGuid   = {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 
0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }}
   
   ## Include/Protocol/Tcg2Protocol.h
-  gEfiTcg2ProtocolGuid   = {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 
0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }}
+  gEfiTcg2ProtocolGuid   = {0x35509ddb, 0x7523, 0x407e, { 0x9e, 0x23, 
0xef, 0xd4, 0xc4, 0x45, 0x57, 0xea }}
+
   gEfiTcg2FinalEventsTableGuid   = {0x1e2ed096, 0x30e2, 0x4254, { 0xbd, 0x89, 
0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25 }}
 
   ## Include/Protocol/FormBrowser2.h
--
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] MdePkg: Fix the duplicated protocol GUID.

2015-08-14 Thread Qiu Shumin
Tcg2Protocl and TrEEProtocol use the same GUID value.

Cc: Yao Jiewen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin 
---
 MdePkg/Include/Protocol/Tcg2Protocol.h | 2 +-
 MdePkg/MdePkg.dec  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Include/Protocol/Tcg2Protocol.h 
b/MdePkg/Include/Protocol/Tcg2Protocol.h
index 0bda105..69221a2 100644
--- a/MdePkg/Include/Protocol/Tcg2Protocol.h
+++ b/MdePkg/Include/Protocol/Tcg2Protocol.h
@@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 
 #define EFI_TCG2_PROTOCOL_GUID \
-  {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 
0x0f }}
+  {0x35509ddb, 0x7523, 0x407e, { 0x9e, 0x23, 0xef, 0xd4, 0xc4, 0x45, 0x57, 
0xea }}
 
 typedef struct tdEFI_TCG2_PROTOCOL EFI_TCG2_PROTOCOL;
 
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 64dc5f9..c91ccb4 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1363,7 +1363,8 @@
   gEfiTrEEProtocolGuid   = {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 
0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }}
   
   ## Include/Protocol/Tcg2Protocol.h
-  gEfiTcg2ProtocolGuid   = {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 
0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }}
+  gEfiTcg2ProtocolGuid   = {0x35509ddb, 0x7523, 0x407e, { 0x9e, 0x23, 
0xef, 0xd4, 0xc4, 0x45, 0x57, 0xea }}
+
   gEfiTcg2FinalEventsTableGuid   = {0x1e2ed096, 0x30e2, 0x4254, { 0xbd, 0x89, 
0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25 }}
 
   ## Include/Protocol/FormBrowser2.h
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [RFC PATCH 0/4] unify GCC command line options

2015-08-14 Thread Ard Biesheuvel
On 13 August 2015 at 21:57, Bill Paul  wrote:
> Of all the gin joints in all the towns in all the world, Ard Biesheuvel had to
> walk into mine at 12:25:31 on Thursday 13 August 2015 and say:
>
>> On 13 August 2015 at 21:14, David Woodhouse  wrote:
>> > On Thu, 2015-08-13 at 13:25 -0500, Scott Duplichan wrote:
>> >> A while back I experimented with mingw as a Windows hosted gcc tool
>> >> chain for EDK2. It is usable, but has limitations. From a 2014 email
>> >> to this list:
>> >>
>> >> 1) Image is big due to dead library code in final image.
>> >> 2) Default calling convention is different. This makes MINGW code
>> >>
>> >>generation differ from gcc-linux code generation.
>> >>
>> >> 3) MINGW sizeof long differs from gnu-linux size of long, resulting
>> >>
>> >>in more code generation differences.
>> >
>> > These aren't new issues, surely? The GCC builds are still larger than
>> > the MSVC builds, largely due to CFLAGS as recently discussed but also
>> > because we don't yet have LTO for GCC, do we? And we don't use
>> > -ffunction-sections --gc-sections and other tricks so we can only drop
>> > unused things out at the C file granularity.
>>
>> Another reason to unify the GCC compiler and linker flags: we do use
>> -ffunction-sections -fdata-sections and --gc-sections, but only for
>> GCC44 - GCC49, and these flags are not inherited by UNIXGCC et al
>>
>> So I suppose the linker output is a PE/COFF application when using
>> MinGW, and the BaseTools/ just skip the ELF conversion in this case? I
>> wonder whether --gc-sections works well here, but I can have a look.
>
> For the record, I tend to use the UNIXGCC cross-build toolchain on my
> FreeBSD/amd64 9.1-RELEASE machine at work. The system compiler is gcc 4.2.1,
> and it and the system linker aren't quite sexy enough to build EDK2/OVMF on
> their own. (Newer releases might be better, but I'm not in a position to
> upgrade my work system right now.) Instead I've been using the mingw-gcc-
> build.py script to bootstrap a GCC MinGW-targeted toolchain, and it's worked
> fine for me so far.
>

OK, good to know.

> Yes, the MinGW toolchain does generate PE/COFF objects directly so you can
> skip the objcopy conversion step from ELF. You need a set of binutils to
> handle this off course, but the mingw-gcc-build.py bootstraps those for you
> too.
>

I am currently testing with my distro supplied MinGW, which is based on 4.8.3

> I recently experimented with updating the mingw-gcc-build.py script to use a
> newer version of GCC, in this case 4.9.3 and binutils 2.25. I had to update
> tools_def.template a little to get it to work. I was planning to submit this
> as a patch but was waiting for the dust around GCC rule tweaking to settle. So
> far it hasn't settled yet. :)
>

Well, MinGW is a really good data point, so if I end up proposing
another round of patches that unifies GCC support, I will take this
into account.

> The only real gotcha I ran into is the "underscore" convention. With MinGW,
> the rule seems to be that for IA32, all symbols get a leading underscore, but
> on X64 they do not. This is something that seems to have changed between GCC
> 4.3.0 and 4.9.3. For example, currently (well, unless someone changed them
> recently), the following generic GCC rules exist:
>
> DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry
> _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
>
> DEFINE GCC_IA32_X64_DLINK_FLAGS= DEF(GCC_IA32_X64_DLINK_COMMON) --entry
> _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(D
> EST_DIR_DEBUG)/$(BASE_NAME).map
>
> The IA32_X64 in the names assumes that these rules apply for both targets, and
> you can see that they apply leading underscores to symbol names
> (_ReferenceAcpiTable, _$(IMAGE_ENTRY_POINT)). This worked for GCC 4.3.0, but
> GCC 4.9.3 only automatically applies the leading underscore for IA32, not for
> X64. So this rule can't be applied to both anymore.
>
> I'm not sure of the reason for the difference, but I tried several different
> GCC releases newer than 4.3.0 and they all had the same behavior. I suspect
> the newer behavior (X64 doesn't use leading underscores) is correct and the
> earlier behavior was buggy. Maybe someone who knows more about the MS
> toolchain can clear this up.
>

As far as I could dig up, the leading underscore convention used by
Microsoft is 32-bit only. I guess that means EDK2 was right all along
(unsurprisingly), MinGW got fixed along the way, and the best way
forward would be to use the correct convention for UNIXGCC/X64 builds
from now on, which would mean dropping support for pre-4.3.0

> In any case, when I first tried it, I found that IA32 OVMF builds produced
> working firmware images, but X64 OVMF builds did not. The underscore
> difference meant that the linker could not find _$(IMAGE_ENTRY_POINT) which
> lead to the generation of bogus images, though it did not lead to the build
> aborting right away. Instead there was 

[edk2] [Patch] MdeModulePkg: IP4 should re-initiate a DHCP while network reconnection

2015-08-14 Thread Jiaxin Wu
IP4 driver should re-initiate a DHCP if it detects that there is a network.
To fix this issue, we can implement the DHCP re-initiate policy while the media
change detected. The Ip4 driver should set a timer to signal the Ip4 to run the
DHCP configuration again(D.O.R.A). IP4 driver should free old IP address related
resource, then initiate a DHCP process to acquire new IP.

Cc: Ye Ting 
Cc: Zhang Lubo 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c  |   1 +
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c  |  10 ++
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c| 119 +++--
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h|   7 ++
 4 files changed, 131 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index fcb2bdd..caf84fb 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -490,10 +490,11 @@ Ip4Config2SetDefaultAddr (
   IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);
   IpIf = IpSb->DefaultInterface;
   ASSERT (IpIf != NULL);
 
   if ((IpIf->Ip == StationAddress) && (IpIf->SubnetMask == SubnetMask)) {
+IpSb->State = IP4_SERVICE_CONFIGED;
 return EFI_SUCCESS;
   }
 
   //
   // The default address is changed, free the previous interface first.
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index 101390c..4d3ccec 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -208,10 +208,14 @@ Ip4CreateService (
 
   ZeroMem (&IpSb->SnpMode, sizeof (EFI_SIMPLE_NETWORK_MODE));
 
   IpSb->Timer = NULL;
 
+  IpSb->ReconfigEvent = NULL;
+  
+  IpSb->MediaPresent = TRUE;
+
   //
   // Create various resources. First create the route table, timer
   // event and MNP child. IGMP, interface's initialization depend
   // on the MNP child.
   //
@@ -384,10 +388,16 @@ Ip4CleanService (
 gBS->CloseEvent (IpSb->Timer);
 
 IpSb->Timer = NULL;
   }
 
+  if (IpSb->ReconfigEvent != NULL) {
+gBS->CloseEvent (IpSb->ReconfigEvent);
+
+IpSb->ReconfigEvent = NULL;
+  }
+
   if (IpSb->MacString != NULL) {
 FreePool (IpSb->MacString);
   }
 
   Ip4Config2CleanInstance (&IpSb->Ip4Config2Instance);
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
index 2fb4f4c..3165af0 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
@@ -561,10 +561,58 @@ Ip4InitProtocol (
 
   EfiInitializeLock (&IpInstance->RecycleLock, TPL_NOTIFY);
 }
 
 
+/**
+  The event handle for IP4 auto reconfiguration. The original default
+  interface and route table will be removed as the default.
+
+  @param[in]  ContextThe IP4 service binding instance.
+
+**/
+VOID
+EFIAPI
+Ip4AutoReconfigCallBackDpc (
+  IN VOID   *Context
+  )
+{
+  IP4_SERVICE   *IpSb;
+
+  IpSb  = (IP4_SERVICE *) Context;
+  NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
+
+  if (IpSb->State > IP4_SERVICE_UNSTARTED) {
+IpSb->State = IP4_SERVICE_UNSTARTED;
+  }
+
+  Ip4StartAutoConfig (&IpSb->Ip4Config2Instance);
+
+  return ;
+}
+
+
+/**
+  Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK.
+
+  @param Event The event that is signalled.
+  @param Context   The IP4 service binding instance.
+
+**/
+VOID
+EFIAPI
+Ip4AutoReconfigCallBack (
+  IN EFI_EVENT  Event,
+  IN VOID   *Context
+  )
+{
+  //
+  // Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK
+  //
+  QueueDpc (TPL_CALLBACK, Ip4AutoReconfigCallBackDpc, Context);
+}
+
 
 /**
   Configure the IP4 child. If the child is already configured,
   change the configuration parameter. Otherwise configure it
   for the first time. The caller should validate the configuration
@@ -676,14 +724,31 @@ Ip4ConfigProtocol (
 //
 // Use the default address. If the default configuration hasn't
 // been started, start it.
 //
 if (IpSb->State == IP4_SERVICE_UNSTARTED) {
+  //
+  // Create the ReconfigEvent to start the new configuration.
+  //
+  if (IpSb->ReconfigEvent == NULL) {
+Status = gBS->CreateEvent (
+EVT_NOTIFY_SIGNAL,
+TPL_NOTIFY,
+Ip4AutoReconfigCallBack,
+IpSb,
+&IpSb->ReconfigEvent
+);
+
+if (EFI_ERROR (Status)) {
+  goto ON_ERROR;
+}
+  }
+  
   Status = Ip4StartAutoConfig (&IpSb->Ip4Config2Instance);
 
   if (EFI_ERROR (Status)) {
-goto ON_ERROR;
+goto CLOSE_RECONFIG_EVENT;
   }
 }
 
 IpIf = IpSb->Defaul

Re: [edk2] [PATCH] ShellPkg\Tftp.c: Refine parameter name and use implicit comparison for BOOLEAN variable.

2015-08-14 Thread Ni, Ruiyu


Reviewed-by: Ruiyu Ni 



-Original Message-
From: Qiu, Shumin 
Sent: Monday, August 10, 2015 3:31 PM
To: edk2-devel@lists.01.org
Cc: Qiu, Shumin ; Ni, Ruiyu ; Ronald 
Cron 
Subject: [PATCH] ShellPkg\Tftp.c: Refine parameter name and use implicit 
comparison for BOOLEAN variable.

1. Refine parameter name to consistent with function headers.
2. To avoid potential bug BOOLEAN values should not use explicit comparisons to 
TRUE or FALSE.

Cc: Ruiyu Ni 
Cc: Ronald Cron 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin 
---
 ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c 
b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
index d837485..d2f7046 100644
--- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
+++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
@@ -73,7 +73,7 @@ STATIC
 EFI_STATUS 
 GetNicName (
   IN   EFI_HANDLE  ControllerHandle,
-  IN   UINTN   Index,
+  IN   UINTN   NicNumber,
   OUT  CHAR16  *NicName
   );
 
@@ -524,7 +524,7 @@ ShellCommandRunTftp (
   );
   }
 
-  if ((UserNicName != NULL) && (NicFound == FALSE)) {
+  if ((UserNicName != NULL) && (!NicFound)) {
 ShellPrintHiiEx (
   -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NIC_NOT_FOUND),
   gShellTftpHiiHandle, UserNicName
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel