summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/C
Commit message (Collapse)AuthorAgeFilesLines
* BaseTools/Source/C: Remove CPU architecture assumptionsMichael D Kinney2021-04-152-6/+4
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3308 The EDK II Build Specifications do not restrict the set of CPU architectures that can be supported. Remove places in the EDK II that assume a fixed set of CPU architectures. Remove build breaks in the following tools when a check against a fixed set of CPU architectures is made. * GenFw Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Abner Chang <abner.chang@hpe.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Convert Split tool to pythonBob Feng2021-01-215-501/+0
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3165 There are 2 reasons to convert Split tool from C to Python. 1. We are in the process of moving the Basetools Python code to a separate repository. But there still are many C tools under edk2/BaseTools. To make all Basetools be in the separate repo, we can convert the C tools to Python tools. 2. The original Split tool is very slow. This python tool can reduce 90% time. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
* BaseTools LzmaCompress: Update LZMA to new 19.00 versionLiu, WeiX C2021-01-0812-575/+877
| | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3101 New formal release in https://www.7-zip.org/sdk.html is 19.00. Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Wei Liu <weix.c.liu@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools/CommonLib.h: Build failed due to MAX_LONG_FILE_PATHEnze Zhu2021-01-061-0/+8
| | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3032 We had a build fail due to the hard coded MAX_LONG_FILE_PATH value. We should use PATH_MAX if it is available. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Enze Zhu <zhuenze@byosoft.com.cn> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/EfiRom: remove redundant checking of argcwenyi,xie via groups.io2020-12-221-1/+1
| | | | | | | | | | | As the condition of while statement is argc > 0, so argc < 1 will always be false, it's redundant. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/GenFfs: Optimazing else if statementwenyi,xie via groups.io2020-12-221-6/+5
| | | | | | | | | | | When Alignment < 0x400 is false, the expression of Alignment >= 0x400 is always true. So extract the expression from the else if statement. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Fix BrotliCompress tool issueYunhua Feng2020-11-133-4/+576
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2946 This is the regression issue in BaseTools BrotliCompress after Brotli is changed to submodule. BrotliCompress should store the source size and scratch buffer size into the header of the compressed binary data. But now, BrotliCompress doesn't store them. So, BrotliDecompress can't work. To fix this issue, BrotliCompress tool main() function should be provided. It needs to support the options of -e, -d, -o file, -g gap, -q level. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Yunhua Feng <fengyunhua@byosoft.com.cn> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools/VfrCompile: VFR compiler supports REST_STYLE in HII optionAbner Chang2020-11-111-3/+22
| | | | | | | | | | | | | | | | | | Add REST_STYLE support on VFR language BZ: 2916 https://bugzilla.tianocore.org/show_bug.cgi?id=2916 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Signed-off-by: Ye Ting <ting.ye@intel.com> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Signed-off-by: Wang Fan <fan.wang@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Nickle Wang <nickle.wang@hpe.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Add image type into generate map fileYunhua Feng2020-11-101-1/+6
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2977 For a source-level BIOS debugger the .map files are quite useful with one major shortcoming: the debugger cannot know, solely from the .map file, the format (PE/COFF vs. TE) of the image included in the final BIOS ROM Add Type=PE or TE in the map file Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Yunhua Feng <fengyunhua@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Fix BaseTools nmake cleanall hang issuefengyunhua2020-11-061-1/+4
| | | | | | | | | | | | | | | | | On windows system, when use command chcp displays the number of the active console code page, if the active console code is 936, run make cleanall in the BaseTools will hang. Issue reproduce step: chcp 936 edksetup.bat VS2015 cd BaseTools nmake cleanall Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Yunhua Feng <fengyunhua@byosoft.com.cn> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Fix PcdValueInit tool build issue with VS compiler x64Bob Feng2020-10-261-1/+1
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3001 When the 64-bit version of VS compiler is used, the generated PcdValueInit tool will be failed to compile. This patch is going to fix that issue. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Move C tool flags before the common flagsgaoliming2020-10-101-1/+1
| | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2938 C tool may add the additional INC include path. They should have high priority than the common INC include path. This fix is to resolve the structure PCD issue to refer to the same header file defined in BaseTools and MdePkg. The one in MdePkg should be used. Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Yuwei Chen<yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Tested-by: Garrett Kirkendall <garrett.kirkendall@amd.com>
* BaseTools: Copy PACKED definition from MdePkg Base.hgaoliming2020-10-101-0/+10
| | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2938 MdePkg Acpi10.h definition depends on PACKED. When structure PCD refers to Acpi10.h, build will fail, because PACKED definition is missing in BaseTools BaseTypes.h. C source tools include BaseTools BaseTypes.h. They don't include MdePkg Base.h. When C source tools include MdePkg Acpi10.h, they also need PACKED definition. So, add PACKED definition into BaseTools BaseTypes.h. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Tested-by: Garrett Kirkendall <garrett.kirkendall@amd.com>
* BaseTools: Add RISCV64 bindingNikita2020-09-293-0/+94
| | | | | | | | | | - Add RISCV64 ProcessorBind.h - Add RISCV64 to Makefiles Signed-off-by: Nikita Ermakov <sh1r4s3@mail.si-head.nl> Ack-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Abner Chang <abner.chang@hpe.com>
* BaseTools/VolInfo: Fix spelling mistakeMichael D Kinney2020-08-051-1/+1
| | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2349 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/GenSec: Fix spelling mistakeMichael D Kinney2020-08-031-1/+1
| | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2345 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/PeCoffLoaderEx: Remove the unused local variableAbner Chang2020-07-291-3/+0
| | | | | | | | | | | | | BZ:2864 GCC build fails due to variable self assignment. This local variable is not used at any where, we can just remove it. Signed-off-by: Abner Chang <abner.chang@hpe.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Daniel Schaefer <daniel.schaefer@hpe.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* Using LLVM compiler set to build BaseTools in LinuxLiu, Zhiguang2020-07-214-4/+32
| | | | | | | | | | | | | | | Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2842 To use LLVM to build BaseTools, first set the CLANG_BIN environment value, and add "CXX=llvm" to choose LLVM compiler set when using make command. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>
* BaseTools GenFv: Report the correct spare FV image sizeLiming Gao2020-06-111-0/+13
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2790 If the top FFS is placed in FV image, current FV will show there is no space. In fact, the pad ffs in FV image can be regarded as the spare space. This change reports the max pad ffs size as the spare space for use. Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Bootable NVDIMM namespacesOleksiy Yakovlev2020-05-151-0/+12
| | | | | | | | | | | | Provided a mechanism for UEFI FW to identify and hand off bootable NVDIMM namespaces to the OS by standardizing the EFI device path. EFI device path for physical NVDIMM devices changed from an ACPI _ADR device to an ACPI NVDIMM device for correctness. (UEFI 2.8 mantis 1858) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
* BaseTools: REST style formsetOleksiy Yakovlev2020-05-151-0/+1
| | | | | | | | | | In question level, a new flag EFI_IFR_FLAG_REST_STYLE is defined. (UEFI 2.8 mantis 1853) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
* BaseTools: BaseTools changes for RISC-V platform.Abner Chang2020-04-298-13/+580
| | | | | | | | | | | | | | | C code changes for building EDK2 RISC-V platform. Signed-off-by: Abner Chang <abner.chang@hpe.com> Co-authored-by: Gilbert Chen <gilbert.chen@hpe.com> Co-authored-by: Daniel Helmut Schaefer <daniel.schaefer@hpe.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Gilbert Chen <gilbert.chen@hpe.com>
* BaseTools: Make brotli a submoduleShenglei Zhang2020-04-1689-35213/+53
| | | | | | | | | | | Use submodule way to access brotli in BaseTools based on brotli version 666c3280cc11dc433c303d79a83d4ffbdd12cc8d. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2558 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/PcdValueCommon: Fix 64-bit host compiler errorSean Brogan2020-02-071-1/+1
| | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2496 Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/Build: Do not use Common.lib in Structured PCD appKinney, Michael D2020-02-072-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2496 Reduce the build and env dependencies for the Structured PCD application by removing the dependency on Common.lib that is only built when BaseTools is built which does not happen if pre-compiled BaseToools are used. Change the makefile for the Structure PCD application to build all files from sources which adds PcdValueCommon.c to the makefile. Also remove PcdValueCommon.c from Common.lib. With the change to the makefile for the Structured PCD application, multiple C files are compiled. Only PcdValueInit.c contains the extra information expected by the error/warning message parser. Only parse the DSC line number into an error message if there is an error/warning in PcdValueInit.c. Errors/warnings in other files should be passed through. This fixes a build failure with no useful log information that was observed when there was a compiler error in PcdValueCommon.c. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* edksetup.bat stuck on unicode locale WindowsPark, Aiden2019-12-231-1/+1
| | | | | | | | | | | | | | This issue happens under two conditions. 1. Unicode language environment in Windows 2. Python2 (Not reproducible with Python3) Step to reproduce C:\edk2>edksetup.bat forcerebuild The edksetup.bat stuck at 'nmake cleanall'. Signed-off-by: Aiden Park <aiden.park@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/GenFw AARCH64: disregard ADRP instructions that are patched alreadyArd Biesheuvel2019-11-081-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to permit the use of compilers that only implement the small code model [which involves the use of ADRP instructions that require 4 KB segment alignment] for generating PE/COFF binaries with a small footprint, we patch ADRP instructions into ADR instructions while doing the ELF to PE/COFF conversion. As it turns out, the linker may be doing the same, but for different reasons: there is a silicon erratum #843419 for ARM Cortex-A53 which affects ADRP instructions appearing at a certain offset in memory, and one of the mitigations for this erratum is to patch them into ADR instructions at link time if the symbol reference is within -/+ 1 MB. However, the LD linker fails to update the static relocation tables, and so we end up with an ADR instruction in the fully linked binary, but with a relocation entry in the RELA section identifying it as an ADRP instruction. Since the linker has already updated the symbol reference, there is no handling needed in GenFw for such instructions, and we can simply treat it as an ordinary ADR. However, since it is guaranteed to be accompanied by an add or load instruction with a LO12 relocation referencing the same symbol, the section offset check we apply to ADR instructions is going to take place anyway, so we can just disregard the ADR instruction entirely. Reported-by: Eugene Cohen <eugene@hp.com> Suggested-by: Eugene Cohen <eugene@hp.com> Tested-by: Eugene Cohen <eugene@hp.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Acked-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* BaseTools: Add support for parseing map files generated by CLANG9 in GenFvZhiguang Liu2019-11-081-5/+23
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2320 Add support for parseing map files generated by CLANG9 in GenFv Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* BaseTools GenFw: Fix the issue to update the wrong size as SectionSizeLiming Gao2019-10-241-2/+6
| | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603 CLANG9 generated PE image exposes below two issues. 1. SectionSize is used to copy PE section data. It should be smaller than section raw size. 2. The real data is required to be copied. So, copy the min size of VirtualSize and SizeOfRawData. Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
* BaseTools: strip trailing whitespaceLeif Lindholm2019-10-047-15/+15
| | | | | | | Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* BaseTools: use stdint.h for GCC ProcessorBind.h typedefsLeif Lindholm2019-10-011-13/+13
| | | | | | | | | | | | | | | | | The AArch64 definitions of UINT64/INT64 differ from the X64 ones. Since this is on the tool side, doing like X64 and picking the definitions from stdint.h feels like a better idea than hardcoding them. So copy the pattern from X64/ProcessorBind.h. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
* BaseTools/LzmaCompress: Fix the option "d" dictionary sizeZhang, Shenglei2019-09-301-4/+8
| | | | | | | | | | | | | | The range of dictionary size is set from [0,30] to [0,27]. And update the help information for this. The previous logic for processing the parameter dict size is incorrect. Now fix the logic. The option "d" is added at 6b80310f34199d1f62e45e40fa902734735091fa. (https://bugzilla.tianocore.org/show_bug.cgi?id=2077) Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/LzmaCompress: Add two switchesZhang, Shenglei2019-09-233-11/+38
| | | | | | | | | | | As is requested in the BZ 2077, add two switches to support setting compression mode and dictionary size. (https://bugzilla.tianocore.org/show_bug.cgi?id=2077) Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Robustness for multiple build environmentsBurt Silverman2019-09-111-0/+2
| | | | | | | | | | | | | When building BaseTools, GNUmakefile builds create directory BaseTools/Source/C/libs/. On the other hand, Makefile builds use libs as an nmake pseudo target, so it either must NOT exist as a file or directory, OR it must phony dependency like .PHONY. The latter solution conflicts with NmakeSubdirs.py. Therefore, I make it go away in the cleanall target. I could also add it to the clean target, but it strikes me that cleanall should be more forceful. Signed-off-by: Burt Silverman <burtms@gmail.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/GenFw AARCH64: fix up GOT based relative relocationsArd Biesheuvel2019-09-041-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We take great care to avoid GOT based relocations in EDK2 executables, primarily because they are pointless - we don't care about things like the CoW footprint or relocations that target read-only sections, and so GOT entries only bloat the binary. However, in some cases (e.g., when building the relocatable PrePi SEC module in ArmVirtPkg with the CLANG38 toolchain), we may end up with some GOT based relocations nonetheless, which break the build since GenFw does not know how to deal with them. The relocations emitted in this case are ADRP/LDR instruction pairs that are annotated as GOT based, which means that it is the linker's job to emit the GOT entry and tag it with an appropriate dynamic relocation that ensures that the correct absolute value is stored into the GOT entry when the executable is loaded. This dynamic relocation is not visible to GenFw, and so populating the PE/COFF relocation section for these entries is non-trivial. Since each ADRP/LDR pair refers to a single symbol that is local to the binary (given that shared libraries are not supported), we can actually convert the ADRP/LDR pair into an ADRP/ADD pair that produces the symbol address directly rather than loading it from memory. This leaves the GOT entry in the binary, but since it is now unused, it is no longer necessary to emit a PE/COFF relocation entry for it. Acked-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* BaseTools: Update GenFw tool to support -e -z option togetherLiming Gao2019-09-041-2/+15
| | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1727 -e -z option is to generate EFI image with zero debug entry. It can be used to check the EFI image in DEBUG build. This fix also supports the case -t -z option together for TE image. Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
* Revert "BaseTools/BfmLib: Add a tool BfmLib"Liming Gao2019-07-117-5852/+0
| | | | | | | | | | | This reverts commit dc7b0dc8d662b3bedece2cf1015e2a94884cb111. There are the concerns on code design and code quality, and request to rewrite FCE, BfmLib and FMMT for the review. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Feng Bob C <bob.c.feng@intel.com> Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
* Revert "BaseTools/FCE: Add a tool FCE"Liming Gao2019-07-1122-23414/+2
| | | | | | | | | | | This reverts commit 3c59d94637adbfdd497b5a2c16073c7dc62b669c. There are the concerns on code design and code quality, and request to rewrite FCE, BfmLib and FMMT for the review. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Feng Bob C <bob.c.feng@intel.com> Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
* Revert "BaseTools/FMMT: Add a tool FMMT"Liming Gao2019-07-1110-9007/+0
| | | | | | | | | | | This reverts commit 080981d72dcbb782ad73716c439639324b0aa4dd. There are the concerns on code design and code quality, and request to rewrite FCE, BfmLib and FMMT for the review. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Feng Bob C <bob.c.feng@intel.com> Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
* Revert "BaseTools: fix FCE build when edksetup not executed"Liming Gao2019-07-111-1/+1
| | | | | | | | | | | This reverts commit d031fc07eb83c9d13bff3ebac25da458d5a47917. There are the concerns on code design and code quality, and request to rewrite FCE, BfmLib and FMMT for the review. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Feng Bob C <bob.c.feng@intel.com> Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
* BaseTools: Fix various typosAntoine Cœur2019-07-085-6/+6
| | | | | | | Fix various typos in BaseTools. Signed-off-by: Cœur <coeur@gmx.fr> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: fix FCE build when edksetup not executedLeif Lindholm2019-07-051-1/+1
| | | | | | | | | | | | Commit 3c59d94637ad ("BaseTools/FCE: Add a tool FCE") added a new tool that is always built. Pre-existing tools locate the makefile includes with relative paths, but FCE uses EDK_TOOLS_PATH, adding a new dependency on having sourced edksetup.sh before building BaseTools. Change FCE GNUmakefile to match other tools. Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/FMMT: Add a tool FMMTShenglei Zhang2019-07-0410-0/+9007
| | | | | | | | | | | FMMT is a tool to enable removal, addition and replacement of FFS files in FD image binaries. https://bugzilla.tianocore.org/show_bug.cgi?id=1847 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/FCE: Add a tool FCEShenglei Zhang2019-07-0422-2/+23414
| | | | | | | | | | | FCE is a tool to retrieve and change HII configuration data in Firmware Device(*.fd) files. https://bugzilla.tianocore.org/show_bug.cgi?id=1848 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/BfmLib: Add a tool BfmLibShenglei Zhang2019-07-047-0/+5852
| | | | | | | | | | BmfLib is added for FCE tool. https://bugzilla.tianocore.org/show_bug.cgi?id=1848 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/VfrCompile: clean Framework Vfr supportDandan Bi2019-05-131-217/+55
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1464 This commit is to do the cleanup which are missing in previous commit 1b72fd5121b5b31918be0a9a0868a39070d4c8d4 BaseTools/VfrCompile: Remove framework VFR support Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Check the fread function and avoid dead loopLiu, Zhiguang2019-05-101-2/+9
| | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1789 If the input file is not a valid file, it may cause dead loop, because the return of fread function is not checked. Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/VfrCompile: Remove framework VFR supportDandan Bi2019-05-097-211/+15
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1464 Currently there is no usage of framework VFR, remove the support from VfrCompile. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: support arm64 as a platform name in addition to aarch64Rebecca Cran2019-05-032-4/+6
| | | | | | | | | | | Some systems such as FreeBSD identify the platform as 'arm64' and not 'aarch64' as Linux does. Signed-off-by: Rebecca Cran <rebecca@bluestop.org> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> [lersek@redhat.com: fix up DKIM damage in the "From:" address]
* BaseTools: Add GCC flags to Basetool build.Feng, Bob C2019-05-011-1/+2
| | | | | | | | | | | | | | | | | | | | BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1764 Some compiler flags restrict the compiler from making arbitrary decisions while handling undefined C/C++ behaviors. Therefore they can be used to fix some issues caused by undefined behavior. For example, for GCC, the following flags are available: -fno-delete-null-pointer-checks tells the compiler NOT to assume that null pointer deference does not exist. -fwrapv tells the compiler that signed overflow always wraps. This patch is going to add these 2 build options to BaseTool GCC build option. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>