fix(AArch64): Fix issue in processing dynamic relocations
Fixes issue in processing dynamic relocations, when
relocation entries not matching R_AARCH64_RELATIVE type are found.
Linker might generate entries of relocation type R_AARCH64_NONE
(code 0), which should be ignored to make the code boot.
Similar fix done in TF-A (db9736e3d86d7098f9785a9db834746a8b2ed335)
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
Change-Id: Ibc769efa322618f59c05a6b1596555fc1b00b57b
diff --git a/lib/aarch64/misc_helpers.S b/lib/aarch64/misc_helpers.S
index b677721..2a2d633 100644
--- a/lib/aarch64/misc_helpers.S
+++ b/lib/aarch64/misc_helpers.S
@@ -197,9 +197,12 @@
* Size of Elf64_Rela structure is 24 bytes.
*/
1:
+ /* Skip R_AARCH64_NONE entry with code 0 */
+ ldr x3, [x1, #8]
+ cbz x3, 2f
+
/* Assert that the relocation type is R_AARCH64_RELATIVE */
#if ENABLE_ASSERTIONS
- ldr x3, [x1, #8]
cmp x3, #0x403
ASM_ASSERT(eq)
#endif