[PATCH v3 20/23] tools: relocate-rela: Check that relocation works only for EM_AARCH64
Michal Simek
monstr at monstr.eu
Wed Jun 15 12:03:57 CEST 2022
Relocation support is only for EM_AARCH64 that's why check machine type to
make sure that the code will never run on any unsupported one.
Signed-off-by: Michal Simek <michal.simek at amd.com>
---
(no changes since v1)
tools/relocate-rela.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c
index e62247d51e2a..2f7f1796a0ef 100644
--- a/tools/relocate-rela.c
+++ b/tools/relocate-rela.c
@@ -79,6 +79,11 @@ static int decode_elf64(FILE *felf, char **argv)
machine = header.e_machine;
debug("Machine\t%d\n", machine);
+ if (machine != EM_AARCH64) {
+ fprintf(stderr, "%s: Not supported machine type\n", argv[0]);
+ return 30;
+ }
+
text_base = header.e_entry;
section_header_base = header.e_shoff;
section_header_size = header.e_shentsize * header.e_shnum;
--
2.36.1
More information about the U-Boot
mailing list