aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2016-01-10 05:42:28 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2016-02-24 09:57:26 -0500
commit7b957b6e603623ef8b2e8222fa94b976df613fa2 (patch)
treea162adbba1f241b477ead6044618ed0d691b7f7b
parent4a2e034e5cdadde4c712f79bdd57d1455c76a3db (diff)
scripts/sortextable: add support for ET_DYN binaries
Add support to scripts/sortextable for handling relocatable (PIE) executables, whose ELF type is ET_DYN, not ET_EXEC. Other than adding support for the new type, no changes are needed. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--scripts/sortextable.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/sortextable.c b/scripts/sortextable.c
index c2423d913b46..ecefa0a634f8 100644
--- a/scripts/sortextable.c
+++ b/scripts/sortextable.c
@@ -266,9 +266,9 @@ do_file(char const *const fname)
266 break; 266 break;
267 } /* end switch */ 267 } /* end switch */
268 if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 268 if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0
269 || r2(&ehdr->e_type) != ET_EXEC 269 || (r2(&ehdr->e_type) != ET_EXEC && r2(&ehdr->e_type) != ET_DYN)
270 || ehdr->e_ident[EI_VERSION] != EV_CURRENT) { 270 || ehdr->e_ident[EI_VERSION] != EV_CURRENT) {
271 fprintf(stderr, "unrecognized ET_EXEC file %s\n", fname); 271 fprintf(stderr, "unrecognized ET_EXEC/ET_DYN file %s\n", fname);
272 fail_file(); 272 fail_file();
273 } 273 }
274 274
@@ -304,7 +304,7 @@ do_file(char const *const fname)
304 if (r2(&ehdr->e_ehsize) != sizeof(Elf32_Ehdr) 304 if (r2(&ehdr->e_ehsize) != sizeof(Elf32_Ehdr)
305 || r2(&ehdr->e_shentsize) != sizeof(Elf32_Shdr)) { 305 || r2(&ehdr->e_shentsize) != sizeof(Elf32_Shdr)) {
306 fprintf(stderr, 306 fprintf(stderr,
307 "unrecognized ET_EXEC file: %s\n", fname); 307 "unrecognized ET_EXEC/ET_DYN file: %s\n", fname);
308 fail_file(); 308 fail_file();
309 } 309 }
310 do32(ehdr, fname, custom_sort); 310 do32(ehdr, fname, custom_sort);
@@ -314,7 +314,7 @@ do_file(char const *const fname)
314 if (r2(&ghdr->e_ehsize) != sizeof(Elf64_Ehdr) 314 if (r2(&ghdr->e_ehsize) != sizeof(Elf64_Ehdr)
315 || r2(&ghdr->e_shentsize) != sizeof(Elf64_Shdr)) { 315 || r2(&ghdr->e_shentsize) != sizeof(Elf64_Shdr)) {
316 fprintf(stderr, 316 fprintf(stderr,
317 "unrecognized ET_EXEC file: %s\n", fname); 317 "unrecognized ET_EXEC/ET_DYN file: %s\n", fname);
318 fail_file(); 318 fail_file();
319 } 319 }
320 do64(ghdr, fname, custom_sort); 320 do64(ghdr, fname, custom_sort);