Under what circumstances, if any, would an executable ELF file (type == EXEC) not have section headers?

Viewed 34

Reading the ELF specification, it seems that for an EXEC type ELF file, the section header table is listed as "optional". Under what circumstances would it be omitted?

1 Answers

Under what circumstances would it be omitted?

Section info is not needed at execution time, and traditionally is only kept for debugging (e.g. you can get a backtrace for a crash from an executable compiled without any debugging info).

You should be able to remove them with e.g. strip --strip-all, but that doesn't appear to work.

You could also binary-patch the the file -- e.g. zero out .e_shoff and .e_shnum in the ELF header.

Related answer.

Related