]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: relocate-rela: Check that relocation works only for EM_AARCH64
authorMichal Simek <michal.simek@amd.com>
Fri, 24 Jun 2022 12:15:00 +0000 (14:15 +0200)
committerMichal Simek <michal.simek@amd.com>
Fri, 24 Jun 2022 12:15:00 +0000 (14:15 +0200)
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
tools/relocate-rela.c

index e62247d51e2a903b1562984ba02d8dce09f4e8a1..2f7f1796a0eff4c3108318078a61f4de42a406e4 100644 (file)
@@ -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;