[PATCH 2/2] UefiPayloadPkg/PayloadLoader: Remove assertion


Ni, Ray
 

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@...>
Cc: Maurice Ma <maurice.ma@...>
Cc: Guo Dong <guo.dong@...>
Cc: Benjamin You <benjamin.you@...>
---
UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c | 1 -
UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c | 1 -
2 files changed, 2 deletions(-)

diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c b/UefiPaylo=
adPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c
index dd27d3ce59..780f2d9507 100644
--- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c
+++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c
@@ -164,7 +164,6 @@ ProcessRelocation32 (
// Calculation: B + A=0D
//=0D
if (RelaType =3D=3D SHT_RELA) {=0D
- ASSERT (*Ptr =3D=3D 0);=0D
*Ptr =3D (UINT32) Delta + Rela->r_addend;=0D
} else {=0D
//=0D
diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c b/UefiPaylo=
adPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
index 3f4f12903c..0f1b06e8cc 100644
--- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
+++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
@@ -173,7 +173,6 @@ ProcessRelocation64 (
// Calculation: B + A=0D
//=0D
if (RelaType =3D=3D SHT_RELA) {=0D
- ASSERT (*Ptr =3D=3D 0);=0D
*Ptr =3D Delta + Rela->r_addend;=0D
} else {=0D
//=0D
--=20
2.31.1.windows.1

Join devel@edk2.groups.io to automatically receive all group messages.