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.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -266,9 +266,9 @@ do_file(char const *const fname) · 265 unmodified lines | |||
| 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) · 29 unmodified lines | |||
| 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) · 3 unmodified lines | |||
| 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); |