summaryrefslogtreecommitdiffstats
path: root/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c
Commit message (Collapse)AuthorAgeFilesLines
* UefiPayloadPkg: Fix RelaAddress type always mismatch in if conditionJames Lu2022-07-271-1/+1
| | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3984 Under function RolocateElfDynamic() in Elf32Lib.c if (RelaAddress == MAX_UINT64) is always FALSE while RelaAddress is UINT32 Fix is to modify if condition check to "if (RelaAddress == MAX_UINT32)" Cc: Ray Ni <ray.ni@intel.com> Cc: Guo Dong <guo.dong@intel.com> Cc: Gua Guo <gua.guo@intel.com> Signed-off-by: James Lu <james.lu@intel.com> Reviewed-by: Guo Dong <guo.dong@intel.com>
* UefiPayloadPkg: Apply uncrustify changesMichael Kubacki2021-12-071-78/+97
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the UefiPayloadPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* UefiPayloadPkg/PayloadLoader: Remove assertionRay Ni2021-06-301-1/+0
| | | | | | | | | | | | | | For R_386_RELATIVE and R_X86_64_RELATIVE, today's logic assumes that the content pointed by the Rela->r_offset is 0 but it's not always TRUE. We observed that linker may set the content to Rela->r_addend. The patch removes the assertion. There is no functionality impact for this patch. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Maurice Ma <maurice.ma@intel.com> Reviewed-by: Guo Dong <guo.dong@intel.com> Cc: Benjamin You <benjamin.you@intel.com>
* UefiPayloadPkg/PayloadLoader: Fix bug in locating relocation sectionRay Ni2021-06-301-7/+15
| | | | | | | | | | | | | | | | | | | | | Per ELF spec, the DT_REL/DT_RELA tag in dynamic section stores the virtual address of the relocation section. But today's code logic treats it as the section offset and finds the relocation section whose offset equals to DT_REL/DT_RELA. The logic can work when the section offset equals to the section virtual address. But when the ELF is generated from the link script that reserves a sizeof(pe_header) in the file beginning, the section offset doesn't equal to section virtual address. Such logic can not find the relocation section. The patch fixes this bug. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Maurice Ma <maurice.ma@intel.com> Reviewed-by: Guo Dong <guo.dong@intel.com> Cc: Benjamin You <benjamin.you@intel.com>
* UefiPayloadPkg: Add PayloadLoaderPeim which can load ELF payloadRay Ni2021-06-161-0/+451
Per universal payload spec, the payload is in ELF format. The patch adds a payload loader that supports to load ELF image. The location of extra data sections whose names start with "upld." is stored in UNIVERSAL_PAYLOAD_EXTRA_DATA HOB. Signed-off-by: Maurice Ma <maurice.ma@intel.com> Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Maurice Ma <maurice.ma@intel.com> Reviewed-by: Guo Dong <guo.dong@intel.com> Cc: Benjamin You <benjamin.you@intel.com>