summaryrefslogtreecommitdiff
path: root/BaseTools/Source
AgeCommit message (Collapse)Author
2016-09-25BaseTools: handling the case that map file is not existYonghong Zhu
We meet a case that add the library inf file which has the uni file in the [Sources] section, for this case there will no map file exist, it cause build tools report Traceback error. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-09-21BaseTools: Update Python Makefile not to depend on PYTHON_FREEZER_PATHLiming Gao
If PYTHON_FREEZER_PATH is not set, Python tools will not be freeze. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Erik Bjorge <erik.c.bjorge@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
2016-09-21BaseTools: Update python tool to call external tools with shell true modeLiming Gao
Python tool may run from source as the dos batch files. So, update python code to call external tools with shell true mode. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Erik Bjorge <erik.c.bjorge@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
2016-09-20BaseTools: Follow PI1.4a to fix artificial limitation of PCD SkuId rangeYonghong Zhu
Current BaseTools follow previous PI spec to use UINT8 for SkuId, to follow PI1.4a, BaseTools need to be updated to fix artificial limitation of PCD SkuId range. This patch is to update BaseTools to use UINT64 for SkuId, since the PCD database structure needs to be naturally aligned, the PCD database structure layout is adjusted to keep the natural alignment and version is updated to 6. Note: As the PCD database structure layout is adjusted, the structure definition in MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h and PCD drivers also need to be updated. That means the source code and BaseTools need to be upgraded at the same time, and if they are not upgraded at the same time, build error like below will be triggered to help user identify the problem. "Please make sure the version of PCD PEIM Service and the generated PCD PEI Database match." Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-09-15BaseTools: Fix the bug to handle the read-only fileYonghong Zhu
change the 'r+b' to 'rb' for some file's open, since these files we only read it and no need to write. It can fix the bug that the file's attribute had been set to read-only. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-09-09BaseTools/EfiRom: supply missing machine type lookup stringsLaszlo Ersek
"EfiRom --dump" does not recognize the 0x8664 machine type: > EFI ROM header contents > EFI Signature 0x0EF1 > Compression Type 0x0001 (compressed) > Machine type 0x8664 (unknown) > Subsystem 0x000B (EFI boot service driver) > EFI image offset 0x0050 (@0xF650) Add lookup strings for the remaining EFI_IMAGE_MACHINE_* numeric macros that can be found in "BaseTools/Source/C/Include/IndustryStandard/PeImage.h". The strings follow Table 12. "UEFI Image Types" from the UEFI v2.6 spec. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-09-08BaseTools VfrCompile Pccts: Update GCC Flags to the specific one with BUILD_ ā†µLiming Gao
prefix This change is also applied to VfrCompile Pccts antlr and dlg tool. In V2, add the missing C rules. Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-09-08BaseTools VfrCompile GNU makefile: Replace CXX with BUILD_CXXLiming Gao
The change is missing in VfrComile GNUmakefile. Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-09-08BaseTools GNU makefile: remove unused .S ruleLiming Gao
Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-09-08BaseTools GNU makefile: Add BUILD_CXXFLAGS to align make built-in ruleLiming Gao
GNU make built-in rule to Compiling C++ programs with ā€˜$(CXX) $(CPPFLAGS) $(CXXFLAGS) -cā€™. To align to it, add empty BUILD_CXXFLAGS in cpp rule. Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-09-04BaseTools: Change source files to DOS formatYonghong Zhu
Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-30BaseTools: UpdateImageSize include Image auth info for FMP Auth capsuleYonghong Zhu
Per UEFI spec UpdateImageSize may or may not include Firmware Image Authentication information. so for FMP auth capsule, UpdateImageSize should include the Image auth info. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-23BaseTools/GenFw: ignore dynamic RELA sectionsArd Biesheuvel
When building PIE (ET_DYN) executables, an additional RELA section is emitted (in addition to the per-section .rela.text and .rela.data sections) that is intended to be resolved at runtime by a ET_DYN compatible loader. At the moment, due to the fact that we don't support GOT based relocations, this dynamic RELA section only contains relocations that are redundant, i.e., each R_xxx_RELATIVE relocation it contains duplicates a R_xxx_xx64 relocation appearing in .rela.text or .rela.data, and so we can simply ignore this section (and we already ignore it in practice due to the fact that it points to the NULL section, which has the SHF_ALLOC bit cleared). For example, Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .text PROGBITS 0000000000000240 000000c0 000000000000427c 0000000000000008 AX 0 0 64 [ 2] .rela.text RELA 0000000000000000 00009310 0000000000001bf0 0000000000000018 I 7 1 8 [ 3] .data PROGBITS 00000000000044c0 00004340 00000000000046d0 0000000000000000 WA 0 0 64 [ 4] .rela.data RELA 0000000000000000 0000af00 0000000000000600 0000000000000018 I 7 3 8 [ 5] .rela RELA 0000000000008bc0 00008a10 0000000000000600 0000000000000018 0 0 8 [ 6] .shstrtab STRTAB 0000000000000000 0000b500 0000000000000037 0000000000000000 0 0 1 [ 7] .symtab SYMTAB 0000000000000000 00009010 0000000000000210 0000000000000018 8 17 8 [ 8] .strtab STRTAB 0000000000000000 00009220 00000000000000eb 0000000000000000 0 0 1 Relocation section '.rela.data' at offset 0xaf00 contains 64 entries: Offset Info Type Sym. Value Sym. Name + Addend 000000004800 000100000001 R_X86_64_64 0000000000000240 .text + 3f5b 000000004808 000100000001 R_X86_64_64 0000000000000240 .text + 3f63 000000004810 000100000001 R_X86_64_64 0000000000000240 .text + 3f79 000000004818 000100000001 R_X86_64_64 0000000000000240 .text + 3f90 000000004820 000100000001 R_X86_64_64 0000000000000240 .text + 3fa6 ... Relocation section '.rela' at offset 0x8a10 contains 64 entries: Offset Info Type Sym. Value Sym. Name + Addend 000000004800 000000000008 R_X86_64_RELATIVE 419b 000000004808 000000000008 R_X86_64_RELATIVE 41a3 000000004810 000000000008 R_X86_64_RELATIVE 41b9 000000004818 000000000008 R_X86_64_RELATIVE 41d0 000000004820 000000000008 R_X86_64_RELATIVE 41e6 000000004828 000000000008 R_X86_64_RELATIVE 41ff ... Note that GOT based relocations result in entries that *only* appear in the dynamic .rela section and not in .rela.text or .rela.data. This means two things if we intend to add support for GOT based relocations: - we must check that a dynamic RELA section exists; - we must filter out duplicates between .rela and .rela.xxx, to prevent emitting duplicate fixups into the PE/COFF .reloc section. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-23BaseTools GnuMakefile: Update GCC Flags to the specific one with BUILD_ prefixLiming Gao
To avoid the conflict with the default GCC flag name, BUILD_ prefix is added. Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
2016-08-23BaseTools GNU Makefile: Add the missing rules for cpp source fileLiming Gao
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
2016-08-23BaseTools: update BinaryFiles.txt file to add Pkcs7Sign ToolYonghong Zhu
add Pkcs7Sign.exe and related pem file into BinaryFiles.txt for build server to automatically build the binary win32 files. Cc: Liming Gao <liming.gao@intel.com> CC: Erik Bjorge <erik.c.bjorge@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
2016-08-23BaseTools: add capsule image header for auth FMP capsule fileYonghong Zhu
in last commit 91ae29, it missed to add the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER for the auth FMP capsule. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-22BaseTools PeCoffLib: Fix the issue to get RelocationsStripped from TE imageLiming Gao
If PE image has no relocation section, and has not set RELOCS_STRIPPED, after it is converted to TE image, GenFw will set its relocation section VirtualAddress to non-zero address, and keep Size value as Zero. MdePkg BasePeCoffLib applied this rule to get RelocationsStripped attribute. But, it is missing in BaseTools BasePeCoffLib. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-08-19BaseTools: Fix a bug use 'COMMON' as CodeBase in BuildOptions sectionYonghong Zhu
Current BaseTools query the BuildOptions not cover the case that use 'COMMON' as CodeBase, while DSC spec allow this usage. This Patch add support for such 'common.DXE_RUNTIME_DRIVER' as the Scope2 in the query Condition. Cc: Liming Gao <liming.gao@intel.com> Cc: Kurt Kennett <Kurt.Kennett@microsoft.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-19BaseTools: FMP capsule add the support to generate auth infoYonghong Zhu
Current BaseTools cannot generate EFI_FIRMWARE_IMAGE_AUTHENTICATION for FMP capsule. this patch fix it by FDF spec's update to add the definition for CERTIFICATE_GUID and MONOTONIC_COUNT. BaseTools call the tool by CERTIFICATE_GUID to generate the certdata and fill the header info. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-19BaseTools: Rsa2048Sha256Sign add new option to support Monotonic countYonghong Zhu
the EFI_FIRMWARE_IMAGE_AUTHENTICATION struct require the AuthInfo which is a signature across the image data and the Monotonic Count value, so we add the new option to support Monotonic count. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-19BaseTools: Add the PKCS7 toolYonghong Zhu
Provide the PKCS7 Tool to support the CertType - EFI_CERT_TYPE_PKCS7_GUID, then user can use this tool to add EFI_FIRMWARE_IMAGE_AUTHENTICATION for a binary. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-19BaseTools: check CONF_PATH env to get the configure filesYonghong Zhu
Add CONF_PATH env check. First priority is user set the conf dir by --conf option, then the CONF_PATH env, the last one is the standard WORKSPACE(PACKAGE_PATH)/Conf. Also print the conf path directory in the build log. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-14BaseTools/GenFv: Account for rebase of FV section containing VTF fileLeo Duran
Account for rebase of FV section containing VTF file on IA32/IA64. This supports cases where the reset vector may not be set at 0xFFFFFFF0. For example, FV section defined as: [FV.FvSecPei] FvBaseAddress = $(FV_BOOT_BASE) FvForceRebase = TRUE Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leo Duran <leo.duran@amd.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-12BaseTool/VfrCompile: Remove reset button opcode in CheckQuestionOpCodeDandan Bi
"EFI_IFR_RESET_BUTTON_OP" is a statement, not a question, so remove it from function CheckQuestionOpCode. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
2016-08-09BaseTools/UPT: Fix a install issueHess Chen
Fix a corner case issue of installing a module without any files which causes installing UNI file failure Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-08-08BaseTools X64: fold PLT relocations into simple relative referencesArd Biesheuvel
For X64/GCC, we use position independent code with hidden visibility to inform the compiler that symbol references are never resolved at runtime, which removes the need for PLTs and GOTs. However, in some cases, GCC has been reported to still emit PLT based relocations, which we need to handle in the ELF to PE/COFF perform by GenFw. Unlike GOT based relocations, which are non-trivial to handle since the indirections in the code can not be fixed up easily (although relocation types exist for X64 that annotate relocation targets as suitable for relaxation), PLT relocations simply point to jump targets, and we can relax such relocations by resolving them using the symbol directly rather than via a PLT entry that does nothing more than tail call the function we already know it is going to call (since all symbol references are resolved in the same module). So handle R_X86_64_PLT32 as a R_X86_64_PC32 relocation. Suggested-by: Steven Shi <steven.shi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-08BaseTools/VfrCompile: Add two new option for VfrCompileDandan Bi
1.--autodefault option VfrCompile will generate default opcodes for questions if some default are missing. 2 --checkdefault option VfrCompile will check whether every question has no default or has all default. If not, will generate an error to let user know the question misses default. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-08-08BaseTool/VfrCompile: Add missing question opcodeDandan Bi
The function CheckQuestionOpCode is to check whether the opcode is question opcode, but it misses two question opcodes: 'EFI_IFR_REF_OP' and 'EFI_IFR_RESET_BUTTON'. Now add them. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-08-08BaseTools: Fix the bug when use FILE_GUID override the module in DSCYonghong Zhu
In last commit 2502b73, it doesn't cover the case that in the DSC file use FILE_GUID to override the module. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-08BaseTools: Allow string token identifier to use lower case lettersYonghong Zhu
This patch is to align the code behavior with UNI spec that string token identifier can use upper case and lower case letters. Cc: Liming Gao <liming.gao@intel.com> Cc: Felix <Felixp@ami.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-03BaseTool/Upt: Avoid UNI file name conflictHess Chen
When creating a UNI file if there is a name conflict, add an index from 0 to the file name Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-08-03BaseTool/UPT: Not expand macro for UserExtensionHess Chen
All MACRO values defined by the DEFINE statements n any section (except [Userextensions] sections other than TianoCore."ExtraFiles) of the INF or DEC file must be expanded before processing of the file. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-08-03BaseTool/Upt: Add support for PrivateHess Chen
Support new syntax in package DEC file as below: [Includes.Common.Private] [Ppis.Common.Private] [Guids.Common.Private] [Protocols.Common.Private] Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-08-03BaseTool/UPT: Add Test InstallHess Chen
Add a new function to test if a DIST file list one by one to see if they can meet the requirement of Dependency. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-08-02BaseTools: Keep the Pcd order in the Asbuilt Inf is same with SourceYonghong Zhu
The original behavior is that in the Asbuilt inf Pcd's order is base on the Pcd's offset. Now we change the order to keep it is same with the Pcd order in the source inf file. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-02BaseTools/GenFw AARCH64: convert ADRP to ADR instructions if binary size ā†µArd Biesheuvel
allows it The ADRP instruction in the AArch64 ISA requires the link time and load time offsets of a binary to be equal modulo 4 KB. The reason is that this instruction always produces a multiple of 4 KB, and relies on a subsequent ADD or LDR instruction to set the offset into the page. The resulting symbol reference only produces the correct value if the symbol in question resides at that exact offset into the page, and so loading the binary at arbitrary offsets is not possible. Due to the various levels of padding when packing FVs into FVs into FDs, this alignment is very costly for XIP code, and so we would like to relax this alignment requirement if possible. Given that symbols that are sufficiently close (within 1 MB) of the reference can also be reached using an ADR instruction which does not suffer from this alignment issue, let's replace ADRP instructions with ADR after linking if the offset can be encoded in this instruction's immediate field. Note that this only makes sense if the section alignment is < 4 KB. Otherwise, replacing the ADRP has no benefit, considering that the subsequent ADD or LDR instruction is retained, and that micro-architectures are more likely to be optimized for ADRP/ADD pairs (i.e., via micro op fusing) than for ADR/ADD pairs, which are non-typical. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-07-29BaseTools/Ecc: GUID checkpointHess Chen
Fix a bug of checking duplicate GUID Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-07-29BaseTools: Add build info for binary modules that only list in FDF fileYonghong Zhu
If the binary module is list in the FDF file but not list in the DSC file, current build report would not include these binary module's info in the report "Module section". The patch fix this issue. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-07-27BaseTools: report error if source module INF is only list in FDF fileYonghong Zhu
If source module INF is not listed in DSC, it will not be built. And it is listed in FDF, GenFds will fail to find its build output. To reminder user this issue early, build tool should report failure to user in early phase. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-07-18BaseTools: Fix a bug for FixedPcd value generation in AutoGen fileYonghong Zhu
If the library is listed in [Components] section for build only, its used FixedPcd Value is not generated into AutoGen code. This patch cover this case to generate the FixedPcd Value in AutoGen file. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-07-14BaseTools: Update the FV region name as upper letterYonghong Zhu
Since in the GenFds phase, the FV is generated as upper letter. This patch update the FV region name as upper letter, it can fix the build report generate failure on case sensitive file system. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Andrew Fish <afish@apple.com>
2016-07-12BaseTools/GenFds: unbreak Region.PadBufferLaszlo Ersek
In its current form, Region.PadBuffer() fills every second byte with 0x20, the default separator string of Python's string.join(): https://docs.python.org/2/library/string.html#string.join This corrupts some firmware because (a) 0x20 never corresponds to any ErasePolarity, (b) the PadData produced are actually longer than Size. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Fixes: bd907fb6386560e621112beca7b7d381d0003967 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-07-12BaseTools/GenFds: speed up Region.PadBuffer()Laszlo Ersek
The current implementation calls both pack() and Buffer.write() Size times. The new implementation calls both of these methods only once; the full data to write are constructed locally [1]. The range() function is replaced by xrange() because the latter is supposed to be faster / lighter weight [2]. On my laptop, I tested the change as follows: I pre-built the series at [3] with build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b DEBUG \ -D HTTP_BOOT_ENABLE -D SECURE_BOOT_ENABLE (The series at [3] is relevant because it increases the size of one of the padded regions by 8.5 MB, slowing down the build quite a bit.) With all source code already compiled, repeating the above command takes approximately 45 seconds. With the patch applied, it goes down to 29 seconds. [1] http://stackoverflow.com/questions/27384093/fastest-way-to-write-huge-data-in-file [2] https://docs.python.org/2/library/functions.html?highlight=xrange#xrange [3] http://thread.gmane.org/gmane.comp.bios.edk2.devel/14214 We can also measure the impact with a synthetic test: > import timeit > > test_old = """ > import struct, string, StringIO > Size = (8 * 1024 + 512) * 1024 > Buffer = StringIO.StringIO() > PadData = 0xFF > for i in range(0, Size): > Buffer.write(struct.pack('B', PadData)) > """ > > test_new = """ > import struct, string, StringIO > Size = (8 * 1024 + 512) * 1024 > Buffer = StringIO.StringIO() > PadByte = struct.pack('B', 0xFF) > PadData = string.join(PadByte for i in xrange(0, Size)) > Buffer.write(PadData) > """ > > print(timeit.repeat(stmt=test_old, number=1, repeat=3)) > print(timeit.repeat(stmt=test_new, number=1, repeat=3)) The output is [8.231637001037598, 8.81188416481018, 8.948754072189331] [0.5503702163696289, 0.5461571216583252, 0.578315019607544] Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-07-12BaseTools/GenFds: factor out Region.PadBuffer() methodLaszlo Ersek
The same logic is used in five places; factor it out to a common method. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-07-05BaseTools: Add support for $(FAMILY) macroYonghong Zhu
Build spec mentions $(FAMILY) macro be used in DSC/FDF to specify the tool chain family, like GCC, MSFT. This patch add the support for this macro. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-06-15BaseTools: ignore the binary LIB file in gen_libsYonghong Zhu
For single module build, it would call gen_libs target. then if it use binary LIB file, it cause build failure. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-06-04BaseTools: fix the bug to build a compressed ROM image via .INF fileYonghong Zhu
Fix the bug that always use the '-e' as OPTROM_FLAGS even the .INF file has statement 'PCI_COMPRESS = TRUE'. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-06-04BaseTools: Add error handling for current_dir is not existYonghong Zhu
Add the error handling to cover the case that current_dir is not exist. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-05-27BaseTools: Fix bad macro expansion during tools_def.txt parsingMichael Zimmermann
this is something I missed in 8ac46e4 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com> Reviewed-by: Liming Gao <liming.gao@intel.com>