aboutsummaryrefslogtreecommitdiff
path: root/tools/relocate-rela.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@amd.com>2022-06-24 14:15:00 +0200
committerMichal Simek <michal.simek@amd.com>2022-06-24 14:15:00 +0200
commita1405d9cfedb1228289e617258de3fc0d7facecd (patch)
tree2372459f3c4786d2bd32fe82e65d8a4f8f839fb8 /tools/relocate-rela.c
parent582ffb5cb3784ec8f4981d464a11f043d1d63846 (diff)
downloadu-boot-a1405d9cfedb1228289e617258de3fc0d7facecd.zip
u-boot-a1405d9cfedb1228289e617258de3fc0d7facecd.tar.gz
u-boot-a1405d9cfedb1228289e617258de3fc0d7facecd.tar.bz2
tools: relocate-rela: Check that relocation works only for EM_AARCH64
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@amd.com> Link: https://lore.kernel.org/r/36f26c8752335239344b265e5ddedad10e9cac8b.1655299267.git.michal.simek@amd.com
Diffstat (limited to 'tools/relocate-rela.c')
-rw-r--r--tools/relocate-rela.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c
index e62247d..2f7f179 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;